├── .gitignore ├── README.md ├── include ├── animator │ ├── SkAnimator.h │ └── SkAnimatorView.h ├── config │ ├── SkUserConfig.h │ └── sk_stdint.h ├── core │ ├── Sk64.h │ ├── SkAdvancedTypefaceMetrics.h │ ├── SkAutoKern.h │ ├── SkBitmap.h │ ├── SkBlitRow.h │ ├── SkBlitter.h │ ├── SkBounder.h │ ├── SkBuffer.h │ ├── SkCanvas.h │ ├── SkChunkAlloc.h │ ├── SkClipStack.h │ ├── SkColor.h │ ├── SkColorFilter.h │ ├── SkColorPriv.h │ ├── SkColorShader.h │ ├── SkComposeShader.h │ ├── SkData.h │ ├── SkDeque.h │ ├── SkDescriptor.h │ ├── SkDevice.h │ ├── SkDeviceProfile.h │ ├── SkDither.h │ ├── SkDraw.h │ ├── SkDrawFilter.h │ ├── SkDrawLooper.h │ ├── SkEdgeClipper.h │ ├── SkEmptyShader.h │ ├── SkEndian.h │ ├── SkFDot6.h │ ├── SkFixed.h │ ├── SkFlate.h │ ├── SkFlattenable.h │ ├── SkFloatBits.h │ ├── SkFloatingPoint.h │ ├── SkFontHost.h │ ├── SkGeometry.h │ ├── SkGraphics.h │ ├── SkImageFilter.h │ ├── SkLineClipper.h │ ├── SkMMapStream.h │ ├── SkMallocPixelRef.h │ ├── SkMask.h │ ├── SkMaskFilter.h │ ├── SkMath.h │ ├── SkMatrix.h │ ├── SkMetaData.h │ ├── SkOSFile.h │ ├── SkOrderedReadBuffer.h │ ├── SkOrderedWriteBuffer.h │ ├── SkPackBits.h │ ├── SkPaint.h │ ├── SkPath.h │ ├── SkPathEffect.h │ ├── SkPathMeasure.h │ ├── SkPerspIter.h │ ├── SkPicture.h │ ├── SkPixelRef.h │ ├── SkPoint.h │ ├── SkPostConfig.h │ ├── SkPreConfig.h │ ├── SkPtrRecorder.h │ ├── SkRandom.h │ ├── SkRasterizer.h │ ├── SkReader32.h │ ├── SkRect.h │ ├── SkRefCnt.h │ ├── SkRefDict.h │ ├── SkRegion.h │ ├── SkRelay.h │ ├── SkScalar.h │ ├── SkScalarCompare.h │ ├── SkScalerContext.h │ ├── SkScan.h │ ├── SkShader.h │ ├── SkShape.h │ ├── SkSize.h │ ├── SkStream.h │ ├── SkString.h │ ├── SkTArray.h │ ├── SkTDArray.h │ ├── SkTDStack.h │ ├── SkTDict.h │ ├── SkTLazy.h │ ├── SkTRegistry.h │ ├── SkTScopedPtr.h │ ├── SkTSearch.h │ ├── SkTemplates.h │ ├── SkThread.h │ ├── SkThread_platform.h │ ├── SkTime.h │ ├── SkTrace.h │ ├── SkTypeface.h │ ├── SkTypes.h │ ├── SkUnPreMultiply.h │ ├── SkUnitMapper.h │ ├── SkUtils.h │ ├── SkWriter32.h │ └── SkXfermode.h ├── device │ └── xps │ │ ├── SkConstexprMath.h │ │ └── SkXPSDevice.h ├── effects │ ├── Sk1DPathEffect.h │ ├── Sk2DPathEffect.h │ ├── SkArithmeticMode.h │ ├── SkAvoidXfermode.h │ ├── SkBlurDrawLooper.h │ ├── SkBlurImageFilter.h │ ├── SkBlurMaskFilter.h │ ├── SkColorMatrix.h │ ├── SkColorMatrixFilter.h │ ├── SkCornerPathEffect.h │ ├── SkDashPathEffect.h │ ├── SkDiscretePathEffect.h │ ├── SkDrawExtraPathEffect.h │ ├── SkEmbossMaskFilter.h │ ├── SkGradientShader.h │ ├── SkGroupShape.h │ ├── SkKernel33MaskFilter.h │ ├── SkLayerDrawLooper.h │ ├── SkLayerRasterizer.h │ ├── SkMorphologyImageFilter.h │ ├── SkPaintFlagsDrawFilter.h │ ├── SkPixelXorXfermode.h │ ├── SkPorterDuff.h │ ├── SkRectShape.h │ ├── SkTableColorFilter.h │ ├── SkTableMaskFilter.h │ ├── SkTestImageFilters.h │ └── SkTransparentShader.h ├── gpu │ ├── GrClip.h │ ├── GrClipIterator.h │ ├── GrColor.h │ ├── GrConfig.h │ ├── GrContext.h │ ├── GrContextFactory.h │ ├── GrCustomStage.h │ ├── GrFontScaler.h │ ├── GrGlyph.h │ ├── GrInstanceCounter.h │ ├── GrKey.h │ ├── GrMatrix.h │ ├── GrNoncopyable.h │ ├── GrPaint.h │ ├── GrPoint.h │ ├── GrRect.h │ ├── GrRefCnt.h │ ├── GrRenderTarget.h │ ├── GrResource.h │ ├── GrSamplerState.h │ ├── GrScalar.h │ ├── GrTemplates.h │ ├── GrTextContext.h │ ├── GrTexture.h │ ├── GrTypes.h │ ├── GrUserConfig.h │ ├── SkGpuCanvas.h │ ├── SkGpuDevice.h │ ├── SkGr.h │ ├── SkGrTexturePixelRef.h │ └── gl │ │ ├── GrGLConfig.h │ │ ├── GrGLConfig_chrome.h │ │ ├── GrGLDefines.h │ │ ├── GrGLInterface.h │ │ ├── SkANGLEGLContext.h │ │ ├── SkDebugGLContext.h │ │ ├── SkGLContext.h │ │ ├── SkMesaGLContext.h │ │ ├── SkNativeGLContext.h │ │ └── SkNullGLContext.h ├── images │ ├── SkFlipPixelRef.h │ ├── SkImageDecoder.h │ ├── SkImageEncoder.h │ ├── SkImageRef.h │ ├── SkImageRef_GlobalPool.h │ ├── SkJpegUtility.h │ ├── SkMovie.h │ └── SkPageFlipper.h ├── pdf │ ├── SkPDFDevice.h │ └── SkPDFDocument.h ├── pipe │ └── SkGPipe.h ├── ports │ ├── SkHarfBuzzFont.h │ ├── SkStream_Win.h │ ├── SkTypeface_android.h │ ├── SkTypeface_mac.h │ └── SkTypeface_win.h ├── svg │ ├── SkSVGAttribute.h │ ├── SkSVGBase.h │ ├── SkSVGPaintState.h │ ├── SkSVGParser.h │ └── SkSVGTypes.h ├── text │ └── SkTextLayout.h ├── utils │ ├── SkBoundaryPatch.h │ ├── SkCamera.h │ ├── SkCubicInterval.h │ ├── SkCullPoints.h │ ├── SkDeferredCanvas.h │ ├── SkDumpCanvas.h │ ├── SkInterpolator.h │ ├── SkJSON.h │ ├── SkLayer.h │ ├── SkMatrix44.h │ ├── SkMeshUtils.h │ ├── SkNWayCanvas.h │ ├── SkNinePatch.h │ ├── SkParse.h │ ├── SkParsePaint.h │ ├── SkParsePath.h │ ├── SkProxyCanvas.h │ ├── SkSfntUtils.h │ ├── SkUnitMappers.h │ ├── SkWGL.h │ ├── ios │ │ └── SkStream_NSData.h │ ├── mac │ │ └── SkCGUtils.h │ └── win │ │ ├── SkAutoCoInitialize.h │ │ ├── SkHRESULT.h │ │ ├── SkIStream.h │ │ └── SkTScopedComPtr.h ├── views │ ├── SkApplication.h │ ├── SkBGViewArtist.h │ ├── SkBorderView.h │ ├── SkEvent.h │ ├── SkEventSink.h │ ├── SkImageView.h │ ├── SkKey.h │ ├── SkOSMenu.h │ ├── SkOSWindow_Android.h │ ├── SkOSWindow_Mac.h │ ├── SkOSWindow_SDL.h │ ├── SkOSWindow_Unix.h │ ├── SkOSWindow_Win.h │ ├── SkOSWindow_iOS.h │ ├── SkOSWindow_wxwidgets.h │ ├── SkProgressBarView.h │ ├── SkScrollBarView.h │ ├── SkStackViewLayout.h │ ├── SkSystemEventTypes.h │ ├── SkTextBox.h │ ├── SkTouchGesture.h │ ├── SkView.h │ ├── SkViewInflate.h │ ├── SkWidget.h │ ├── SkWindow.h │ ├── android │ │ └── AndroidKeyToSkKey.h │ ├── animated │ │ └── SkWidgetViews.h │ └── unix │ │ ├── XkeysToSkKeys.h │ │ └── keysym2ucs.h └── xml │ ├── SkBML_WXMLParser.h │ ├── SkBML_XMLParser.h │ ├── SkDOM.h │ ├── SkJS.h │ ├── SkXMLParser.h │ └── SkXMLWriter.h ├── src ├── animator │ ├── SkAnimate.h │ ├── SkAnimate3DSchema.xsd │ ├── SkAnimate3DSchema.xsx │ ├── SkAnimateActive.cpp │ ├── SkAnimateActive.h │ ├── SkAnimateBase.cpp │ ├── SkAnimateBase.h │ ├── SkAnimateField.cpp │ ├── SkAnimateMaker.cpp │ ├── SkAnimateMaker.h │ ├── SkAnimateProperties.h │ ├── SkAnimateSchema.xsd │ ├── SkAnimateSchema.xsx │ ├── SkAnimateSet.cpp │ ├── SkAnimateSet.h │ ├── SkAnimator.cpp │ ├── SkAnimatorScript.cpp │ ├── SkAnimatorScript.h │ ├── SkAnimatorScript2.cpp │ ├── SkAnimatorScript2.h │ ├── SkBoundable.cpp │ ├── SkBoundable.h │ ├── SkBuildCondensedInfo.cpp │ ├── SkCondensedDebug.cpp │ ├── SkCondensedRelease.cpp │ ├── SkDisplayAdd.cpp │ ├── SkDisplayAdd.h │ ├── SkDisplayApply.cpp │ ├── SkDisplayApply.h │ ├── SkDisplayBounds.cpp │ ├── SkDisplayBounds.h │ ├── SkDisplayEvent.cpp │ ├── SkDisplayEvent.h │ ├── SkDisplayEvents.cpp │ ├── SkDisplayEvents.h │ ├── SkDisplayInclude.cpp │ ├── SkDisplayInclude.h │ ├── SkDisplayInput.cpp │ ├── SkDisplayInput.h │ ├── SkDisplayList.cpp │ ├── SkDisplayList.h │ ├── SkDisplayMath.cpp │ ├── SkDisplayMath.h │ ├── SkDisplayMovie.cpp │ ├── SkDisplayMovie.h │ ├── SkDisplayNumber.cpp │ ├── SkDisplayNumber.h │ ├── SkDisplayPost.cpp │ ├── SkDisplayPost.h │ ├── SkDisplayRandom.cpp │ ├── SkDisplayRandom.h │ ├── SkDisplayScreenplay.cpp │ ├── SkDisplayScreenplay.h │ ├── SkDisplayType.cpp │ ├── SkDisplayType.h │ ├── SkDisplayTypes.cpp │ ├── SkDisplayTypes.h │ ├── SkDisplayXMLParser.cpp │ ├── SkDisplayXMLParser.h │ ├── SkDisplayable.cpp │ ├── SkDisplayable.h │ ├── SkDraw3D.cpp │ ├── SkDraw3D.h │ ├── SkDrawBitmap.cpp │ ├── SkDrawBitmap.h │ ├── SkDrawBlur.cpp │ ├── SkDrawBlur.h │ ├── SkDrawClip.cpp │ ├── SkDrawClip.h │ ├── SkDrawColor.cpp │ ├── SkDrawColor.h │ ├── SkDrawDash.cpp │ ├── SkDrawDash.h │ ├── SkDrawDiscrete.cpp │ ├── SkDrawDiscrete.h │ ├── SkDrawEmboss.cpp │ ├── SkDrawEmboss.h │ ├── SkDrawExtraPathEffect.cpp │ ├── SkDrawFull.cpp │ ├── SkDrawFull.h │ ├── SkDrawGradient.cpp │ ├── SkDrawGradient.h │ ├── SkDrawGroup.cpp │ ├── SkDrawGroup.h │ ├── SkDrawLine.cpp │ ├── SkDrawLine.h │ ├── SkDrawMatrix.cpp │ ├── SkDrawMatrix.h │ ├── SkDrawOval.cpp │ ├── SkDrawOval.h │ ├── SkDrawPaint.cpp │ ├── SkDrawPaint.h │ ├── SkDrawPath.cpp │ ├── SkDrawPath.h │ ├── SkDrawPoint.cpp │ ├── SkDrawPoint.h │ ├── SkDrawRectangle.cpp │ ├── SkDrawRectangle.h │ ├── SkDrawSaveLayer.cpp │ ├── SkDrawSaveLayer.h │ ├── SkDrawShader.cpp │ ├── SkDrawShader.h │ ├── SkDrawText.cpp │ ├── SkDrawText.h │ ├── SkDrawTextBox.cpp │ ├── SkDrawTextBox.h │ ├── SkDrawTo.cpp │ ├── SkDrawTo.h │ ├── SkDrawTransparentShader.cpp │ ├── SkDrawTransparentShader.h │ ├── SkDrawable.cpp │ ├── SkDrawable.h │ ├── SkDump.cpp │ ├── SkDump.h │ ├── SkExtraPathEffects.xsd │ ├── SkExtras.h │ ├── SkGetCondensedInfo.cpp │ ├── SkHitClear.cpp │ ├── SkHitClear.h │ ├── SkHitTest.cpp │ ├── SkHitTest.h │ ├── SkIntArray.h │ ├── SkMatrixParts.cpp │ ├── SkMatrixParts.h │ ├── SkMemberInfo.cpp │ ├── SkMemberInfo.h │ ├── SkOpArray.cpp │ ├── SkOpArray.h │ ├── SkOperand.h │ ├── SkOperand2.h │ ├── SkOperandInterpolator.h │ ├── SkOperandIterpolator.cpp │ ├── SkPaintParts.cpp │ ├── SkPaintParts.h │ ├── SkParseSVGPath.cpp │ ├── SkPathParts.cpp │ ├── SkPathParts.h │ ├── SkPostParts.cpp │ ├── SkPostParts.h │ ├── SkScript.cpp │ ├── SkScript.h │ ├── SkScript2.h │ ├── SkScriptCallBack.h │ ├── SkScriptDecompile.cpp │ ├── SkScriptRuntime.cpp │ ├── SkScriptRuntime.h │ ├── SkScriptTokenizer.cpp │ ├── SkSnapshot.cpp │ ├── SkSnapshot.h │ ├── SkTDArray_Experimental.h │ ├── SkTextOnPath.cpp │ ├── SkTextOnPath.h │ ├── SkTextToPath.cpp │ ├── SkTextToPath.h │ ├── SkTime.cpp │ ├── SkTypedArray.cpp │ ├── SkTypedArray.h │ ├── SkXMLAnimatorWriter.cpp │ ├── SkXMLAnimatorWriter.h │ └── thingstodo.txt ├── core │ ├── ARGB32_Clamp_Bilinear_BitmapShader.h │ ├── Sk64.cpp │ ├── SkAAClip.cpp │ ├── SkAAClip.h │ ├── SkAdvancedTypefaceMetrics.cpp │ ├── SkAlphaRuns.cpp │ ├── SkAntiRun.h │ ├── SkBitmap.cpp │ ├── SkBitmapProcShader.cpp │ ├── SkBitmapProcShader.h │ ├── SkBitmapProcState.cpp │ ├── SkBitmapProcState.h │ ├── SkBitmapProcState_filter.h │ ├── SkBitmapProcState_matrix.h │ ├── SkBitmapProcState_matrixProcs.cpp │ ├── SkBitmapProcState_matrix_clamp.h │ ├── SkBitmapProcState_matrix_repeat.h │ ├── SkBitmapProcState_sample.h │ ├── SkBitmapProcState_shaderproc.h │ ├── SkBitmapSampler.cpp │ ├── SkBitmapSampler.h │ ├── SkBitmapSamplerTemplate.h │ ├── SkBitmapShader16BilerpTemplate.h │ ├── SkBitmapShaderTemplate.h │ ├── SkBitmap_scroll.cpp │ ├── SkBlitBWMaskTemplate.h │ ├── SkBlitMask.h │ ├── SkBlitMask_D32.cpp │ ├── SkBlitRow_D16.cpp │ ├── SkBlitRow_D32.cpp │ ├── SkBlitRow_D4444.cpp │ ├── SkBlitter.cpp │ ├── SkBlitter_4444.cpp │ ├── SkBlitter_A1.cpp │ ├── SkBlitter_A8.cpp │ ├── SkBlitter_ARGB32.cpp │ ├── SkBlitter_RGB16.cpp │ ├── SkBlitter_Sprite.cpp │ ├── SkBuffer.cpp │ ├── SkCanvas.cpp │ ├── SkChunkAlloc.cpp │ ├── SkClipStack.cpp │ ├── SkColor.cpp │ ├── SkColorFilter.cpp │ ├── SkColorTable.cpp │ ├── SkComposeShader.cpp │ ├── SkConcaveToTriangles.cpp │ ├── SkConcaveToTriangles.h │ ├── SkConfig8888.cpp │ ├── SkConfig8888.h │ ├── SkCordic.cpp │ ├── SkCordic.h │ ├── SkCoreBlitters.h │ ├── SkCubicClipper.cpp │ ├── SkCubicClipper.h │ ├── SkData.cpp │ ├── SkDebug.cpp │ ├── SkDeque.cpp │ ├── SkDevice.cpp │ ├── SkDeviceProfile.cpp │ ├── SkDither.cpp │ ├── SkDraw.cpp │ ├── SkDrawProcs.h │ ├── SkEdge.cpp │ ├── SkEdge.h │ ├── SkEdgeBuilder.cpp │ ├── SkEdgeBuilder.h │ ├── SkEdgeClipper.cpp │ ├── SkFP.h │ ├── SkFilterProc.cpp │ ├── SkFilterProc.h │ ├── SkFlate.cpp │ ├── SkFlattenable.cpp │ ├── SkFloat.cpp │ ├── SkFloat.h │ ├── SkFloatBits.cpp │ ├── SkFontHost.cpp │ ├── SkGeometry.cpp │ ├── SkGlyphCache.cpp │ ├── SkGlyphCache.h │ ├── SkGraphics.cpp │ ├── SkLineClipper.cpp │ ├── SkMMapStream.cpp │ ├── SkMallocPixelRef.cpp │ ├── SkMask.cpp │ ├── SkMaskFilter.cpp │ ├── SkMath.cpp │ ├── SkMatrix.cpp │ ├── SkMemory_stdlib.cpp │ ├── SkMetaData.cpp │ ├── SkOrderedReadBuffer.cpp │ ├── SkOrderedWriteBuffer.cpp │ ├── SkPackBits.cpp │ ├── SkPaint.cpp │ ├── SkPaintDefaults.h │ ├── SkPath.cpp │ ├── SkPathEffect.cpp │ ├── SkPathHeap.cpp │ ├── SkPathHeap.h │ ├── SkPathMeasure.cpp │ ├── SkPicture.cpp │ ├── SkPictureFlat.cpp │ ├── SkPictureFlat.h │ ├── SkPicturePlayback.cpp │ ├── SkPicturePlayback.h │ ├── SkPictureRecord.cpp │ ├── SkPictureRecord.h │ ├── SkPixelRef.cpp │ ├── SkPoint.cpp │ ├── SkProcSpriteBlitter.cpp │ ├── SkPtrRecorder.cpp │ ├── SkQuadClipper.cpp │ ├── SkQuadClipper.h │ ├── SkRasterClip.cpp │ ├── SkRasterClip.h │ ├── SkRasterizer.cpp │ ├── SkRect.cpp │ ├── SkRefDict.cpp │ ├── SkRegion.cpp │ ├── SkRegionPriv.h │ ├── SkRegion_path.cpp │ ├── SkRegion_rects.cpp │ ├── SkScalar.cpp │ ├── SkScalerContext.cpp │ ├── SkScan.cpp │ ├── SkScanPriv.h │ ├── SkScan_AntiPath.cpp │ ├── SkScan_Antihair.cpp │ ├── SkScan_Hairline.cpp │ ├── SkScan_Path.cpp │ ├── SkShader.cpp │ ├── SkShape.cpp │ ├── SkSinTable.h │ ├── SkSpriteBlitter.h │ ├── SkSpriteBlitterTemplate.h │ ├── SkSpriteBlitter_ARGB32.cpp │ ├── SkSpriteBlitter_RGB16.cpp │ ├── SkStream.cpp │ ├── SkString.cpp │ ├── SkStroke.cpp │ ├── SkStroke.h │ ├── SkStrokerPriv.cpp │ ├── SkStrokerPriv.h │ ├── SkTLS.h │ ├── SkTSearch.cpp │ ├── SkTSort.h │ ├── SkTemplatesPriv.h │ ├── SkTextFormatParams.h │ ├── SkTypeface.cpp │ ├── SkTypefaceCache.cpp │ ├── SkTypefaceCache.h │ ├── SkUnPreMultiply.cpp │ ├── SkUtils.cpp │ ├── SkWriter32.cpp │ └── SkXfermode.cpp ├── device │ └── xps │ │ └── SkXPSDevice.cpp ├── effects │ ├── Sk1DPathEffect.cpp │ ├── Sk2DPathEffect.cpp │ ├── SkArithmeticMode.cpp │ ├── SkAvoidXfermode.cpp │ ├── SkBitmapCache.cpp │ ├── SkBitmapCache.h │ ├── SkBlurDrawLooper.cpp │ ├── SkBlurImageFilter.cpp │ ├── SkBlurMask.cpp │ ├── SkBlurMask.h │ ├── SkBlurMaskFilter.cpp │ ├── SkClampRange.cpp │ ├── SkClampRange.h │ ├── SkColorFilters.cpp │ ├── SkColorMatrix.cpp │ ├── SkColorMatrixFilter.cpp │ ├── SkCornerPathEffect.cpp │ ├── SkDashPathEffect.cpp │ ├── SkDiscretePathEffect.cpp │ ├── SkEmbossMask.cpp │ ├── SkEmbossMask.h │ ├── SkEmbossMaskFilter.cpp │ ├── SkEmbossMask_Table.h │ ├── SkGradientShader.cpp │ ├── SkGroupShape.cpp │ ├── SkKernel33MaskFilter.cpp │ ├── SkLayerDrawLooper.cpp │ ├── SkLayerRasterizer.cpp │ ├── SkMorphologyImageFilter.cpp │ ├── SkPaintFlagsDrawFilter.cpp │ ├── SkPixelXorXfermode.cpp │ ├── SkPorterDuff.cpp │ ├── SkRadialGradient_Table.h │ ├── SkRectShape.cpp │ ├── SkTableColorFilter.cpp │ ├── SkTableMaskFilter.cpp │ ├── SkTestImageFilters.cpp │ └── SkTransparentShader.cpp ├── gpu │ ├── FlingState.cpp │ ├── GrAAConvexPathRenderer.cpp │ ├── GrAAConvexPathRenderer.h │ ├── GrAAHairLinePathRenderer.cpp │ ├── GrAAHairLinePathRenderer.h │ ├── GrAddPathRenderers_default.cpp │ ├── GrAddPathRenderers_none.cpp │ ├── GrAddPathRenderers_tesselated.cpp │ ├── GrAllocPool.cpp │ ├── GrAllocPool.h │ ├── GrAllocator.h │ ├── GrAtlas.cpp │ ├── GrAtlas.h │ ├── GrBatchedTextContext.cpp │ ├── GrBatchedTextContext.h │ ├── GrBinHashKey.h │ ├── GrBufferAllocPool.cpp │ ├── GrBufferAllocPool.h │ ├── GrClip.cpp │ ├── GrClipMaskManager.cpp │ ├── GrClipMaskManager.h │ ├── GrContext.cpp │ ├── GrCustomStage.cpp │ ├── GrDefaultPathRenderer.cpp │ ├── GrDefaultPathRenderer.h │ ├── GrDefaultTextContext.cpp │ ├── GrDefaultTextContext.h │ ├── GrDrawState.h │ ├── GrDrawTarget.cpp │ ├── GrDrawTarget.h │ ├── GrGeometryBuffer.h │ ├── GrGpu.cpp │ ├── GrGpu.h │ ├── GrGpuFactory.cpp │ ├── GrGpuVertex.h │ ├── GrInOrderDrawBuffer.cpp │ ├── GrInOrderDrawBuffer.h │ ├── GrIndexBuffer.h │ ├── GrMatrix.cpp │ ├── GrMemory.cpp │ ├── GrPathRenderer.cpp │ ├── GrPathRenderer.h │ ├── GrPathRendererChain.cpp │ ├── GrPathRendererChain.h │ ├── GrPathUtils.cpp │ ├── GrPathUtils.h │ ├── GrPlotMgr.h │ ├── GrRandom.h │ ├── GrRectanizer.cpp │ ├── GrRectanizer.h │ ├── GrRectanizer_fifo.cpp │ ├── GrRedBlackTree.h │ ├── GrRenderTarget.cpp │ ├── GrResource.cpp │ ├── GrResourceCache.cpp │ ├── GrResourceCache.h │ ├── GrSoftwarePathRenderer.cpp │ ├── GrSoftwarePathRenderer.h │ ├── GrStencil.cpp │ ├── GrStencil.h │ ├── GrStencilBuffer.cpp │ ├── GrStencilBuffer.h │ ├── GrStringBuilder.h │ ├── GrTBSearch.h │ ├── GrTDArray.h │ ├── GrTHashCache.h │ ├── GrTLList.h │ ├── GrTesselatedPathRenderer.cpp │ ├── GrTesselatedPathRenderer.h │ ├── GrTextStrike.cpp │ ├── GrTextStrike.h │ ├── GrTextStrike_impl.h │ ├── GrTexture.cpp │ ├── GrVertexBuffer.h │ ├── SkGpuCanvas.cpp │ ├── SkGpuDevice.cpp │ ├── SkGr.cpp │ ├── SkGrFontScaler.cpp │ ├── SkGrTexturePixelRef.cpp │ ├── android │ │ ├── GrGLCreateNativeInterface_android.cpp │ │ └── SkNativeGLContext_android.cpp │ ├── app-android.cpp │ ├── gl │ │ ├── GrGLCaps.cpp │ │ ├── GrGLCaps.h │ │ ├── GrGLContextInfo.cpp │ │ ├── GrGLContextInfo.h │ │ ├── GrGLCreateNativeInterface_none.cpp │ │ ├── GrGLCreateNullInterface.cpp │ │ ├── GrGLDefaultInterface_native.cpp │ │ ├── GrGLDefaultInterface_none.cpp │ │ ├── GrGLIRect.h │ │ ├── GrGLIndexBuffer.cpp │ │ ├── GrGLIndexBuffer.h │ │ ├── GrGLInterface.cpp │ │ ├── GrGLProgram.cpp │ │ ├── GrGLProgram.h │ │ ├── GrGLProgramStage.cpp │ │ ├── GrGLProgramStage.h │ │ ├── GrGLRenderTarget.cpp │ │ ├── GrGLRenderTarget.h │ │ ├── GrGLSL.cpp │ │ ├── GrGLSL.h │ │ ├── GrGLShaderVar.h │ │ ├── GrGLStencilBuffer.cpp │ │ ├── GrGLStencilBuffer.h │ │ ├── GrGLTexture.cpp │ │ ├── GrGLTexture.h │ │ ├── GrGLUtil.cpp │ │ ├── GrGLVertexBuffer.cpp │ │ ├── GrGLVertexBuffer.h │ │ ├── GrGpuGL.cpp │ │ ├── GrGpuGL.h │ │ ├── GrGpuGLShaders.cpp │ │ ├── GrGpuGLShaders.h │ │ ├── SkGLContext.cpp │ │ ├── SkNullGLContext.cpp │ │ ├── angle │ │ │ ├── GrGLCreateANGLEInterface.cpp │ │ │ └── SkANGLEGLContext.cpp │ │ ├── debug │ │ │ ├── GrBufferObj.cpp │ │ │ ├── GrBufferObj.h │ │ │ ├── GrDebugGL.cpp │ │ │ ├── GrDebugGL.h │ │ │ ├── GrFBBindableObj.cpp │ │ │ ├── GrFBBindableObj.h │ │ │ ├── GrFakeRefObj.h │ │ │ ├── GrFrameBufferObj.cpp │ │ │ ├── GrFrameBufferObj.h │ │ │ ├── GrGLCreateDebugInterface.cpp │ │ │ ├── GrProgramObj.cpp │ │ │ ├── GrProgramObj.h │ │ │ ├── GrRenderBufferObj.cpp │ │ │ ├── GrRenderBufferObj.h │ │ │ ├── GrShaderObj.cpp │ │ │ ├── GrShaderObj.h │ │ │ ├── GrTextureObj.cpp │ │ │ ├── GrTextureObj.h │ │ │ ├── GrTextureUnitObj.cpp │ │ │ ├── GrTextureUnitObj.h │ │ │ └── SkDebugGLContext.cpp │ │ ├── mac │ │ │ ├── GrGLCreateNativeInterface_mac.cpp │ │ │ └── SkNativeGLContext_mac.cpp │ │ ├── mesa │ │ │ ├── GrGLCreateMesaInterface.cpp │ │ │ └── SkMesaGLContext.cpp │ │ ├── unix │ │ │ ├── GrGLCreateNativeInterface_unix.cpp │ │ │ └── SkNativeGLContext_unix.cpp │ │ └── win │ │ │ ├── GrGLCreateNativeInterface_win.cpp │ │ │ └── SkNativeGLContext_win.cpp │ ├── gr_hello_world.cpp │ ├── gr_unittests.cpp │ └── ios │ │ └── GrGLDefaultInterface_iOS.cpp ├── images │ ├── SkFDStream.cpp │ ├── SkFlipPixelRef.cpp │ ├── SkImageDecoder.cpp │ ├── SkImageDecoder_Factory.cpp │ ├── SkImageDecoder_libbmp.cpp │ ├── SkImageDecoder_libgif.cpp │ ├── SkImageDecoder_libico.cpp │ ├── SkImageDecoder_libjpeg.cpp │ ├── SkImageDecoder_libpng.cpp │ ├── SkImageDecoder_wbmp.cpp │ ├── SkImageEncoder.cpp │ ├── SkImageEncoder_Factory.cpp │ ├── SkImageRef.cpp │ ├── SkImageRefPool.cpp │ ├── SkImageRefPool.h │ ├── SkImageRef_GlobalPool.cpp │ ├── SkJpegUtility.cpp │ ├── SkMovie.cpp │ ├── SkMovie_gif.cpp │ ├── SkPageFlipper.cpp │ ├── SkScaledBitmapSampler.cpp │ ├── SkScaledBitmapSampler.h │ ├── bmpdecoderhelper.cpp │ └── bmpdecoderhelper.h ├── opts │ ├── SkBitmapProcState_opts_SSE2.cpp │ ├── SkBitmapProcState_opts_SSE2.h │ ├── SkBitmapProcState_opts_SSSE3.cpp │ ├── SkBitmapProcState_opts_SSSE3.h │ ├── SkBitmapProcState_opts_arm.cpp │ ├── SkBitmapProcState_opts_none.cpp │ ├── SkBlitRect_opts_SSE2.cpp │ ├── SkBlitRect_opts_SSE2.h │ ├── SkBlitRow_opts_SSE2.cpp │ ├── SkBlitRow_opts_SSE2.h │ ├── SkBlitRow_opts_arm.cpp │ ├── SkBlitRow_opts_none.cpp │ ├── SkUtils_opts_SSE2.cpp │ ├── SkUtils_opts_SSE2.h │ ├── SkUtils_opts_none.cpp │ ├── memset.arm.S │ ├── memset16_neon.S │ ├── memset32_neon.S │ ├── opts_check_SSE2.cpp │ └── opts_check_arm.cpp ├── pdf │ ├── SkPDFCatalog.cpp │ ├── SkPDFCatalog.h │ ├── SkPDFDevice.cpp │ ├── SkPDFDocument.cpp │ ├── SkPDFFont.cpp │ ├── SkPDFFont.h │ ├── SkPDFFontImpl.h │ ├── SkPDFFormXObject.cpp │ ├── SkPDFFormXObject.h │ ├── SkPDFGraphicState.cpp │ ├── SkPDFGraphicState.h │ ├── SkPDFImage.cpp │ ├── SkPDFImage.h │ ├── SkPDFPage.cpp │ ├── SkPDFPage.h │ ├── SkPDFShader.cpp │ ├── SkPDFShader.h │ ├── SkPDFStream.cpp │ ├── SkPDFStream.h │ ├── SkPDFTypes.cpp │ ├── SkPDFTypes.h │ ├── SkPDFUtils.cpp │ └── SkPDFUtils.h ├── pipe │ ├── SkGPipePriv.h │ ├── SkGPipeRead.cpp │ └── SkGPipeWrite.cpp ├── ports │ ├── FontHostConfiguration_android.cpp │ ├── FontHostConfiguration_android.h │ ├── SkDebug_android.cpp │ ├── SkDebug_brew.cpp │ ├── SkDebug_stdio.cpp │ ├── SkDebug_win.cpp │ ├── SkFontHost_FONTPATH.cpp │ ├── SkFontHost_FreeType.cpp │ ├── SkFontHost_android.cpp │ ├── SkFontHost_ascender.cpp │ ├── SkFontHost_fontconfig.cpp │ ├── SkFontHost_freetype_mac.cpp │ ├── SkFontHost_gamma.cpp │ ├── SkFontHost_gamma_none.cpp │ ├── SkFontHost_linux.cpp │ ├── SkFontHost_mac.cpp │ ├── SkFontHost_mac_atsui.cpp │ ├── SkFontHost_mac_coretext.cpp │ ├── SkFontHost_none.cpp │ ├── SkFontHost_sandbox_none.cpp │ ├── SkFontHost_simple.cpp │ ├── SkFontHost_tables.cpp │ ├── SkFontHost_win.cpp │ ├── SkGlobalInitialization_chromium.cpp │ ├── SkGlobalInitialization_default.cpp │ ├── SkHarfBuzzFont.cpp │ ├── SkImageDecoder_CG.cpp │ ├── SkImageDecoder_WIC.cpp │ ├── SkImageDecoder_empty.cpp │ ├── SkImageRef_ashmem.cpp │ ├── SkImageRef_ashmem.h │ ├── SkMemory_brew.cpp │ ├── SkMemory_malloc.cpp │ ├── SkOSFile_brew.cpp │ ├── SkOSFile_stdio.cpp │ ├── SkThread_none.cpp │ ├── SkThread_pthread.cpp │ ├── SkThread_win.cpp │ ├── SkTime_Unix.cpp │ ├── SkTime_win.cpp │ ├── SkXMLParser_empty.cpp │ ├── SkXMLParser_expat.cpp │ ├── SkXMLParser_tinyxml.cpp │ ├── SkXMLPullParser_expat.cpp │ ├── sk_predefined_gamma.h │ ├── tinyxml2.cpp │ └── tinyxml2.h ├── sfnt │ ├── SkIBMFamilyClass.h │ ├── SkOTTableTypes.h │ ├── SkOTTable_OS_2.h │ ├── SkOTTable_OS_2_V0.h │ ├── SkOTTable_OS_2_V1.h │ ├── SkOTTable_OS_2_V2.h │ ├── SkOTTable_OS_2_V3.h │ ├── SkOTTable_OS_2_V4.h │ ├── SkOTTable_OS_2_VA.h │ ├── SkOTTable_head.h │ ├── SkOTTable_hhea.h │ ├── SkOTTable_name.h │ ├── SkOTTable_post.h │ ├── SkOTUtils.cpp │ ├── SkOTUtils.h │ ├── SkPanose.h │ ├── SkPreprocessorSeq.h │ ├── SkSFNTHeader.h │ └── SkTypedEnum.h ├── svg │ ├── SkSVG.cpp │ ├── SkSVGCircle.cpp │ ├── SkSVGCircle.h │ ├── SkSVGClipPath.cpp │ ├── SkSVGClipPath.h │ ├── SkSVGDefs.cpp │ ├── SkSVGDefs.h │ ├── SkSVGElements.cpp │ ├── SkSVGElements.h │ ├── SkSVGEllipse.cpp │ ├── SkSVGEllipse.h │ ├── SkSVGFeColorMatrix.cpp │ ├── SkSVGFeColorMatrix.h │ ├── SkSVGFilter.cpp │ ├── SkSVGFilter.h │ ├── SkSVGG.cpp │ ├── SkSVGG.h │ ├── SkSVGGradient.cpp │ ├── SkSVGGradient.h │ ├── SkSVGGroup.cpp │ ├── SkSVGGroup.h │ ├── SkSVGImage.cpp │ ├── SkSVGImage.h │ ├── SkSVGLine.cpp │ ├── SkSVGLine.h │ ├── SkSVGLinearGradient.cpp │ ├── SkSVGLinearGradient.h │ ├── SkSVGMask.cpp │ ├── SkSVGMask.h │ ├── SkSVGMetadata.cpp │ ├── SkSVGMetadata.h │ ├── SkSVGPaintState.cpp │ ├── SkSVGParser.cpp │ ├── SkSVGPath.cpp │ ├── SkSVGPath.h │ ├── SkSVGPolygon.cpp │ ├── SkSVGPolygon.h │ ├── SkSVGPolyline.cpp │ ├── SkSVGPolyline.h │ ├── SkSVGRadialGradient.cpp │ ├── SkSVGRadialGradient.h │ ├── SkSVGRect.cpp │ ├── SkSVGRect.h │ ├── SkSVGSVG.cpp │ ├── SkSVGSVG.h │ ├── SkSVGStop.cpp │ ├── SkSVGStop.h │ ├── SkSVGSymbol.cpp │ ├── SkSVGSymbol.h │ ├── SkSVGText.cpp │ ├── SkSVGText.h │ ├── SkSVGUse.cpp │ └── SkSVGUse.h ├── text │ └── SkTextLayout.cpp ├── utils │ ├── SkBase64.cpp │ ├── SkBase64.h │ ├── SkBitSet.cpp │ ├── SkBitSet.h │ ├── SkBoundaryPatch.cpp │ ├── SkCamera.cpp │ ├── SkCubicInterval.cpp │ ├── SkCullPoints.cpp │ ├── SkDebugTrace.h │ ├── SkDeferredCanvas.cpp │ ├── SkDumpCanvas.cpp │ ├── SkInterpolator.cpp │ ├── SkJSON.cpp │ ├── SkLayer.cpp │ ├── SkMatrix44.cpp │ ├── SkMeshUtils.cpp │ ├── SkNWayCanvas.cpp │ ├── SkNinePatch.cpp │ ├── SkOSFile.cpp │ ├── SkParse.cpp │ ├── SkParseColor.cpp │ ├── SkParsePath.cpp │ ├── SkProxyCanvas.cpp │ ├── SkSfntUtils.cpp │ ├── SkUnitMappers.cpp │ ├── ios │ │ ├── SkFontHost_iOS.mm │ │ ├── SkImageDecoder_iOS.mm │ │ ├── SkOSFile_iOS.mm │ │ └── SkStream_NSData.mm │ ├── mac │ │ ├── SkBitmap_Mac.cpp │ │ ├── SkCreateCGImageRef.cpp │ │ └── SkStream_mac.cpp │ └── win │ │ ├── SkAutoCoInitialize.cpp │ │ ├── SkHRESULT.cpp │ │ ├── SkIStream.cpp │ │ └── SkWGL_win.cpp ├── views │ ├── SkBGViewArtist.cpp │ ├── SkEvent.cpp │ ├── SkEventSink.cpp │ ├── SkListView.cpp │ ├── SkOSMenu.cpp │ ├── SkParsePaint.cpp │ ├── SkProgressView.cpp │ ├── SkStackViewLayout.cpp │ ├── SkTagList.cpp │ ├── SkTagList.h │ ├── SkTextBox.cpp │ ├── SkTouchGesture.cpp │ ├── SkView.cpp │ ├── SkViewInflate.cpp │ ├── SkViewPriv.cpp │ ├── SkViewPriv.h │ ├── SkWidget.cpp │ ├── SkWidgets.cpp │ ├── SkWindow.cpp │ ├── animated │ │ ├── SkBorderView.cpp │ │ ├── SkImageView.cpp │ │ ├── SkListWidget.cpp │ │ ├── SkProgressBarView.cpp │ │ ├── SkScrollBarView.cpp │ │ ├── SkStaticTextView.cpp │ │ └── SkWidgetViews.cpp │ ├── ios │ │ └── SkOSWindow_iOS.mm │ ├── mac │ │ ├── SampleApp-Info.plist │ │ ├── SampleApp.xib │ │ ├── SampleAppDelegate.h │ │ ├── SampleAppDelegate.mm │ │ ├── SkEventNotifier.h │ │ ├── SkEventNotifier.mm │ │ ├── SkNSView.h │ │ ├── SkNSView.mm │ │ ├── SkOSWindow_Mac.cpp │ │ ├── SkOSWindow_Mac.mm │ │ ├── SkOptionsTableView.h │ │ ├── SkOptionsTableView.mm │ │ ├── SkSampleNSView.h │ │ ├── SkSampleNSView.mm │ │ ├── SkTextFieldCell.h │ │ ├── SkTextFieldCell.m │ │ └── skia_mac.mm │ ├── sdl │ │ └── SkOSWindow_SDL.cpp │ ├── unix │ │ ├── SkOSWindow_Unix.cpp │ │ ├── keysym2ucs.c │ │ └── skia_unix.cpp │ ├── views_files.mk │ └── win │ │ ├── SkOSWindow_win.cpp │ │ └── skia_win.cpp └── xml │ ├── SkBML_Verbs.h │ ├── SkBML_XMLParser.cpp │ ├── SkDOM.cpp │ ├── SkJS.cpp │ ├── SkJSDisplayable.cpp │ ├── SkXMLParser.cpp │ ├── SkXMLPullParser.cpp │ ├── SkXMLWriter.cpp │ └── xml_files.mk ├── third_party └── externals │ ├── libgif │ ├── dev2gif.c │ ├── dgif_lib.c │ ├── egif_lib.c │ ├── getarg.c │ ├── getarg.h │ ├── gif_err.c │ ├── gif_font.c │ ├── gif_hash.c │ ├── gif_hash.h │ ├── gif_lib.h │ ├── gif_lib_private.h │ ├── gifalloc.c │ ├── qprintf.c │ └── quantize.c │ ├── libjpeg │ ├── .svn │ │ ├── entries │ │ ├── format │ │ └── wc.db │ ├── LICENSE │ ├── README │ ├── README.chromium │ ├── jcapimin.c │ ├── jcapistd.c │ ├── jccoefct.c │ ├── jccolor.c │ ├── jcdctmgr.c │ ├── jchuff.c │ ├── jchuff.h │ ├── jcinit.c │ ├── jcmainct.c │ ├── jcmarker.c │ ├── jcmaster.c │ ├── jcomapi.c │ ├── jconfig.h │ ├── jcparam.c │ ├── jcphuff.c │ ├── jcprepct.c │ ├── jcsample.c │ ├── jdapimin.c │ ├── jdapistd.c │ ├── jdatadst.c │ ├── jdatasrc.c │ ├── jdcoefct.c │ ├── jdcolor.c │ ├── jdct.h │ ├── jddctmgr.c │ ├── jdhuff.c │ ├── jdhuff.h │ ├── jdinput.c │ ├── jdmainct.c │ ├── jdmarker.c │ ├── jdmaster.c │ ├── jdmerge.c │ ├── jdphuff.c │ ├── jdpostct.c │ ├── jdsample.c │ ├── jerror.c │ ├── jerror.h │ ├── jfdctflt.c │ ├── jfdctfst.c │ ├── jfdctint.c │ ├── jidctflt.c │ ├── jidctfst.c │ ├── jidctint.c │ ├── jidctred.c │ ├── jinclude.h │ ├── jmemmgr.c │ ├── jmemnobs.c │ ├── jmemsys.h │ ├── jmorecfg.h │ ├── jpegint.h │ ├── jpeglib.h │ ├── jpeglibmangler.h │ ├── jquant1.c │ ├── jquant2.c │ ├── jutils.c │ ├── jversion.h │ └── libjpeg.gyp │ ├── libpng │ ├── png.c │ ├── png.h │ ├── pngconf.h │ ├── pngdebug.h │ ├── pngerror.c │ ├── pngget.c │ ├── pnginfo.h │ ├── pnglibconf.h │ ├── pngmem.c │ ├── pngpread.c │ ├── pngpriv.h │ ├── pngread.c │ ├── pngrio.c │ ├── pngrtran.c │ ├── pngrutil.c │ ├── pngset.c │ ├── pngstruct.h │ ├── pngtest.c │ ├── pngtrans.c │ ├── pngwio.c │ ├── pngwrite.c │ ├── pngwtran.c │ └── pngwutil.c │ └── zlib │ ├── adler32.c │ ├── compress.c │ ├── crc32.c │ ├── crc32.h │ ├── deflate.c │ ├── deflate.h │ ├── gzclose.c │ ├── gzguts.h │ ├── gzlib.c │ ├── gzread.c │ ├── gzwrite.c │ ├── infback.c │ ├── inffast.c │ ├── inffast.h │ ├── inffixed.h │ ├── inflate.c │ ├── inflate.h │ ├── inftrees.c │ ├── inftrees.h │ ├── trees.c │ ├── trees.h │ ├── zconf.h │ ├── zlib.h │ ├── zutil.c │ └── zutil.h └── vs9 ├── Skia.vcproj.LAUYOUME.acer.user ├── SkiaAll.sln ├── libgif.vcproj ├── libgif.vcproj.LAUYOUME.acer.user ├── libjpeg.vcproj ├── libjpeg.vcproj.LAUYOUME.acer.user ├── libpng.vcproj ├── libpng.vcproj.LAUYOUME.acer.user ├── skia.vcproj ├── skiahello ├── skhello.cpp ├── skhello.png ├── skiahello.vcproj └── skiahello.vcproj.LAUYOUME.acer.user ├── zlib.vcproj └── zlib.vcproj.LAUYOUME.acer.user /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | 6 | # Compiled Dynamic libraries 7 | *.so 8 | 9 | # Compiled Static libraries 10 | *.lai 11 | *.la 12 | *.a 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | SkiaLib 2 | ======= 3 | 4 | skia library build by visual studio 2008 -------------------------------------------------------------------------------- /include/animator/SkAnimatorView.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkAnimatorView_DEFINED 11 | #define SkAnimatorView_DEFINED 12 | 13 | #include "SkView.h" 14 | #include "SkAnimator.h" 15 | 16 | class SkAnimatorView : public SkView { 17 | public: 18 | SkAnimatorView(); 19 | virtual ~SkAnimatorView(); 20 | 21 | SkAnimator* getAnimator() const { return fAnimator; } 22 | 23 | bool decodeFile(const char path[]); 24 | bool decodeMemory(const void* buffer, size_t size); 25 | bool decodeStream(SkStream* stream); 26 | 27 | protected: 28 | // overrides 29 | virtual bool onEvent(const SkEvent&); 30 | virtual void onDraw(SkCanvas*); 31 | virtual void onInflate(const SkDOM&, const SkDOM::Node*); 32 | 33 | private: 34 | SkAnimator* fAnimator; 35 | 36 | typedef SkView INHERITED; 37 | }; 38 | 39 | #endif 40 | 41 | -------------------------------------------------------------------------------- /include/config/sk_stdint.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | #ifndef sk_stdint_DEFINED 9 | #define sk_stdint_DEFINED 10 | 11 | typedef signed char int8_t; 12 | typedef unsigned char uint8_t; 13 | typedef short int16_t; 14 | typedef unsigned short uint16_t; 15 | typedef int int32_t; 16 | typedef unsigned uint32_t; 17 | typedef long long int64_t; 18 | typedef unsigned long long uint64_t; 19 | 20 | typedef int64_t intmax_t; 21 | typedef uint64_t uintmax_t; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /include/core/SkDrawFilter.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkDrawFilter_DEFINED 11 | #define SkDrawFilter_DEFINED 12 | 13 | #include "SkRefCnt.h" 14 | 15 | class SkCanvas; 16 | class SkPaint; 17 | 18 | /** 19 | * Right before something is being draw, filter() is called with the 20 | * paint. The filter may modify the paint as it wishes, which will then be 21 | * used for the actual drawing. Note: this modification only lasts for the 22 | * current draw, as a temporary copy of the paint is used. 23 | */ 24 | class SkDrawFilter : public SkRefCnt { 25 | public: 26 | enum Type { 27 | kPaint_Type, 28 | kPoint_Type, 29 | kLine_Type, 30 | kBitmap_Type, 31 | kRect_Type, 32 | kPath_Type, 33 | kText_Type 34 | }; 35 | 36 | /** 37 | * Called with the paint that will be used to draw the specified type. 38 | * The implementation may modify the paint as they wish. 39 | */ 40 | virtual void filter(SkPaint*, Type) = 0; 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /include/core/SkMMapStream.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2008 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkMMapStream_DEFINED 11 | #define SkMMapStream_DEFINED 12 | 13 | #include "SkStream.h" 14 | 15 | class SkMMAPStream : public SkMemoryStream { 16 | public: 17 | SkMMAPStream(const char filename[]); 18 | virtual ~SkMMAPStream(); 19 | 20 | virtual void setMemory(const void* data, size_t length, bool); 21 | private: 22 | void* fAddr; 23 | size_t fSize; 24 | 25 | void closeMMap(); 26 | 27 | typedef SkMemoryStream INHERITED; 28 | }; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /include/core/SkRasterizer.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkRasterizer_DEFINED 11 | #define SkRasterizer_DEFINED 12 | 13 | #include "SkFlattenable.h" 14 | #include "SkMask.h" 15 | 16 | class SkMaskFilter; 17 | class SkMatrix; 18 | class SkPath; 19 | struct SkIRect; 20 | 21 | class SkRasterizer : public SkFlattenable { 22 | public: 23 | SkRasterizer() {} 24 | 25 | /** Turn the path into a mask, respecting the specified local->device matrix. 26 | */ 27 | bool rasterize(const SkPath& path, const SkMatrix& matrix, 28 | const SkIRect* clipBounds, SkMaskFilter* filter, 29 | SkMask* mask, SkMask::CreateMode mode); 30 | 31 | protected: 32 | SkRasterizer(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} 33 | 34 | virtual bool onRasterize(const SkPath& path, const SkMatrix& matrix, 35 | const SkIRect* clipBounds, 36 | SkMask* mask, SkMask::CreateMode mode); 37 | 38 | private: 39 | typedef SkFlattenable INHERITED; 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /include/core/SkShape.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | #ifndef SkShape_DEFINED 9 | #define SkShape_DEFINED 10 | 11 | #include "SkFlattenable.h" 12 | 13 | class SkCanvas; 14 | class SkMatrix; 15 | class SkWStream; 16 | 17 | class SkShape : public SkFlattenable { 18 | public: 19 | SkShape(); 20 | virtual ~SkShape(); 21 | 22 | void draw(SkCanvas*); 23 | 24 | /** Draw the shape translated by (dx,dy), which is applied before the 25 | shape's matrix (if any). 26 | */ 27 | void drawXY(SkCanvas*, SkScalar dx, SkScalar dy); 28 | 29 | /** Draw the shape with the specified matrix, applied before the shape's 30 | matrix (if any). 31 | */ 32 | void drawMatrix(SkCanvas*, const SkMatrix&); 33 | 34 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkShape) 35 | 36 | protected: 37 | virtual void onDraw(SkCanvas*); 38 | 39 | SkShape(SkFlattenableReadBuffer&); 40 | 41 | private: 42 | 43 | typedef SkFlattenable INHERITED; 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /include/core/SkUnitMapper.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkUnitMapper_DEFINED 11 | #define SkUnitMapper_DEFINED 12 | 13 | #include "SkRefCnt.h" 14 | #include "SkScalar.h" 15 | 16 | #include "SkFlattenable.h" 17 | 18 | class SkUnitMapper : public SkFlattenable { 19 | public: 20 | SkUnitMapper() {} 21 | 22 | /** Given a value in [0..0xFFFF], return a value in the same range. 23 | */ 24 | virtual uint16_t mapUnit16(uint16_t x) = 0; 25 | 26 | protected: 27 | SkUnitMapper(SkFlattenableReadBuffer& rb) : SkFlattenable(rb) {} 28 | }; 29 | 30 | #endif 31 | 32 | -------------------------------------------------------------------------------- /include/effects/SkArithmeticMode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkArithmeticMode_DEFINED 9 | #define SkArithmeticMode_DEFINED 10 | 11 | #include "SkXfermode.h" 12 | 13 | class SkArithmeticMode : public SkXfermode { 14 | public: 15 | /** 16 | * result = clamp[k1 * src * dst + k2 * src + k3 * dst + k4] 17 | * 18 | * src and dst are treated as being [0.0 .. 1.0]. The polynomial is 19 | * evaluated on their unpremultiplied components. 20 | * 21 | * k1=k2=k3=0, k4=1.0 results in returning opaque white 22 | * k1=k3=k4=0, k2=1.0 results in returning the src 23 | * k1=k2=k4=0, k3=1.0 results in returning the dst 24 | */ 25 | static SkXfermode* Create(SkScalar k1, SkScalar k2, 26 | SkScalar k3, SkScalar k4); 27 | }; 28 | 29 | #endif 30 | 31 | -------------------------------------------------------------------------------- /include/effects/SkBlurImageFilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 The Android Open Source Project 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | 9 | #ifndef SkBlurImageFilter_DEFINED 10 | #define SkBlurImageFilter_DEFINED 11 | 12 | #include "SkImageFilter.h" 13 | 14 | class SK_API SkBlurImageFilter : public SkImageFilter { 15 | public: 16 | SkBlurImageFilter(SkScalar sigmaX, SkScalar sigmaY); 17 | 18 | virtual bool asABlur(SkSize* sigma) const SK_OVERRIDE; 19 | 20 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurImageFilter) 21 | 22 | protected: 23 | explicit SkBlurImageFilter(SkFlattenableReadBuffer& buffer); 24 | virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; 25 | 26 | virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, 27 | SkBitmap* result, SkIPoint* offset) SK_OVERRIDE; 28 | 29 | private: 30 | SkSize fSigma; 31 | typedef SkImageFilter INHERITED; 32 | }; 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /include/effects/SkDrawExtraPathEffect.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2008 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SK_DRAW_EXTRA_PATH_EFFECT_H 11 | #define SK_DRAW_EXTRA_PATH_EFFECT_H 12 | class SkAnimator; 13 | void InitializeSkExtraPathEffects(SkAnimator* animator); 14 | #endif 15 | 16 | -------------------------------------------------------------------------------- /include/effects/SkPaintFlagsDrawFilter.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2008 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkPaintFlagsDrawFilter_DEFINED 11 | #define SkPaintFlagsDrawFilter_DEFINED 12 | 13 | #include "SkDrawFilter.h" 14 | 15 | class SkPaintFlagsDrawFilter : public SkDrawFilter { 16 | public: 17 | SkPaintFlagsDrawFilter(uint32_t clearFlags, uint32_t setFlags); 18 | 19 | // overrides 20 | virtual void filter(SkPaint*, Type); 21 | 22 | private: 23 | uint16_t fClearFlags; // user specified 24 | uint16_t fSetFlags; // user specified 25 | }; 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /include/effects/SkPixelXorXfermode.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2007 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkPixelXorXfermode_DEFINED 11 | #define SkPixelXorXfermode_DEFINED 12 | 13 | #include "SkXfermode.h" 14 | 15 | /** SkPixelXorXfermode implements a simple pixel xor (op ^ src ^ dst). 16 | This transformation does not follow premultiplied conventions, therefore 17 | this proc *always* returns an opaque color (alpha == 255). Thus it is 18 | not really usefull for operating on blended colors. 19 | */ 20 | class SkPixelXorXfermode : public SkXfermode { 21 | public: 22 | SkPixelXorXfermode(SkColor opColor) : fOpColor(opColor) {} 23 | 24 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPixelXorXfermode) 25 | 26 | protected: 27 | SkPixelXorXfermode(SkFlattenableReadBuffer& rb); 28 | virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; 29 | 30 | // override from SkXfermode 31 | virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst); 32 | 33 | private: 34 | SkColor fOpColor; 35 | 36 | typedef SkXfermode INHERITED; 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /include/effects/SkTransparentShader.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkTransparentShader_DEFINED 11 | #define SkTransparentShader_DEFINED 12 | 13 | #include "SkShader.h" 14 | 15 | class SkTransparentShader : public SkShader { 16 | public: 17 | SkTransparentShader() {} 18 | 19 | virtual uint32_t getFlags() SK_OVERRIDE; 20 | virtual bool setContext( const SkBitmap& device, 21 | const SkPaint& paint, 22 | const SkMatrix& matrix) SK_OVERRIDE; 23 | virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE; 24 | virtual void shadeSpan16(int x, int y, uint16_t span[], int count) SK_OVERRIDE; 25 | 26 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTransparentShader) 27 | 28 | private: 29 | // these are a cache from the call to setContext() 30 | const SkBitmap* fDevice; 31 | uint8_t fAlpha; 32 | 33 | SkTransparentShader(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} 34 | 35 | typedef SkShader INHERITED; 36 | }; 37 | 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /include/gpu/GrFontScaler.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2010 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | 11 | #ifndef GrFontScaler_DEFINED 12 | #define GrFontScaler_DEFINED 13 | 14 | #include "GrGlyph.h" 15 | #include "GrKey.h" 16 | 17 | class SkPath; 18 | 19 | /** 20 | * This is a virtual base class which Gr's interface to the host platform's 21 | * font scaler. 22 | * 23 | * The client is responsible for subclassing, and instantiating this. The 24 | * instance is create for a specific font+size+matrix. 25 | */ 26 | class GrFontScaler : public GrRefCnt { 27 | public: 28 | virtual const GrKey* getKey() = 0; 29 | virtual GrMaskFormat getMaskFormat() = 0; 30 | virtual bool getPackedGlyphBounds(GrGlyph::PackedID, GrIRect* bounds) = 0; 31 | virtual bool getPackedGlyphImage(GrGlyph::PackedID, int width, int height, 32 | int rowBytes, void* image) = 0; 33 | virtual bool getGlyphPath(uint16_t glyphID, SkPath*) = 0; 34 | }; 35 | 36 | #endif 37 | 38 | -------------------------------------------------------------------------------- /include/gpu/GrInstanceCounter.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2010 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | 11 | #ifndef GrInstanceCounter_DEFINED 12 | #define GrInstanceCounter_DEFINED 13 | 14 | #include "GrTypes.h" 15 | 16 | template class GrInstanceCounter { 17 | public: 18 | GrInstanceCounter() { 19 | ++gCounter; 20 | GrPrintf("+ %s %d\n", T::InstanceCounterClassName(), gCounter); 21 | } 22 | 23 | ~GrInstanceCounter() { 24 | --gCounter; 25 | GrPrintf("- %s %d\n", T::InstanceCounterClassName(), gCounter); 26 | } 27 | 28 | private: 29 | static int gCounter; 30 | }; 31 | 32 | template int GrInstanceCounter::gCounter; 33 | 34 | #define DECLARE_INSTANCE_COUNTER(T) \ 35 | static const char* InstanceCounterClassName() { return #T; } \ 36 | friend class GrInstanceCounter; \ 37 | GrInstanceCounter fInstanceCounter 38 | 39 | #endif 40 | 41 | -------------------------------------------------------------------------------- /include/gpu/GrKey.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2010 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | 11 | #ifndef GrKey_DEFINED 12 | #define GrKey_DEFINED 13 | 14 | #include "GrRefCnt.h" 15 | 16 | class GrKey : public GrRefCnt { 17 | public: 18 | typedef intptr_t Hash; 19 | 20 | explicit GrKey(Hash hash) : fHash(hash) {} 21 | 22 | intptr_t getHash() const { return fHash; } 23 | 24 | bool operator<(const GrKey& rh) const { 25 | return fHash < rh.fHash || (fHash == rh.fHash && this->lt(rh)); 26 | } 27 | bool operator==(const GrKey& rh) const { 28 | return fHash == rh.fHash && this->eq(rh); 29 | } 30 | 31 | protected: 32 | virtual bool lt(const GrKey& rh) const = 0; 33 | virtual bool eq(const GrKey& rh) const = 0; 34 | 35 | private: 36 | const Hash fHash; 37 | }; 38 | 39 | #endif 40 | 41 | -------------------------------------------------------------------------------- /include/gpu/GrMatrix.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2010 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | 11 | #ifndef GrMatrix_DEFINED 12 | #define GrMatrix_DEFINED 13 | 14 | #include "GrRect.h" 15 | #include "SkMatrix.h" 16 | 17 | typedef SkMatrix GrMatrix; 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /include/gpu/GrNoncopyable.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2010 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | 11 | #ifndef GrNoncopyable_DEFINED 12 | #define GrNoncopyable_DEFINED 13 | 14 | #include "GrTypes.h" 15 | 16 | /** 17 | * Base for classes that want to disallow copying themselves. It makes its 18 | * copy-constructor and assignment operators private (and unimplemented). 19 | */ 20 | class GR_API GrNoncopyable { 21 | public: 22 | GrNoncopyable() {} 23 | 24 | private: 25 | // illegal 26 | GrNoncopyable(const GrNoncopyable&); 27 | GrNoncopyable& operator=(const GrNoncopyable&); 28 | }; 29 | 30 | #endif 31 | 32 | -------------------------------------------------------------------------------- /include/gpu/GrPoint.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2010 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | 11 | #ifndef GrPoint_DEFINED 12 | #define GrPoint_DEFINED 13 | 14 | #include "GrTypes.h" 15 | #include "GrScalar.h" 16 | #include "SkPoint.h" 17 | 18 | #define GrPoint SkPoint 19 | #define GrVec SkVector 20 | 21 | struct GrIPoint16 { 22 | int16_t fX, fY; 23 | 24 | void set(intptr_t x, intptr_t y) { 25 | fX = GrToS16(x); 26 | fY = GrToS16(y); 27 | } 28 | }; 29 | 30 | #endif 31 | 32 | -------------------------------------------------------------------------------- /include/gpu/GrRect.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2010 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | 11 | #ifndef GrRect_DEFINED 12 | #define GrRect_DEFINED 13 | 14 | #include "GrPoint.h" 15 | #include "SkRect.h" 16 | 17 | typedef SkIRect GrIRect; 18 | typedef SkRect GrRect; 19 | 20 | struct GrIRect16 { 21 | int16_t fLeft, fTop, fRight, fBottom; 22 | 23 | int width() const { return fRight - fLeft; } 24 | int height() const { return fBottom - fTop; } 25 | int area() const { return this->width() * this->height(); } 26 | bool isEmpty() const { return fLeft >= fRight || fTop >= fBottom; } 27 | 28 | void set(const GrIRect& r) { 29 | fLeft = SkToS16(r.fLeft); 30 | fTop = SkToS16(r.fTop); 31 | fRight = SkToS16(r.fRight); 32 | fBottom = SkToS16(r.fBottom); 33 | } 34 | }; 35 | 36 | #endif 37 | 38 | -------------------------------------------------------------------------------- /include/gpu/GrRefCnt.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2010 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | 11 | #ifndef GrRefCnt_DEFINED 12 | #define GrRefCnt_DEFINED 13 | 14 | #include "GrTypes.h" 15 | #include "SkRefCnt.h" 16 | 17 | typedef SkRefCnt GrRefCnt; 18 | typedef SkAutoRef GrAutoRef; 19 | typedef SkAutoUnref GrAutoUnref; 20 | 21 | #define GrSafeRef SkSafeRef 22 | #define GrSafeUnref SkSafeUnref 23 | #define GrSafeAssign(a, b) SkRefCnt_SafeAssign(a, b) 24 | 25 | template 26 | static inline void GrSafeSetNull(T*& obj) { 27 | if (NULL != obj) { 28 | obj->unref(); 29 | obj = NULL; 30 | } 31 | } 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /include/gpu/gl/SkANGLEGLContext.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2012 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | #ifndef SkANGLEGLContext_DEFINED 9 | #define SkANGLEGLContext_DEFINED 10 | 11 | #if SK_ANGLE 12 | 13 | #include "SkGLContext.h" 14 | 15 | #include 16 | #include 17 | 18 | class SkANGLEGLContext : public SkGLContext { 19 | public: 20 | SkANGLEGLContext(); 21 | 22 | virtual ~SkANGLEGLContext(); 23 | 24 | virtual void makeCurrent() const SK_OVERRIDE; 25 | 26 | class AutoContextRestore { 27 | public: 28 | AutoContextRestore(); 29 | ~AutoContextRestore(); 30 | 31 | private: 32 | EGLContext fOldEGLContext; 33 | EGLDisplay fOldDisplay; 34 | EGLSurface fOldSurface; 35 | }; 36 | 37 | protected: 38 | virtual const GrGLInterface* createGLContext() SK_OVERRIDE; 39 | virtual void destroyGLContext() SK_OVERRIDE; 40 | 41 | private: 42 | EGLContext fContext; 43 | EGLDisplay fDisplay; 44 | EGLSurface fSurface; 45 | }; 46 | 47 | #endif 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /include/gpu/gl/SkDebugGLContext.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2012 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | #ifndef SkDebugGLContext_DEFINED 9 | #define SkDebugGLContext_DEFINED 10 | 11 | #include "SkGLContext.h" 12 | 13 | class SkDebugGLContext : public SkGLContext { 14 | 15 | public: 16 | SkDebugGLContext() {}; 17 | 18 | virtual void makeCurrent() const SK_OVERRIDE {}; 19 | 20 | protected: 21 | virtual const GrGLInterface* createGLContext() SK_OVERRIDE; 22 | 23 | virtual void destroyGLContext() SK_OVERRIDE {}; 24 | }; 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /include/gpu/gl/SkMesaGLContext.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | #ifndef SkMesaGLContext_DEFINED 9 | #define SkMesaGLContext_DEFINED 10 | 11 | #include "SkGLContext.h" 12 | 13 | #if SK_MESA 14 | 15 | class SkMesaGLContext : public SkGLContext { 16 | private: 17 | typedef intptr_t Context; 18 | 19 | public: 20 | SkMesaGLContext(); 21 | 22 | virtual ~SkMesaGLContext(); 23 | 24 | virtual void makeCurrent() const SK_OVERRIDE; 25 | 26 | class AutoContextRestore { 27 | public: 28 | AutoContextRestore(); 29 | ~AutoContextRestore(); 30 | 31 | private: 32 | Context fOldContext; 33 | GrGLint fOldWidth; 34 | GrGLint fOldHeight; 35 | GrGLint fOldFormat; 36 | void* fOldImage; 37 | }; 38 | 39 | protected: 40 | virtual const GrGLInterface* createGLContext() SK_OVERRIDE; 41 | virtual void destroyGLContext() SK_OVERRIDE; 42 | 43 | private: 44 | Context fContext; 45 | GrGLubyte *fImage; 46 | }; 47 | 48 | #endif 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /include/gpu/gl/SkNullGLContext.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | #ifndef SkNullGLContext_DEFINED 9 | #define SkNullGLContext_DEFINED 10 | 11 | #include "SkGLContext.h" 12 | 13 | class SkNullGLContext : public SkGLContext { 14 | 15 | public: 16 | SkNullGLContext() {}; 17 | 18 | virtual void makeCurrent() const SK_OVERRIDE {}; 19 | 20 | protected: 21 | virtual const GrGLInterface* createGLContext() SK_OVERRIDE; 22 | 23 | virtual void destroyGLContext() SK_OVERRIDE {}; 24 | }; 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /include/ports/SkStream_Win.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkStream_Win_DEFINED 11 | #define SkStream_Win_DEFINED 12 | 13 | #ifndef SK_BUILD_FOR_WIN 14 | #error "only valid for windows and wince builds" 15 | #endif 16 | 17 | #ifndef SkStream_DEFINED 18 | #include "SkStream.h" 19 | #endif 20 | #include "SkString.h" 21 | #include "Wininet.h" 22 | 23 | /** \cond ZERO */ 24 | class SkURLStream : public SkStream { 25 | public: 26 | SkURLStream(const char url[] = NULL); 27 | virtual ~SkURLStream(); 28 | 29 | /** Close the current URL, and open a new URL. 30 | If URL is null, just close the current URL. 31 | */ 32 | void setURL(const char url[]); 33 | 34 | // overrides 35 | virtual bool rewind(); 36 | virtual size_t read(void* buffer, size_t size); 37 | 38 | private: 39 | SkString fURL; 40 | HINTERNET fConnection; 41 | HINTERNET fURLStream; 42 | }; 43 | 44 | /** \endcond */ 45 | #endif // SkStream_Win_DEFINED 46 | 47 | -------------------------------------------------------------------------------- /include/ports/SkTypeface_mac.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | 11 | #ifndef SkTypeface_mac_DEFINED 12 | #define SkTypeface_mac_DEFINED 13 | 14 | #include "SkTypeface.h" 15 | #ifdef SK_BUILD_FOR_MAC 16 | #import 17 | #endif 18 | 19 | #ifdef SK_BUILD_FOR_IOS 20 | #include 21 | #endif 22 | /** 23 | * Like the other Typeface create methods, this returns a new reference to the 24 | * corresponding typeface for the specified CTFontRef. The caller must call 25 | * unref() when it is finished. 26 | */ 27 | SK_API extern SkTypeface* SkCreateTypefaceFromCTFont(CTFontRef); 28 | 29 | #endif 30 | 31 | -------------------------------------------------------------------------------- /include/ports/SkTypeface_win.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | 11 | #ifndef SkTypeface_win_DEFINED 12 | #define SkTypeface_win_DEFINED 13 | 14 | #include "SkTypeface.h" 15 | 16 | /** 17 | * Like the other Typeface create methods, this returns a new reference to the 18 | * corresponding typeface for the specified logfont. The caller is responsible 19 | * for calling unref() when it is finished. 20 | */ 21 | SK_API SkTypeface* SkCreateTypefaceFromLOGFONT(const LOGFONT&); 22 | 23 | /** 24 | * Copy the LOGFONT associated with this typeface into the lf parameter. Note 25 | * that the lfHeight will need to be set afterwards, since the typeface does 26 | * not track this (the paint does). 27 | * typeface may be NULL, in which case we return the logfont for the default font. 28 | */ 29 | SK_API void SkLOGFONTFromTypeface(const SkTypeface* typeface, LOGFONT* lf); 30 | 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /include/svg/SkSVGAttribute.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSVGAttribute_DEFINED 11 | #define SkSVGAttribute_DEFINED 12 | 13 | #include "SkTypes.h" 14 | 15 | struct SkSVGAttribute { 16 | const char* fName; 17 | #ifdef SK_DEBUG 18 | size_t fOffset; 19 | #endif 20 | }; 21 | 22 | #ifndef SK_OFFSETOF 23 | #define SK_OFFSETOF(a, b) (((size_t) (&(((a*) 1)->b)))-1) 24 | #endif 25 | 26 | #ifdef SK_DEBUG 27 | #define SVG_ATTRIBUTE(attr) { #attr, SK_OFFSETOF(BASE_CLASS, f_##attr) } 28 | #define SVG_LITERAL_ATTRIBUTE(svgAttr, cAttr) { #svgAttr, SK_OFFSETOF(BASE_CLASS, cAttr) } 29 | #else 30 | #define SVG_ATTRIBUTE(attr) { #attr } 31 | #define SVG_LITERAL_ATTRIBUTE(svgAttr, cAttr) { #svgAttr } 32 | #endif 33 | 34 | #define SVG_ADD_ATTRIBUTE(attr) \ 35 | if (f_##attr.size() > 0) \ 36 | parser._addAttributeLen(#attr, f_##attr.c_str(), f_##attr.size()) 37 | 38 | #define SVG_ADD_ATTRIBUTE_ALIAS(attr, alias) \ 39 | if (f_##alias.size() > 0) \ 40 | parser._addAttributeLen(#attr, f_##alias.c_str(), f_##alias.size()) 41 | 42 | #endif // SkSVGAttribute_DEFINED 43 | -------------------------------------------------------------------------------- /include/svg/SkSVGBase.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSVGBase_DEFINED 11 | #define SkSVGBase_DEFINED 12 | 13 | #include "SkSVGAttribute.h" 14 | 15 | class SkSVGParser; 16 | 17 | class SkSVGBase { 18 | public: 19 | virtual ~SkSVGBase(); 20 | virtual void addAttribute(SkSVGParser& parser, int attrIndex, 21 | const char* attrValue, size_t attrLength); 22 | virtual int getAttributes(const SkSVGAttribute** attrPtr) = 0; 23 | }; 24 | 25 | #endif // SkSVGBase_DEFINEDes(const SkSVGAttribute** attrPtr) = 0; 26 | 27 | -------------------------------------------------------------------------------- /include/svg/SkSVGTypes.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSVGTypes_DEFINED 11 | #define SkSVGTypes_DEFINED 12 | 13 | enum SkSVGTypes { 14 | SkSVGType_Circle, 15 | SkSVGType_ClipPath, 16 | SkSVGType_Defs, 17 | SkSVGType_Ellipse, 18 | SkSVGType_FeColorMatrix, 19 | SkSVGType_Filter, 20 | SkSVGType_G, 21 | SkSVGType_Image, 22 | SkSVGType_Line, 23 | SkSVGType_LinearGradient, 24 | SkSVGType_Mask, 25 | SkSVGType_Metadata, 26 | SkSVGType_Path, 27 | SkSVGType_Polygon, 28 | SkSVGType_Polyline, 29 | SkSVGType_RadialGradient, 30 | SkSVGType_Rect, 31 | SkSVGType_SVG, 32 | SkSVGType_Stop, 33 | SkSVGType_Symbol, 34 | SkSVGType_Text, 35 | SkSVGType_Tspan, 36 | SkSVGType_Unknown, 37 | SkSVGType_Use 38 | }; 39 | 40 | #endif // SkSVGTypes_DEFINED 41 | -------------------------------------------------------------------------------- /include/utils/SkCubicInterval.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | #ifndef SkCubicInterval_DEFINED 9 | #define SkCubicInterval_DEFINED 10 | 11 | #include "SkPoint.h" 12 | 13 | SkScalar SkEvalCubicInterval(SkScalar x1, SkScalar y1, 14 | SkScalar x2, SkScalar y2, 15 | SkScalar unitX); 16 | 17 | static inline SkScalar SkEvalCubicInterval(const SkPoint pts[2], SkScalar x) { 18 | return SkEvalCubicInterval(pts[0].fX, pts[0].fY, 19 | pts[1].fX, pts[1].fY, x); 20 | } 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /include/utils/SkNinePatch.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkNinePatch_DEFINED 11 | #define SkNinePatch_DEFINED 12 | 13 | #include "SkRect.h" 14 | #include "SkRegion.h" 15 | 16 | class SkBitmap; 17 | class SkCanvas; 18 | class SkPaint; 19 | 20 | class SkNinePatch { 21 | public: 22 | static void DrawNine(SkCanvas* canvas, const SkRect& dst, 23 | const SkBitmap& bitmap, const SkIRect& margins, 24 | const SkPaint* paint = NULL); 25 | 26 | static void DrawMesh(SkCanvas* canvas, const SkRect& dst, 27 | const SkBitmap& bitmap, 28 | const int32_t xDivs[], int numXDivs, 29 | const int32_t yDivs[], int numYDivs, 30 | const SkPaint* paint = NULL); 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /include/utils/SkParsePaint.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkParsePaint_DEFINED 11 | #define SkParsePaint_DEFINED 12 | 13 | #include "SkPaint.h" 14 | #include "SkDOM.h" 15 | 16 | /** "color" color 17 | "opacity" scalar [0..1] 18 | "stroke-width" scalar (0...inf) 19 | "text-size" scalar (0..inf) 20 | "is-stroke" bool 21 | "is-antialias" bool 22 | "is-lineartext" bool 23 | */ 24 | void SkPaint_Inflate(SkPaint*, const SkDOM&, const SkDOM::Node*); 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /include/utils/SkParsePath.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkParsePath_DEFINED 11 | #define SkParsePath_DEFINED 12 | 13 | #include "SkPath.h" 14 | 15 | class SkString; 16 | 17 | class SkParsePath { 18 | public: 19 | static bool FromSVGString(const char str[], SkPath*); 20 | static void ToSVGString(const SkPath&, SkString*); 21 | }; 22 | 23 | #endif 24 | 25 | -------------------------------------------------------------------------------- /include/utils/win/SkAutoCoInitialize.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkAutoCo_DEFINED 11 | #define SkAutoCo_DEFINED 12 | 13 | #define WIN32_LEAN_AND_MEAN 14 | #include 15 | #include "SkTemplates.h" 16 | 17 | /** 18 | * An instance of this class initializes COM on creation 19 | * and closes the COM library on destruction. 20 | */ 21 | class SkAutoCoInitialize : SkNoncopyable { 22 | private: 23 | HRESULT fHR; 24 | public: 25 | SkAutoCoInitialize(); 26 | ~SkAutoCoInitialize(); 27 | bool succeeded(); 28 | }; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /include/views/SkApplication.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkApplication_DEFINED 11 | #define SkApplication_DEFINED 12 | 13 | class SkOSWindow; 14 | 15 | extern SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv); 16 | extern void application_init(); 17 | extern void application_term(); 18 | 19 | #endif // SkApplication_DEFINED 20 | -------------------------------------------------------------------------------- /include/views/SkBGViewArtist.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkBGViewArtist_DEFINED 11 | #define SkBGViewArtist_DEFINED 12 | 13 | #include "SkView.h" 14 | #include "SkPaint.h" 15 | 16 | class SkBGViewArtist : public SkView::Artist { 17 | public: 18 | SkBGViewArtist(SkColor c = SK_ColorWHITE); 19 | virtual ~SkBGViewArtist(); 20 | 21 | const SkPaint& paint() const { return fPaint; } 22 | SkPaint& paint() { return fPaint; } 23 | 24 | protected: 25 | // overrides 26 | virtual void onDraw(SkView*, SkCanvas*); 27 | virtual void onInflate(const SkDOM&, const SkDOM::Node*); 28 | 29 | private: 30 | SkPaint fPaint; 31 | }; 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /include/views/SkBorderView.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkBorderView_DEFINED 11 | #define SkBorderView_DEFINED 12 | 13 | #include "SkView.h" 14 | #include "SkWidgetViews.h" 15 | #include "SkAnimator.h" 16 | 17 | class SkBorderView : public SkWidgetView { 18 | public: 19 | SkBorderView(); 20 | ~SkBorderView(); 21 | void setSkin(const char skin[]); 22 | SkScalar getLeft() const { return fLeft; } 23 | SkScalar getRight() const { return fRight; } 24 | SkScalar getTop() const { return fTop; } 25 | SkScalar getBottom() const { return fBottom; } 26 | protected: 27 | //overrides 28 | virtual void onInflate(const SkDOM& dom, const SkDOM::Node* node); 29 | virtual void onSizeChange(); 30 | virtual void onDraw(SkCanvas* canvas); 31 | virtual bool onEvent(const SkEvent& evt); 32 | private: 33 | SkAnimator fAnim; 34 | SkScalar fLeft, fRight, fTop, fBottom; //margin on each side 35 | SkRect fMargin; 36 | 37 | typedef SkWidgetView INHERITED; 38 | }; 39 | 40 | #endif 41 | 42 | -------------------------------------------------------------------------------- /include/views/SkOSWindow_Android.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Skia 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkOSWindow_Android_DEFINED 11 | #define SkOSWindow_Android_DEFINED 12 | 13 | #include "SkWindow.h" 14 | 15 | class SkIRect; 16 | 17 | class SkOSWindow : public SkWindow { 18 | public: 19 | SkOSWindow(void*) {} 20 | ~SkOSWindow() {} 21 | 22 | enum SkBackEndTypes { 23 | kNone_BackEndType, 24 | kNativeGL_BackEndType, 25 | }; 26 | 27 | bool attach(SkBackEndTypes /* attachType */, int /* msaaSampleCount */) { 28 | return true; 29 | } 30 | void detach() {} 31 | void present() {} 32 | 33 | virtual void onPDFSaved(const char title[], const char desc[], 34 | const char path[]); 35 | 36 | protected: 37 | // overrides from SkWindow 38 | virtual void onHandleInval(const SkIRect&); 39 | virtual void onSetTitle(const char title[]); 40 | 41 | private: 42 | typedef SkWindow INHERITED; 43 | }; 44 | 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /include/views/SkOSWindow_SDL.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkOSWindow_SDL_DEFINED 11 | #define SkOSWindow_SDL_DEFINED 12 | 13 | #include "SDL.h" 14 | #include "SkWindow.h" 15 | 16 | class SkGLCanvas; 17 | 18 | class SkOSWindow : public SkWindow { 19 | public: 20 | SkOSWindow(void* screen); 21 | virtual ~SkOSWindow(); 22 | 23 | static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay); 24 | 25 | void handleSDLEvent(const SDL_Event& event); 26 | 27 | protected: 28 | // overrides from SkWindow 29 | virtual void onHandleInval(const SkIRect&); 30 | // overrides from SkView 31 | virtual void onAddMenu(const SkOSMenu*); 32 | virtual void onSetTitle(const char[]); 33 | 34 | private: 35 | SDL_Surface* fScreen; 36 | SDL_Surface* fSurface; 37 | SkGLCanvas* fGLCanvas; 38 | 39 | void doDraw(); 40 | 41 | typedef SkWindow INHERITED; 42 | }; 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /include/views/SkOSWindow_wxwidgets.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 The Android Open Source Project 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkOSWindow_wxwidgets_DEFINED 9 | #define SkOSWindow_wxwidgets_DEFINED 10 | 11 | #include "SkWindow.h" 12 | #include "wx/frame.h" 13 | 14 | class SkOSWindow: public SkWindow 15 | { 16 | public: 17 | SkOSWindow(); 18 | SkOSWindow(const wxString& title, int x, int y, int width, int height); 19 | ~SkOSWindow(); 20 | 21 | wxFrame* getWXFrame() const { return fFrame; } 22 | 23 | void updateSize(); 24 | 25 | protected: 26 | virtual void onHandleInval(const SkIRect&); 27 | virtual void onAddMenu(const SkOSMenu*); 28 | 29 | private: 30 | wxFrame* fFrame; 31 | typedef SkWindow INHERITED; 32 | 33 | }; 34 | 35 | #endifpedef SkWindow INHERITED; 36 | -------------------------------------------------------------------------------- /include/views/SkScrollBarView.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkScrollBarView_DEFINED 11 | #define SkScrollBarView_DEFINED 12 | 13 | #include "SkView.h" 14 | #include "SkWidgetViews.h" 15 | #include "SkAnimator.h" 16 | 17 | class SkScrollBarView : public SkWidgetView { 18 | public: 19 | SkScrollBarView(); 20 | 21 | unsigned getStart() const { return fStartPoint; } 22 | unsigned getShown() const { return fShownLength; } 23 | unsigned getTotal() const { return fTotalLength; } 24 | 25 | void setStart(unsigned start); 26 | void setShown(unsigned shown); 27 | void setTotal(unsigned total); 28 | 29 | protected: 30 | //overrides 31 | virtual void onInflate(const SkDOM& dom, const SkDOM::Node* node); 32 | virtual void onSizeChange(); 33 | virtual void onDraw(SkCanvas* canvas); 34 | virtual bool onEvent(const SkEvent& evt); 35 | 36 | private: 37 | SkAnimator fAnim; 38 | unsigned fTotalLength, fStartPoint, fShownLength; 39 | 40 | void adjust(); 41 | 42 | typedef SkWidgetView INHERITED; 43 | }; 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /include/views/SkSystemEventTypes.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSystemEventTypes_DEFINED 11 | #define SkSystemEventTypes_DEFINED 12 | 13 | /* 14 | The goal of these strings is two-fold: 15 | 1) make funny strings (containing at least one char < 32) to avoid colliding with "user" strings 16 | 2) keep them <= 4 bytes, so we can avoid an allocation in SkEvent::setType() 17 | */ 18 | #define SK_EventType_Delay "\xd" "lay" 19 | #define SK_EventType_Inval "nv" "\xa" "l" 20 | #define SK_EventType_Key "key" "\x1" 21 | #define SK_EventType_OnEnd "on" "\xe" "n" 22 | #define SK_EventType_Unichar "\xc" "har" 23 | #define SK_EventType_KeyUp "key" "\xf" 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /include/views/android/AndroidKeyToSkKey.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Skia 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef _ANDROID_TO_SKIA_KEYCODES_H 11 | #define _ANDROID_TO_SKIA_KEYCODES_H 12 | 13 | #include "android/keycodes.h" 14 | #include "SkKey.h" 15 | 16 | // Convert an Android keycode to an SkKey. This is an incomplete list, only 17 | // including keys used by the sample app. 18 | SkKey AndroidKeycodeToSkKey(int keycode) { 19 | switch (keycode) { 20 | case AKEYCODE_DPAD_LEFT: 21 | return kLeft_SkKey; 22 | case AKEYCODE_DPAD_RIGHT: 23 | return kRight_SkKey; 24 | case AKEYCODE_DPAD_UP: 25 | return kUp_SkKey; 26 | case AKEYCODE_DPAD_DOWN: 27 | return kDown_SkKey; 28 | case AKEYCODE_BACK: 29 | return kBack_SkKey; 30 | default: 31 | return kNONE_SkKey; 32 | } 33 | } 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /include/views/unix/XkeysToSkKeys.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | #include "X11/Xlib.h" 9 | #include "X11/keysym.h" 10 | 11 | #include "SkKey.h" 12 | 13 | #ifndef XKEYS_TOSKKEYS_H 14 | #define XKEYS_TOSKKEYS_H 15 | 16 | SkKey XKeyToSkKey(KeySym keysym) { 17 | switch (keysym) { 18 | case XK_BackSpace: 19 | return kBack_SkKey; 20 | case XK_Return: 21 | return kOK_SkKey; 22 | case XK_Home: 23 | return kHome_SkKey; 24 | case XK_End: 25 | return kEnd_SkKey; 26 | case XK_Right: 27 | return kRight_SkKey; 28 | case XK_Left: 29 | return kLeft_SkKey; 30 | case XK_Down: 31 | return kDown_SkKey; 32 | case XK_Up: 33 | return kUp_SkKey; 34 | default: 35 | return kNONE_SkKey; 36 | } 37 | } 38 | #endif 39 | -------------------------------------------------------------------------------- /include/views/unix/keysym2ucs.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | /* 9 | * This module converts keysym values into the corresponding ISO 10646-1 10 | * (UCS, Unicode) values. 11 | */ 12 | 13 | #include 14 | 15 | long keysym2ucs(KeySym keysym); 16 | -------------------------------------------------------------------------------- /include/xml/SkBML_XMLParser.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkBML_XMLParser_DEFINED 11 | #define SkBML_XMLParser_DEFINED 12 | 13 | class SkStream; 14 | class SkWStream; 15 | class SkXMLParser; 16 | class SkXMLWriter; 17 | 18 | class BML_XMLParser { 19 | public: 20 | /** Read the byte XML stream and write the decompressed XML. 21 | */ 22 | static void Read(SkStream& s, SkXMLWriter& writer); 23 | /** Read the byte XML stream and write the decompressed XML into a writable stream. 24 | */ 25 | static void Read(SkStream& s, SkWStream& output); 26 | /** Read the byte XML stream and write the decompressed XML into an XML parser. 27 | */ 28 | static void Read(SkStream& s, SkXMLParser& output); 29 | }; 30 | 31 | #endif // SkBML_XMLParser_DEFINED 32 | 33 | -------------------------------------------------------------------------------- /include/xml/SkJS.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkTypes.h" 11 | #include "SkWindow.h" 12 | 13 | extern "C" { 14 | typedef long JSWord; 15 | typedef JSWord jsword; 16 | typedef jsword jsval; 17 | typedef struct JSRuntime JSRuntime; 18 | typedef struct JSContext JSContext; 19 | typedef struct JSObject JSObject; 20 | } 21 | 22 | class SkString; 23 | 24 | class SkJS : public SkOSWindow { 25 | public: 26 | SkJS(void* hwnd); 27 | ~SkJS(); 28 | SkBool EvaluateScript(const char* script, jsval* rVal); 29 | SkBool ValueToString(jsval value, SkString* string); 30 | #ifdef SK_DEBUG 31 | static void Test(void* hwnd); 32 | #endif 33 | protected: 34 | void InitializeDisplayables(const SkBitmap& , JSContext *, JSObject *, JSObject *); 35 | void DisposeDisplayables(); 36 | JSRuntime *fRuntime; 37 | JSContext *fContext; 38 | JSObject *fGlobal; 39 | }; 40 | 41 | -------------------------------------------------------------------------------- /src/animator/SkAnimate.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkAnimate_DEFINED 11 | #define SkAnimate_DEFINED 12 | 13 | #include "SkAnimateBase.h" 14 | #include "SkDisplayType.h" 15 | #include "SkIntArray.h" 16 | #include "SkUtils.h" 17 | 18 | class SkAnimate : public SkAnimateBase { 19 | DECLARE_MEMBER_INFO(Animate); 20 | SkAnimate(); 21 | virtual ~SkAnimate(); 22 | virtual int components(); 23 | #ifdef SK_DUMP_ENABLED 24 | virtual void dump(SkAnimateMaker* ); 25 | #endif 26 | virtual void onEndElement(SkAnimateMaker& maker); 27 | protected: 28 | bool resolveCommon(SkAnimateMaker& ); 29 | int fComponents; 30 | private: 31 | typedef SkAnimateBase INHERITED; 32 | }; 33 | 34 | #endif // SkAnimateField_DEFINED 35 | 36 | -------------------------------------------------------------------------------- /src/animator/SkAnimate3DSchema.xsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/animator/SkAnimateProperties.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkAnimateProperties_DEFINED 11 | #define SkAnimateProperties_DEFINED 12 | 13 | enum SkAnimateBase_Properties { 14 | SK_PROPERTY(dynamic), 15 | SK_PROPERTY(mirror), 16 | SK_PROPERTY(reset), 17 | SK_PROPERTY(step), 18 | SK_PROPERTY(values) 19 | }; 20 | 21 | #endif // SkAnimateProperties_DEFINED 22 | -------------------------------------------------------------------------------- /src/animator/SkAnimateSchema.xsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/animator/SkAnimateSet.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkAnimateSet_DEFINED 11 | #define SkAnimateSet_DEFINED 12 | 13 | #include "SkAnimate.h" 14 | 15 | class SkSet : public SkAnimate { 16 | DECLARE_MEMBER_INFO(Set); 17 | SkSet(); 18 | #ifdef SK_DUMP_ENABLED 19 | virtual void dump(SkAnimateMaker* ); 20 | #endif 21 | virtual void onEndElement(SkAnimateMaker& ); 22 | virtual void refresh(SkAnimateMaker& ); 23 | private: 24 | typedef SkAnimate INHERITED; 25 | }; 26 | 27 | #endif // SkAnimateSet_DEFINED 28 | 29 | -------------------------------------------------------------------------------- /src/animator/SkBoundable.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkBoundable_DEFINED 11 | #define SkBoundable_DEFINED 12 | 13 | #include "SkDrawable.h" 14 | #include "SkRect.h" 15 | 16 | class SkBoundable : public SkDrawable { 17 | public: 18 | SkBoundable(); 19 | virtual void clearBounder(); 20 | virtual void enableBounder(); 21 | virtual void getBounds(SkRect* ); 22 | bool hasBounds() { return fBounds.fLeft != (int16_t)0x8000U; } 23 | void setBounds(SkIRect& bounds) { fBounds = bounds; } 24 | protected: 25 | void clearBounds() { fBounds.fLeft = (int16_t) SkToU16(0x8000); }; // mark bounds as unset 26 | SkIRect fBounds; 27 | private: 28 | typedef SkDrawable INHERITED; 29 | }; 30 | 31 | class SkBoundableAuto { 32 | public: 33 | SkBoundableAuto(SkBoundable* boundable, SkAnimateMaker& maker); 34 | ~SkBoundableAuto(); 35 | private: 36 | SkBoundable* fBoundable; 37 | SkAnimateMaker& fMaker; 38 | SkBoundableAuto& operator= (const SkBoundableAuto& ); 39 | }; 40 | 41 | #endif // SkBoundable_DEFINED 42 | 43 | -------------------------------------------------------------------------------- /src/animator/SkDisplayBounds.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkDisplayBounds.h" 11 | #include "SkAnimateMaker.h" 12 | 13 | #if SK_USE_CONDENSED_INFO == 0 14 | 15 | const SkMemberInfo SkDisplayBounds::fInfo[] = { 16 | SK_MEMBER_INHERITED, 17 | SK_MEMBER(inval, Boolean) 18 | }; 19 | 20 | #endif 21 | 22 | DEFINE_GET_MEMBER(SkDisplayBounds); 23 | 24 | SkDisplayBounds::SkDisplayBounds() : inval(false) { 25 | } 26 | 27 | bool SkDisplayBounds::draw(SkAnimateMaker& maker) { 28 | maker.fDisplayList.fUnionBounds = SkToBool(inval); 29 | maker.fDisplayList.fDrawBounds = false; 30 | fBounds.setEmpty(); 31 | bool result = INHERITED::draw(maker); 32 | maker.fDisplayList.fUnionBounds = false; 33 | maker.fDisplayList.fDrawBounds = true; 34 | if (inval && fBounds.isEmpty() == false) { 35 | SkIRect& rect = maker.fDisplayList.fInvalBounds; 36 | maker.fDisplayList.fHasUnion = true; 37 | if (rect.isEmpty()) 38 | rect = fBounds; 39 | else 40 | rect.join(fBounds); 41 | } 42 | return result; 43 | } 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/animator/SkDisplayBounds.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkDisplayBounds_DEFINED 11 | #define SkDisplayBounds_DEFINED 12 | 13 | #include "SkDrawRectangle.h" 14 | 15 | class SkDisplayBounds : public SkDrawRect { 16 | DECLARE_DISPLAY_MEMBER_INFO(Bounds); 17 | SkDisplayBounds(); 18 | virtual bool draw(SkAnimateMaker& ); 19 | private: 20 | SkBool inval; 21 | typedef SkDrawRect INHERITED; 22 | }; 23 | 24 | #endif // SkDisplayBounds_DEFINED 25 | 26 | -------------------------------------------------------------------------------- /src/animator/SkDisplayEvents.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkDisplayEvents_DEFINED 11 | #define SkDisplayEvents_DEFINED 12 | 13 | #include "SkEvent.h" 14 | #include "SkDisplayEvent.h" 15 | 16 | struct SkEventState { 17 | SkEventState(); 18 | int fCode; 19 | SkBool fDisable; 20 | SkDisplayable* fDisplayable; 21 | SkScalar fX; 22 | SkScalar fY; 23 | }; 24 | 25 | class SkEvents { 26 | public: 27 | SkEvents(); 28 | ~SkEvents(); 29 | void addEvent(SkDisplayEvent* evt) { *fEvents.append() = evt; } 30 | bool doEvent(SkAnimateMaker& , SkDisplayEvent::Kind , SkEventState* ); 31 | #ifdef SK_DUMP_ENABLED 32 | void dump(SkAnimateMaker& ); 33 | #endif 34 | void reset() { fEvents.reset(); } 35 | void removeEvent(SkDisplayEvent::Kind kind, SkEventState* ); 36 | private: 37 | SkTDDisplayEventArray fEvents; 38 | SkBool fError; 39 | friend class SkDisplayXMLParser; 40 | }; 41 | 42 | #endif // SkDisplayEvents_DEFINED 43 | 44 | -------------------------------------------------------------------------------- /src/animator/SkDisplayInclude.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkDisplayInclude_DEFINED 11 | #define SkDisplayInclude_DEFINED 12 | 13 | #include "SkDisplayable.h" 14 | #include "SkMemberInfo.h" 15 | 16 | class SkInclude : public SkDisplayable { 17 | DECLARE_MEMBER_INFO(Include); 18 | virtual void onEndElement(SkAnimateMaker & ); 19 | virtual bool enable(SkAnimateMaker & ); 20 | virtual bool hasEnable() const; 21 | protected: 22 | SkString src; 23 | }; 24 | 25 | #endif // SkDisplayInclude_DEFINED 26 | 27 | -------------------------------------------------------------------------------- /src/animator/SkDisplayInput.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkDisplayInput_DEFINED 11 | #define SkDisplayInput_DEFINED 12 | 13 | #include "SkDisplayable.h" 14 | #include "SkMemberInfo.h" 15 | 16 | class SkInput : public SkDisplayable { 17 | DECLARE_MEMBER_INFO(Input); 18 | SkInput(); 19 | virtual SkDisplayable* contains(const SkString& ); 20 | virtual bool getProperty(int index, SkScriptValue* value) const; 21 | virtual bool enable(SkAnimateMaker & ); 22 | virtual bool hasEnable() const; 23 | protected: 24 | SkString name; 25 | int32_t fInt; 26 | SkScalar fFloat; 27 | SkString string; 28 | private: 29 | friend class SkDisplayEvent; 30 | friend class SkPost; 31 | }; 32 | 33 | #endif // SkDisplayInput_DEFINED 34 | 35 | -------------------------------------------------------------------------------- /src/animator/SkDisplayMath.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkDisplayMath_DEFINED 11 | #define SkDisplayMath_DEFINED 12 | 13 | #include "SkDisplayable.h" 14 | #include "SkMemberInfo.h" 15 | #include "SkRandom.h" 16 | 17 | class SkDisplayMath : public SkDisplayable { 18 | DECLARE_DISPLAY_MEMBER_INFO(Math); 19 | virtual void executeFunction(SkDisplayable* , int index, 20 | SkTDArray& parameters, SkDisplayTypes type, 21 | SkScriptValue* ); 22 | virtual const SkFunctionParamType* getFunctionsParameters(); 23 | virtual bool getProperty(int index, SkScriptValue* value) const; 24 | private: 25 | mutable SkRandom fRandom; 26 | static const SkScalar gConstants[]; 27 | static const SkFunctionParamType fFunctionParameters[]; 28 | 29 | }; 30 | 31 | #endif // SkDisplayMath_DEFINED 32 | 33 | -------------------------------------------------------------------------------- /src/animator/SkDisplayNumber.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkDisplayNumber_DEFINED 11 | #define SkDisplayNumber_DEFINED 12 | 13 | #include "SkDisplayable.h" 14 | #include "SkMemberInfo.h" 15 | 16 | class SkDisplayNumber : public SkDisplayable { 17 | DECLARE_DISPLAY_MEMBER_INFO(Number); 18 | virtual bool getProperty(int index, SkScriptValue* value) const; 19 | private: 20 | }; 21 | 22 | #endif // SkDisplayNumber_DEFINED 23 | -------------------------------------------------------------------------------- /src/animator/SkDisplayRandom.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkDisplayRandom_DEFINED 11 | #define SkDisplayRandom_DEFINED 12 | 13 | #include "SkDisplayable.h" 14 | #include "SkMemberInfo.h" 15 | #include "SkRandom.h" 16 | 17 | #ifdef min 18 | #undef min 19 | #endif 20 | 21 | #ifdef max 22 | #undef max 23 | #endif 24 | 25 | class SkDisplayRandom : public SkDisplayable { 26 | DECLARE_DISPLAY_MEMBER_INFO(Random); 27 | SkDisplayRandom(); 28 | #ifdef SK_DUMP_ENABLED 29 | virtual void dump(SkAnimateMaker* ); 30 | #endif 31 | virtual bool getProperty(int index, SkScriptValue* value) const; 32 | virtual bool setProperty(int index, SkScriptValue& ); 33 | private: 34 | SkScalar blend; 35 | SkScalar min; 36 | SkScalar max; 37 | mutable SkRandom fRandom; 38 | }; 39 | 40 | #endif // SkDisplayRandom_DEFINED 41 | 42 | -------------------------------------------------------------------------------- /src/animator/SkDisplayScreenplay.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkDisplayScreenplay.h" 11 | 12 | #if SK_USE_CONDENSED_INFO == 0 13 | 14 | const SkMemberInfo SkDisplayScreenplay::fInfo[] = { 15 | SK_MEMBER(time, MSec) 16 | }; 17 | 18 | #endif 19 | 20 | DEFINE_GET_MEMBER(SkDisplayScreenplay); 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/animator/SkDisplayScreenplay.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkDisplayScreenplay_DEFINED 11 | #define SkDisplayScreenplay_DEFINED 12 | 13 | #include "SkDisplayable.h" 14 | #include "SkMemberInfo.h" 15 | 16 | class SkDisplayScreenplay : public SkDisplayable { 17 | DECLARE_DISPLAY_MEMBER_INFO(Screenplay); 18 | SkMSec time; 19 | }; 20 | 21 | #endif // SkDisplayScreenplay_DEFINED 22 | -------------------------------------------------------------------------------- /src/animator/SkDrawBlur.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkDrawBlur.h" 11 | 12 | #if SK_USE_CONDENSED_INFO == 0 13 | 14 | const SkMemberInfo SkDrawBlur::fInfo[] = { 15 | SK_MEMBER(blurStyle, MaskFilterBlurStyle), 16 | SK_MEMBER(radius, Float) 17 | }; 18 | 19 | #endif 20 | 21 | DEFINE_GET_MEMBER(SkDrawBlur); 22 | 23 | SkDrawBlur::SkDrawBlur() : radius(-1), 24 | blurStyle(SkBlurMaskFilter::kNormal_BlurStyle) { 25 | } 26 | 27 | SkMaskFilter* SkDrawBlur::getMaskFilter() { 28 | if (radius < 0) 29 | return NULL; 30 | return SkBlurMaskFilter::Create(radius, (SkBlurMaskFilter::BlurStyle) blurStyle); 31 | } 32 | 33 | -------------------------------------------------------------------------------- /src/animator/SkDrawBlur.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkDrawBlur_DEFINED 11 | #define SkDrawBlur_DEFINED 12 | 13 | #include "SkPaintParts.h" 14 | #include "SkBlurMaskFilter.h" 15 | 16 | class SkDrawBlur : public SkDrawMaskFilter { 17 | DECLARE_DRAW_MEMBER_INFO(Blur); 18 | SkDrawBlur(); 19 | virtual SkMaskFilter* getMaskFilter(); 20 | protected: 21 | SkScalar radius; 22 | int /*SkBlurMaskFilter::BlurStyle*/ blurStyle; 23 | }; 24 | 25 | #endif // SkDrawBlur_DEFINED 26 | 27 | -------------------------------------------------------------------------------- /src/animator/SkDrawClip.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkDrawClip.h" 11 | #include "SkAnimateMaker.h" 12 | #include "SkCanvas.h" 13 | #include "SkDrawRectangle.h" 14 | #include "SkDrawPath.h" 15 | 16 | 17 | #if SK_USE_CONDENSED_INFO == 0 18 | 19 | const SkMemberInfo SkDrawClip::fInfo[] = { 20 | SK_MEMBER(path, Path), 21 | SK_MEMBER(rect, Rect) 22 | }; 23 | 24 | #endif 25 | 26 | DEFINE_GET_MEMBER(SkDrawClip); 27 | 28 | SkDrawClip::SkDrawClip() : rect(NULL), path(NULL) { 29 | } 30 | 31 | bool SkDrawClip::draw(SkAnimateMaker& maker ) { 32 | if (rect != NULL) 33 | maker.fCanvas->clipRect(rect->fRect); 34 | else { 35 | SkASSERT(path != NULL); 36 | maker.fCanvas->clipPath(path->fPath); 37 | } 38 | return false; 39 | } 40 | 41 | -------------------------------------------------------------------------------- /src/animator/SkDrawClip.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkDrawClip_DEFINED 11 | #define SkDrawClip_DEFINED 12 | 13 | #include "SkDrawable.h" 14 | #include "SkMemberInfo.h" 15 | #include "SkRegion.h" 16 | 17 | class SkDrawPath; 18 | class SkDrawRect; 19 | 20 | class SkDrawClip : public SkDrawable { 21 | DECLARE_DRAW_MEMBER_INFO(Clip); 22 | SkDrawClip(); 23 | virtual bool draw(SkAnimateMaker& ); 24 | private: 25 | SkDrawRect* rect; 26 | SkDrawPath* path; 27 | }; 28 | 29 | #endif // SkDrawClip_DEFINED 30 | -------------------------------------------------------------------------------- /src/animator/SkDrawColor.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkDrawColor_DEFINED 11 | #define SkDrawColor_DEFINED 12 | 13 | #include "SkPaintParts.h" 14 | #include "SkColor.h" 15 | 16 | class SkDrawColor : public SkPaintPart { 17 | DECLARE_DRAW_MEMBER_INFO(Color); 18 | SkDrawColor(); 19 | virtual bool add(); 20 | virtual void dirty(); 21 | #ifdef SK_DUMP_ENABLED 22 | virtual void dump(SkAnimateMaker* ); 23 | #endif 24 | SkColor getColor(); 25 | virtual SkDisplayable* deepCopy(SkAnimateMaker* ); 26 | virtual SkDisplayable* getParent() const; 27 | virtual bool getProperty(int index, SkScriptValue* value) const; 28 | virtual void onEndElement(SkAnimateMaker& ); 29 | virtual bool setParent(SkDisplayable* parent); 30 | virtual bool setProperty(int index, SkScriptValue&); 31 | protected: 32 | SkColor color; 33 | SkScalar fHue; 34 | SkScalar fSaturation; 35 | SkScalar fValue; 36 | SkBool fDirty; 37 | private: 38 | friend class SkGradient; 39 | typedef SkPaintPart INHERITED; 40 | }; 41 | 42 | #endif // SkDrawColor_DEFINED 43 | -------------------------------------------------------------------------------- /src/animator/SkDrawDash.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkDrawDash.h" 11 | #include "SkDashPathEffect.h" 12 | 13 | #if SK_USE_CONDENSED_INFO == 0 14 | 15 | const SkMemberInfo SkDash::fInfo[] = { 16 | SK_MEMBER_ARRAY(intervals, Float), 17 | SK_MEMBER(phase, Float) 18 | }; 19 | 20 | #endif 21 | 22 | DEFINE_GET_MEMBER(SkDash); 23 | 24 | SkDash::SkDash() : phase(0) { 25 | } 26 | 27 | SkDash::~SkDash() { 28 | } 29 | 30 | SkPathEffect* SkDash::getPathEffect() { 31 | int count = intervals.count(); 32 | if (count == 0) 33 | return NULL; 34 | return new SkDashPathEffect(intervals.begin(), count, phase); 35 | } 36 | 37 | -------------------------------------------------------------------------------- /src/animator/SkDrawDash.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkDrawDash_DEFINED 11 | #define SkDrawDash_DEFINED 12 | 13 | #include "SkPaintParts.h" 14 | #include "SkIntArray.h" 15 | 16 | class SkDash : public SkDrawPathEffect { 17 | DECLARE_MEMBER_INFO(Dash); 18 | SkDash(); 19 | virtual ~SkDash(); 20 | virtual SkPathEffect* getPathEffect(); 21 | private: 22 | SkTDScalarArray intervals; 23 | SkScalar phase; 24 | }; 25 | 26 | #endif // SkDrawDash_DEFINED 27 | 28 | -------------------------------------------------------------------------------- /src/animator/SkDrawDiscrete.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkDrawDiscrete.h" 11 | #include "SkAnimateMaker.h" 12 | #include "SkPaint.h" 13 | #include "SkDiscretePathEffect.h" 14 | 15 | #if SK_USE_CONDENSED_INFO == 0 16 | 17 | const SkMemberInfo SkDiscrete::fInfo[] = { 18 | SK_MEMBER(deviation, Float), 19 | SK_MEMBER(segLength, Float) 20 | }; 21 | 22 | #endif 23 | 24 | DEFINE_GET_MEMBER(SkDiscrete); 25 | 26 | SkDiscrete::SkDiscrete() : deviation(0), segLength(0) { 27 | } 28 | 29 | SkPathEffect* SkDiscrete::getPathEffect() { 30 | if (deviation <= 0 || segLength <= 0) 31 | return NULL; 32 | else 33 | return new SkDiscretePathEffect(segLength, deviation); 34 | } 35 | 36 | -------------------------------------------------------------------------------- /src/animator/SkDrawDiscrete.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkDrawDiscrete_DEFINED 11 | #define SkDrawDiscrete_DEFINED 12 | 13 | #include "SkPaintParts.h" 14 | 15 | class SkDiscrete : public SkDrawPathEffect { 16 | DECLARE_MEMBER_INFO(Discrete); 17 | SkDiscrete(); 18 | virtual SkPathEffect* getPathEffect(); 19 | private: 20 | SkScalar deviation; 21 | SkScalar segLength; 22 | }; 23 | 24 | #endif //SkDrawDiscrete_DEFINED 25 | -------------------------------------------------------------------------------- /src/animator/SkDrawEmboss.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkDrawEmboss.h" 11 | 12 | #if SK_USE_CONDENSED_INFO == 0 13 | 14 | const SkMemberInfo SkDrawEmboss::fInfo[] = { 15 | SK_MEMBER(ambient, Float), 16 | SK_MEMBER_ARRAY(direction, Float), 17 | SK_MEMBER(radius, Float), 18 | SK_MEMBER(specular, Float) 19 | }; 20 | 21 | #endif 22 | 23 | DEFINE_GET_MEMBER(SkDrawEmboss); 24 | 25 | SkDrawEmboss::SkDrawEmboss() : radius(-1) { 26 | direction.setCount(3); 27 | } 28 | 29 | SkMaskFilter* SkDrawEmboss::getMaskFilter() { 30 | if (radius < 0 || direction.count() !=3) 31 | return NULL; 32 | return SkBlurMaskFilter::CreateEmboss(direction.begin(), ambient, specular, radius); 33 | } 34 | 35 | -------------------------------------------------------------------------------- /src/animator/SkDrawEmboss.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkDrawEmboss_DEFINED 11 | #define SkDrawEmboss_DEFINED 12 | 13 | #include "SkDrawBlur.h" 14 | 15 | class SkDrawEmboss : public SkDrawMaskFilter { 16 | DECLARE_DRAW_MEMBER_INFO(Emboss); 17 | SkDrawEmboss(); 18 | virtual SkMaskFilter* getMaskFilter(); 19 | protected: 20 | SkTDScalarArray direction; 21 | SkScalar radius, ambient, specular; 22 | }; 23 | 24 | #endif // SkDrawEmboss_DEFINED 25 | 26 | -------------------------------------------------------------------------------- /src/animator/SkDrawFull.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkDrawFull.h" 11 | #include "SkAnimateMaker.h" 12 | #include "SkCanvas.h" 13 | 14 | bool SkFull::draw(SkAnimateMaker& maker) { 15 | SkBoundableAuto boundable(this, maker); 16 | maker.fCanvas->drawPaint(*maker.fPaint); 17 | return false; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /src/animator/SkDrawFull.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkDrawFull_DEFINED 11 | #define SkDrawFull_DEFINED 12 | 13 | #include "SkBoundable.h" 14 | 15 | class SkFull : public SkBoundable { 16 | DECLARE_EMPTY_MEMBER_INFO(Full); 17 | virtual bool draw(SkAnimateMaker& ); 18 | private: 19 | typedef SkBoundable INHERITED; 20 | }; 21 | 22 | #endif // SkDrawFull_DEFINED 23 | -------------------------------------------------------------------------------- /src/animator/SkDrawLine.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkDrawLine.h" 11 | #include "SkAnimateMaker.h" 12 | #include "SkCanvas.h" 13 | #include "SkPaint.h" 14 | 15 | #if SK_USE_CONDENSED_INFO == 0 16 | 17 | const SkMemberInfo SkLine::fInfo[] = { 18 | SK_MEMBER(x1, Float), 19 | SK_MEMBER(x2, Float), 20 | SK_MEMBER(y1, Float), 21 | SK_MEMBER(y2, Float) 22 | }; 23 | 24 | #endif 25 | 26 | DEFINE_GET_MEMBER(SkLine); 27 | 28 | SkLine::SkLine() : x1(0), x2(0), y1(0), y2(0) { 29 | } 30 | 31 | bool SkLine::draw(SkAnimateMaker& maker) { 32 | SkBoundableAuto boundable(this, maker); 33 | maker.fCanvas->drawLine(x1, y1, x2, y2, *maker.fPaint); 34 | return false; 35 | } 36 | -------------------------------------------------------------------------------- /src/animator/SkDrawLine.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkDrawLine_DEFINED 11 | #define SkDrawLine_DEFINED 12 | 13 | #include "SkBoundable.h" 14 | #include "SkMemberInfo.h" 15 | 16 | class SkLine : public SkBoundable { 17 | DECLARE_MEMBER_INFO(Line); 18 | SkLine(); 19 | virtual bool draw(SkAnimateMaker& ); 20 | private: 21 | SkScalar x1; 22 | SkScalar x2; 23 | SkScalar y1; 24 | SkScalar y2; 25 | typedef SkBoundable INHERITED; 26 | }; 27 | 28 | #endif // SkDrawLine_DEFINED 29 | 30 | -------------------------------------------------------------------------------- /src/animator/SkDrawOval.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkDrawOval.h" 11 | #include "SkAnimateMaker.h" 12 | #include "SkCanvas.h" 13 | 14 | #if SK_USE_CONDENSED_INFO == 0 15 | 16 | const SkMemberInfo SkOval::fInfo[] = { 17 | SK_MEMBER_INHERITED, 18 | }; 19 | 20 | #endif 21 | 22 | DEFINE_GET_MEMBER(SkOval); 23 | 24 | bool SkOval::draw(SkAnimateMaker& maker) { 25 | SkBoundableAuto boundable(this, maker); 26 | maker.fCanvas->drawOval(fRect, *maker.fPaint); 27 | return false; 28 | } 29 | 30 | -------------------------------------------------------------------------------- /src/animator/SkDrawOval.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkDrawOval_DEFINED 11 | #define SkDrawOval_DEFINED 12 | 13 | #include "SkDrawRectangle.h" 14 | 15 | class SkOval : public SkDrawRect { 16 | DECLARE_MEMBER_INFO(Oval); 17 | virtual bool draw(SkAnimateMaker& ); 18 | private: 19 | typedef SkDrawRect INHERITED; 20 | }; 21 | 22 | #endif // SkDrawOval_DEFINED 23 | 24 | -------------------------------------------------------------------------------- /src/animator/SkDrawPoint.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkDrawPoint.h" 11 | #include "SkAnimateMaker.h" 12 | #include "SkCanvas.h" 13 | #include "SkPaint.h" 14 | 15 | #if SK_USE_CONDENSED_INFO == 0 16 | 17 | const SkMemberInfo Sk_Point::fInfo[] = { 18 | SK_MEMBER_ALIAS(x, fPoint.fX, Float), 19 | SK_MEMBER_ALIAS(y, fPoint.fY, Float) 20 | }; 21 | 22 | #endif 23 | 24 | DEFINE_NO_VIRTUALS_GET_MEMBER(Sk_Point); 25 | 26 | #if SK_USE_CONDENSED_INFO == 0 27 | 28 | const SkMemberInfo SkDrawPoint::fInfo[] = { 29 | SK_MEMBER_ALIAS(x, fPoint.fX, Float), 30 | SK_MEMBER_ALIAS(y, fPoint.fY, Float) 31 | }; 32 | 33 | #endif 34 | 35 | DEFINE_GET_MEMBER(SkDrawPoint); 36 | 37 | SkDrawPoint::SkDrawPoint() { 38 | fPoint.set(0, 0); 39 | } 40 | 41 | void SkDrawPoint::getBounds(SkRect* rect ) { 42 | rect->fLeft = rect->fRight = fPoint.fX; 43 | rect->fTop = rect->fBottom = fPoint.fY; 44 | } 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/animator/SkDrawPoint.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkDrawPoint_DEFINED 11 | #define SkDrawPoint_DEFINED 12 | 13 | #include "SkBoundable.h" 14 | #include "SkMemberInfo.h" 15 | #include "SkPoint.h" 16 | 17 | struct Sk_Point { 18 | DECLARE_NO_VIRTUALS_MEMBER_INFO(_Point); 19 | Sk_Point(); 20 | private: 21 | SkPoint fPoint; 22 | }; 23 | 24 | class SkDrawPoint : public SkDisplayable { 25 | DECLARE_MEMBER_INFO(DrawPoint); 26 | SkDrawPoint(); 27 | virtual void getBounds(SkRect* ); 28 | private: 29 | SkPoint fPoint; 30 | typedef SkDisplayable INHERITED; 31 | }; 32 | 33 | #endif // SkDrawPoint_DEFINED 34 | -------------------------------------------------------------------------------- /src/animator/SkDrawSaveLayer.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkDrawSaveLayer_DEFINED 11 | #define SkDrawSaveLayer_DEFINED 12 | 13 | #include "SkDrawGroup.h" 14 | #include "SkMemberInfo.h" 15 | 16 | class SkDrawPaint; 17 | class SkDrawRect; 18 | 19 | class SkSaveLayer : public SkGroup { 20 | DECLARE_MEMBER_INFO(SaveLayer); 21 | SkSaveLayer(); 22 | virtual ~SkSaveLayer(); 23 | virtual bool draw(SkAnimateMaker& ); 24 | #ifdef SK_DUMP_ENABLED 25 | virtual void dump(SkAnimateMaker* ); 26 | #endif 27 | virtual void onEndElement(SkAnimateMaker& ); 28 | protected: 29 | SkDrawPaint* paint; 30 | SkDrawRect* bounds; 31 | private: 32 | typedef SkGroup INHERITED; 33 | 34 | }; 35 | 36 | #endif //SkDrawSaveLayer_DEFINED 37 | -------------------------------------------------------------------------------- /src/animator/SkDrawShader.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkDrawShader_DEFINED 11 | #define SkDrawShader_DEFINED 12 | 13 | #include "SkPaintParts.h" 14 | #include "SkShader.h" 15 | 16 | class SkBaseBitmap; 17 | 18 | class SkDrawBitmapShader : public SkDrawShader { 19 | DECLARE_DRAW_MEMBER_INFO(BitmapShader); 20 | SkDrawBitmapShader(); 21 | virtual bool add(); 22 | virtual SkShader* getShader(); 23 | protected: 24 | SkBool filterBitmap; 25 | SkBaseBitmap* image; 26 | private: 27 | typedef SkDrawShader INHERITED; 28 | }; 29 | 30 | #endif // SkDrawShader_DEFINED 31 | -------------------------------------------------------------------------------- /src/animator/SkDrawText.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkDrawText_DEFINED 11 | #define SkDrawText_DEFINED 12 | 13 | #include "SkBoundable.h" 14 | #include "SkMemberInfo.h" 15 | 16 | class SkText : public SkBoundable { 17 | DECLARE_MEMBER_INFO(Text); 18 | SkText(); 19 | virtual ~SkText(); 20 | virtual bool draw(SkAnimateMaker& ); 21 | #ifdef SK_DUMP_ENABLED 22 | virtual void dump(SkAnimateMaker* ); 23 | #endif 24 | virtual bool getProperty(int index, SkScriptValue* value) const ; 25 | const char* getText() { return text.c_str(); } 26 | size_t getSize() { return text.size(); } 27 | protected: 28 | SkString text; 29 | SkScalar x; 30 | SkScalar y; 31 | private: 32 | friend class SkTextToPath; 33 | typedef SkBoundable INHERITED; 34 | }; 35 | 36 | #endif // SkDrawText_DEFINED 37 | -------------------------------------------------------------------------------- /src/animator/SkDrawTextBox.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkDrawTextBox_DEFINED 11 | #define SkDrawTextBox_DEFINED 12 | 13 | #include "SkDrawRectangle.h" 14 | #include "SkTextBox.h" 15 | 16 | class SkDrawTextBox : public SkDrawRect { 17 | DECLARE_DRAW_MEMBER_INFO(TextBox); 18 | SkDrawTextBox(); 19 | 20 | // overrides 21 | virtual bool draw(SkAnimateMaker& ); 22 | #ifdef SK_DUMP_ENABLED 23 | virtual void dump(SkAnimateMaker* ); 24 | #endif 25 | virtual bool getProperty(int index, SkScriptValue* value) const; 26 | virtual bool setProperty(int index, SkScriptValue& ); 27 | 28 | private: 29 | SkString fText; 30 | SkScalar fSpacingMul; 31 | SkScalar fSpacingAdd; 32 | int /*SkTextBox::Mode*/ mode; 33 | int /*SkTextBox::SpacingAlign*/ spacingAlign; 34 | 35 | typedef SkDrawRect INHERITED; 36 | }; 37 | 38 | #endif // SkDrawTextBox_DEFINED 39 | 40 | -------------------------------------------------------------------------------- /src/animator/SkDrawTo.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkDrawTo_DEFINED 11 | #define SkDrawTo_DEFINED 12 | 13 | #include "SkDrawGroup.h" 14 | #include "SkMemberInfo.h" 15 | 16 | class SkDrawBitmap; 17 | 18 | class SkDrawTo : public SkGroup { 19 | DECLARE_MEMBER_INFO(DrawTo); 20 | SkDrawTo(); 21 | // virtual ~SkDrawTo(); 22 | virtual bool draw(SkAnimateMaker& ); 23 | #ifdef SK_DUMP_ENABLED 24 | virtual void dump(SkAnimateMaker* ); 25 | #endif 26 | protected: 27 | SkBool drawOnce; 28 | SkDrawBitmap* use; 29 | private: 30 | typedef SkGroup INHERITED; 31 | SkBool fDrawnOnce; 32 | }; 33 | 34 | #endif // SkDrawTo_DEFINED 35 | -------------------------------------------------------------------------------- /src/animator/SkDrawTransparentShader.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkDrawTransparentShader.h" 11 | #include "SkTransparentShader.h" 12 | 13 | SkShader* SkDrawTransparentShader::getShader() { 14 | return new SkTransparentShader(); 15 | } 16 | 17 | -------------------------------------------------------------------------------- /src/animator/SkDrawTransparentShader.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkDrawTransparentShader_DEFINED 11 | #define SkDrawTransparentShader_DEFINED 12 | 13 | #include "SkPaintParts.h" 14 | 15 | class SkDrawTransparentShader : public SkDrawShader { 16 | DECLARE_EMPTY_MEMBER_INFO(TransparentShader); 17 | virtual SkShader* getShader(); 18 | }; 19 | 20 | #endif // SkDrawTransparentShader_DEFINED 21 | 22 | -------------------------------------------------------------------------------- /src/animator/SkDrawable.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkDrawable.h" 11 | 12 | bool SkDrawable::doEvent(SkDisplayEvent::Kind , SkEventState* ) { 13 | return false; 14 | } 15 | 16 | bool SkDrawable::isDrawable() const { 17 | return true; 18 | } 19 | 20 | void SkDrawable::initialize() { 21 | } 22 | 23 | void SkDrawable::setSteps(int steps) { 24 | } 25 | 26 | -------------------------------------------------------------------------------- /src/animator/SkDrawable.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkDrawable_DEFINED 11 | #define SkDrawable_DEFINED 12 | 13 | #include "SkDisplayable.h" 14 | #include "SkDisplayEvent.h" 15 | #include "SkMath.h" 16 | 17 | struct SkEventState; 18 | 19 | class SkDrawable : public SkDisplayable { 20 | public: 21 | virtual bool doEvent(SkDisplayEvent::Kind , SkEventState* state ); 22 | virtual bool draw(SkAnimateMaker& ) = 0; 23 | virtual void initialize(); 24 | virtual bool isDrawable() const; 25 | virtual void setSteps(int steps); 26 | }; 27 | 28 | #endif // SkDrawable_DEFINED 29 | -------------------------------------------------------------------------------- /src/animator/SkDump.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkDump_DEFINED 11 | #define SkDump_DEFINED 12 | 13 | #include "SkDisplayable.h" 14 | #include "SkMemberInfo.h" 15 | 16 | class SkAnimateMaker; 17 | class SkString; 18 | 19 | class SkDump : public SkDisplayable { 20 | DECLARE_MEMBER_INFO(Dump); 21 | #ifdef SK_DUMP_ENABLED 22 | SkDump(); 23 | virtual bool enable(SkAnimateMaker & ); 24 | bool evaluate(SkAnimateMaker &); 25 | virtual bool hasEnable() const; 26 | static void GetEnumString(SkDisplayTypes , int index, SkString* result); 27 | SkBool displayList; 28 | SkBool eventList; 29 | SkBool events; 30 | SkString name; 31 | SkBool groups; 32 | SkBool posts; 33 | SkString script; 34 | #else 35 | virtual bool enable(SkAnimateMaker & ); 36 | virtual bool hasEnable() const; 37 | virtual bool setProperty(int index, SkScriptValue& ); 38 | #endif 39 | }; 40 | 41 | 42 | #endif // SkDump_DEFINED 43 | 44 | -------------------------------------------------------------------------------- /src/animator/SkExtraPathEffects.xsd: -------------------------------------------------------------------------------- 1 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/animator/SkExtras.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkExtras_DEFINED 11 | #define SkExtras_DEFINED 12 | 13 | #include "SkScript.h" 14 | 15 | class SkExtras { 16 | public: 17 | SkExtras(); 18 | virtual ~SkExtras() {} 19 | 20 | virtual SkDisplayable* createInstance(SkDisplayTypes type) = 0; 21 | virtual bool definesType(SkDisplayTypes type) = 0; 22 | #if SK_USE_CONDENSED_INFO == 0 23 | virtual const SkMemberInfo* getMembers(SkDisplayTypes type, int* infoCountPtr) = 0; 24 | #endif 25 | #ifdef SK_DEBUG 26 | virtual const char* getName(SkDisplayTypes type) = 0; 27 | #endif 28 | virtual SkDisplayTypes getType(const char match[], size_t len ) = 0; 29 | 30 | SkScriptEngine::_propertyCallBack fExtraCallBack; 31 | void* fExtraStorage; 32 | }; 33 | 34 | #endif // SkExtras_DEFINED 35 | -------------------------------------------------------------------------------- /src/animator/SkHitClear.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkHitClear.h" 11 | 12 | #if SK_USE_CONDENSED_INFO == 0 13 | 14 | const SkMemberInfo SkHitClear::fInfo[] = { 15 | SK_MEMBER_ARRAY(targets, Displayable) 16 | }; 17 | 18 | #endif 19 | 20 | DEFINE_GET_MEMBER(SkHitClear); 21 | 22 | bool SkHitClear::enable(SkAnimateMaker& maker) { 23 | for (int tIndex = 0; tIndex < targets.count(); tIndex++) { 24 | SkDisplayable* target = targets[tIndex]; 25 | target->clearBounder(); 26 | } 27 | return true; 28 | } 29 | 30 | bool SkHitClear::hasEnable() const { 31 | return true; 32 | } 33 | 34 | -------------------------------------------------------------------------------- /src/animator/SkHitClear.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkHitClear_DEFINED 11 | #define SkHitClear_DEFINED 12 | 13 | #include "SkDisplayable.h" 14 | #include "SkMemberInfo.h" 15 | #include "SkTypedArray.h" 16 | 17 | class SkHitClear : public SkDisplayable { 18 | DECLARE_MEMBER_INFO(HitClear); 19 | virtual bool enable(SkAnimateMaker& ); 20 | virtual bool hasEnable() const; 21 | private: 22 | SkTDDisplayableArray targets; 23 | }; 24 | 25 | #endif // SkHitClear_DEFINED 26 | -------------------------------------------------------------------------------- /src/animator/SkHitTest.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkHitTest_DEFINED 11 | #define SkHitTest_DEFINED 12 | 13 | #include "SkDrawable.h" 14 | #include "SkTypedArray.h" 15 | 16 | class SkHitTest : public SkDrawable { 17 | DECLARE_MEMBER_INFO(HitTest); 18 | SkHitTest(); 19 | virtual bool draw(SkAnimateMaker& ); 20 | virtual bool enable(SkAnimateMaker& ); 21 | virtual bool hasEnable() const; 22 | virtual const SkMemberInfo* preferredChild(SkDisplayTypes type); 23 | private: 24 | SkTDDisplayableArray bullets; 25 | SkTDIntArray hits; 26 | SkTDDisplayableArray targets; 27 | SkBool value; 28 | }; 29 | 30 | #endif // SkHitTest_DEFINED 31 | -------------------------------------------------------------------------------- /src/animator/SkOpArray.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | #include "SkOpArray.h" 9 | 10 | SkOpArray::SkOpArray() : fType(SkOperand2::kNoType) { 11 | } 12 | 13 | SkOpArray::SkOpArray(SkOperand2::OpType type) : fType(type) { 14 | } 15 | 16 | bool SkOpArray::getIndex(int index, SkOperand2* operand) { 17 | if (index >= count()) { 18 | SkASSERT(0); 19 | return false; 20 | } 21 | *operand = begin()[index]; 22 | return true; 23 | } 24 | -------------------------------------------------------------------------------- /src/animator/SkOpArray.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | #ifndef SkOpArray_DEFINED 9 | #define SkOpArray_DEFINED 10 | 11 | #include "SkOperand2.h" 12 | #include "SkTDArray_Experimental.h" 13 | 14 | typedef SkLongArray(SkOperand2) SkTDOperand2Array; 15 | 16 | class SkOpArray : public SkTDOperand2Array { 17 | public: 18 | SkOpArray(); 19 | SkOpArray(SkOperand2::OpType type); 20 | bool getIndex(int index, SkOperand2* operand); 21 | SkOperand2::OpType getType() { return fType; } 22 | void setType(SkOperand2::OpType type) { 23 | fType = type; 24 | } 25 | protected: 26 | SkOperand2::OpType fType; 27 | }; 28 | 29 | #endif // SkOpArray_DEFINED 30 | -------------------------------------------------------------------------------- /src/animator/SkPostParts.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkPostParts_DEFINED 11 | #define SkPostParts_DEFINED 12 | 13 | #include "SkDisplayInput.h" 14 | 15 | class SkPost; 16 | 17 | class SkDataInput: public SkInput { 18 | DECLARE_MEMBER_INFO(DataInput); 19 | SkDataInput(); 20 | bool add(); 21 | virtual void dirty(); 22 | virtual SkDisplayable* getParent() const; 23 | virtual void onEndElement(SkAnimateMaker& ); 24 | virtual bool setParent(SkDisplayable* ); 25 | protected: 26 | SkPost* fParent; 27 | typedef SkInput INHERITED; 28 | friend class SkPost; 29 | }; 30 | 31 | #endif // SkPostParts_DEFINED 32 | -------------------------------------------------------------------------------- /src/animator/SkSnapshot.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSnapShot_DEFINED 11 | #define SkSnapShot_DEFINED 12 | 13 | #include "SkDrawable.h" 14 | #include "SkImageDecoder.h" 15 | #include "SkMemberInfo.h" 16 | #include "SkString.h" 17 | 18 | class SkSnapshot: public SkDrawable { 19 | DECLARE_MEMBER_INFO(Snapshot); 20 | SkSnapshot(); 21 | virtual bool draw(SkAnimateMaker& ); 22 | private: 23 | SkString filename; 24 | SkScalar quality; 25 | SkBool sequence; 26 | int /*SkImageEncoder::Type*/ type; 27 | int fSeqVal; 28 | }; 29 | 30 | #endif // SkSnapShot_DEFINED 31 | 32 | -------------------------------------------------------------------------------- /src/animator/SkTextOnPath.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkTextOnPath.h" 11 | #include "SkAnimateMaker.h" 12 | #include "SkCanvas.h" 13 | #include "SkDrawPath.h" 14 | #include "SkDrawText.h" 15 | #include "SkPaint.h" 16 | 17 | #if SK_USE_CONDENSED_INFO == 0 18 | 19 | const SkMemberInfo SkTextOnPath::fInfo[] = { 20 | SK_MEMBER(offset, Float), 21 | SK_MEMBER(path, Path), 22 | SK_MEMBER(text, Text) 23 | }; 24 | 25 | #endif 26 | 27 | DEFINE_GET_MEMBER(SkTextOnPath); 28 | 29 | SkTextOnPath::SkTextOnPath() : offset(0), path(NULL), text(NULL) { 30 | } 31 | 32 | bool SkTextOnPath::draw(SkAnimateMaker& maker) { 33 | SkASSERT(text); 34 | SkASSERT(path); 35 | SkBoundableAuto boundable(this, maker); 36 | maker.fCanvas->drawTextOnPathHV(text->getText(), text->getSize(), 37 | path->getPath(), offset, 0, *maker.fPaint); 38 | return false; 39 | } 40 | -------------------------------------------------------------------------------- /src/animator/SkTextOnPath.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkTextOnPath_DEFINED 11 | #define SkTextOnPath_DEFINED 12 | 13 | #include "SkBoundable.h" 14 | #include "SkMemberInfo.h" 15 | 16 | class SkDrawPath; 17 | class SkText; 18 | 19 | class SkTextOnPath : public SkBoundable { 20 | DECLARE_MEMBER_INFO(TextOnPath); 21 | SkTextOnPath(); 22 | virtual bool draw(SkAnimateMaker& ); 23 | private: 24 | SkScalar offset; 25 | SkDrawPath* path; 26 | SkText* text; 27 | typedef SkBoundable INHERITED; 28 | }; 29 | 30 | #endif // SkTextOnPath_DEFINED 31 | -------------------------------------------------------------------------------- /src/animator/SkTextToPath.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkTextToPath_DEFINED 11 | #define SkTextToPath_DEFINED 12 | 13 | #include "SkDrawPath.h" 14 | #include "SkMemberInfo.h" 15 | 16 | class SkDrawPaint; 17 | class SkDrawPath; 18 | class SkText; 19 | 20 | class SkTextToPath : public SkDrawable { 21 | DECLARE_MEMBER_INFO(TextToPath); 22 | SkTextToPath(); 23 | virtual bool draw(SkAnimateMaker& ); 24 | virtual void onEndElement(SkAnimateMaker& ); 25 | private: 26 | SkDrawPaint* paint; 27 | SkDrawPath* path; 28 | SkText* text; 29 | }; 30 | 31 | #endif // SkTextToPath_DEFINED 32 | 33 | -------------------------------------------------------------------------------- /src/animator/SkTypedArray.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkTypedArray_DEFINED 11 | #define SkTypedArray_DEFINED 12 | 13 | #include "SkScript.h" 14 | #include "SkTDArray_Experimental.h" 15 | 16 | class SkTypedArray : public SkTDOperandArray { 17 | public: 18 | SkTypedArray(); 19 | SkTypedArray(SkDisplayTypes type); 20 | bool getIndex(int index, SkOperand* operand); 21 | SkDisplayTypes getType() { return fType; } 22 | SkScriptEngine::SkOpType getOpType() { return SkScriptEngine::ToOpType(fType); } 23 | void setType(SkDisplayTypes type) { 24 | // SkASSERT(count() == 0); 25 | fType = type; 26 | } 27 | protected: 28 | SkDisplayTypes fType; 29 | }; 30 | 31 | #endif // SkTypedArray_DEFINED 32 | -------------------------------------------------------------------------------- /src/animator/SkXMLAnimatorWriter.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkXMLAnimatorWriter_DEFINED 11 | #define SkXMLAnimatorWriter_DEFINED 12 | 13 | #include "SkXMLWriter.h" 14 | 15 | class SkAnimator; 16 | class SkDisplayXMLParser; 17 | 18 | class SkXMLAnimatorWriter : public SkXMLWriter { 19 | public: 20 | SkXMLAnimatorWriter(SkAnimator*); 21 | virtual ~SkXMLAnimatorWriter(); 22 | virtual void writeHeader(); 23 | SkDEBUGCODE(static void UnitTest(class SkCanvas* canvas);) 24 | protected: 25 | virtual void onAddAttributeLen(const char name[], const char value[], size_t length); 26 | virtual void onEndElement(); 27 | virtual void onStartElementLen(const char elem[], size_t length); 28 | private: 29 | SkAnimator* fAnimator; 30 | SkDisplayXMLParser* fParser; 31 | }; 32 | 33 | #endif // SkXMLAnimatorWriter_DEFINED 34 | 35 | -------------------------------------------------------------------------------- /src/animator/thingstodo.txt: -------------------------------------------------------------------------------- 1 | things to do: 2 | figure out where endless or very deep recursion is possible 3 | at these points, generate an error if actual physical stack gets too large 4 | candidates are scripts 5 | eval(eval(eval... user callouts 6 | ((((( operator precedence or similar making stack deep 7 | groups within groups 8 | very large apply create or apply immediate steps 9 | 10 | write tests for math functions 11 | looks like random takes a parameter when it should take zero parameters 12 | 13 | add Math, Number files to perforce for docs 14 | alphabetize attributes in docs 15 | 16 | manually modified tools/screenplayDocs/xmlToJPEG.cpp 17 | 18 | fix docs where lines are stitched together (insert space) 19 | 20 | naked outside of asserts on name 21 | handle errors for all element not contained by correct parents -------------------------------------------------------------------------------- /src/core/SkConcaveToTriangles.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2009 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkConcaveToTriangles_DEFINED 11 | #define SkConcaveToTriangles_DEFINED 12 | 13 | #include "SkPoint.h" 14 | #include "SkTDArray.h" 15 | 16 | 17 | // Triangulate a polygon. 18 | // The polygon can be convex or concave, and can have holes or multiple contours 19 | // of arbitrary recursion. 20 | // The holes must have opposite orientation of the outer contours, whereas 21 | // islands within the holes must have the same orientation as the outer contour. 22 | // Contours should be joined by zero-thickness double-edges, to mimic a single 23 | // polygon. The polygon should not be self-intersecting. 24 | // Currently, the outer contour must be right-handed, i.e. it should be oriented 25 | // in the direction that rotates the X-axis to the Y-axis. 26 | bool SkConcaveToTriangles(size_t count, 27 | const SkPoint pts[], 28 | SkTDArray *triangles); 29 | 30 | 31 | #endif // SkConcaveToTriangles_DEFINED 32 | -------------------------------------------------------------------------------- /src/core/SkCordic.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkCordic_DEFINED 11 | #define SkCordic_DEFINED 12 | 13 | #include "SkTypes.h" 14 | #include "SkFixed.h" 15 | 16 | SkFixed SkCordicACos(SkFixed a); 17 | SkFixed SkCordicASin(SkFixed a); 18 | SkFixed SkCordicATan2(SkFixed y, SkFixed x); 19 | SkFixed SkCordicExp(SkFixed a); 20 | SkFixed SkCordicLog(SkFixed a); 21 | SkFixed SkCordicSinCos(SkFixed radians, SkFixed* cosp); 22 | SkFixed SkCordicTan(SkFixed a); 23 | 24 | #ifdef SK_DEBUG 25 | void SkCordic_UnitTest(); 26 | #endif 27 | 28 | #endif // SkCordic 29 | 30 | -------------------------------------------------------------------------------- /src/core/SkCubicClipper.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2009 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkCubicClipper_DEFINED 11 | #define SkCubicClipper_DEFINED 12 | 13 | #include "SkPoint.h" 14 | #include "SkRect.h" 15 | 16 | /** This class is initialized with a clip rectangle, and then can be fed cubics, 17 | which must already be monotonic in Y. 18 | 19 | In the future, it might return a series of segments, allowing it to clip 20 | also in X, to ensure that all segments fit in a finite coordinate system. 21 | */ 22 | class SkCubicClipper { 23 | public: 24 | SkCubicClipper(); 25 | 26 | void setClip(const SkIRect& clip); 27 | 28 | bool clipCubic(const SkPoint src[4], SkPoint dst[4]); 29 | 30 | private: 31 | SkRect fClip; 32 | }; 33 | 34 | #endif // SkCubicClipper_DEFINED 35 | -------------------------------------------------------------------------------- /src/core/SkDebug.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkTypes.h" 11 | 12 | #ifdef SK_DEBUG 13 | 14 | int8_t SkToS8(long x) 15 | { 16 | SkASSERT((int8_t)x == x); 17 | return (int8_t)x; 18 | } 19 | 20 | uint8_t SkToU8(size_t x) 21 | { 22 | SkASSERT((uint8_t)x == x); 23 | return (uint8_t)x; 24 | } 25 | 26 | int16_t SkToS16(long x) 27 | { 28 | SkASSERT((int16_t)x == x); 29 | return (int16_t)x; 30 | } 31 | 32 | uint16_t SkToU16(size_t x) 33 | { 34 | SkASSERT((uint16_t)x == x); 35 | return (uint16_t)x; 36 | } 37 | 38 | int32_t SkToS32(long x) 39 | { 40 | SkASSERT((int32_t)x == x); 41 | return (int32_t)x; 42 | } 43 | 44 | uint32_t SkToU32(size_t x) 45 | { 46 | SkASSERT((uint32_t)x == x); 47 | return (uint32_t)x; 48 | } 49 | 50 | #endif 51 | 52 | -------------------------------------------------------------------------------- /src/core/SkEdgeBuilder.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | #ifndef SkEdgeBuilder_DEFINED 9 | #define SkEdgeBuilder_DEFINED 10 | 11 | #include "SkChunkAlloc.h" 12 | #include "SkRect.h" 13 | #include "SkTDArray.h" 14 | 15 | struct SkEdge; 16 | class SkEdgeClipper; 17 | class SkPath; 18 | 19 | class SkEdgeBuilder { 20 | public: 21 | SkEdgeBuilder(); 22 | 23 | int build(const SkPath& path, const SkIRect* clip, int shiftUp); 24 | 25 | SkEdge** edgeList() { return fList.begin(); } 26 | 27 | private: 28 | SkChunkAlloc fAlloc; 29 | SkTDArray fList; 30 | int fShiftUp; 31 | 32 | void addLine(const SkPoint pts[]); 33 | void addQuad(const SkPoint pts[]); 34 | void addCubic(const SkPoint pts[]); 35 | void addClipper(SkEdgeClipper*); 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/core/SkFontHost.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2009 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkFontHost.h" 11 | 12 | static SkFontHost::LCDOrientation gLCDOrientation = SkFontHost::kHorizontal_LCDOrientation; 13 | static SkFontHost::LCDOrder gLCDOrder = SkFontHost::kRGB_LCDOrder; 14 | 15 | // static 16 | SkFontHost::LCDOrientation SkFontHost::GetSubpixelOrientation() 17 | { 18 | return gLCDOrientation; 19 | } 20 | 21 | // static 22 | void SkFontHost::SetSubpixelOrientation(LCDOrientation orientation) 23 | { 24 | gLCDOrientation = orientation; 25 | } 26 | 27 | // static 28 | SkFontHost::LCDOrder SkFontHost::GetSubpixelOrder() 29 | { 30 | return gLCDOrder; 31 | } 32 | 33 | // static 34 | void SkFontHost::SetSubpixelOrder(LCDOrder order) 35 | { 36 | gLCDOrder = order; 37 | } 38 | -------------------------------------------------------------------------------- /src/core/SkPaintDefaults.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkPaintDefaults_DEFINED 9 | #define SkPaintDefaults_DEFINED 10 | 11 | #include "SkPaint.h" 12 | 13 | /** 14 | * Any of these can be specified by the build system (or SkUserConfig.h) 15 | * to change the default values for a SkPaint. This file should not be 16 | * edited directly. 17 | */ 18 | 19 | #ifndef SkPaintDefaults_Flags 20 | #define SkPaintDefaults_Flags 0 21 | #endif 22 | 23 | #ifndef SkPaintDefaults_TextSize 24 | #define SkPaintDefaults_TextSize SkIntToScalar(12) 25 | #endif 26 | 27 | #ifndef SkPaintDefaults_Hinting 28 | #define SkPaintDefaults_Hinting SkPaint::kNormal_Hinting 29 | #endif 30 | 31 | #ifndef SkPaintDefaults_MiterLimit 32 | #define SkPaintDefaults_MiterLimit SkIntToScalar(4) 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/core/SkTSort.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkTSort_DEFINED 11 | #define SkTSort_DEFINED 12 | 13 | #include "SkTypes.h" 14 | 15 | template 16 | void SkTHeapSort_SiftDown(T array[], int root, int bottom) { 17 | while (root*2 + 1 <= bottom) { 18 | int child = root * 2 + 1; 19 | if (child+1 <= bottom && array[child] < array[child+1]) { 20 | child += 1; 21 | } 22 | if (array[root] < array[child]) { 23 | SkTSwap(array[root], array[child]); 24 | root = child; 25 | } else { 26 | break; 27 | } 28 | } 29 | } 30 | 31 | template void SkTHeapSort(T array[], int count) { 32 | int i; 33 | for (i = count/2 - 1; i >= 0; --i) { 34 | SkTHeapSort_SiftDown(array, i, count-1); 35 | } 36 | for (i = count - 1; i > 0; --i) { 37 | SkTSwap(array[0], array[i]); 38 | SkTHeapSort_SiftDown(array, 0, i-1); 39 | } 40 | } 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/effects/SkBitmapCache.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2010 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkBitmapCache_DEFINED 11 | #define SkBitmapCache_DEFINED 12 | 13 | #include "SkBitmap.h" 14 | 15 | class SkBitmapCache : SkNoncopyable { 16 | public: 17 | SkBitmapCache(int maxEntries); 18 | ~SkBitmapCache(); 19 | 20 | bool find(const void* buffer, size_t len, SkBitmap*) const; 21 | void add(const void* buffer, size_t len, const SkBitmap&); 22 | 23 | private: 24 | int fEntryCount; 25 | const int fMaxEntries; 26 | 27 | struct Entry; 28 | mutable Entry* fHead; 29 | mutable Entry* fTail; 30 | 31 | inline Entry* detach(Entry*) const; 32 | inline void attachToHead(Entry*) const; 33 | 34 | #ifdef SK_DEBUG 35 | void validate() const; 36 | #else 37 | void validate() const {} 38 | #endif 39 | 40 | class AutoValidate : SkNoncopyable { 41 | public: 42 | AutoValidate(const SkBitmapCache* bc) : fBC(bc) { bc->validate(); } 43 | ~AutoValidate() { fBC->validate(); } 44 | private: 45 | const SkBitmapCache* fBC; 46 | }; 47 | }; 48 | 49 | #endif 50 | 51 | -------------------------------------------------------------------------------- /src/effects/SkBlurMask.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkBlurMask_DEFINED 11 | #define SkBlurMask_DEFINED 12 | 13 | #include "SkShader.h" 14 | 15 | class SkBlurMask { 16 | public: 17 | enum Style { 18 | kNormal_Style, //!< fuzzy inside and outside 19 | kSolid_Style, //!< solid inside, fuzzy outside 20 | kOuter_Style, //!< nothing inside, fuzzy outside 21 | kInner_Style, //!< fuzzy inside, nothing outside 22 | 23 | kStyleCount 24 | }; 25 | 26 | enum Quality { 27 | kLow_Quality, //!< box blur 28 | kHigh_Quality //!< three pass box blur (similar to gaussian) 29 | }; 30 | 31 | static bool Blur(SkMask* dst, const SkMask& src, 32 | SkScalar radius, Style style, Quality quality, 33 | SkIPoint* margin = NULL); 34 | }; 35 | 36 | #endif 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/effects/SkClampRange.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkClampRange_DEFINED 11 | #define SkClampRange_DEFINED 12 | 13 | #include "SkFixed.h" 14 | 15 | /** 16 | * Iteration fixed fx by dx, clamping as you go to [0..0xFFFF], this class 17 | * computes the (up to) 3 spans there are: 18 | * 19 | * range0: use constant value V0 20 | * range1: iterate as usual fx += dx 21 | * range2: use constant value V1 22 | */ 23 | struct SkClampRange { 24 | int fCount0; // count for fV0 25 | int fCount1; // count for interpolating (fV0...fV1) 26 | int fCount2; // count for fV1 27 | SkFixed fFx1; // initial fx value for the fCount1 range. 28 | // only valid if fCount1 > 0 29 | int fV0, fV1; 30 | bool fOverflowed; // true if we had to clamp due to numerical overflow 31 | 32 | void init(SkFixed fx, SkFixed dx, int count, int v0, int v1); 33 | 34 | private: 35 | void initFor1(SkFixed fx); 36 | }; 37 | 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /src/effects/SkEmbossMask.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkEmbossMask_DEFINED 11 | #define SkEmbossMask_DEFINED 12 | 13 | #include "SkEmbossMaskFilter.h" 14 | 15 | class SkEmbossMask { 16 | public: 17 | static void Emboss(SkMask* mask, const SkEmbossMaskFilter::Light&); 18 | }; 19 | 20 | #endif 21 | 22 | -------------------------------------------------------------------------------- /src/effects/SkPaintFlagsDrawFilter.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkPaintFlagsDrawFilter.h" 11 | #include "SkPaint.h" 12 | 13 | SkPaintFlagsDrawFilter::SkPaintFlagsDrawFilter(uint32_t clearFlags, 14 | uint32_t setFlags) { 15 | fClearFlags = SkToU16(clearFlags & SkPaint::kAllFlags); 16 | fSetFlags = SkToU16(setFlags & SkPaint::kAllFlags); 17 | } 18 | 19 | void SkPaintFlagsDrawFilter::filter(SkPaint* paint, Type) { 20 | paint->setFlags((paint->getFlags() & ~fClearFlags) | fSetFlags); 21 | } 22 | 23 | -------------------------------------------------------------------------------- /src/effects/SkPixelXorXfermode.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkPixelXorXfermode.h" 11 | #include "SkColorPriv.h" 12 | 13 | // we always return an opaque color, 'cause I don't know what to do with 14 | // the alpha-component and still return a valid premultiplied color. 15 | SkPMColor SkPixelXorXfermode::xferColor(SkPMColor src, SkPMColor dst) { 16 | SkPMColor res = src ^ dst ^ fOpColor; 17 | res |= (SK_A32_MASK << SK_A32_SHIFT); // force it to be opaque 18 | return res; 19 | } 20 | 21 | void SkPixelXorXfermode::flatten(SkFlattenableWriteBuffer& wb) const { 22 | this->INHERITED::flatten(wb); 23 | wb.write32(fOpColor); 24 | } 25 | 26 | SkPixelXorXfermode::SkPixelXorXfermode(SkFlattenableReadBuffer& rb) 27 | : INHERITED(rb) { 28 | fOpColor = rb.readU32(); 29 | } 30 | 31 | SK_DEFINE_FLATTENABLE_REGISTRAR(SkPixelXorXfermode) 32 | -------------------------------------------------------------------------------- /src/gpu/GrAAConvexPathRenderer.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2012 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #include "GrPathRenderer.h" 10 | 11 | 12 | class GrAAConvexPathRenderer : public GrPathRenderer { 13 | public: 14 | GrAAConvexPathRenderer(); 15 | 16 | virtual bool canDrawPath(const SkPath& path, 17 | GrPathFill fill, 18 | const GrDrawTarget* target, 19 | bool antiAlias) const SK_OVERRIDE; 20 | protected: 21 | virtual bool onDrawPath(const SkPath& path, 22 | GrPathFill fill, 23 | const GrVec* translate, 24 | GrDrawTarget* target, 25 | GrDrawState::StageMask stageMask, 26 | bool antiAlias) SK_OVERRIDE; 27 | }; 28 | -------------------------------------------------------------------------------- /src/gpu/GrAddPathRenderers_default.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2012 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "GrAAHairLinePathRenderer.h" 11 | #include "GrAAConvexPathRenderer.h" 12 | #include "GrSoftwarePathRenderer.h" 13 | 14 | void GrPathRenderer::AddPathRenderers(GrContext* ctx, 15 | GrPathRendererChain::UsageFlags flags, 16 | GrPathRendererChain* chain) { 17 | if (!(GrPathRendererChain::kNonAAOnly_UsageFlag & flags)) { 18 | 19 | if (GrPathRenderer* pr = GrAAHairLinePathRenderer::Create(ctx)) { 20 | chain->addPathRenderer(pr)->unref(); 21 | } 22 | chain->addPathRenderer(new GrAAConvexPathRenderer())->unref(); 23 | chain->addPathRenderer(new GrSoftwarePathRenderer(ctx))->unref(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/gpu/GrAddPathRenderers_none.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "GrPathRenderer.h" 11 | 12 | 13 | void GrPathRenderer::AddPathRenderers(GrContext*, 14 | GrPathRendererChain::UsageFlags, 15 | GrPathRendererChain*) {} 16 | -------------------------------------------------------------------------------- /src/gpu/GrAddPathRenderers_tesselated.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "GrTesselatedPathRenderer.h" 11 | 12 | 13 | void GrPathRenderer::AddPathRenderers(GrContext*, 14 | GrPathRendererChain::UsageFlags flags, 15 | GrPathRendererChain* chain) { 16 | chain->addPathRenderer(new GrTesselatedPathRenderer())->unref(); 17 | } 18 | -------------------------------------------------------------------------------- /src/gpu/GrCustomStage.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "GrContext.h" 9 | #include "GrCustomStage.h" 10 | 11 | GrCustomStage::GrCustomStage() { 12 | 13 | } 14 | 15 | GrCustomStage::~GrCustomStage() { 16 | 17 | } 18 | 19 | bool GrCustomStage::isOpaque(bool inputTextureIsOpaque) const { 20 | return false; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /src/gpu/GrIndexBuffer.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2010 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | 11 | #ifndef GrIndexBuffer_DEFINED 12 | #define GrIndexBuffer_DEFINED 13 | 14 | #include "GrGeometryBuffer.h" 15 | 16 | class GrIndexBuffer : public GrGeometryBuffer { 17 | public: 18 | /** 19 | * Retrieves the maximum number of quads that could be rendered 20 | * from the index buffer (using kTriangles_PrimitiveType). 21 | * @return the maximum number of quads using full size of index buffer. 22 | */ 23 | int maxQuads() const { 24 | return this->sizeInBytes() / (sizeof(uint16_t) * 6); 25 | } 26 | protected: 27 | GrIndexBuffer(GrGpu* gpu, size_t sizeInBytes, bool dynamic) 28 | : INHERITED(gpu, sizeInBytes, dynamic) {} 29 | private: 30 | typedef GrGeometryBuffer INHERITED; 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/gpu/GrMemory.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2010 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | 11 | #include 12 | 13 | void* GrMalloc(size_t bytes) { 14 | void* ptr = ::malloc(bytes); 15 | if (NULL == ptr) { 16 | ::exit(-1); 17 | } 18 | return ptr; 19 | } 20 | 21 | void GrFree(void* ptr) { 22 | if (ptr) { 23 | ::free(ptr); 24 | } 25 | } 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/gpu/GrPathRenderer.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #include "GrPathRenderer.h" 10 | 11 | GrPathRenderer::GrPathRenderer() { 12 | } 13 | 14 | -------------------------------------------------------------------------------- /src/gpu/GrRandom.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2010 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | 11 | #ifndef GrRandom_DEFINED 12 | #define GrRandom_DEFINED 13 | 14 | class GrRandom { 15 | public: 16 | GrRandom() : fSeed(0) {} 17 | GrRandom(uint32_t seed) : fSeed(seed) {} 18 | 19 | uint32_t seed() const { return fSeed; } 20 | 21 | uint32_t nextU() { 22 | fSeed = fSeed * kMUL + kADD; 23 | return fSeed; 24 | } 25 | 26 | int32_t nextS() { return (int32_t)this->nextU(); } 27 | 28 | /** 29 | * Returns value [0...1) as a float 30 | */ 31 | float nextF() { 32 | // const is 1 / (2^32 - 1) 33 | return (float)(this->nextU() * 2.32830644e-10); 34 | } 35 | 36 | /** 37 | * Returns value [min...max) as a float 38 | */ 39 | float nextF(float min, float max) { 40 | return min + this->nextF() * (max - min); 41 | } 42 | 43 | private: 44 | /* 45 | * These constants taken from "Numerical Recipes in C", reprinted 1999 46 | */ 47 | enum { 48 | kMUL = 1664525, 49 | kADD = 1013904223 50 | }; 51 | uint32_t fSeed; 52 | }; 53 | 54 | #endif 55 | 56 | -------------------------------------------------------------------------------- /src/gpu/GrResource.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "GrResource.h" 11 | #include "GrGpu.h" 12 | 13 | GrResource::GrResource(GrGpu* gpu) { 14 | fGpu = gpu; 15 | fNext = NULL; 16 | fPrevious = NULL; 17 | fGpu->insertResource(this); 18 | } 19 | 20 | GrResource::~GrResource() { 21 | // subclass should have released this. 22 | GrAssert(!this->isValid()); 23 | } 24 | 25 | void GrResource::release() { 26 | if (NULL != fGpu) { 27 | this->onRelease(); 28 | fGpu->removeResource(this); 29 | fGpu = NULL; 30 | } 31 | } 32 | 33 | void GrResource::abandon() { 34 | if (NULL != fGpu) { 35 | this->onAbandon(); 36 | fGpu->removeResource(this); 37 | fGpu = NULL; 38 | } 39 | } 40 | 41 | const GrContext* GrResource::getContext() const { 42 | if (NULL != fGpu) { 43 | return fGpu->getContext(); 44 | } else { 45 | return NULL; 46 | } 47 | } 48 | 49 | GrContext* GrResource::getContext() { 50 | if (NULL != fGpu) { 51 | return fGpu->getContext(); 52 | } else { 53 | return NULL; 54 | } 55 | } 56 | 57 | -------------------------------------------------------------------------------- /src/gpu/GrSoftwarePathRenderer.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2012 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #ifndef GrSoftwarePathRenderer_DEFINED 10 | #define GrSoftwarePathRenderer_DEFINED 11 | 12 | #include "GrPathRenderer.h" 13 | 14 | class GrSoftwarePathRenderer : public GrPathRenderer { 15 | public: 16 | GrSoftwarePathRenderer(GrContext* context) 17 | : fContext(context) { 18 | } 19 | 20 | virtual bool canDrawPath(const SkPath& path, 21 | GrPathFill fill, 22 | const GrDrawTarget* target, 23 | bool antiAlias) const SK_OVERRIDE; 24 | protected: 25 | virtual bool onDrawPath(const SkPath& path, 26 | GrPathFill fill, 27 | const GrVec* translate, 28 | GrDrawTarget* target, 29 | GrDrawState::StageMask stageMask, 30 | bool antiAlias) SK_OVERRIDE; 31 | 32 | private: 33 | GrContext* fContext; 34 | 35 | typedef GrPathRenderer INHERITED; 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/gpu/GrStringBuilder.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2010 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | 11 | #ifndef GrStringBuilder_DEFINED 12 | #define GrStringBuilder_DEFINED 13 | 14 | #include "SkString.h" 15 | 16 | typedef SkString GrStringBuilder; 17 | 18 | #endif 19 | 20 | -------------------------------------------------------------------------------- /src/gpu/GrTBSearch.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2010 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | 11 | #ifndef GrTBSearch_DEFINED 12 | #define GrTBSearch_DEFINED 13 | 14 | template 15 | int GrTBSearch(const ELEM array[], int count, KEY target) { 16 | GrAssert(count >= 0); 17 | if (0 == count) { 18 | // we should insert it at 0 19 | return ~0; 20 | } 21 | 22 | int high = count - 1; 23 | int low = 0; 24 | while (high > low) { 25 | int index = (low + high) >> 1; 26 | if (LT(array[index], target)) { 27 | low = index + 1; 28 | } else { 29 | high = index; 30 | } 31 | } 32 | 33 | // check if we found it 34 | if (EQ(array[high], target)) { 35 | return high; 36 | } 37 | 38 | // now return the ~ of where we should insert it 39 | if (LT(array[high], target)) { 40 | high += 1; 41 | } 42 | return ~high; 43 | } 44 | 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /src/gpu/GrTLList.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2010 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | 11 | #ifndef GrTLList_DEFINED 12 | #define GrTLList_DEFINED 13 | 14 | #include "GrNoncopyable.h" 15 | 16 | template class GrTLList : GrNoncopyable { 17 | public: 18 | class Entry { 19 | Entry* fPrev; 20 | Entry* fNext; 21 | }; 22 | 23 | GrTLList() : fHead(NULL), fTail(NULL) {} 24 | #if GR_DEBUG 25 | ~GrTLList() { 26 | GrAssert(NULL == fHead); 27 | GrAssert(NULL == ftail); 28 | } 29 | #endif 30 | 31 | T* head() const { return fHead; } 32 | T* tail() const { return fTail; } 33 | 34 | void addToHead(T*); 35 | void addToTail(T*); 36 | void removeFromList(T*); 37 | 38 | private: 39 | Entry* fHead; 40 | Entry* fTail; 41 | 42 | friend class Entry; 43 | }; 44 | 45 | 46 | class Parent { 47 | GrTDLList fList; 48 | }; 49 | 50 | class Child : public GrTLList::Entry { 51 | }; 52 | 53 | #endif 54 | 55 | -------------------------------------------------------------------------------- /src/gpu/GrTesselatedPathRenderer.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef GrTesselatedPathRenderer_DEFINED 11 | #define GrTesselatedPathRenderer_DEFINED 12 | 13 | #include "GrPathRenderer.h" 14 | 15 | class GrTesselatedPathRenderer : public GrPathRenderer { 16 | public: 17 | GrTesselatedPathRenderer(); 18 | 19 | virtual bool canDrawPath(const SkPath& path, 20 | GrPathFill fill, 21 | const GrDrawTarget* target, 22 | bool antiAlias) const SK_OVERRIDE; 23 | 24 | virtual bool onDrawPath(const SkPath& path, 25 | GrPathFill fill, 26 | const GrVec* translate, 27 | GrDrawTarget* target, 28 | GrDrawState::StageMask stageMask, 29 | bool antiAlias) SK_OVERRIDE; 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/gpu/GrVertexBuffer.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2010 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | 11 | #ifndef GrVertexBuffer_DEFINED 12 | #define GrVertexBuffer_DEFINED 13 | 14 | #include "GrGeometryBuffer.h" 15 | 16 | class GrVertexBuffer : public GrGeometryBuffer { 17 | protected: 18 | GrVertexBuffer(GrGpu* gpu, size_t sizeInBytes, bool dynamic) 19 | : INHERITED(gpu, sizeInBytes, dynamic) {} 20 | private: 21 | typedef GrGeometryBuffer INHERITED; 22 | }; 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /src/gpu/SkGpuCanvas.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2010 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | 11 | #include "GrContext.h" 12 | 13 | #include "SkGpuCanvas.h" 14 | #include "SkGpuDevice.h" 15 | 16 | /////////////////////////////////////////////////////////////////////////////// 17 | 18 | SkGpuCanvas::SkGpuCanvas(GrContext* context, GrRenderTarget* renderTarget) { 19 | SkASSERT(context); 20 | fContext = context; 21 | fContext->ref(); 22 | 23 | this->setDevice(new SkGpuDevice(context, renderTarget))->unref(); 24 | } 25 | 26 | SkGpuCanvas::~SkGpuCanvas() { 27 | // call this now, while our override of restore() is in effect 28 | this->restoreToCount(1); 29 | fContext->flush(false); 30 | fContext->unref(); 31 | } 32 | 33 | /////////////////////////////////////////////////////////////////////////////// 34 | 35 | bool SkGpuCanvas::getViewport(SkIPoint* size) const { 36 | if (size) { 37 | SkDevice* device = this->getDevice(); 38 | if (device) { 39 | size->set(device->width(), device->height()); 40 | } else { 41 | size->set(0, 0); 42 | } 43 | } 44 | return true; 45 | } 46 | 47 | -------------------------------------------------------------------------------- /src/gpu/gl/GrGLCreateNativeInterface_none.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #include "gl/GrGLInterface.h" 10 | 11 | const GrGLInterface* GrGLCreateNativeInterface() { 12 | return NULL; 13 | } 14 | -------------------------------------------------------------------------------- /src/gpu/gl/GrGLDefaultInterface_native.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #include "gl/GrGLInterface.h" 10 | 11 | const GrGLInterface* GrGLDefaultInterface() { 12 | return GrGLCreateNativeInterface(); 13 | } 14 | -------------------------------------------------------------------------------- /src/gpu/gl/GrGLDefaultInterface_none.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #include "gl/GrGLInterface.h" 10 | 11 | const GrGLInterface* GrGLDefaultInterface() { 12 | return NULL; 13 | } 14 | -------------------------------------------------------------------------------- /src/gpu/gl/GrGLStencilBuffer.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "GrGLStencilBuffer.h" 11 | #include "GrGpuGL.h" 12 | 13 | GrGLStencilBuffer::~GrGLStencilBuffer() { 14 | this->release(); 15 | } 16 | 17 | size_t GrGLStencilBuffer::sizeInBytes() const { 18 | uint64_t size = this->width(); 19 | size *= this->height(); 20 | size *= fFormat.fTotalBits; 21 | size *= GrMax(1,this->numSamples()); 22 | return static_cast(size / 8); 23 | } 24 | 25 | void GrGLStencilBuffer::onRelease() { 26 | if (0 != fRenderbufferID) { 27 | GrGpuGL* gpuGL = (GrGpuGL*) this->getGpu(); 28 | const GrGLInterface* gl = gpuGL->glInterface(); 29 | GR_GL_CALL(gl, DeleteRenderbuffers(1, &fRenderbufferID)); 30 | fRenderbufferID = 0; 31 | } 32 | INHERITED::onRelease(); 33 | } 34 | 35 | void GrGLStencilBuffer::onAbandon() { 36 | fRenderbufferID = 0; 37 | INHERITED::onAbandon(); 38 | } 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/gpu/gl/GrGLUtil.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "gl/GrGLConfig.h" 11 | #include "gl/GrGLInterface.h" 12 | 13 | void GrGLClearErr(const GrGLInterface* gl) { 14 | while (GR_GL_NO_ERROR != gl->fGetError()) {} 15 | } 16 | 17 | void GrGLCheckErr(const GrGLInterface* gl, 18 | const char* location, 19 | const char* call) { 20 | uint32_t err = GR_GL_GET_ERROR(gl); 21 | if (GR_GL_NO_ERROR != err) { 22 | GrPrintf("---- glGetError %x", err); 23 | if (NULL != location) { 24 | GrPrintf(" at\n\t%s", location); 25 | } 26 | if (NULL != call) { 27 | GrPrintf("\n\t\t%s", call); 28 | } 29 | GrPrintf("\n"); 30 | } 31 | } 32 | 33 | /////////////////////////////////////////////////////////////////////////////// 34 | 35 | #if GR_GL_LOG_CALLS 36 | bool gLogCallsGL = !!(GR_GL_LOG_CALLS_START); 37 | #endif 38 | 39 | #if GR_GL_CHECK_ERROR 40 | bool gCheckErrorGL = !!(GR_GL_CHECK_ERROR_START); 41 | #endif 42 | 43 | -------------------------------------------------------------------------------- /src/gpu/gl/SkNullGLContext.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #include "gl/SkNullGLContext.h" 10 | 11 | const GrGLInterface* SkNullGLContext::createGLContext() { 12 | return GrGLCreateNullInterface(); 13 | }; 14 | -------------------------------------------------------------------------------- /src/gpu/gl/debug/GrBufferObj.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2012 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #include "GrBufferObj.h" 10 | 11 | void GrBufferObj::allocate(GrGLint size, const GrGLchar *dataPtr) { 12 | GrAlwaysAssert(size >= 0); 13 | 14 | // delete pre-existing data 15 | delete[] fDataPtr; 16 | 17 | fSize = size; 18 | fDataPtr = new GrGLchar[size]; 19 | if (dataPtr) { 20 | memcpy(fDataPtr, dataPtr, fSize); 21 | } 22 | // TODO: w/ no dataPtr the data is unitialized - this could be tracked 23 | } 24 | 25 | void GrBufferObj::deleteAction() { 26 | 27 | // buffers are automatically unmapped when deleted 28 | this->resetMapped(); 29 | 30 | this->INHERITED::deleteAction(); 31 | } 32 | -------------------------------------------------------------------------------- /src/gpu/gl/debug/GrFBBindableObj.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2012 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #include "GrFBBindableObj.h" -------------------------------------------------------------------------------- /src/gpu/gl/debug/GrProgramObj.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2012 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #include "GrProgramObj.h" 10 | #include "GrShaderObj.h" 11 | 12 | void GrProgramObj::AttachShader(GrShaderObj *shader) { 13 | shader->ref(); 14 | fShaders.push_back(shader); 15 | } 16 | 17 | void GrProgramObj::deleteAction() { 18 | 19 | // shaders are automatically detached from a deleted program. They will only be 20 | // deleted if they were marked for deletion by a prior call to glDeleteShader 21 | for (int i = 0; i < fShaders.count(); ++i) { 22 | fShaders[i]->unref(); 23 | } 24 | fShaders.reset(); 25 | 26 | this->INHERITED::deleteAction(); 27 | } 28 | -------------------------------------------------------------------------------- /src/gpu/gl/debug/GrProgramObj.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2012 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #ifndef GrProgramObj_DEFINED 10 | #define GrProgramObj_DEFINED 11 | 12 | #include "SkTArray.h" 13 | #include "GrFakeRefObj.h" 14 | class GrShaderObj; 15 | 16 | //////////////////////////////////////////////////////////////////////////////// 17 | class GrProgramObj : public GrFakeRefObj { 18 | GR_DEFINE_CREATOR(GrProgramObj); 19 | 20 | public: 21 | GrProgramObj() 22 | : GrFakeRefObj() 23 | , fInUse(false) {} 24 | 25 | void AttachShader(GrShaderObj *shader); 26 | 27 | virtual void deleteAction() SK_OVERRIDE; 28 | 29 | // TODO: this flag system won't work w/ multiple contexts! 30 | void setInUse() { fInUse = true; } 31 | void resetInUse() { fInUse = false; } 32 | bool getInUse() const { return fInUse; } 33 | 34 | protected: 35 | 36 | private: 37 | SkTArray fShaders; 38 | bool fInUse; // has this program been activated by a glUseProgram call? 39 | 40 | typedef GrFakeRefObj INHERITED; 41 | }; 42 | 43 | #endif // GrProgramObj_DEFINED 44 | -------------------------------------------------------------------------------- /src/gpu/gl/debug/GrRenderBufferObj.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2012 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #include "GrRenderBufferObj.h" 10 | -------------------------------------------------------------------------------- /src/gpu/gl/debug/GrRenderBufferObj.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2012 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #ifndef GrRenderBufferObj_DEFINED 10 | #define GrRenderBufferObj_DEFINED 11 | 12 | #include "GrFBBindableObj.h" 13 | 14 | //////////////////////////////////////////////////////////////////////////////// 15 | class GrRenderBufferObj : public GrFBBindableObj { 16 | GR_DEFINE_CREATOR(GrRenderBufferObj); 17 | 18 | public: 19 | GrRenderBufferObj() 20 | : GrFBBindableObj() 21 | , fBound(false) { 22 | } 23 | 24 | void setBound() { fBound = true; } 25 | void resetBound() { fBound = false; } 26 | bool getBound() const { return fBound; } 27 | 28 | virtual void deleteAction() SK_OVERRIDE { 29 | 30 | this->INHERITED::deleteAction(); 31 | } 32 | 33 | protected: 34 | private: 35 | bool fBound; // is this render buffer currently bound via "glBindRenderbuffer"? 36 | 37 | typedef GrFBBindableObj INHERITED; 38 | }; 39 | 40 | #endif // GrRenderBufferObj_DEFINED 41 | -------------------------------------------------------------------------------- /src/gpu/gl/debug/GrShaderObj.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2012 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #include "GrShaderObj.h" 10 | 11 | void GrShaderObj::deleteAction() { 12 | 13 | this->INHERITED::deleteAction(); 14 | } 15 | -------------------------------------------------------------------------------- /src/gpu/gl/debug/GrShaderObj.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2012 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #ifndef GrShaderObj_DEFINED 10 | #define GrShaderObj_DEFINED 11 | 12 | #include "GrFakeRefObj.h" 13 | 14 | //////////////////////////////////////////////////////////////////////////////// 15 | class GrShaderObj : public GrFakeRefObj { 16 | GR_DEFINE_CREATOR(GrShaderObj); 17 | 18 | public: 19 | GrShaderObj() 20 | : GrFakeRefObj() 21 | , fType(GR_GL_VERTEX_SHADER) {} 22 | 23 | void setType(GrGLenum type) { fType = type; } 24 | GrGLenum getType() { return fType; } 25 | 26 | virtual void deleteAction() SK_OVERRIDE; 27 | 28 | protected: 29 | private: 30 | GrGLenum fType; // either GR_GL_VERTEX_SHADER or GR_GL_FRAGMENT_SHADER 31 | 32 | typedef GrFakeRefObj INHERITED; 33 | }; 34 | 35 | #endif // GrShaderObj_DEFINED 36 | -------------------------------------------------------------------------------- /src/gpu/gl/debug/GrTextureObj.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2012 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #include "GrTextureObj.h" 10 | 11 | void GrTextureObj::deleteAction() { 12 | 13 | this->INHERITED::deleteAction(); 14 | } 15 | -------------------------------------------------------------------------------- /src/gpu/gl/debug/GrTextureUnitObj.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2012 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #include "GrTextureUnitObj.h" 10 | #include "GrTextureObj.h" 11 | 12 | void GrTextureUnitObj::setTexture(GrTextureObj *texture) { 13 | 14 | if (fTexture) { 15 | GrAlwaysAssert(fTexture->getBound(this)); 16 | fTexture->resetBound(this); 17 | 18 | GrAlwaysAssert(!fTexture->getDeleted()); 19 | fTexture->unref(); 20 | } 21 | 22 | fTexture = texture; 23 | 24 | if (fTexture) { 25 | GrAlwaysAssert(!fTexture->getDeleted()); 26 | fTexture->ref(); 27 | 28 | GrAlwaysAssert(!fTexture->getBound(this)); 29 | fTexture->setBound(this); 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /src/gpu/gl/debug/SkDebugGLContext.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2012 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #include "gl/SkDebugGLContext.h" 10 | 11 | const GrGLInterface* SkDebugGLContext::createGLContext() { 12 | return GrGLCreateDebugInterface(); 13 | }; 14 | -------------------------------------------------------------------------------- /src/gpu/gr_hello_world.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | #include "gl/SkGLCanvas.h" 9 | #include "SkBitmap.h" 10 | #include "SkPaint.h" 11 | #include "gl/SkGpuGLShaders.h" 12 | 13 | extern "C" { 14 | void gr_hello_world(); 15 | } 16 | 17 | void gr_hello_world() { 18 | static GrGpu* gGpu; 19 | if (NULL == gGpu) { 20 | gGpu = new SkGpuGLShaders; 21 | } 22 | 23 | SkGLCanvas canvas(gGpu); 24 | SkBitmap bm; 25 | 26 | bm.setConfig(SkBitmap::kARGB_8888_Config, WIDTH, HEIGHT); 27 | canvas.setBitmapDevice(bm); 28 | 29 | canvas.drawColor(SK_ColorWHITE); 30 | 31 | SkPaint paint; 32 | paint.setAntiAlias(true); 33 | paint.setTextSize(30); 34 | canvas.drawText("Hello Kno", 9, 40, 40, paint); 35 | } 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/images/SkImageEncoder_Factory.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2009 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkImageEncoder.h" 11 | #include "SkTRegistry.h" 12 | 13 | typedef SkTRegistry EncodeReg; 14 | 15 | // Can't use the typedef here because of complex C++ corner cases 16 | template EncodeReg* SkTRegistry::gHead; 17 | 18 | #ifdef SK_ENABLE_LIBPNG 19 | extern SkImageEncoder* sk_libpng_efactory(SkImageEncoder::Type); 20 | #endif 21 | 22 | SkImageEncoder* SkImageEncoder::Create(Type t) { 23 | SkImageEncoder* codec = NULL; 24 | const EncodeReg* curr = EncodeReg::Head(); 25 | while (curr) { 26 | if ((codec = curr->factory()(t)) != NULL) { 27 | return codec; 28 | } 29 | curr = curr->next(); 30 | } 31 | #ifdef SK_ENABLE_LIBPNG 32 | if ((codec = sk_libpng_efactory(t)) != NULL) { 33 | return codec; 34 | } 35 | #endif 36 | return NULL; 37 | } 38 | -------------------------------------------------------------------------------- /src/images/SkImageRefPool.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | #ifndef SkImageRefPool_DEFINED 9 | #define SkImageRefPool_DEFINED 10 | 11 | #include "SkTypes.h" 12 | 13 | class SkImageRef; 14 | class SkImageRef_GlobalPool; 15 | 16 | class SkImageRefPool { 17 | public: 18 | SkImageRefPool(); 19 | ~SkImageRefPool(); 20 | 21 | size_t getRAMBudget() const { return fRAMBudget; } 22 | void setRAMBudget(size_t); 23 | 24 | size_t getRAMUsed() const { return fRAMUsed; } 25 | void setRAMUsed(size_t limit); 26 | 27 | void addToHead(SkImageRef*); 28 | void addToTail(SkImageRef*); 29 | void detach(SkImageRef*); 30 | 31 | void dump() const; 32 | 33 | private: 34 | size_t fRAMBudget; 35 | size_t fRAMUsed; 36 | 37 | int fCount; 38 | SkImageRef* fHead, *fTail; 39 | 40 | int computeCount() const; 41 | 42 | friend class SkImageRef_GlobalPool; 43 | 44 | void justAddedPixels(SkImageRef*); 45 | void canLosePixels(SkImageRef*); 46 | void purgeIfNeeded(); 47 | }; 48 | 49 | #endif 50 | 51 | -------------------------------------------------------------------------------- /src/opts/SkBitmapProcState_opts_SSSE3.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkBitmapProcState.h" 9 | 10 | void S32_opaque_D32_filter_DX_SSSE3(const SkBitmapProcState& s, 11 | const uint32_t* xy, 12 | int count, uint32_t* colors); 13 | void S32_alpha_D32_filter_DX_SSSE3(const SkBitmapProcState& s, 14 | const uint32_t* xy, 15 | int count, uint32_t* colors); 16 | void S32_opaque_D32_filter_DXDY_SSSE3(const SkBitmapProcState& s, 17 | const uint32_t* xy, 18 | int count, uint32_t* colors); 19 | void S32_alpha_D32_filter_DXDY_SSSE3(const SkBitmapProcState& s, 20 | const uint32_t* xy, 21 | int count, uint32_t* colors); 22 | -------------------------------------------------------------------------------- /src/opts/SkBitmapProcState_opts_none.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | #include "SkBitmapProcState.h" 9 | 10 | /* A platform may optionally overwrite any of these with accelerated 11 | versions. On input, these will already have valid function pointers, 12 | so a platform need only overwrite the ones it chooses, based on the 13 | current state (e.g. fBitmap, fInvMatrix, etc.) 14 | 15 | fShaderProc32 16 | fShaderProc16 17 | fMatrixProc 18 | fSampleProc32 19 | fSampleProc32 20 | */ 21 | 22 | // empty implementation just uses default supplied function pointers 23 | void SkBitmapProcState::platformProcs() {} 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/opts/SkBlitRect_opts_SSE2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkBlitRect_opts_SSE2_DEFINED 9 | #define SkBlitRect_opts_SSE2_DEFINED 10 | 11 | /* 12 | These functions' implementations copy sections of both 13 | SkBlitRow_opts_SSE2 and SkUtils_opts_SSE2. 14 | */ 15 | 16 | #include "SkColor.h" 17 | 18 | void ColorRect32_SSE2(SkPMColor* SK_RESTRICT dst, 19 | int width, int height, 20 | size_t rowBytes, uint32_t color); 21 | 22 | 23 | #endif 24 | 25 | -------------------------------------------------------------------------------- /src/opts/SkUtils_opts_SSE2.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2009 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkTypes.h" 11 | 12 | void sk_memset16_SSE2(uint16_t *dst, uint16_t value, int count); 13 | void sk_memset32_SSE2(uint32_t *dst, uint32_t value, int count); 14 | -------------------------------------------------------------------------------- /src/opts/SkUtils_opts_none.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2009 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkBlitRow.h" 11 | #include "SkUtils.h" 12 | 13 | SkMemset16Proc SkMemset16GetPlatformProc() { 14 | return NULL; 15 | } 16 | 17 | SkMemset32Proc SkMemset32GetPlatformProc() { 18 | return NULL; 19 | } 20 | 21 | SkBlitRow::ColorRectProc PlatformColorRectProcFactory() { 22 | return NULL; 23 | } 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/ports/SkDebug_android.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkTypes.h" 11 | 12 | static const size_t kBufferSize = 256; 13 | 14 | #define LOG_TAG "skia" 15 | #include 16 | 17 | void SkDebugf(const char format[], ...) { 18 | va_list args; 19 | va_start(args, format); 20 | __android_log_vprint(ANDROID_LOG_DEBUG, LOG_TAG, format, args); 21 | va_end(args); 22 | } 23 | -------------------------------------------------------------------------------- /src/ports/SkDebug_brew.cpp: -------------------------------------------------------------------------------- 1 | /* libs/corecg/SkDebug_brew.cpp 2 | * 3 | * Copyright 2009, The Android Open Source Project 4 | * Copyright 2009, Company 100, Inc. 5 | * 6 | * Use of this source code is governed by a BSD-style license that can be 7 | * found in the LICENSE file. 8 | */ 9 | 10 | #include "SkTypes.h" 11 | 12 | #ifdef SK_BUILD_FOR_BREW 13 | 14 | static const size_t kBufferSize = 256; 15 | 16 | #include 17 | #include 18 | 19 | void SkDebugf(const char format[], ...) { 20 | char buffer[kBufferSize + 1]; 21 | va_list args; 22 | va_start(args, format); 23 | VSNPRINTF(buffer, kBufferSize, format, args); 24 | va_end(args); 25 | DBGPRINTF(buffer); 26 | } 27 | 28 | #endif SK_BUILD_FOR_BREW 29 | -------------------------------------------------------------------------------- /src/ports/SkDebug_stdio.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkTypes.h" 11 | 12 | static const size_t kBufferSize = 2048; 13 | 14 | #include 15 | #include 16 | 17 | void SkDebugf(const char format[], ...) { 18 | char buffer[kBufferSize + 1]; 19 | va_list args; 20 | va_start(args, format); 21 | vsnprintf(buffer, kBufferSize, format, args); 22 | va_end(args); 23 | fprintf(stderr, "%s", buffer); 24 | } 25 | 26 | -------------------------------------------------------------------------------- /src/ports/SkDebug_win.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2010 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | 11 | #include "SkTypes.h" 12 | 13 | static const size_t kBufferSize = 2048; 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | void SkDebugf(const char format[], ...) { 20 | char buffer[kBufferSize + 1]; 21 | va_list args; 22 | va_start(args, format); 23 | vsnprintf(buffer, kBufferSize, format, args); 24 | va_end(args); 25 | 26 | OutputDebugStringA(buffer); 27 | printf(buffer); 28 | } 29 | 30 | -------------------------------------------------------------------------------- /src/ports/SkFontHost_gamma_none.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2008 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | // ----------------------------------------------------------------------------- 11 | // This is a noop gamma implementation for systems where gamma is already 12 | // corrected, or dealt with in a system wide fashion. For example, on X windows 13 | // one uses the xgamma utility to set the server-wide gamma correction value. 14 | // ----------------------------------------------------------------------------- 15 | 16 | #include "SkFontHost.h" 17 | 18 | void SkFontHost::GetGammaTables(const uint8_t* tables[2]) 19 | { 20 | tables[0] = NULL; 21 | tables[1] = NULL; 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/ports/SkFontHost_mac.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | 11 | /* 12 | ** Mac Text API 13 | ** 14 | ** 15 | ** Two text APIs are available on the Mac, ATSUI and CoreText. 16 | ** 17 | ** ATSUI is available on all versions of Mac OS X, but is 32-bit only. 18 | ** 19 | ** The replacement API, CoreText, supports both 32-bit and 64-bit builds 20 | ** but is only available from Mac OS X 10.5 onwards. 21 | ** 22 | ** To maintain support for Mac OS X 10.4, we default to ATSUI in 32-bit 23 | ** builds unless SK_USE_CORETEXT is defined. 24 | */ 25 | #ifndef SK_USE_CORETEXT 26 | #if TARGET_RT_64_BIT || defined(SK_USE_MAC_CORE_TEXT) 27 | #define SK_USE_CORETEXT 1 28 | #else 29 | #define SK_USE_CORETEXT 0 30 | #endif 31 | #endif 32 | 33 | #if SK_USE_CORETEXT 34 | #include "SkFontHost_mac_coretext.cpp" 35 | #else 36 | #include "SkFontHost_mac_atsui.cpp" 37 | #endif 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/ports/SkFontHost_sandbox_none.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkFontHost.h" 9 | #include "SkTypeface.h" 10 | 11 | //static 12 | void SkFontHost::EnsureTypefaceAccessible(const SkTypeface& typeface) { 13 | //No sandbox, nothing to do. 14 | } 15 | -------------------------------------------------------------------------------- /src/ports/SkGlobalInitialization_chromium.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkBitmapProcShader.h" 9 | #include "SkBlurImageFilter.h" 10 | #include "SkBlurMaskFilter.h" 11 | #include "SkColorFilter.h" 12 | #include "SkCornerPathEffect.h" 13 | #include "SkDashPathEffect.h" 14 | #include "SkGradientShader.h" 15 | #include "SkLayerDrawLooper.h" 16 | #include "SkMallocPixelRef.h" 17 | #include "SkXfermode.h" 18 | 19 | void SkFlattenable::InitializeFlattenables() { 20 | 21 | SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBitmapProcShader) 22 | SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurImageFilter) 23 | SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkCornerPathEffect) 24 | SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDashPathEffect) 25 | SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLayerDrawLooper) 26 | SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMallocPixelRef) 27 | 28 | SkBlurMaskFilter::InitializeFlattenables(); 29 | SkColorFilter::InitializeFlattenables(); 30 | SkGradientShader::InitializeFlattenables(); 31 | SkXfermode::InitializeFlattenables(); 32 | } 33 | -------------------------------------------------------------------------------- /src/ports/SkMemory_malloc.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | #include "SkTypes.h" 9 | #include 10 | #include 11 | 12 | void sk_throw() { 13 | SkDEBUGFAIL("sk_throw"); 14 | abort(); 15 | } 16 | 17 | void sk_out_of_memory(void) { 18 | SkDEBUGFAIL("sk_out_of_memory"); 19 | abort(); 20 | } 21 | 22 | void* sk_malloc_throw(size_t size) { 23 | return sk_malloc_flags(size, SK_MALLOC_THROW); 24 | } 25 | 26 | void* sk_realloc_throw(void* addr, size_t size) { 27 | void* p = realloc(addr, size); 28 | if (size == 0) { 29 | return p; 30 | } 31 | if (p == NULL) { 32 | sk_throw(); 33 | } 34 | return p; 35 | } 36 | 37 | void sk_free(void* p) { 38 | if (p) { 39 | free(p); 40 | } 41 | } 42 | 43 | void* sk_malloc_flags(size_t size, unsigned flags) { 44 | void* p = malloc(size); 45 | if (p == NULL) { 46 | if (flags & SK_MALLOC_THROW) { 47 | sk_throw(); 48 | } 49 | } 50 | return p; 51 | } 52 | 53 | -------------------------------------------------------------------------------- /src/ports/SkThread_none.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkThread.h" 11 | 12 | int32_t sk_atomic_inc(int32_t* addr) { 13 | int32_t value = *addr; 14 | *addr = value + 1; 15 | return value; 16 | } 17 | 18 | int32_t sk_atomic_dec(int32_t* addr) { 19 | int32_t value = *addr; 20 | *addr = value - 1; 21 | return value; 22 | } 23 | 24 | SkMutex::SkMutex() {} 25 | 26 | SkMutex::~SkMutex() {} 27 | 28 | void SkMutex::acquire() {} 29 | 30 | void SkMutex::release() {} 31 | 32 | -------------------------------------------------------------------------------- /src/ports/SkTime_Unix.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkTime.h" 11 | 12 | #include 13 | #include 14 | 15 | void SkTime::GetDateTime(DateTime* dt) 16 | { 17 | if (dt) 18 | { 19 | time_t m_time; 20 | time(&m_time); 21 | struct tm* tstruct; 22 | tstruct = localtime(&m_time); 23 | 24 | dt->fYear = tstruct->tm_year; 25 | dt->fMonth = SkToU8(tstruct->tm_mon + 1); 26 | dt->fDayOfWeek = SkToU8(tstruct->tm_wday); 27 | dt->fDay = SkToU8(tstruct->tm_mday); 28 | dt->fHour = SkToU8(tstruct->tm_hour); 29 | dt->fMinute = SkToU8(tstruct->tm_min); 30 | dt->fSecond = SkToU8(tstruct->tm_sec); 31 | } 32 | } 33 | 34 | SkMSec SkTime::GetMSecs() 35 | { 36 | struct timeval tv; 37 | gettimeofday(&tv, NULL); 38 | return (SkMSec) (tv.tv_sec * 1000 + tv.tv_usec / 1000 ); // microseconds to milliseconds 39 | } 40 | -------------------------------------------------------------------------------- /src/ports/SkTime_win.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2009 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkTime.h" 11 | 12 | void SkTime::GetDateTime(DateTime* dt) 13 | { 14 | if (dt) 15 | { 16 | SYSTEMTIME st; 17 | GetSystemTime(&st); 18 | 19 | dt->fYear = st.wYear; 20 | dt->fMonth = SkToU8(st.wMonth + 1); 21 | dt->fDayOfWeek = SkToU8(st.wDayOfWeek); 22 | dt->fDay = SkToU8(st.wDay); 23 | dt->fHour = SkToU8(st.wHour); 24 | dt->fMinute = SkToU8(st.wMinute); 25 | dt->fSecond = SkToU8(st.wSecond); 26 | } 27 | } 28 | 29 | SkMSec SkTime::GetMSecs() 30 | { 31 | FILETIME ft; 32 | LARGE_INTEGER li; 33 | GetSystemTimeAsFileTime(&ft); 34 | li.LowPart = ft.dwLowDateTime; 35 | li.HighPart = ft.dwHighDateTime; 36 | __int64 t = li.QuadPart; /* In 100-nanosecond intervals */ 37 | return (SkMSec)(t / 10000); /* In milliseconds */ 38 | } 39 | -------------------------------------------------------------------------------- /src/ports/SkXMLParser_empty.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 The Android Open Source Project 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkXMLParser.h" 9 | 10 | bool SkXMLParser::parse(SkStream& docStream) 11 | { 12 | return false; 13 | } 14 | 15 | bool SkXMLParser::parse(const char doc[], size_t len) 16 | { 17 | return false; 18 | } 19 | 20 | void SkXMLParser::GetNativeErrorString(int error, SkString* str) 21 | { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/sfnt/SkOTTableTypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkOTTableTypes_DEFINED 9 | #define SkOTTableTypes_DEFINED 10 | 11 | #include "SkTypes.h" 12 | #include "SkEndian.h" 13 | 14 | //All SK_OT_ prefixed types should be considered as big endian. 15 | typedef uint8_t SK_OT_BYTE; 16 | #if CHAR_BIT == 8 17 | typedef signed char SK_OT_CHAR; //easier to debug 18 | #else 19 | typedef int8_t SK_OT_CHAR; 20 | #endif 21 | typedef int16_t SK_OT_SHORT; 22 | typedef uint16_t SK_OT_USHORT; 23 | typedef uint32_t SK_OT_ULONG; 24 | typedef int32_t SK_OT_LONG; 25 | //16.16 Fixed point representation. 26 | typedef int32_t SK_OT_Fixed; 27 | //F units are the units of measurement in em space. 28 | typedef int16_t SK_OT_FWORD; 29 | typedef uint16_t SK_OT_UFWORD; 30 | //Number of seconds since 12:00 midnight, January 1, 1904. 31 | typedef uint64_t SK_OT_LONGDATETIME; 32 | 33 | #define SK_OT_BYTE_BITFIELD SK_UINT8_BITFIELD 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/sfnt/SkOTUtils.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkOTTableTypes.h" 9 | #include "SkOTUtils.h" 10 | 11 | uint32_t SkOTUtils::CalcTableChecksum(SK_OT_ULONG *data, size_t length) { 12 | uint32_t sum = 0; 13 | SK_OT_ULONG *dataEnd = data + ((length + 3) & ~3) / sizeof(SK_OT_ULONG); 14 | for (; data < dataEnd; ++data) { 15 | sum += SkEndian_SwapBE32(*data); 16 | } 17 | return sum; 18 | } 19 | -------------------------------------------------------------------------------- /src/sfnt/SkOTUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkOTUtils_DEFINED 9 | #define SkOTUtils_DEFINED 10 | 11 | #include "SkOTTableTypes.h" 12 | 13 | struct SkOTUtils { 14 | static uint32_t CalcTableChecksum(SK_OT_ULONG *data, size_t length); 15 | }; 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/svg/SkSVG.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkSVG.h" 11 | #include 'SkSVGParser.h" 12 | 13 | SkSVG::SkSVG() { 14 | } 15 | 16 | SkSVG::~SkSVG() { 17 | } 18 | 19 | bool SkSVG::decodeStream(SkStream* stream); 20 | { 21 | size_t size = stream->read(nil, 0); 22 | SkAutoMalloc storage(size); 23 | char* data = (char*)storage.get(); 24 | size_t actual = stream->read(data, size); 25 | SkASSERT(size == actual); 26 | SkSVGParser parser(*fMaker); 27 | return parser.parse(data, actual, &fErrorCode, &fErrorLineNumber); 28 | } 29 | -------------------------------------------------------------------------------- /src/svg/SkSVGCircle.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSVGCircle_DEFINED 11 | #define SkSVGCircle_DEFINED 12 | 13 | #include "SkSVGElements.h" 14 | 15 | class SkSVGCircle : public SkSVGElement { 16 | DECLARE_SVG_INFO(Circle); 17 | private: 18 | SkString f_cx; 19 | SkString f_cy; 20 | SkString f_r; 21 | typedef SkSVGElement INHERITED; 22 | }; 23 | 24 | #endif // SkSVGCircle_DEFINED 25 | -------------------------------------------------------------------------------- /src/svg/SkSVGClipPath.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkSVGClipPath.h" 11 | #include "SkSVGParser.h" 12 | #include "SkSVGUse.h" 13 | 14 | DEFINE_SVG_NO_INFO(ClipPath) 15 | 16 | bool SkSVGClipPath::isDef() { 17 | return true; 18 | } 19 | 20 | bool SkSVGClipPath::isNotDef() { 21 | return false; 22 | } 23 | 24 | void SkSVGClipPath::translate(SkSVGParser& parser, bool defState) { 25 | parser._startElement("clip"); 26 | INHERITED::translate(parser, defState); 27 | SkASSERT(fChildren.count() == 1); 28 | SkSVGElement* child = *fChildren.begin(); 29 | SkASSERT(child->getType() == SkSVGType_Use); 30 | SkSVGUse* use = (SkSVGUse*) child; 31 | SkSVGElement* ref = NULL; 32 | const char* refStr = &use->f_xlink_href.c_str()[1]; 33 | SkASSERT(parser.getIDs().find(refStr, &ref)); 34 | SkASSERT(ref); 35 | if (ref->getType() == SkSVGType_Rect) 36 | parser._addAttribute("rectangle", refStr); 37 | else 38 | parser._addAttribute("path", refStr); 39 | parser._endElement(); 40 | } 41 | -------------------------------------------------------------------------------- /src/svg/SkSVGClipPath.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSVGClipPath_DEFINED 11 | #define SkSVGClipPath_DEFINED 12 | 13 | #include "SkSVGElements.h" 14 | 15 | class SkSVGClipPath : public SkSVGElement { 16 | DECLARE_SVG_INFO(ClipPath); 17 | virtual bool isDef(); 18 | virtual bool isNotDef(); 19 | private: 20 | typedef SkSVGElement INHERITED; 21 | }; 22 | 23 | #endif // SkSVGClipPath_DEFINED 24 | -------------------------------------------------------------------------------- /src/svg/SkSVGDefs.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkSVGDefs.h" 11 | 12 | DEFINE_SVG_NO_INFO(Defs) 13 | 14 | bool SkSVGDefs::isDef() { 15 | return true; 16 | } 17 | 18 | bool SkSVGDefs::isNotDef() { 19 | return false; 20 | } 21 | 22 | void SkSVGDefs::translate(SkSVGParser& parser, bool defState) { 23 | INHERITED::translate(parser, defState); 24 | } 25 | -------------------------------------------------------------------------------- /src/svg/SkSVGDefs.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSVGDefs_DEFINED 11 | #define SkSVGDefs_DEFINED 12 | 13 | #include "SkSVGGroup.h" 14 | 15 | class SkSVGDefs : public SkSVGGroup { 16 | DECLARE_SVG_INFO(Defs); 17 | virtual bool isDef(); 18 | virtual bool isNotDef(); 19 | private: 20 | typedef SkSVGGroup INHERITED; 21 | }; 22 | 23 | #endif // SkSVGDefs_DEFINED 24 | -------------------------------------------------------------------------------- /src/svg/SkSVGEllipse.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSVGEllipse_DEFINED 11 | #define SkSVGEllipse_DEFINED 12 | 13 | #include "SkSVGElements.h" 14 | 15 | class SkSVGEllipse : public SkSVGElement { 16 | DECLARE_SVG_INFO(Ellipse); 17 | private: 18 | SkString f_cx; 19 | SkString f_cy; 20 | SkString f_rx; 21 | SkString f_ry; 22 | typedef SkSVGElement INHERITED; 23 | }; 24 | 25 | #endif // SkSVGEllipse_DEFINED 26 | -------------------------------------------------------------------------------- /src/svg/SkSVGFeColorMatrix.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkSVGFeColorMatrix.h" 11 | #include "SkSVGParser.h" 12 | 13 | const SkSVGAttribute SkSVGFeColorMatrix::gAttributes[] = { 14 | SVG_LITERAL_ATTRIBUTE(color-interpolation-filters, f_color_interpolation_filters), 15 | SVG_ATTRIBUTE(result), 16 | SVG_ATTRIBUTE(type), 17 | SVG_ATTRIBUTE(values) 18 | }; 19 | 20 | DEFINE_SVG_INFO(FeColorMatrix) 21 | 22 | void SkSVGFeColorMatrix::translate(SkSVGParser& parser, bool defState) { 23 | INHERITED::translate(parser, defState); 24 | } 25 | -------------------------------------------------------------------------------- /src/svg/SkSVGFeColorMatrix.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSVGFeColorMatrix_DEFINED 11 | #define SkSVGFeColorMatrix_DEFINED 12 | 13 | #include "SkSVGElements.h" 14 | 15 | class SkSVGFeColorMatrix : public SkSVGElement { 16 | DECLARE_SVG_INFO(FeColorMatrix); 17 | protected: 18 | SkString f_color_interpolation_filters; 19 | SkString f_result; 20 | SkString f_type; 21 | SkString f_values; 22 | private: 23 | typedef SkSVGElement INHERITED; 24 | }; 25 | 26 | #endif // SkSVGFeColorMatrix_DEFINED 27 | -------------------------------------------------------------------------------- /src/svg/SkSVGFilter.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkSVGFilter.h" 11 | #include "SkSVGParser.h" 12 | 13 | const SkSVGAttribute SkSVGFilter::gAttributes[] = { 14 | SVG_ATTRIBUTE(filterUnits), 15 | SVG_ATTRIBUTE(height), 16 | SVG_ATTRIBUTE(width), 17 | SVG_ATTRIBUTE(x), 18 | SVG_ATTRIBUTE(y) 19 | }; 20 | 21 | DEFINE_SVG_INFO(Filter) 22 | 23 | void SkSVGFilter::translate(SkSVGParser& parser, bool defState) { 24 | // INHERITED::translate(parser, defState); 25 | } 26 | -------------------------------------------------------------------------------- /src/svg/SkSVGFilter.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSVGFilter_DEFINED 11 | #define SkSVGFilter_DEFINED 12 | 13 | #include "SkSVGElements.h" 14 | 15 | class SkSVGFilter : public SkSVGElement { 16 | DECLARE_SVG_INFO(Filter); 17 | protected: 18 | SkString f_filterUnits; 19 | SkString f_height; 20 | SkString f_width; 21 | SkString f_x; 22 | SkString f_y; 23 | private: 24 | typedef SkSVGElement INHERITED; 25 | }; 26 | 27 | #endif // SkSVGFilter_DEFINEDRITED; 28 | 29 | -------------------------------------------------------------------------------- /src/svg/SkSVGG.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkSVGG.h" 11 | 12 | DEFINE_SVG_NO_INFO(G) 13 | 14 | void SkSVGG::translate(SkSVGParser& parser, bool defState) { 15 | INHERITED::translate(parser, defState); 16 | } 17 | -------------------------------------------------------------------------------- /src/svg/SkSVGG.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSVGG_DEFINED 11 | #define SkSVGG_DEFINED 12 | 13 | #include "SkSVGGroup.h" 14 | 15 | class SkSVGG : public SkSVGGroup { 16 | DECLARE_SVG_INFO(G); 17 | private: 18 | typedef SkSVGGroup INHERITED; 19 | }; 20 | 21 | #endif // SkSVGG_DEFINED 22 | -------------------------------------------------------------------------------- /src/svg/SkSVGGradient.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSVGGradient_DEFINED 11 | #define SkSVGGradient_DEFINED 12 | 13 | #include "SkSVGElements.h" 14 | 15 | class SkSVGGradient : public SkSVGElement { 16 | public: 17 | SkSVGGradient(); 18 | virtual SkSVGElement* getGradient(); 19 | virtual bool isDef(); 20 | virtual bool isNotDef(); 21 | virtual void write(SkSVGParser& , SkString& color); 22 | protected: 23 | void translate(SkSVGParser& , bool defState); 24 | void translateGradientUnits(SkString& units); 25 | private: 26 | typedef SkSVGElement INHERITED; 27 | }; 28 | 29 | #endif // SkSVGGradient_DEFINED 30 | -------------------------------------------------------------------------------- /src/svg/SkSVGGroup.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkSVGGroup.h" 11 | #include "SkSVGParser.h" 12 | 13 | SkSVGGroup::SkSVGGroup() { 14 | fIsNotDef = false; 15 | } 16 | 17 | SkSVGElement* SkSVGGroup::getGradient() { 18 | for (SkSVGElement** ptr = fChildren.begin(); ptr < fChildren.end(); ptr++) { 19 | SkSVGElement* result = (*ptr)->getGradient(); 20 | if (result != NULL) 21 | return result; 22 | } 23 | return NULL; 24 | } 25 | 26 | bool SkSVGGroup::isDef() { 27 | return fParent ? fParent->isDef() : false; 28 | } 29 | 30 | bool SkSVGGroup::isFlushable() { 31 | return false; 32 | } 33 | 34 | bool SkSVGGroup::isGroup() { 35 | return true; 36 | } 37 | 38 | bool SkSVGGroup::isNotDef() { 39 | return fParent ? fParent->isNotDef() : false; 40 | } 41 | 42 | void SkSVGGroup::translate(SkSVGParser& parser, bool defState) { 43 | for (SkSVGElement** ptr = fChildren.begin(); ptr < fChildren.end(); ptr++) 44 | parser.translate(*ptr, defState); 45 | } 46 | -------------------------------------------------------------------------------- /src/svg/SkSVGGroup.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSVGGroup_DEFINED 11 | #define SkSVGGroup_DEFINED 12 | 13 | #include "SkSVGElements.h" 14 | 15 | class SkSVGGroup : public SkSVGElement { 16 | public: 17 | SkSVGGroup(); 18 | virtual SkSVGElement* getGradient(); 19 | virtual bool isDef(); 20 | virtual bool isFlushable(); 21 | virtual bool isGroup(); 22 | virtual bool isNotDef(); 23 | void translate(SkSVGParser& , bool defState); 24 | private: 25 | typedef SkSVGElement INHERITED; 26 | }; 27 | 28 | #endif // SkSVGGroup_DEFINED 29 | -------------------------------------------------------------------------------- /src/svg/SkSVGImage.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSVGImage_DEFINED 11 | #define SkSVGImage_DEFINED 12 | 13 | #include "SkSVGElements.h" 14 | 15 | class SkSVGImage : public SkSVGElement { 16 | public: 17 | DECLARE_SVG_INFO(Image); 18 | private: 19 | void translateImage(SkSVGParser& parser); 20 | SkString f_height; 21 | SkString f_width; 22 | SkString f_x; 23 | SkString f_xlink_href; 24 | SkString f_y; 25 | typedef SkSVGElement INHERITED; 26 | }; 27 | 28 | #endif // SkSVGImage_DEFINED 29 | -------------------------------------------------------------------------------- /src/svg/SkSVGLine.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkSVGLine.h" 11 | #include "SkSVGParser.h" 12 | 13 | const SkSVGAttribute SkSVGLine::gAttributes[] = { 14 | SVG_ATTRIBUTE(x1), 15 | SVG_ATTRIBUTE(x2), 16 | SVG_ATTRIBUTE(y1), 17 | SVG_ATTRIBUTE(y2) 18 | }; 19 | 20 | DEFINE_SVG_INFO(Line) 21 | 22 | void SkSVGLine::translate(SkSVGParser& parser, bool defState) { 23 | parser._startElement("line"); 24 | INHERITED::translate(parser, defState); 25 | SVG_ADD_ATTRIBUTE(x1); 26 | SVG_ADD_ATTRIBUTE(y1); 27 | SVG_ADD_ATTRIBUTE(x2); 28 | SVG_ADD_ATTRIBUTE(y2); 29 | parser._endElement(); 30 | } 31 | -------------------------------------------------------------------------------- /src/svg/SkSVGLine.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSVGLine_DEFINED 11 | #define SkSVGLine_DEFINED 12 | 13 | #include "SkSVGElements.h" 14 | 15 | class SkSVGLine : public SkSVGElement { 16 | DECLARE_SVG_INFO(Line); 17 | private: 18 | SkString f_x1; 19 | SkString f_x2; 20 | SkString f_y1; 21 | SkString f_y2; 22 | typedef SkSVGElement INHERITED; 23 | }; 24 | 25 | #endif // SkSVGLine_DEFINED 26 | -------------------------------------------------------------------------------- /src/svg/SkSVGLinearGradient.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSVGLinearGradient_DEFINED 11 | #define SkSVGLinearGradient_DEFINED 12 | 13 | #include "SkSVGGradient.h" 14 | 15 | class SkSVGLinearGradient : public SkSVGGradient { 16 | DECLARE_SVG_INFO(LinearGradient); 17 | private: 18 | SkString f_gradientTransform; 19 | SkString f_gradientUnits; 20 | SkString f_x1; 21 | SkString f_x2; 22 | SkString f_y1; 23 | SkString f_y2; 24 | SkString fMatrixID; 25 | typedef SkSVGGradient INHERITED; 26 | }; 27 | 28 | #endif // SkSVGLinearGradient_DEFINED 29 | -------------------------------------------------------------------------------- /src/svg/SkSVGMask.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkSVGMask.h" 11 | #include "SkSVGParser.h" 12 | 13 | const SkSVGAttribute SkSVGMask::gAttributes[] = { 14 | SVG_ATTRIBUTE(height), 15 | SVG_ATTRIBUTE(maskUnits), 16 | SVG_ATTRIBUTE(width), 17 | SVG_ATTRIBUTE(x), 18 | SVG_ATTRIBUTE(y) 19 | }; 20 | 21 | DEFINE_SVG_INFO(Mask) 22 | 23 | bool SkSVGMask::isDef() { 24 | return false; 25 | } 26 | 27 | bool SkSVGMask::isNotDef() { 28 | return false; 29 | } 30 | 31 | void SkSVGMask::translate(SkSVGParser& parser, bool defState) { 32 | INHERITED::translate(parser, defState); 33 | } 34 | -------------------------------------------------------------------------------- /src/svg/SkSVGMask.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSVGMask_DEFINED 11 | #define SkSVGMask_DEFINED 12 | 13 | #include "SkSVGGroup.h" 14 | 15 | class SkSVGMask : public SkSVGGroup { 16 | DECLARE_SVG_INFO(Mask); 17 | virtual bool isDef(); 18 | virtual bool isNotDef(); 19 | protected: 20 | SkString f_height; 21 | SkString f_maskUnits; 22 | SkString f_width; 23 | SkString f_x; 24 | SkString f_y; 25 | private: 26 | typedef SkSVGGroup INHERITED; 27 | }; 28 | 29 | #endif // SkSVGMask_DEFINED 30 | -------------------------------------------------------------------------------- /src/svg/SkSVGMetadata.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkSVGMetadata.h" 11 | #include "SkSVGParser.h" 12 | 13 | DEFINE_SVG_NO_INFO(Metadata) 14 | 15 | bool SkSVGMetadata::isDef() { 16 | return false; 17 | } 18 | 19 | bool SkSVGMetadata::isNotDef() { 20 | return false; 21 | } 22 | 23 | void SkSVGMetadata::translate(SkSVGParser& parser, bool defState) { 24 | } 25 | -------------------------------------------------------------------------------- /src/svg/SkSVGMetadata.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSVGMetadata_DEFINED 11 | #define SkSVGMetadata_DEFINED 12 | 13 | #include "SkSVGElements.h" 14 | 15 | class SkSVGMetadata : public SkSVGElement { 16 | DECLARE_SVG_INFO(Metadata); 17 | virtual bool isDef(); 18 | virtual bool isNotDef(); 19 | private: 20 | typedef SkSVGElement INHERITED; 21 | }; 22 | 23 | #endif // SkSVGMetadata_DEFINED 24 | -------------------------------------------------------------------------------- /src/svg/SkSVGPath.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkSVGPath.h" 11 | #include "SkSVGParser.h" 12 | 13 | const SkSVGAttribute SkSVGPath::gAttributes[] = { 14 | SVG_ATTRIBUTE(d) 15 | }; 16 | 17 | DEFINE_SVG_INFO(Path) 18 | 19 | void SkSVGPath::translate(SkSVGParser& parser, bool defState) { 20 | parser._startElement("path"); 21 | INHERITED::translate(parser, defState); 22 | bool hasMultiplePaths = false; 23 | const char* firstZ = strchr(f_d.c_str(), 'z'); 24 | if (firstZ != NULL) { 25 | firstZ++; // skip over 'z' 26 | while (*firstZ == ' ') 27 | firstZ++; 28 | hasMultiplePaths = *firstZ != '\0'; 29 | } 30 | if (hasMultiplePaths) { 31 | SkString& fillRule = parser.getPaintLast(SkSVGPaint::kFillRule); 32 | if (fillRule.size() > 0) 33 | parser._addAttribute("fillType", fillRule.equals("evenodd") ? "evenOdd" : "winding"); 34 | } 35 | SVG_ADD_ATTRIBUTE(d); 36 | parser._endElement(); 37 | } 38 | -------------------------------------------------------------------------------- /src/svg/SkSVGPath.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSVGPath_DEFINED 11 | #define SkSVGPath_DEFINED 12 | 13 | #include "SkSVGElements.h" 14 | 15 | class SkSVGPath : public SkSVGElement { 16 | DECLARE_SVG_INFO(Path); 17 | private: 18 | SkString f_d; 19 | typedef SkSVGElement INHERITED; 20 | }; 21 | 22 | #endif // SkSVGPath_DEFINED 23 | -------------------------------------------------------------------------------- /src/svg/SkSVGPolygon.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkSVGPolygon.h" 11 | #include "SkSVGParser.h" 12 | 13 | const SkSVGAttribute SkSVGPolygon::gAttributes[] = { 14 | SVG_LITERAL_ATTRIBUTE(clip-rule, f_clipRule), 15 | SVG_LITERAL_ATTRIBUTE(fill-rule, f_fillRule), 16 | SVG_ATTRIBUTE(points) 17 | }; 18 | 19 | DEFINE_SVG_INFO(Polygon) 20 | 21 | void SkSVGPolygon::addAttribute(SkSVGParser& parser, int attrIndex, 22 | const char* attrValue, size_t attrLength) { 23 | INHERITED::addAttribute(parser, attrIndex, attrValue, attrLength); 24 | } 25 | 26 | void SkSVGPolygon::translate(SkSVGParser& parser, bool defState) { 27 | parser._startElement("polygon"); 28 | SkSVGElement::translate(parser, defState); 29 | SVG_ADD_ATTRIBUTE(points); 30 | if (f_fillRule.size() > 0) 31 | parser._addAttribute("fillType", f_fillRule.equals("evenodd") ? "evenOdd" : "winding"); 32 | parser._endElement(); 33 | } 34 | -------------------------------------------------------------------------------- /src/svg/SkSVGPolygon.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSVGPolygon_DEFINED 11 | #define SkSVGPolygon_DEFINED 12 | 13 | #include "SkSVGPolyline.h" 14 | 15 | class SkSVGPolygon : public SkSVGPolyline { 16 | DECLARE_SVG_INFO(Polygon); 17 | virtual void addAttribute(SkSVGParser& , int attrIndex, 18 | const char* attrValue, size_t attrLength); 19 | private: 20 | typedef SkSVGPolyline INHERITED; 21 | }; 22 | 23 | #endif // SkSVGPolygon_DEFINED 24 | -------------------------------------------------------------------------------- /src/svg/SkSVGPolyline.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSVGPolyline_DEFINED 11 | #define SkSVGPolyline_DEFINED 12 | 13 | #include "SkSVGElements.h" 14 | #include "SkString.h" 15 | 16 | class SkSVGPolyline : public SkSVGElement { 17 | DECLARE_SVG_INFO(Polyline); 18 | virtual void addAttribute(SkSVGParser& , int attrIndex, 19 | const char* attrValue, size_t attrLength); 20 | protected: 21 | SkString f_clipRule; 22 | SkString f_fillRule; 23 | SkString f_points; 24 | typedef SkSVGElement INHERITED; 25 | }; 26 | 27 | #endif // SkSVGPolyline_DEFINED 28 | -------------------------------------------------------------------------------- /src/svg/SkSVGRadialGradient.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSVGRadialGradient_DEFINED 11 | #define SkSVGRadialGradient_DEFINED 12 | 13 | #include "SkSVGGradient.h" 14 | 15 | class SkSVGRadialGradient : public SkSVGGradient { 16 | DECLARE_SVG_INFO(RadialGradient); 17 | protected: 18 | SkString f_cx; 19 | SkString f_cy; 20 | SkString f_fx; 21 | SkString f_fy; 22 | SkString f_gradientTransform; 23 | SkString f_gradientUnits; 24 | SkString f_r; 25 | SkString fMatrixID; 26 | private: 27 | typedef SkSVGGradient INHERITED; 28 | }; 29 | 30 | #endif // SkSVGRadialGradient_DEFINED 31 | -------------------------------------------------------------------------------- /src/svg/SkSVGRect.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkSVGRect.h" 11 | #include "SkSVGParser.h" 12 | 13 | const SkSVGAttribute SkSVGRect::gAttributes[] = { 14 | SVG_ATTRIBUTE(height), 15 | SVG_ATTRIBUTE(width), 16 | SVG_ATTRIBUTE(x), 17 | SVG_ATTRIBUTE(y) 18 | }; 19 | 20 | DEFINE_SVG_INFO(Rect) 21 | 22 | SkSVGRect::SkSVGRect() { 23 | f_x.set("0"); 24 | f_y.set("0"); 25 | } 26 | 27 | void SkSVGRect::translate(SkSVGParser& parser, bool defState) { 28 | parser._startElement("rect"); 29 | INHERITED::translate(parser, defState); 30 | SVG_ADD_ATTRIBUTE_ALIAS(left, x); 31 | SVG_ADD_ATTRIBUTE_ALIAS(top, y); 32 | SVG_ADD_ATTRIBUTE(width); 33 | SVG_ADD_ATTRIBUTE(height); 34 | parser._endElement(); 35 | } 36 | -------------------------------------------------------------------------------- /src/svg/SkSVGRect.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSVGRect_DEFINED 11 | #define SkSVGRect_DEFINED 12 | 13 | #include "SkSVGElements.h" 14 | 15 | class SkSVGRect : public SkSVGElement { 16 | DECLARE_SVG_INFO(Rect); 17 | SkSVGRect(); 18 | private: 19 | SkString f_height; 20 | SkString f_width; 21 | SkString f_x; 22 | SkString f_y; 23 | typedef SkSVGElement INHERITED; 24 | }; 25 | 26 | #endif // SkSVGRect_DEFINED 27 | -------------------------------------------------------------------------------- /src/svg/SkSVGSVG.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSVGSVG_DEFINED 11 | #define SkSVGSVG_DEFINED 12 | 13 | #include "SkSVGElements.h" 14 | 15 | class SkSVGSVG : public SkSVGElement { 16 | DECLARE_SVG_INFO(SVG); 17 | virtual bool isFlushable(); 18 | private: 19 | SkString f_enable_background; 20 | SkString f_height; 21 | SkString f_overflow; 22 | SkString f_width; 23 | SkString f_version; 24 | SkString f_viewBox; 25 | SkString f_x; 26 | SkString f_xml_space; 27 | SkString f_xmlns; 28 | SkString f_xml_xlink; 29 | SkString f_y; 30 | 31 | typedef SkSVGElement INHERITED; 32 | }; 33 | 34 | #endif // SkSVGSVG_DEFINED 35 | -------------------------------------------------------------------------------- /src/svg/SkSVGStop.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkSVGStop.h" 11 | #include "SkSVGParser.h" 12 | 13 | const SkSVGAttribute SkSVGStop::gAttributes[] = { 14 | SVG_ATTRIBUTE(offset) 15 | }; 16 | 17 | DEFINE_SVG_INFO(Stop) 18 | 19 | void SkSVGStop::translate(SkSVGParser& parser, bool defState) { 20 | parser._startElement("color"); 21 | INHERITED::translate(parser, defState); 22 | parser._addAttribute("color", parser.getPaintLast(SkSVGPaint::kStopColor)); 23 | parser._endElement(); 24 | } 25 | -------------------------------------------------------------------------------- /src/svg/SkSVGStop.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSVGStop_DEFINED 11 | #define SkSVGStop_DEFINED 12 | 13 | #include "SkSVGElements.h" 14 | 15 | class SkSVGStop : public SkSVGElement { 16 | DECLARE_SVG_INFO(Stop); 17 | private: 18 | SkString f_offset; 19 | friend class SkSVGGradient; 20 | typedef SkSVGElement INHERITED; 21 | }; 22 | 23 | #endif // SkSVGStop_DEFINED 24 | -------------------------------------------------------------------------------- /src/svg/SkSVGSymbol.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkSVGSymbol.h" 11 | #include "SkSVGParser.h" 12 | 13 | const SkSVGAttribute SkSVGSymbol::gAttributes[] = { 14 | SVG_ATTRIBUTE(viewBox) 15 | }; 16 | 17 | DEFINE_SVG_INFO(Symbol) 18 | 19 | void SkSVGSymbol::translate(SkSVGParser& parser, bool defState) { 20 | INHERITED::translate(parser, defState); 21 | // !!! children need to be written into document 22 | } 23 | -------------------------------------------------------------------------------- /src/svg/SkSVGSymbol.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSVGSymbol_DEFINED 11 | #define SkSVGSymbol_DEFINED 12 | 13 | #include "SkSVGElements.h" 14 | 15 | class SkSVGSymbol : public SkSVGElement { 16 | DECLARE_SVG_INFO(Symbol); 17 | private: 18 | SkString f_viewBox; 19 | typedef SkSVGElement INHERITED; 20 | }; 21 | 22 | #endif // SkSVGSymbol_DEFINED 23 | -------------------------------------------------------------------------------- /src/svg/SkSVGText.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkSVGText.h" 11 | #include "SkSVGParser.h" 12 | 13 | const SkSVGAttribute SkSVGText::gAttributes[] = { 14 | SVG_ATTRIBUTE(x), 15 | SVG_ATTRIBUTE(y) 16 | }; 17 | 18 | DEFINE_SVG_INFO(Text) 19 | 20 | void SkSVGText::translate(SkSVGParser& parser, bool defState) { 21 | parser._startElement("text"); 22 | INHERITED::translate(parser, defState); 23 | SVG_ADD_ATTRIBUTE(x); 24 | SVG_ADD_ATTRIBUTE(y); 25 | SVG_ADD_ATTRIBUTE(text); 26 | parser._endElement(); 27 | } 28 | 29 | 30 | const SkSVGAttribute SkSVGTspan::gAttributes[] = { 31 | SVG_ATTRIBUTE(x), 32 | SVG_ATTRIBUTE(y) 33 | }; 34 | 35 | DEFINE_SVG_INFO(Tspan) 36 | 37 | void SkSVGTspan::translate(SkSVGParser& parser, bool defState) { 38 | INHERITED::translate(parser, defState); 39 | } 40 | -------------------------------------------------------------------------------- /src/svg/SkSVGText.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSVGText_DEFINED 11 | #define SkSVGText_DEFINED 12 | 13 | #include "SkSVGElements.h" 14 | 15 | class SkSVGText : public SkSVGElement { 16 | DECLARE_SVG_INFO(Text); 17 | protected: 18 | SkString f_x; 19 | SkString f_y; 20 | SkString f_text; // not an attribute 21 | private: 22 | typedef SkSVGElement INHERITED; 23 | friend class SkSVGParser; 24 | }; 25 | 26 | class SkSVGTspan : public SkSVGText { 27 | DECLARE_SVG_INFO(Tspan); 28 | private: 29 | typedef SkSVGText INHERITED; 30 | }; 31 | 32 | #endif // SkSVGText_DEFINED 33 | -------------------------------------------------------------------------------- /src/svg/SkSVGUse.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkSVGUse.h" 11 | #include "SkSVGParser.h" 12 | 13 | const SkSVGAttribute SkSVGUse::gAttributes[] = { 14 | SVG_ATTRIBUTE(height), 15 | SVG_ATTRIBUTE(width), 16 | SVG_ATTRIBUTE(x), 17 | SVG_LITERAL_ATTRIBUTE(xlink:href, f_xlink_href), 18 | SVG_ATTRIBUTE(y) 19 | }; 20 | 21 | DEFINE_SVG_INFO(Use) 22 | 23 | void SkSVGUse::translate(SkSVGParser& parser, bool defState) { 24 | INHERITED::translate(parser, defState); 25 | parser._startElement("add"); 26 | const char* start = strchr(f_xlink_href.c_str(), '#') + 1; 27 | SkASSERT(start); 28 | parser._addAttributeLen("use", start, strlen(start) - 1); 29 | parser._endElement(); // clip 30 | } 31 | -------------------------------------------------------------------------------- /src/svg/SkSVGUse.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkSVGUse_DEFINED 11 | #define SkSVGUse_DEFINED 12 | 13 | #include "SkSVGElements.h" 14 | 15 | class SkSVGUse : public SkSVGElement { 16 | DECLARE_SVG_INFO(Use); 17 | protected: 18 | SkString f_height; 19 | SkString f_width; 20 | SkString f_x; 21 | SkString f_xlink_href; 22 | SkString f_y; 23 | private: 24 | typedef SkSVGElement INHERITED; 25 | friend class SkSVGClipPath; 26 | }; 27 | 28 | #endif // SkSVGUse_DEFINED 29 | -------------------------------------------------------------------------------- /src/utils/SkBase64.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkBase64_DEFINED 11 | #define SkBase64_DEFINED 12 | 13 | #include "SkTypes.h" 14 | 15 | struct SkBase64 { 16 | public: 17 | enum Error { 18 | kNoError, 19 | kPadError, 20 | kBadCharError 21 | }; 22 | 23 | SkBase64(); 24 | Error decode(const char* src, size_t length); 25 | char* getData() { return fData; } 26 | /** 27 | Base64 encodes src into dst. encode is a pointer to at least 65 chars. 28 | encode[64] will be used as the pad character. Encodings other than the 29 | default encoding cannot be decoded. 30 | */ 31 | static size_t Encode(const void* src, size_t length, void* dest, const char* encode = NULL); 32 | 33 | #ifdef SK_SUPPORT_UNITTEST 34 | static void UnitTest(); 35 | #endif 36 | private: 37 | Error decode(const void* srcPtr, size_t length, bool writeDestination); 38 | 39 | size_t fLength; 40 | char* fData; 41 | friend class SkImage; 42 | }; 43 | 44 | #endif // SkBase64_DEFINED 45 | -------------------------------------------------------------------------------- /src/utils/SkDebugTrace.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #ifndef SkUserTrace_DEFINED 10 | #define SkUserTrace_DEFINED 11 | 12 | /* Sample implementation of SkUserTrace that routes all of the 13 | trace macros to debug output stream. 14 | To use this, redefine SK_USER_TRACE_INCLUDE_FILE in 15 | include/config/SkUserConfig.h to point to this file 16 | */ 17 | #define SK_TRACE_EVENT0(event) \ 18 | SkDebugf("Trace: %s\n", event) 19 | #define SK_TRACE_EVENT1(event, name1, value1) \ 20 | SkDebugf("Trace: %s (%s=%s)\n", event, name1, value1) 21 | #define SK_TRACE_EVENT2(event, name1, value1, name2, value2) \ 22 | SkDebugf("Trace: %s (%s=%s, %s=%s)\n", event, name1, value1, name2, value2) 23 | 24 | #endif 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/utils/win/SkAutoCoInitialize.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #define WIN32_LEAN_AND_MEAN 11 | #include 12 | #include 13 | #include "SkAutoCoInitialize.h" 14 | 15 | SkAutoCoInitialize::SkAutoCoInitialize() : 16 | fHR( 17 | CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE) 18 | ) 19 | { } 20 | 21 | SkAutoCoInitialize::~SkAutoCoInitialize() { 22 | if (SUCCEEDED(this->fHR)) { 23 | CoUninitialize(); 24 | } 25 | } 26 | 27 | bool SkAutoCoInitialize::succeeded() { 28 | return SUCCEEDED(this->fHR) || RPC_E_CHANGED_MODE == this->fHR; 29 | } 30 | -------------------------------------------------------------------------------- /src/utils/win/SkHRESULT.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkTypes.h" 9 | 10 | #include "SKHRESULT.h" 11 | 12 | void SkTraceHR(const char* file, unsigned long line, 13 | HRESULT hr, const char* msg) { 14 | SkDEBUGCODE(if (NULL != msg) SkDEBUGF(("%s\n", msg))); 15 | SkDEBUGF(("%s(%lu) : error 0x%x: ", file, line, hr)); 16 | 17 | LPSTR errorText = NULL; 18 | FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | 19 | FORMAT_MESSAGE_FROM_SYSTEM | 20 | FORMAT_MESSAGE_IGNORE_INSERTS, 21 | NULL, 22 | hr, 23 | MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 24 | (LPSTR) &errorText, 25 | 0, 26 | NULL 27 | ); 28 | 29 | if (NULL == errorText) { 30 | SkDEBUGF(("\n")); 31 | } else { 32 | SkDEBUGF((errorText)); 33 | LocalFree(errorText); 34 | errorText = NULL; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/views/SkBGViewArtist.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | #include "SkBGViewArtist.h" 9 | #include "SkCanvas.h" 10 | #include "SkParsePaint.h" 11 | 12 | SkBGViewArtist::SkBGViewArtist(SkColor c) 13 | { 14 | fPaint.setColor(c); 15 | } 16 | 17 | SkBGViewArtist::~SkBGViewArtist() 18 | { 19 | } 20 | 21 | void SkBGViewArtist::onDraw(SkView*, SkCanvas* canvas) 22 | { 23 | // only works for views that are clipped their bounds. 24 | canvas->drawPaint(fPaint); 25 | } 26 | 27 | void SkBGViewArtist::onInflate(const SkDOM& dom, const SkDOM::Node* node) 28 | { 29 | SkPaint_Inflate(&fPaint, dom, node); 30 | } 31 | 32 | -------------------------------------------------------------------------------- /src/views/SkTagList.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkTagList_DEFINED 11 | #define SkTagList_DEFINED 12 | 13 | #include "SkTypes.h" 14 | 15 | enum SkTagListEnum { 16 | kListeners_SkTagList, 17 | kViewLayout_SkTagList, 18 | kViewArtist_SkTagList, 19 | 20 | kSkTagListCount 21 | }; 22 | 23 | struct SkTagList { 24 | SkTagList* fNext; 25 | uint16_t fExtra16; 26 | uint8_t fExtra8; 27 | uint8_t fTag; 28 | 29 | SkTagList(U8CPU tag) : fTag(SkToU8(tag)) 30 | { 31 | SkASSERT(tag < kSkTagListCount); 32 | fNext = NULL; 33 | fExtra16 = 0; 34 | fExtra8 = 0; 35 | } 36 | virtual ~SkTagList(); 37 | 38 | static SkTagList* Find(SkTagList* head, U8CPU tag); 39 | static void DeleteTag(SkTagList** headptr, U8CPU tag); 40 | static void DeleteAll(SkTagList* head); 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/views/SkViewPriv.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | #ifndef SkViewPriv_DEFINED 9 | #define SkViewPriv_DEFINED 10 | 11 | #include "SkView.h" 12 | #include "SkTagList.h" 13 | 14 | struct Layout_SkTagList : SkTagList { 15 | SkView::Layout* fLayout; 16 | 17 | Layout_SkTagList(SkView::Layout* layout) 18 | : SkTagList(kViewLayout_SkTagList), fLayout(layout) 19 | { 20 | SkASSERT(layout); 21 | layout->ref(); 22 | } 23 | virtual ~Layout_SkTagList() 24 | { 25 | fLayout->unref(); 26 | } 27 | }; 28 | 29 | struct Artist_SkTagList : SkTagList { 30 | SkView::Artist* fArtist; 31 | 32 | Artist_SkTagList(SkView::Artist* artist) 33 | : SkTagList(kViewArtist_SkTagList), fArtist(artist) 34 | { 35 | SkASSERT(artist); 36 | artist->ref(); 37 | } 38 | virtual ~Artist_SkTagList() 39 | { 40 | fArtist->unref(); 41 | } 42 | }; 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /src/views/mac/SampleApp-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.googlecode.skia.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSMainNibFile 28 | SampleApp 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/views/mac/SampleAppDelegate.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #import 11 | #import "SkSampleNSView.h" 12 | #import "SkOptionsTableView.h" 13 | @interface SampleAppDelegate : NSObject { 14 | NSWindow* fWindow; 15 | SkSampleNSView* fView; 16 | SkOptionsTableView* fOptions; 17 | } 18 | 19 | @property (assign) IBOutlet NSWindow* fWindow; 20 | @property (assign) IBOutlet SkSampleNSView* fView; 21 | @property (assign) IBOutlet SkOptionsTableView* fOptions; 22 | 23 | - (IBAction)toiPadSize:(id)sender; 24 | @end 25 | -------------------------------------------------------------------------------- /src/views/mac/SampleAppDelegate.mm: -------------------------------------------------------------------------------- 1 | #import "SampleAppDelegate.h" 2 | @implementation SampleAppDelegate 3 | @synthesize fWindow, fView, fOptions; 4 | 5 | -(void) applicationDidFinishLaunching:(NSNotification *)aNotification { 6 | //Load specified skia views after launching 7 | fView.fOptionsDelegate = fOptions; 8 | [fWindow setAcceptsMouseMovedEvents:YES]; 9 | [fOptions registerMenus:fView.fWind->getMenus()]; 10 | } 11 | 12 | - (IBAction)toiPadSize:(id)sender { 13 | NSRect frame = NSMakeRect(fWindow.frame.origin.x, fWindow.frame.origin.y, 768, 1024); 14 | [fWindow setFrame:frame display:YES animate:YES]; 15 | } 16 | @end 17 | -------------------------------------------------------------------------------- /src/views/mac/SkEventNotifier.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | #import 8 | 9 | @interface SkEventNotifier : NSObject 10 | - (void)receiveSkEvent:(NSNotification*)notification; 11 | + (void)postTimedSkEvent:(NSTimeInterval)ti; 12 | + (void)timerFireMethod:(NSTimer*)theTimer; 13 | @end 14 | -------------------------------------------------------------------------------- /src/views/mac/SkSampleNSView.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #import "SkNSView.h" 10 | @interface SkSampleNSView : SkNSView 11 | - (id)initWithDefaults; 12 | @end 13 | -------------------------------------------------------------------------------- /src/views/mac/SkSampleNSView.mm: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #import "SkSampleNSView.h" 10 | #include "SampleApp.h" 11 | #include 12 | @implementation SkSampleNSView 13 | 14 | - (id)initWithDefaults { 15 | if (self = [super initWithDefaults]) { 16 | fWind = new SampleWindow(self, *_NSGetArgc(), *_NSGetArgv(), NULL); 17 | } 18 | return self; 19 | } 20 | 21 | - (void)dealloc { 22 | delete fWind; 23 | [super dealloc]; 24 | } 25 | 26 | - (void)swipeWithEvent:(NSEvent *)event { 27 | CGFloat x = [event deltaX]; 28 | if (x < 0) 29 | ((SampleWindow*)fWind)->previousSample(); 30 | else if (x > 0) 31 | ((SampleWindow*)fWind)->nextSample(); 32 | else 33 | ((SampleWindow*)fWind)->showOverview(); 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /src/views/mac/SkTextFieldCell.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #import 11 | //A text field cell that has vertically centered text 12 | @interface SkTextFieldCell : NSTextFieldCell { 13 | BOOL selectingOrEditing; 14 | } 15 | @end 16 | -------------------------------------------------------------------------------- /src/views/mac/skia_mac.mm: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #import 10 | #include "SkApplication.h" 11 | 12 | int main(int argc, char *argv[]) { 13 | signal(SIGPIPE, SIG_IGN); 14 | NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; 15 | application_init(); 16 | int retVal = NSApplicationMain(argc, (const char **)argv); 17 | application_term(); 18 | [pool release]; 19 | return retVal; 20 | } 21 | -------------------------------------------------------------------------------- /src/views/views_files.mk: -------------------------------------------------------------------------------- 1 | SOURCE := \ 2 | SkEvent.cpp \ 3 | SkEventSink.cpp \ 4 | SkOSMenu.cpp \ 5 | SkTagList.cpp \ 6 | SkView.cpp \ 7 | SkViewPriv.cpp \ 8 | SkWindow.cpp \ 9 | SkTouchGesture.cpp 10 | # SkBGViewArtist.cpp \ 11 | SkMetaData.cpp \ 12 | SkListView.cpp \ 13 | SkListWidget.cpp \ 14 | SkParsePaint.cpp \ 15 | SkProgressBarView.cpp \ 16 | SkProgressView.cpp \ 17 | SkScrollBarView.cpp \ 18 | SkStackViewLayout.cpp \ 19 | SkStaticTextView.cpp \ 20 | SkTextBox.cpp \ 21 | SkViewInflate.cpp \ 22 | SkWidget.cpp \ 23 | SkWidgetViews.cpp \ 24 | SkWidgets.cpp \ 25 | # SkBorderView.cpp \ 26 | # SkImageView.cpp \ 27 | -------------------------------------------------------------------------------- /src/xml/SkBML_Verbs.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkBML_Verbs_DEFINED 11 | #define SkBML_Verbs_DEFINED 12 | 13 | enum Verbs { 14 | kStartElem_Value_Verb, 15 | kStartElem_Index_Verb, 16 | kEndElem_Verb, 17 | kAttr_Value_Value_Verb, 18 | kAttr_Value_Index_Verb, 19 | kAttr_Index_Value_Verb, 20 | kAttr_Index_Index_Verb, 21 | 22 | kVerbCount 23 | }; 24 | 25 | #endif // SkBML_Verbs_DEFINED 26 | -------------------------------------------------------------------------------- /src/xml/xml_files.mk: -------------------------------------------------------------------------------- 1 | SOURCE := \ 2 | SkDOM.cpp \ 3 | SkXMLParser.cpp 4 | -------------------------------------------------------------------------------- /third_party/externals/libgif/getarg.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Error numbers as returned by GAGetArg routine: 3 | * 4 | * Gershon Elber Mar 88 5 | *************************************************************************** 6 | * History: 7 | * 11 Mar 88 - Version 1.0 by Gershon Elber. 8 | **************************************************************************/ 9 | 10 | #ifndef _GETARG_H 11 | #define _GETARG_H 12 | 13 | #define CMD_ERR_NotAnOpt 1 /* None Option found. */ 14 | #define CMD_ERR_NoSuchOpt 2 /* Undefined Option Found. */ 15 | #define CMD_ERR_WildEmpty 3 /* Empty input for !*? seq. */ 16 | #define CMD_ERR_NumRead 4 /* Failed on reading number. */ 17 | #define CMD_ERR_AllSatis 5 /* Fail to satisfy (must-'!') option. */ 18 | 19 | #ifdef HAVE_STDARG_H 20 | int GAGetArgs(int argc, char **argv, char *CtrlStr, ...); 21 | #elif defined (HAVE_VARARGS_H) 22 | int GAGetArgs(int va_alist, ...); 23 | #endif /* HAVE_STDARG_H */ 24 | 25 | void GAPrintErrMsg(int Error); 26 | void GAPrintHowTo(char *CtrlStr); 27 | 28 | #endif /* _GETARG_H */ 29 | -------------------------------------------------------------------------------- /third_party/externals/libjpeg/.svn/entries: -------------------------------------------------------------------------------- 1 | 12 2 | -------------------------------------------------------------------------------- /third_party/externals/libjpeg/.svn/format: -------------------------------------------------------------------------------- 1 | 12 2 | -------------------------------------------------------------------------------- /third_party/externals/libjpeg/.svn/wc.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itsimba/SkiaLib/dbdc85d517aa5f6b52511a5af8719e42aa8a7395/third_party/externals/libjpeg/.svn/wc.db -------------------------------------------------------------------------------- /third_party/externals/libjpeg/README.chromium: -------------------------------------------------------------------------------- 1 | Name: libjpeg 2 | URL: http://www.ijg.org/ 3 | Version: 6b 4 | 5 | Description: 6 | This contains a copy of libjpeg-6b. 7 | 8 | The project files does not incldue from the distribution: 9 | jidctred.c : downsampling 10 | jdtrans.c : decoder transcoder 11 | 12 | Also not included are files obviously not needed: 13 | jmemdos.c 14 | jmemname.c 15 | along with all of the frontend files for doing utility programs. 16 | 17 | We added a new file jpeglibmangler.h and included it from jpeglib.h that changes 18 | the names of all externally visible functions to chromium_* so that we can avoid 19 | conflicts that arise when system libraries attempt to use our libjpeg. 20 | -------------------------------------------------------------------------------- /third_party/externals/libjpeg/jversion.h: -------------------------------------------------------------------------------- 1 | /* 2 | * jversion.h 3 | * 4 | * Copyright (C) 1991-1998, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains software version identification. 9 | */ 10 | 11 | 12 | #define JVERSION "6b 27-Mar-1998" 13 | 14 | #define JCOPYRIGHT "Copyright (C) 1998, Thomas G. Lane" 15 | -------------------------------------------------------------------------------- /third_party/externals/zlib/gzclose.c: -------------------------------------------------------------------------------- 1 | /* gzclose.c -- zlib gzclose() function 2 | * Copyright (C) 2004, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | #include "gzguts.h" 7 | 8 | /* gzclose() is in a separate file so that it is linked in only if it is used. 9 | That way the other gzclose functions can be used instead to avoid linking in 10 | unneeded compression or decompression routines. */ 11 | int ZEXPORT gzclose(file) 12 | gzFile file; 13 | { 14 | #ifndef NO_GZCOMPRESS 15 | gz_statep state; 16 | 17 | if (file == NULL) 18 | return Z_STREAM_ERROR; 19 | state = (gz_statep)file; 20 | 21 | return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); 22 | #else 23 | return gzclose_r(file); 24 | #endif 25 | } 26 | -------------------------------------------------------------------------------- /third_party/externals/zlib/inffast.h: -------------------------------------------------------------------------------- 1 | /* inffast.h -- header to use inffast.c 2 | * Copyright (C) 1995-2003, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); 12 | -------------------------------------------------------------------------------- /vs9/skiahello/skhello.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itsimba/SkiaLib/dbdc85d517aa5f6b52511a5af8719e42aa8a7395/vs9/skiahello/skhello.cpp -------------------------------------------------------------------------------- /vs9/skiahello/skhello.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itsimba/SkiaLib/dbdc85d517aa5f6b52511a5af8719e42aa8a7395/vs9/skiahello/skhello.png --------------------------------------------------------------------------------