summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-12 21:01:41 +0000
committerbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-12 21:01:41 +0000
commit52e935d04c59135739c3a68fb6e19d313dc6d5ad (patch)
tree95f7ab178b045bef4456cbf92c6aa7e476becd99
parent30fab79877b4bb067944b74d98346ac9bb6bfc7e (diff)
downloadchromium_src-52e935d04c59135739c3a68fb6e19d313dc6d5ad.zip
chromium_src-52e935d04c59135739c3a68fb6e19d313dc6d5ad.tar.gz
chromium_src-52e935d04c59135739c3a68fb6e19d313dc6d5ad.tar.bz2
New drop of Skia. This is up to CL 121320.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6925 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--skia/README.google1
-rw-r--r--skia/SConscript7
-rw-r--r--skia/animator/SkAnimate.h2
-rw-r--r--skia/animator/SkAnimateActive.cpp2
-rw-r--r--skia/animator/SkAnimateActive.h2
-rw-r--r--skia/animator/SkAnimateBase.cpp2
-rw-r--r--skia/animator/SkAnimateBase.h2
-rw-r--r--skia/animator/SkAnimateField.cpp2
-rw-r--r--skia/animator/SkAnimateMaker.cpp2
-rw-r--r--skia/animator/SkAnimateMaker.h2
-rw-r--r--skia/animator/SkAnimateProperties.h2
-rw-r--r--skia/animator/SkAnimateSet.cpp2
-rw-r--r--skia/animator/SkAnimateSet.h2
-rw-r--r--skia/animator/SkAnimator.cpp2
-rw-r--r--skia/animator/SkAnimatorScript.cpp2
-rw-r--r--skia/animator/SkAnimatorScript.h2
-rw-r--r--skia/animator/SkBase64.cpp2
-rw-r--r--skia/animator/SkBase64.h2
-rw-r--r--skia/animator/SkBoundable.cpp2
-rw-r--r--skia/animator/SkBoundable.h2
-rw-r--r--skia/animator/SkBuildCondensedInfo.cpp2
-rw-r--r--skia/animator/SkCondensedDebug.cpp2
-rw-r--r--skia/animator/SkCondensedRelease.cpp2
-rw-r--r--skia/animator/SkDisplayAdd.cpp2
-rw-r--r--skia/animator/SkDisplayAdd.h2
-rw-r--r--skia/animator/SkDisplayApply.cpp2
-rw-r--r--skia/animator/SkDisplayApply.h2
-rw-r--r--skia/animator/SkDisplayBounds.cpp2
-rw-r--r--skia/animator/SkDisplayBounds.h2
-rw-r--r--skia/animator/SkDisplayEvent.cpp2
-rw-r--r--skia/animator/SkDisplayEvent.h2
-rw-r--r--skia/animator/SkDisplayEvents.cpp2
-rw-r--r--skia/animator/SkDisplayEvents.h2
-rw-r--r--skia/animator/SkDisplayInclude.cpp2
-rw-r--r--skia/animator/SkDisplayInclude.h2
-rw-r--r--skia/animator/SkDisplayInput.cpp2
-rw-r--r--skia/animator/SkDisplayInput.h2
-rw-r--r--skia/animator/SkDisplayList.cpp2
-rw-r--r--skia/animator/SkDisplayList.h2
-rw-r--r--skia/animator/SkDisplayMath.cpp2
-rw-r--r--skia/animator/SkDisplayMath.h2
-rw-r--r--skia/animator/SkDisplayMovie.cpp2
-rw-r--r--skia/animator/SkDisplayMovie.h2
-rw-r--r--skia/animator/SkDisplayNumber.cpp2
-rw-r--r--skia/animator/SkDisplayNumber.h2
-rw-r--r--skia/animator/SkDisplayPost.cpp2
-rw-r--r--skia/animator/SkDisplayPost.h2
-rw-r--r--skia/animator/SkDisplayRandom.cpp2
-rw-r--r--skia/animator/SkDisplayRandom.h2
-rw-r--r--skia/animator/SkDisplayScreenplay.cpp2
-rw-r--r--skia/animator/SkDisplayScreenplay.h2
-rw-r--r--skia/animator/SkDisplayType.cpp2
-rw-r--r--skia/animator/SkDisplayType.h2
-rw-r--r--skia/animator/SkDisplayTypes.cpp2
-rw-r--r--skia/animator/SkDisplayTypes.h2
-rw-r--r--skia/animator/SkDisplayXMLParser.cpp2
-rw-r--r--skia/animator/SkDisplayXMLParser.h2
-rw-r--r--skia/animator/SkDisplayable.cpp2
-rw-r--r--skia/animator/SkDisplayable.h2
-rw-r--r--skia/animator/SkDraw3D.cpp2
-rw-r--r--skia/animator/SkDraw3D.h2
-rw-r--r--skia/animator/SkDrawBitmap.cpp2
-rw-r--r--skia/animator/SkDrawBitmap.h2
-rw-r--r--skia/animator/SkDrawBlur.cpp2
-rw-r--r--skia/animator/SkDrawBlur.h2
-rw-r--r--skia/animator/SkDrawClip.cpp2
-rw-r--r--skia/animator/SkDrawClip.h2
-rw-r--r--skia/animator/SkDrawColor.cpp2
-rw-r--r--skia/animator/SkDrawColor.h2
-rw-r--r--skia/animator/SkDrawDash.cpp2
-rw-r--r--skia/animator/SkDrawDash.h2
-rw-r--r--skia/animator/SkDrawDiscrete.cpp2
-rw-r--r--skia/animator/SkDrawDiscrete.h2
-rw-r--r--skia/animator/SkDrawEmboss.cpp2
-rw-r--r--skia/animator/SkDrawEmboss.h2
-rw-r--r--skia/animator/SkDrawExtraPathEffect.cpp2
-rw-r--r--skia/animator/SkDrawFull.cpp2
-rw-r--r--skia/animator/SkDrawFull.h2
-rw-r--r--skia/animator/SkDrawGradient.cpp2
-rw-r--r--skia/animator/SkDrawGradient.h2
-rw-r--r--skia/animator/SkDrawGroup.cpp2
-rw-r--r--skia/animator/SkDrawGroup.h2
-rw-r--r--skia/animator/SkDrawLine.cpp2
-rw-r--r--skia/animator/SkDrawLine.h2
-rw-r--r--skia/animator/SkDrawMatrix.cpp2
-rw-r--r--skia/animator/SkDrawMatrix.h2
-rw-r--r--skia/animator/SkDrawOval.cpp2
-rw-r--r--skia/animator/SkDrawOval.h2
-rw-r--r--skia/animator/SkDrawPaint.cpp5
-rw-r--r--skia/animator/SkDrawPaint.h2
-rw-r--r--skia/animator/SkDrawPath.cpp2
-rw-r--r--skia/animator/SkDrawPath.h2
-rw-r--r--skia/animator/SkDrawPoint.cpp2
-rw-r--r--skia/animator/SkDrawPoint.h2
-rw-r--r--skia/animator/SkDrawRectangle.cpp2
-rw-r--r--skia/animator/SkDrawRectangle.h2
-rw-r--r--skia/animator/SkDrawSaveLayer.cpp2
-rw-r--r--skia/animator/SkDrawSaveLayer.h2
-rw-r--r--skia/animator/SkDrawShader.cpp7
-rw-r--r--skia/animator/SkDrawShader.h2
-rw-r--r--skia/animator/SkDrawText.cpp2
-rw-r--r--skia/animator/SkDrawText.h2
-rw-r--r--skia/animator/SkDrawTextBox.cpp2
-rw-r--r--skia/animator/SkDrawTextBox.h2
-rw-r--r--skia/animator/SkDrawTo.cpp2
-rw-r--r--skia/animator/SkDrawTo.h2
-rw-r--r--skia/animator/SkDrawTransparentShader.cpp2
-rw-r--r--skia/animator/SkDrawTransparentShader.h2
-rw-r--r--skia/animator/SkDrawable.cpp2
-rw-r--r--skia/animator/SkDrawable.h2
-rw-r--r--skia/animator/SkDump.cpp2
-rw-r--r--skia/animator/SkDump.h2
-rw-r--r--skia/animator/SkExtras.h2
-rw-r--r--skia/animator/SkGetCondensedInfo.cpp2
-rw-r--r--skia/animator/SkHitClear.cpp2
-rw-r--r--skia/animator/SkHitClear.h2
-rw-r--r--skia/animator/SkHitTest.cpp2
-rw-r--r--skia/animator/SkHitTest.h2
-rw-r--r--skia/animator/SkIntArray.h2
-rw-r--r--skia/animator/SkMatrixParts.cpp2
-rw-r--r--skia/animator/SkMatrixParts.h2
-rw-r--r--skia/animator/SkMemberInfo.cpp2
-rw-r--r--skia/animator/SkMemberInfo.h2
-rw-r--r--skia/animator/SkOperand.h2
-rw-r--r--skia/animator/SkOperandInterpolator.h2
-rw-r--r--skia/animator/SkOperandIterpolator.cpp2
-rw-r--r--skia/animator/SkPaintParts.cpp2
-rw-r--r--skia/animator/SkPaintParts.h2
-rw-r--r--skia/animator/SkPathParts.cpp2
-rw-r--r--skia/animator/SkPathParts.h2
-rw-r--r--skia/animator/SkPostParts.cpp2
-rw-r--r--skia/animator/SkPostParts.h2
-rw-r--r--skia/animator/SkSVGPath.cpp2
-rw-r--r--skia/animator/SkScript.cpp2
-rw-r--r--skia/animator/SkScript.h2
-rw-r--r--skia/animator/SkScriptDecompile.cpp2
-rw-r--r--skia/animator/SkSnapshot.cpp2
-rw-r--r--skia/animator/SkSnapshot.h2
-rw-r--r--skia/animator/SkTDArray_Experimental.h2
-rw-r--r--skia/animator/SkTextOnPath.cpp2
-rw-r--r--skia/animator/SkTextOnPath.h2
-rw-r--r--skia/animator/SkTextToPath.cpp2
-rw-r--r--skia/animator/SkTextToPath.h2
-rw-r--r--skia/animator/SkTime.cpp2
-rw-r--r--skia/animator/SkTypedArray.cpp2
-rw-r--r--skia/animator/SkTypedArray.h2
-rw-r--r--skia/animator/SkXMLAnimatorWriter.cpp2
-rw-r--r--skia/animator/SkXMLAnimatorWriter.h2
-rw-r--r--skia/corecg/Android.mk3
-rw-r--r--skia/corecg/NOTICE37
-rw-r--r--skia/corecg/Sk64.cpp2
-rw-r--r--skia/corecg/SkBuffer.cpp2
-rw-r--r--skia/corecg/SkChunkAlloc.cpp2
-rw-r--r--skia/corecg/SkCordic.cpp2
-rw-r--r--skia/corecg/SkCordic.h2
-rw-r--r--skia/corecg/SkDebug.cpp2
-rw-r--r--skia/corecg/SkDebug_stdio.cpp6
-rw-r--r--skia/corecg/SkFloat.cpp2
-rw-r--r--skia/corecg/SkFloat.h2
-rw-r--r--skia/corecg/SkFloatBits.cpp205
-rw-r--r--skia/corecg/SkFloatBits.h45
-rw-r--r--skia/corecg/SkInterpolator.cpp4
-rw-r--r--skia/corecg/SkMath.cpp122
-rw-r--r--skia/corecg/SkMatrix.cpp33
-rw-r--r--skia/corecg/SkMemory_stdlib.cpp2
-rw-r--r--skia/corecg/SkPageFlipper.cpp85
-rw-r--r--skia/corecg/SkPoint.cpp2
-rw-r--r--skia/corecg/SkRect.cpp60
-rw-r--r--skia/corecg/SkRegion.cpp42
-rw-r--r--skia/corecg/SkRegionPriv.h2
-rw-r--r--skia/corecg/SkSinTable.h2
-rw-r--r--skia/corecg/SkTSort.h2
-rw-r--r--skia/effects/Sk1DPathEffect.cpp2
-rw-r--r--skia/effects/Sk2DPathEffect.cpp2
-rw-r--r--skia/effects/SkAvoidXfermode.cpp2
-rw-r--r--skia/effects/SkBlurDrawLooper.cpp5
-rw-r--r--skia/effects/SkBlurMask.cpp2
-rw-r--r--skia/effects/SkBlurMask.h2
-rw-r--r--skia/effects/SkBlurMaskFilter.cpp10
-rw-r--r--skia/effects/SkCamera.cpp2
-rw-r--r--skia/effects/SkColorFilters.cpp2
-rw-r--r--skia/effects/SkColorMatrixFilter.cpp38
-rw-r--r--skia/effects/SkCornerPathEffect.cpp2
-rw-r--r--skia/effects/SkCullPoints.cpp10
-rw-r--r--skia/effects/SkDashPathEffect.cpp2
-rw-r--r--skia/effects/SkDiscretePathEffect.cpp2
-rw-r--r--skia/effects/SkEmbossMask.cpp2
-rw-r--r--skia/effects/SkEmbossMask.h2
-rw-r--r--skia/effects/SkEmbossMaskFilter.cpp2
-rw-r--r--skia/effects/SkEmbossMask_Table.h2
-rw-r--r--skia/effects/SkGradientShader.cpp34
-rw-r--r--skia/effects/SkLayerDrawLooper.cpp130
-rw-r--r--skia/effects/SkLayerRasterizer.cpp2
-rw-r--r--skia/effects/SkNinePatch.cpp75
-rw-r--r--skia/effects/SkRadialGradient_Table.h2
-rw-r--r--skia/effects/SkShaderExtras.cpp2
-rw-r--r--skia/effects/SkTransparentShader.cpp2
-rw-r--r--skia/gl/SkGL.cpp101
-rw-r--r--skia/gl/SkGL.h12
-rw-r--r--skia/gl/SkGLCanvas.cpp50
-rw-r--r--skia/gl/SkGLDevice.cpp29
-rw-r--r--skia/gl/SkGLDevice.h3
-rw-r--r--skia/gl/SkGLTextCache.cpp24
-rw-r--r--skia/gl/SkGLTextCache.h13
-rw-r--r--skia/gl/SkTextureCache.cpp53
-rw-r--r--skia/gl/SkTextureCache.h11
-rw-r--r--skia/images/SkFDStream.cpp85
-rw-r--r--skia/images/SkFlipPixelRef.cpp127
-rw-r--r--skia/images/SkImageDecoder.cpp44
-rw-r--r--skia/images/SkImageDecoder_fpdfemb.cpp236
-rw-r--r--skia/images/SkImageDecoder_libbmp.cpp2
-rw-r--r--skia/images/SkImageDecoder_libgif.cpp39
-rw-r--r--skia/images/SkImageDecoder_libico.cpp28
-rw-r--r--skia/images/SkImageDecoder_libjpeg.cpp367
-rw-r--r--skia/images/SkImageDecoder_libpng.cpp242
-rw-r--r--skia/images/SkImageDecoder_wbmp.cpp2
-rw-r--r--skia/images/SkImageRef.cpp10
-rw-r--r--skia/images/SkMovie_gif.cpp19
-rw-r--r--skia/images/SkScaledBitmapSampler.cpp2
-rw-r--r--skia/images/SkStream.cpp114
-rw-r--r--skia/images/bmpdecoderhelper.cpp2
-rw-r--r--skia/images/bmpdecoderhelper.h5
-rw-r--r--skia/include/Sk1DPathEffect.h29
-rw-r--r--skia/include/Sk2DPathEffect.h31
-rw-r--r--skia/include/SkAnimator.h31
-rw-r--r--skia/include/SkAnimatorView.h31
-rw-r--r--skia/include/SkApplication.h31
-rw-r--r--skia/include/SkAvoidXfermode.h31
-rw-r--r--skia/include/SkBGViewArtist.h31
-rw-r--r--skia/include/SkBML_WXMLParser.h31
-rw-r--r--skia/include/SkBML_XMLParser.h31
-rw-r--r--skia/include/SkBitmap.h77
-rw-r--r--skia/include/SkBlurDrawLooper.h25
-rw-r--r--skia/include/SkBlurMaskFilter.h31
-rw-r--r--skia/include/SkBorderView.h31
-rw-r--r--skia/include/SkBounder.h31
-rw-r--r--skia/include/SkCamera.h31
-rw-r--r--skia/include/SkCanvas.h42
-rw-r--r--skia/include/SkColor.h31
-rw-r--r--skia/include/SkColorFilter.h31
-rw-r--r--skia/include/SkColorMatrix.h2
-rw-r--r--skia/include/SkColorMatrixFilter.h2
-rw-r--r--skia/include/SkColorPriv.h60
-rw-r--r--skia/include/SkColorShader.h29
-rw-r--r--skia/include/SkCornerPathEffect.h31
-rw-r--r--skia/include/SkCullPoints.h31
-rw-r--r--skia/include/SkDOM.h2
-rw-r--r--skia/include/SkDashPathEffect.h31
-rw-r--r--skia/include/SkDeque.h31
-rw-r--r--skia/include/SkDescriptor.h31
-rw-r--r--skia/include/SkDevice.h16
-rw-r--r--skia/include/SkDiscretePathEffect.h31
-rw-r--r--skia/include/SkDither.h16
-rw-r--r--skia/include/SkDraw.h35
-rw-r--r--skia/include/SkDrawExtraPathEffect.h16
-rw-r--r--skia/include/SkDrawFilter.h18
-rw-r--r--skia/include/SkDrawLooper.h29
-rw-r--r--skia/include/SkEmbossMaskFilter.h31
-rw-r--r--skia/include/SkEvent.h31
-rw-r--r--skia/include/SkEventSink.h31
-rw-r--r--skia/include/SkFlattenable.h29
-rw-r--r--skia/include/SkFlipPixelRef.h114
-rw-r--r--skia/include/SkFontCodec.h31
-rw-r--r--skia/include/SkFontHost.h31
-rw-r--r--skia/include/SkGLCanvas.h20
-rw-r--r--skia/include/SkGlobals.h31
-rw-r--r--skia/include/SkGradientShader.h31
-rw-r--r--skia/include/SkGraphics.h31
-rw-r--r--skia/include/SkImageDecoder.h75
-rw-r--r--skia/include/SkImageRef.h19
-rw-r--r--skia/include/SkImageRef_GlobalPool.h16
-rw-r--r--skia/include/SkImageView.h31
-rw-r--r--skia/include/SkJS.h31
-rw-r--r--skia/include/SkKernel33MaskFilter.h16
-rw-r--r--skia/include/SkKey.h31
-rw-r--r--skia/include/SkLayerDrawLooper.h70
-rw-r--r--skia/include/SkLayerRasterizer.h31
-rw-r--r--skia/include/SkMMapStream.h16
-rw-r--r--skia/include/SkMallocPixelRef.h60
-rw-r--r--skia/include/SkMask.h31
-rw-r--r--skia/include/SkMaskFilter.h31
-rw-r--r--skia/include/SkMetaData.h2
-rw-r--r--skia/include/SkMovie.h16
-rw-r--r--skia/include/SkNinePatch.h29
-rw-r--r--skia/include/SkOSFile.h32
-rw-r--r--skia/include/SkOSMenu.h31
-rw-r--r--skia/include/SkOSSound.h31
-rw-r--r--skia/include/SkOSWindow_Mac.h31
-rw-r--r--skia/include/SkOSWindow_Unix.h31
-rw-r--r--skia/include/SkOSWindow_Win.h31
-rw-r--r--skia/include/SkOSWindow_wxwidgets.h33
-rw-r--r--skia/include/SkPackBits.h16
-rw-r--r--skia/include/SkPaint.h60
-rw-r--r--skia/include/SkPaintFlagsDrawFilter.h16
-rw-r--r--skia/include/SkParse.h31
-rw-r--r--skia/include/SkParsePaint.h31
-rw-r--r--skia/include/SkPath.h9
-rw-r--r--skia/include/SkPathEffect.h31
-rw-r--r--skia/include/SkPathMeasure.h31
-rw-r--r--skia/include/SkPicture.h35
-rw-r--r--skia/include/SkPixelRef.h16
-rw-r--r--skia/include/SkPixelXorXfermode.h2
-rw-r--r--skia/include/SkPorterDuff.h35
-rw-r--r--skia/include/SkProgressBarView.h31
-rw-r--r--skia/include/SkPtrRecorder.h18
-rw-r--r--skia/include/SkRasterizer.h31
-rw-r--r--skia/include/SkReader32.h20
-rw-r--r--skia/include/SkRefCnt.h31
-rw-r--r--skia/include/SkSVGAttribute.h31
-rw-r--r--skia/include/SkSVGBase.h31
-rw-r--r--skia/include/SkSVGPaintState.h31
-rw-r--r--skia/include/SkSVGParser.h31
-rw-r--r--skia/include/SkSVGTypes.h31
-rw-r--r--skia/include/SkScalerContext.h44
-rw-r--r--skia/include/SkScrollBarView.h31
-rw-r--r--skia/include/SkShader.h31
-rw-r--r--skia/include/SkShaderExtras.h31
-rw-r--r--skia/include/SkStackViewLayout.h31
-rw-r--r--skia/include/SkStream.h79
-rw-r--r--skia/include/SkStream_Win.h31
-rw-r--r--skia/include/SkString.h31
-rw-r--r--skia/include/SkStroke.h31
-rw-r--r--skia/include/SkSystemEventTypes.h31
-rw-r--r--skia/include/SkTDArray.h33
-rw-r--r--skia/include/SkTDStack.h31
-rw-r--r--skia/include/SkTDict.h31
-rw-r--r--skia/include/SkTextBox.h31
-rw-r--r--skia/include/SkTime.h31
-rw-r--r--skia/include/SkTransparentShader.h31
-rw-r--r--skia/include/SkTypeface.h29
-rw-r--r--skia/include/SkUnPreMultiply.h16
-rw-r--r--skia/include/SkUnitMapper.h31
-rw-r--r--skia/include/SkUnitMappers.h16
-rw-r--r--skia/include/SkUtils.h31
-rw-r--r--skia/include/SkView.h31
-rw-r--r--skia/include/SkViewInflate.h31
-rw-r--r--skia/include/SkWidget.h31
-rw-r--r--skia/include/SkWidgetViews.h31
-rw-r--r--skia/include/SkWindow.h31
-rw-r--r--skia/include/SkWriter32.h16
-rw-r--r--skia/include/SkXMLParser.h31
-rw-r--r--skia/include/SkXMLWriter.h31
-rw-r--r--skia/include/SkXfermode.h2
-rw-r--r--skia/include/corecg/Sk64.h2
-rw-r--r--skia/include/corecg/SkBuffer.h31
-rw-r--r--skia/include/corecg/SkChunkAlloc.h31
-rw-r--r--skia/include/corecg/SkEndian.h31
-rw-r--r--skia/include/corecg/SkFDot6.h31
-rw-r--r--skia/include/corecg/SkFixed.h31
-rw-r--r--skia/include/corecg/SkFloatBits.h150
-rw-r--r--skia/include/corecg/SkFloatingPoint.h42
-rw-r--r--skia/include/corecg/SkInterpolator.h2
-rw-r--r--skia/include/corecg/SkMath.h2
-rw-r--r--skia/include/corecg/SkMatrix.h2
-rw-r--r--skia/include/corecg/SkPageFlipper.h70
-rw-r--r--skia/include/corecg/SkPerspIter.h31
-rw-r--r--skia/include/corecg/SkPoint.h2
-rw-r--r--skia/include/corecg/SkPostConfig.h40
-rw-r--r--skia/include/corecg/SkPreConfig.h31
-rw-r--r--skia/include/corecg/SkRandom.h2
-rw-r--r--skia/include/corecg/SkRect.h41
-rw-r--r--skia/include/corecg/SkRegion.h12
-rw-r--r--skia/include/corecg/SkScalar.h45
-rw-r--r--skia/include/corecg/SkScalarCompare.h34
-rw-r--r--skia/include/corecg/SkTSearch.h31
-rw-r--r--skia/include/corecg/SkTemplates.h31
-rw-r--r--skia/include/corecg/SkThread.h31
-rw-r--r--skia/include/corecg/SkThread_platform.h31
-rw-r--r--skia/include/corecg/SkTypes.h18
-rw-r--r--skia/picture/SkPathHeap.cpp55
-rw-r--r--skia/picture/SkPathHeap.h37
-rw-r--r--skia/picture/SkPicture.cpp (renamed from skia/sgl/SkPicture.cpp)10
-rw-r--r--skia/picture/SkPictureFlat.cpp9
-rw-r--r--skia/picture/SkPictureFlat.h27
-rw-r--r--skia/picture/SkPicturePlayback.cpp130
-rw-r--r--skia/picture/SkPicturePlayback.h12
-rw-r--r--skia/picture/SkPictureRecord.cpp74
-rw-r--r--skia/picture/SkPictureRecord.h8
-rw-r--r--skia/ports/SkFontHost_FONTPATH.cpp2
-rw-r--r--skia/ports/SkFontHost_FreeType.cpp403
-rw-r--r--skia/ports/SkFontHost_android.cpp65
-rw-r--r--skia/ports/SkFontHost_gamma.cpp77
-rw-r--r--skia/ports/SkFontHost_linux.cpp604
-rw-r--r--skia/ports/SkFontHost_mac.cpp562
-rw-r--r--skia/ports/SkFontHost_none.cpp54
-rw-r--r--skia/ports/SkFontHost_win.cpp818
-rw-r--r--skia/ports/SkGlobals_global.cpp2
-rw-r--r--skia/ports/SkImageDecoder_Factory.cpp16
-rw-r--r--skia/ports/SkImageRef_ashmem.cpp20
-rw-r--r--skia/ports/SkImageRef_ashmem.h2
-rw-r--r--skia/ports/SkOSEvent_android.cpp2
-rw-r--r--skia/ports/SkOSEvent_dummy.cpp2
-rw-r--r--skia/ports/SkOSFile_stdio.cpp2
-rw-r--r--skia/ports/SkThread_none.cpp2
-rw-r--r--skia/ports/SkThread_win.cpp2
-rw-r--r--skia/ports/SkTime_Unix.cpp2
-rw-r--r--skia/ports/SkXMLParser_empty.cpp2
-rw-r--r--skia/ports/SkXMLParser_expat.cpp2
-rw-r--r--skia/ports/SkXMLParser_tinyxml.cpp2
-rw-r--r--skia/ports/SkXMLPullParser_expat.cpp2
-rw-r--r--skia/ports/sk_predefined_gamma.h44
-rw-r--r--skia/sgl/SkAlphaRuns.cpp2
-rw-r--r--skia/sgl/SkAntiRun.h2
-rw-r--r--skia/sgl/SkAutoKern.h2
-rw-r--r--skia/sgl/SkBitmap.cpp65
-rw-r--r--skia/sgl/SkBitmapProcShader.h2
-rw-r--r--skia/sgl/SkBitmapProcState.cpp15
-rw-r--r--skia/sgl/SkBitmapProcState.h9
-rw-r--r--skia/sgl/SkBitmapProcState_matrix.h42
-rw-r--r--skia/sgl/SkBitmapProcState_matrixProcs.cpp71
-rw-r--r--skia/sgl/SkBitmapSampler.cpp2
-rw-r--r--skia/sgl/SkBitmapSampler.h2
-rw-r--r--skia/sgl/SkBitmapSamplerTemplate.h2
-rw-r--r--skia/sgl/SkBitmapShader.cpp2
-rw-r--r--skia/sgl/SkBitmapShader.h2
-rw-r--r--skia/sgl/SkBitmapShader16BilerpTemplate.h2
-rw-r--r--skia/sgl/SkBitmapShaderTemplate.h2
-rw-r--r--skia/sgl/SkBitmap_scroll.cpp1
-rw-r--r--skia/sgl/SkBlitBWMaskTemplate.h2
-rw-r--r--skia/sgl/SkBlitter.cpp2
-rw-r--r--skia/sgl/SkBlitter.h2
-rw-r--r--skia/sgl/SkBlitter_4444.cpp18
-rw-r--r--skia/sgl/SkBlitter_A1.cpp2
-rw-r--r--skia/sgl/SkBlitter_A8.cpp2
-rw-r--r--skia/sgl/SkBlitter_ARGB32.cpp2
-rw-r--r--skia/sgl/SkBlitter_RGB16.cpp12
-rw-r--r--skia/sgl/SkBlitter_Sprite.cpp2
-rw-r--r--skia/sgl/SkCanvas.cpp215
-rw-r--r--skia/sgl/SkColor.cpp6
-rw-r--r--skia/sgl/SkColorFilter.cpp2
-rw-r--r--skia/sgl/SkColorTable.cpp2
-rw-r--r--skia/sgl/SkCoreBlitters.h3
-rw-r--r--skia/sgl/SkDeque.cpp2
-rw-r--r--skia/sgl/SkDraw.cpp67
-rw-r--r--skia/sgl/SkEdge.cpp85
-rw-r--r--skia/sgl/SkEdge.h11
-rw-r--r--skia/sgl/SkFP.h2
-rw-r--r--skia/sgl/SkFilterProc.cpp2
-rw-r--r--skia/sgl/SkFilterProc.h8
-rw-r--r--skia/sgl/SkGeometry.cpp10
-rw-r--r--skia/sgl/SkGeometry.h2
-rw-r--r--skia/sgl/SkGlobals.cpp2
-rw-r--r--skia/sgl/SkGlyphCache.cpp104
-rw-r--r--skia/sgl/SkGlyphCache.h16
-rw-r--r--skia/sgl/SkGraphics.cpp130
-rw-r--r--skia/sgl/SkMask.cpp2
-rw-r--r--skia/sgl/SkMaskFilter.cpp2
-rw-r--r--skia/sgl/SkPaint.cpp126
-rw-r--r--skia/sgl/SkPath.cpp128
-rw-r--r--skia/sgl/SkPathEffect.cpp2
-rw-r--r--skia/sgl/SkPathMeasure.cpp2
-rw-r--r--skia/sgl/SkProcSpriteBlitter.cpp2
-rw-r--r--skia/sgl/SkRasterizer.cpp2
-rw-r--r--skia/sgl/SkRefCnt.cpp2
-rw-r--r--skia/sgl/SkRegion_path.cpp39
-rw-r--r--skia/sgl/SkScalerContext.cpp24
-rw-r--r--skia/sgl/SkScan.cpp8
-rw-r--r--skia/sgl/SkScan.h10
-rw-r--r--skia/sgl/SkScanPriv.h2
-rw-r--r--skia/sgl/SkScan_AntiPath.cpp2
-rw-r--r--skia/sgl/SkScan_Antihair.cpp214
-rw-r--r--skia/sgl/SkScan_Hairline.cpp57
-rw-r--r--skia/sgl/SkScan_Path.cpp12
-rw-r--r--skia/sgl/SkShader.cpp2
-rw-r--r--skia/sgl/SkSpriteBlitter.h2
-rw-r--r--skia/sgl/SkSpriteBlitterTemplate.h2
-rw-r--r--skia/sgl/SkSpriteBlitter_ARGB32.cpp2
-rw-r--r--skia/sgl/SkSpriteBlitter_RGB16.cpp9
-rw-r--r--skia/sgl/SkString.cpp7
-rw-r--r--skia/sgl/SkStroke.cpp66
-rw-r--r--skia/sgl/SkStrokerPriv.cpp2
-rw-r--r--skia/sgl/SkStrokerPriv.h2
-rw-r--r--skia/sgl/SkTSearch.cpp2
-rw-r--r--skia/sgl/SkTSort.h2
-rw-r--r--skia/sgl/SkTemplatesPriv.h2
-rw-r--r--skia/sgl/SkUtils.cpp4
-rw-r--r--skia/sgl/SkWriter32.cpp9
-rw-r--r--skia/sgl/SkXfermode.cpp15
-rw-r--r--skia/skia.vcproj52
-rw-r--r--skia/skia.xcodeproj/project.pbxproj46
-rw-r--r--skia/svg/SkSVG.cpp2
-rw-r--r--skia/svg/SkSVGCircle.cpp2
-rw-r--r--skia/svg/SkSVGCircle.h2
-rw-r--r--skia/svg/SkSVGClipPath.cpp2
-rw-r--r--skia/svg/SkSVGClipPath.h2
-rw-r--r--skia/svg/SkSVGDefs.cpp2
-rw-r--r--skia/svg/SkSVGDefs.h2
-rw-r--r--skia/svg/SkSVGElements.cpp2
-rw-r--r--skia/svg/SkSVGElements.h2
-rw-r--r--skia/svg/SkSVGEllipse.cpp2
-rw-r--r--skia/svg/SkSVGEllipse.h2
-rw-r--r--skia/svg/SkSVGFeColorMatrix.cpp2
-rw-r--r--skia/svg/SkSVGFeColorMatrix.h2
-rw-r--r--skia/svg/SkSVGFilter.cpp2
-rw-r--r--skia/svg/SkSVGFilter.h2
-rw-r--r--skia/svg/SkSVGG.cpp2
-rw-r--r--skia/svg/SkSVGG.h2
-rw-r--r--skia/svg/SkSVGGradient.cpp2
-rw-r--r--skia/svg/SkSVGGradient.h2
-rw-r--r--skia/svg/SkSVGGroup.cpp2
-rw-r--r--skia/svg/SkSVGGroup.h2
-rw-r--r--skia/svg/SkSVGImage.cpp2
-rw-r--r--skia/svg/SkSVGImage.h2
-rw-r--r--skia/svg/SkSVGLine.cpp2
-rw-r--r--skia/svg/SkSVGLine.h2
-rw-r--r--skia/svg/SkSVGLinearGradient.cpp2
-rw-r--r--skia/svg/SkSVGLinearGradient.h2
-rw-r--r--skia/svg/SkSVGMask.cpp2
-rw-r--r--skia/svg/SkSVGMask.h2
-rw-r--r--skia/svg/SkSVGMetadata.cpp2
-rw-r--r--skia/svg/SkSVGMetadata.h2
-rw-r--r--skia/svg/SkSVGPaintState.cpp2
-rw-r--r--skia/svg/SkSVGParser.cpp2
-rw-r--r--skia/svg/SkSVGPath.cpp2
-rw-r--r--skia/svg/SkSVGPath.h2
-rw-r--r--skia/svg/SkSVGPolygon.cpp2
-rw-r--r--skia/svg/SkSVGPolygon.h2
-rw-r--r--skia/svg/SkSVGPolyline.cpp2
-rw-r--r--skia/svg/SkSVGPolyline.h2
-rw-r--r--skia/svg/SkSVGRadialGradient.cpp2
-rw-r--r--skia/svg/SkSVGRadialGradient.h2
-rw-r--r--skia/svg/SkSVGRect.cpp2
-rw-r--r--skia/svg/SkSVGRect.h2
-rw-r--r--skia/svg/SkSVGSVG.cpp2
-rw-r--r--skia/svg/SkSVGSVG.h2
-rw-r--r--skia/svg/SkSVGStop.cpp2
-rw-r--r--skia/svg/SkSVGStop.h2
-rw-r--r--skia/svg/SkSVGSymbol.cpp2
-rw-r--r--skia/svg/SkSVGSymbol.h2
-rw-r--r--skia/svg/SkSVGText.cpp2
-rw-r--r--skia/svg/SkSVGText.h2
-rw-r--r--skia/svg/SkSVGUse.cpp2
-rw-r--r--skia/svg/SkSVGUse.h2
-rw-r--r--skia/text/ATextEntry.h2
-rw-r--r--skia/views/SkEvent.cpp2
-rw-r--r--skia/views/SkEventSink.cpp2
-rw-r--r--skia/views/SkMetaData.cpp2
-rw-r--r--skia/views/SkTagList.cpp2
-rw-r--r--skia/views/SkTagList.h2
-rw-r--r--skia/views/SkTextBox.cpp2
-rw-r--r--skia/xml/SkBML_Verbs.h2
-rw-r--r--skia/xml/SkBML_XMLParser.cpp2
-rw-r--r--skia/xml/SkDOM.cpp2
-rw-r--r--skia/xml/SkJS.cpp2
-rw-r--r--skia/xml/SkJSDisplayable.cpp2
-rw-r--r--skia/xml/SkParse.cpp2
-rw-r--r--skia/xml/SkParseColor.cpp2
-rw-r--r--skia/xml/SkXMLParser.cpp2
-rw-r--r--skia/xml/SkXMLWriter.cpp2
549 files changed, 8653 insertions, 3745 deletions
diff --git a/skia/README.google b/skia/README.google
index dc4cb88..76a9284 100644
--- a/skia/README.google
+++ b/skia/README.google
@@ -21,3 +21,4 @@ also pick up any important changes they make.
Patches we are tracking locally (until Skia is fixed upstream):
fix_for_1186198.diff -- eseidel, 6/4/08, BUG=1186198
+linux_patch.diff
diff --git a/skia/SConscript b/skia/SConscript
index eb1f265..ae26b3e 100644
--- a/skia/SConscript
+++ b/skia/SConscript
@@ -49,10 +49,12 @@ input_files = [
'corecg/SkDebug.cpp',
'corecg/SkDebug_stdio.cpp',
'corecg/SkFloat.cpp',
+ 'corecg/SkFloatBits.cpp',
'corecg/SkInterpolator.cpp',
'corecg/SkMath.cpp',
'corecg/SkMatrix.cpp',
'corecg/SkMemory_stdlib.cpp',
+ 'corecg/SkPageFlipper.cpp',
'corecg/SkPoint.cpp',
'corecg/SkRect.cpp',
'corecg/SkRegion.cpp',
@@ -86,6 +88,8 @@ input_files = [
'images/SkImageDecoder.cpp',
'images/SkImageRef.cpp',
'images/SkStream.cpp',
+ 'picture/SkPathHeap.cpp',
+ 'picture/SkPicture.cpp',
'picture/SkPictureFlat.cpp',
'picture/SkPicturePlayback.cpp',
'picture/SkPictureRecord.cpp',
@@ -131,7 +135,6 @@ input_files = [
'sgl/SkPath.cpp',
'sgl/SkPathEffect.cpp',
'sgl/SkPathMeasure.cpp',
- 'sgl/SkPicture.cpp',
'sgl/SkPixelRef.cpp',
'sgl/SkProcSpriteBlitter.cpp',
'sgl/SkPtrRecorder.cpp',
@@ -172,6 +175,8 @@ if env['PLATFORM'] == 'posix':
input_files.append('ports/SkFontHost_fontconfig.cpp')
input_files.append('images/SkMMapStream.cpp')
+ env.Append(CCFLAGS = ['-Wno-unused-function'])
+
if env['PLATFORM'] in ('darwin', 'posix'):
input_files.append('ports/SkThread_pthread.cpp')
diff --git a/skia/animator/SkAnimate.h b/skia/animator/SkAnimate.h
index 5500798..a4281d3 100644
--- a/skia/animator/SkAnimate.h
+++ b/skia/animator/SkAnimate.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkAnimate.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkAnimateActive.cpp b/skia/animator/SkAnimateActive.cpp
index 0aa1279..4ee7ded 100644
--- a/skia/animator/SkAnimateActive.cpp
+++ b/skia/animator/SkAnimateActive.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkAnimateActive.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkAnimateActive.h b/skia/animator/SkAnimateActive.h
index 9f6756a..b0c4483 100644
--- a/skia/animator/SkAnimateActive.h
+++ b/skia/animator/SkAnimateActive.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkAnimateActive.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkAnimateBase.cpp b/skia/animator/SkAnimateBase.cpp
index cd11442..10a3b5b 100644
--- a/skia/animator/SkAnimateBase.cpp
+++ b/skia/animator/SkAnimateBase.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkAnimateBase.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkAnimateBase.h b/skia/animator/SkAnimateBase.h
index 5f7b1ec..64b9722 100644
--- a/skia/animator/SkAnimateBase.h
+++ b/skia/animator/SkAnimateBase.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkAnimateBase.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkAnimateField.cpp b/skia/animator/SkAnimateField.cpp
index 67381ea..f1439a2 100644
--- a/skia/animator/SkAnimateField.cpp
+++ b/skia/animator/SkAnimateField.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkAnimateField.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkAnimateMaker.cpp b/skia/animator/SkAnimateMaker.cpp
index 82c3f9a..8a78678 100644
--- a/skia/animator/SkAnimateMaker.cpp
+++ b/skia/animator/SkAnimateMaker.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkAnimateMaker.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkAnimateMaker.h b/skia/animator/SkAnimateMaker.h
index 3c22e5d..dae8caf 100644
--- a/skia/animator/SkAnimateMaker.h
+++ b/skia/animator/SkAnimateMaker.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkAnimateMaker.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkAnimateProperties.h b/skia/animator/SkAnimateProperties.h
index a49d2b3..9e3da9ae 100644
--- a/skia/animator/SkAnimateProperties.h
+++ b/skia/animator/SkAnimateProperties.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkAnimateProperties.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkAnimateSet.cpp b/skia/animator/SkAnimateSet.cpp
index c20496d..dd636da 100644
--- a/skia/animator/SkAnimateSet.cpp
+++ b/skia/animator/SkAnimateSet.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkAnimateSet.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkAnimateSet.h b/skia/animator/SkAnimateSet.h
index 8e88b41..9f9ecfb 100644
--- a/skia/animator/SkAnimateSet.h
+++ b/skia/animator/SkAnimateSet.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkAnimateSet.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkAnimator.cpp b/skia/animator/SkAnimator.cpp
index 19c0214..242398b 100644
--- a/skia/animator/SkAnimator.cpp
+++ b/skia/animator/SkAnimator.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkAnimator.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkAnimatorScript.cpp b/skia/animator/SkAnimatorScript.cpp
index 808a596..eafe1db 100644
--- a/skia/animator/SkAnimatorScript.cpp
+++ b/skia/animator/SkAnimatorScript.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkAnimatorScript.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkAnimatorScript.h b/skia/animator/SkAnimatorScript.h
index b3e946b..2fdb029 100644
--- a/skia/animator/SkAnimatorScript.h
+++ b/skia/animator/SkAnimatorScript.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkAnimatorScript.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkBase64.cpp b/skia/animator/SkBase64.cpp
index 5b48acd..e192a52 100644
--- a/skia/animator/SkBase64.cpp
+++ b/skia/animator/SkBase64.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkBase64.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkBase64.h b/skia/animator/SkBase64.h
index 89a179b..12ccf8c 100644
--- a/skia/animator/SkBase64.h
+++ b/skia/animator/SkBase64.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkBase64.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkBoundable.cpp b/skia/animator/SkBoundable.cpp
index 12fb201..f2125ea 100644
--- a/skia/animator/SkBoundable.cpp
+++ b/skia/animator/SkBoundable.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkBoundable.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkBoundable.h b/skia/animator/SkBoundable.h
index 1c21cd2..67f5a12 100644
--- a/skia/animator/SkBoundable.h
+++ b/skia/animator/SkBoundable.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkBoundable.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkBuildCondensedInfo.cpp b/skia/animator/SkBuildCondensedInfo.cpp
index 361a8bd..5e4eedc 100644
--- a/skia/animator/SkBuildCondensedInfo.cpp
+++ b/skia/animator/SkBuildCondensedInfo.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkBuildCondensedInfo.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkCondensedDebug.cpp b/skia/animator/SkCondensedDebug.cpp
index 1d20025a..e7b7ff1 100644
--- a/skia/animator/SkCondensedDebug.cpp
+++ b/skia/animator/SkCondensedDebug.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkCondensedDebug.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkCondensedRelease.cpp b/skia/animator/SkCondensedRelease.cpp
index 87d5d7c..a493cb3 100644
--- a/skia/animator/SkCondensedRelease.cpp
+++ b/skia/animator/SkCondensedRelease.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkCondensedRelease.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayAdd.cpp b/skia/animator/SkDisplayAdd.cpp
index ac8d9c0..8a97a06 100644
--- a/skia/animator/SkDisplayAdd.cpp
+++ b/skia/animator/SkDisplayAdd.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayAdd.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayAdd.h b/skia/animator/SkDisplayAdd.h
index 8429fc8..0f3edc9 100644
--- a/skia/animator/SkDisplayAdd.h
+++ b/skia/animator/SkDisplayAdd.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayAdd.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayApply.cpp b/skia/animator/SkDisplayApply.cpp
index 8926299..b9e65f7 100644
--- a/skia/animator/SkDisplayApply.cpp
+++ b/skia/animator/SkDisplayApply.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayApply.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayApply.h b/skia/animator/SkDisplayApply.h
index 208caa2..d51e467 100644
--- a/skia/animator/SkDisplayApply.h
+++ b/skia/animator/SkDisplayApply.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayApply.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayBounds.cpp b/skia/animator/SkDisplayBounds.cpp
index 03d7366..d0499ce 100644
--- a/skia/animator/SkDisplayBounds.cpp
+++ b/skia/animator/SkDisplayBounds.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayBounds.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayBounds.h b/skia/animator/SkDisplayBounds.h
index fdfb78b..6fcd09c 100644
--- a/skia/animator/SkDisplayBounds.h
+++ b/skia/animator/SkDisplayBounds.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayBounds.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayEvent.cpp b/skia/animator/SkDisplayEvent.cpp
index 4d27158..6253cdf 100644
--- a/skia/animator/SkDisplayEvent.cpp
+++ b/skia/animator/SkDisplayEvent.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayEvent.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayEvent.h b/skia/animator/SkDisplayEvent.h
index e1e66df..837cfec 100644
--- a/skia/animator/SkDisplayEvent.h
+++ b/skia/animator/SkDisplayEvent.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayEvent.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayEvents.cpp b/skia/animator/SkDisplayEvents.cpp
index 0f13b70..e6a01ba 100644
--- a/skia/animator/SkDisplayEvents.cpp
+++ b/skia/animator/SkDisplayEvents.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayEvents.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayEvents.h b/skia/animator/SkDisplayEvents.h
index e22f5c8..73721d4 100644
--- a/skia/animator/SkDisplayEvents.h
+++ b/skia/animator/SkDisplayEvents.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayEvents.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayInclude.cpp b/skia/animator/SkDisplayInclude.cpp
index 52f2e7c..26b1e69 100644
--- a/skia/animator/SkDisplayInclude.cpp
+++ b/skia/animator/SkDisplayInclude.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayInclude.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayInclude.h b/skia/animator/SkDisplayInclude.h
index af67942..81ad76a 100644
--- a/skia/animator/SkDisplayInclude.h
+++ b/skia/animator/SkDisplayInclude.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayInclude.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayInput.cpp b/skia/animator/SkDisplayInput.cpp
index bd034db..3688930 100644
--- a/skia/animator/SkDisplayInput.cpp
+++ b/skia/animator/SkDisplayInput.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayInput.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayInput.h b/skia/animator/SkDisplayInput.h
index 4693c36..ac7c7c1 100644
--- a/skia/animator/SkDisplayInput.h
+++ b/skia/animator/SkDisplayInput.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayInput.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayList.cpp b/skia/animator/SkDisplayList.cpp
index 84889d8..57f29f7 100644
--- a/skia/animator/SkDisplayList.cpp
+++ b/skia/animator/SkDisplayList.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayList.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayList.h b/skia/animator/SkDisplayList.h
index 7f127ba..3743e35 100644
--- a/skia/animator/SkDisplayList.h
+++ b/skia/animator/SkDisplayList.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayList.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayMath.cpp b/skia/animator/SkDisplayMath.cpp
index 9facb9b..66bd1f8 100644
--- a/skia/animator/SkDisplayMath.cpp
+++ b/skia/animator/SkDisplayMath.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayMath.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayMath.h b/skia/animator/SkDisplayMath.h
index dc1fb9e..de26319 100644
--- a/skia/animator/SkDisplayMath.h
+++ b/skia/animator/SkDisplayMath.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayMath.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayMovie.cpp b/skia/animator/SkDisplayMovie.cpp
index eaf73e0..ed74329 100644
--- a/skia/animator/SkDisplayMovie.cpp
+++ b/skia/animator/SkDisplayMovie.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayMovie.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayMovie.h b/skia/animator/SkDisplayMovie.h
index 9441343..2b8a893 100644
--- a/skia/animator/SkDisplayMovie.h
+++ b/skia/animator/SkDisplayMovie.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayMovie.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayNumber.cpp b/skia/animator/SkDisplayNumber.cpp
index 062fd4a..3bb96d7 100644
--- a/skia/animator/SkDisplayNumber.cpp
+++ b/skia/animator/SkDisplayNumber.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayNumber.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayNumber.h b/skia/animator/SkDisplayNumber.h
index 5429aaf..515c35b 100644
--- a/skia/animator/SkDisplayNumber.h
+++ b/skia/animator/SkDisplayNumber.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayNumber.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayPost.cpp b/skia/animator/SkDisplayPost.cpp
index 464150b..17e7c76 100644
--- a/skia/animator/SkDisplayPost.cpp
+++ b/skia/animator/SkDisplayPost.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayPost.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayPost.h b/skia/animator/SkDisplayPost.h
index ab4ad60..4b75b07 100644
--- a/skia/animator/SkDisplayPost.h
+++ b/skia/animator/SkDisplayPost.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayPost.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayRandom.cpp b/skia/animator/SkDisplayRandom.cpp
index dcdfdaf..ab078cd2 100644
--- a/skia/animator/SkDisplayRandom.cpp
+++ b/skia/animator/SkDisplayRandom.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayRandom.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayRandom.h b/skia/animator/SkDisplayRandom.h
index 73f490b..b40907e 100644
--- a/skia/animator/SkDisplayRandom.h
+++ b/skia/animator/SkDisplayRandom.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayRandom.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayScreenplay.cpp b/skia/animator/SkDisplayScreenplay.cpp
index 7591a13..58180e7 100644
--- a/skia/animator/SkDisplayScreenplay.cpp
+++ b/skia/animator/SkDisplayScreenplay.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayScreenplay.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayScreenplay.h b/skia/animator/SkDisplayScreenplay.h
index 3a7200d..cb8103d 100644
--- a/skia/animator/SkDisplayScreenplay.h
+++ b/skia/animator/SkDisplayScreenplay.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayScreenplay.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayType.cpp b/skia/animator/SkDisplayType.cpp
index 0ecbfb4..90fcd89 100644
--- a/skia/animator/SkDisplayType.cpp
+++ b/skia/animator/SkDisplayType.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayType.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayType.h b/skia/animator/SkDisplayType.h
index 068fcddb..a29b285 100644
--- a/skia/animator/SkDisplayType.h
+++ b/skia/animator/SkDisplayType.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayType.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayTypes.cpp b/skia/animator/SkDisplayTypes.cpp
index 6c6ad08..b5bc573 100644
--- a/skia/animator/SkDisplayTypes.cpp
+++ b/skia/animator/SkDisplayTypes.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayTypes.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayTypes.h b/skia/animator/SkDisplayTypes.h
index 738af18..0ac57ba 100644
--- a/skia/animator/SkDisplayTypes.h
+++ b/skia/animator/SkDisplayTypes.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayTypes.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayXMLParser.cpp b/skia/animator/SkDisplayXMLParser.cpp
index 39c4a39..d2775e8 100644
--- a/skia/animator/SkDisplayXMLParser.cpp
+++ b/skia/animator/SkDisplayXMLParser.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayXMLParser.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayXMLParser.h b/skia/animator/SkDisplayXMLParser.h
index bddc809..2c2bec1 100644
--- a/skia/animator/SkDisplayXMLParser.h
+++ b/skia/animator/SkDisplayXMLParser.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayXMLParser.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayable.cpp b/skia/animator/SkDisplayable.cpp
index 83182e5..e50e1ab 100644
--- a/skia/animator/SkDisplayable.cpp
+++ b/skia/animator/SkDisplayable.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayable.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDisplayable.h b/skia/animator/SkDisplayable.h
index 0c35d10..cbc96de 100644
--- a/skia/animator/SkDisplayable.h
+++ b/skia/animator/SkDisplayable.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDisplayable.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDraw3D.cpp b/skia/animator/SkDraw3D.cpp
index d90cf0a..137de9f 100644
--- a/skia/animator/SkDraw3D.cpp
+++ b/skia/animator/SkDraw3D.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDraw3D.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDraw3D.h b/skia/animator/SkDraw3D.h
index b9be37e..5ab61cd 100644
--- a/skia/animator/SkDraw3D.h
+++ b/skia/animator/SkDraw3D.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDraw3D.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawBitmap.cpp b/skia/animator/SkDrawBitmap.cpp
index f5102ab..25355be 100644
--- a/skia/animator/SkDrawBitmap.cpp
+++ b/skia/animator/SkDrawBitmap.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawBitmap.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawBitmap.h b/skia/animator/SkDrawBitmap.h
index 28ec054..f846193 100644
--- a/skia/animator/SkDrawBitmap.h
+++ b/skia/animator/SkDrawBitmap.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawBitmap.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawBlur.cpp b/skia/animator/SkDrawBlur.cpp
index 618a590..0ebabce 100644
--- a/skia/animator/SkDrawBlur.cpp
+++ b/skia/animator/SkDrawBlur.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawBlur.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawBlur.h b/skia/animator/SkDrawBlur.h
index 5a6e8b3..14ceba0 100644
--- a/skia/animator/SkDrawBlur.h
+++ b/skia/animator/SkDrawBlur.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawBlur.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawClip.cpp b/skia/animator/SkDrawClip.cpp
index 147c3a8..1c01c6a 100644
--- a/skia/animator/SkDrawClip.cpp
+++ b/skia/animator/SkDrawClip.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawClip.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawClip.h b/skia/animator/SkDrawClip.h
index c19694b..2fed99a 100644
--- a/skia/animator/SkDrawClip.h
+++ b/skia/animator/SkDrawClip.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawClip.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawColor.cpp b/skia/animator/SkDrawColor.cpp
index d7934a9..009ca10 100644
--- a/skia/animator/SkDrawColor.cpp
+++ b/skia/animator/SkDrawColor.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawColor.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawColor.h b/skia/animator/SkDrawColor.h
index f1e6d2b..89b87cc 100644
--- a/skia/animator/SkDrawColor.h
+++ b/skia/animator/SkDrawColor.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawColor.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawDash.cpp b/skia/animator/SkDrawDash.cpp
index 1a76064..bdac9cd 100644
--- a/skia/animator/SkDrawDash.cpp
+++ b/skia/animator/SkDrawDash.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawDash.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawDash.h b/skia/animator/SkDrawDash.h
index 39a13ea..c2108c1 100644
--- a/skia/animator/SkDrawDash.h
+++ b/skia/animator/SkDrawDash.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawDash.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawDiscrete.cpp b/skia/animator/SkDrawDiscrete.cpp
index 0afe8f5..e1089c2 100644
--- a/skia/animator/SkDrawDiscrete.cpp
+++ b/skia/animator/SkDrawDiscrete.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawDiscrete.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawDiscrete.h b/skia/animator/SkDrawDiscrete.h
index 9652766..78485ee 100644
--- a/skia/animator/SkDrawDiscrete.h
+++ b/skia/animator/SkDrawDiscrete.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawDiscrete.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawEmboss.cpp b/skia/animator/SkDrawEmboss.cpp
index ed1433c..77f6dfd 100644
--- a/skia/animator/SkDrawEmboss.cpp
+++ b/skia/animator/SkDrawEmboss.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawEmboss.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawEmboss.h b/skia/animator/SkDrawEmboss.h
index 51c60a1..fe6911b 100644
--- a/skia/animator/SkDrawEmboss.h
+++ b/skia/animator/SkDrawEmboss.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawEmboss.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawExtraPathEffect.cpp b/skia/animator/SkDrawExtraPathEffect.cpp
index 2a9cb2f..4cca738 100644
--- a/skia/animator/SkDrawExtraPathEffect.cpp
+++ b/skia/animator/SkDrawExtraPathEffect.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawExtraPathEffect.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawFull.cpp b/skia/animator/SkDrawFull.cpp
index 9c964eb3..c6568dbf 100644
--- a/skia/animator/SkDrawFull.cpp
+++ b/skia/animator/SkDrawFull.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawFull.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawFull.h b/skia/animator/SkDrawFull.h
index 68fe130..cfbb643 100644
--- a/skia/animator/SkDrawFull.h
+++ b/skia/animator/SkDrawFull.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawFull.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawGradient.cpp b/skia/animator/SkDrawGradient.cpp
index 4ae7b4f..e9061b5 100644
--- a/skia/animator/SkDrawGradient.cpp
+++ b/skia/animator/SkDrawGradient.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawGradient.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawGradient.h b/skia/animator/SkDrawGradient.h
index 4b4a3cd..30a86df 100644
--- a/skia/animator/SkDrawGradient.h
+++ b/skia/animator/SkDrawGradient.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawGradient.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawGroup.cpp b/skia/animator/SkDrawGroup.cpp
index 4c215a1..aa53564 100644
--- a/skia/animator/SkDrawGroup.cpp
+++ b/skia/animator/SkDrawGroup.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawGroup.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawGroup.h b/skia/animator/SkDrawGroup.h
index da153a0e1..0009a4c 100644
--- a/skia/animator/SkDrawGroup.h
+++ b/skia/animator/SkDrawGroup.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawGroup.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawLine.cpp b/skia/animator/SkDrawLine.cpp
index 4fee464..166cbbc 100644
--- a/skia/animator/SkDrawLine.cpp
+++ b/skia/animator/SkDrawLine.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawLine.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawLine.h b/skia/animator/SkDrawLine.h
index 80451e3..8f771cf 100644
--- a/skia/animator/SkDrawLine.h
+++ b/skia/animator/SkDrawLine.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawLine.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawMatrix.cpp b/skia/animator/SkDrawMatrix.cpp
index 8ccd9c1..dbdbf19 100644
--- a/skia/animator/SkDrawMatrix.cpp
+++ b/skia/animator/SkDrawMatrix.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawMatrix.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawMatrix.h b/skia/animator/SkDrawMatrix.h
index 1cf00ff..8339d8c 100644
--- a/skia/animator/SkDrawMatrix.h
+++ b/skia/animator/SkDrawMatrix.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawMatrix.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawOval.cpp b/skia/animator/SkDrawOval.cpp
index 734bcad..0e3a9ae 100644
--- a/skia/animator/SkDrawOval.cpp
+++ b/skia/animator/SkDrawOval.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawOval.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawOval.h b/skia/animator/SkDrawOval.h
index 2bfec9d..0e7ae3f 100644
--- a/skia/animator/SkDrawOval.h
+++ b/skia/animator/SkDrawOval.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawOval.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawPaint.cpp b/skia/animator/SkDrawPaint.cpp
index a1b67f5..68caa5a3 100644
--- a/skia/animator/SkDrawPaint.cpp
+++ b/skia/animator/SkDrawPaint.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawPaint.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -195,7 +195,7 @@ bool SkDrawPaint::getProperty(int index, SkScriptValue* value) const {
case SK_PROPERTY(descent):
value->fOperand.fScalar = metrics.fDescent;
break;
- // should consider returning fLeading as well (or roll it into ascent/descent somehow <reed>
+ // should consider returning fLeading as well (or roll it into ascent/descent somehow
default:
SkASSERT(0);
return false;
@@ -275,4 +275,3 @@ void SkDrawPaint::setupPaint(SkPaint* paint) const {
if (xfermode != (SkPorterDuff::Mode) -1)
paint->setPorterDuffXfermode((SkPorterDuff::Mode) xfermode);
}
-
diff --git a/skia/animator/SkDrawPaint.h b/skia/animator/SkDrawPaint.h
index 9c4df61..ea77acd 100644
--- a/skia/animator/SkDrawPaint.h
+++ b/skia/animator/SkDrawPaint.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawPaint.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawPath.cpp b/skia/animator/SkDrawPath.cpp
index c1cbad5..895e597 100644
--- a/skia/animator/SkDrawPath.cpp
+++ b/skia/animator/SkDrawPath.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawPath.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawPath.h b/skia/animator/SkDrawPath.h
index 719b3461..673051a 100644
--- a/skia/animator/SkDrawPath.h
+++ b/skia/animator/SkDrawPath.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawPath.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawPoint.cpp b/skia/animator/SkDrawPoint.cpp
index 8654e9a..383a599 100644
--- a/skia/animator/SkDrawPoint.cpp
+++ b/skia/animator/SkDrawPoint.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawPoint.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawPoint.h b/skia/animator/SkDrawPoint.h
index 30fd243..d06e5b7 100644
--- a/skia/animator/SkDrawPoint.h
+++ b/skia/animator/SkDrawPoint.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawPoint.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawRectangle.cpp b/skia/animator/SkDrawRectangle.cpp
index 2971e8c..f2054bd 100644
--- a/skia/animator/SkDrawRectangle.cpp
+++ b/skia/animator/SkDrawRectangle.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawRectangle.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawRectangle.h b/skia/animator/SkDrawRectangle.h
index 51edcc5..9f8bc0a 100644
--- a/skia/animator/SkDrawRectangle.h
+++ b/skia/animator/SkDrawRectangle.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawRectangle.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawSaveLayer.cpp b/skia/animator/SkDrawSaveLayer.cpp
index c78ef30..bc2288f 100644
--- a/skia/animator/SkDrawSaveLayer.cpp
+++ b/skia/animator/SkDrawSaveLayer.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawSaveLayer.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawSaveLayer.h b/skia/animator/SkDrawSaveLayer.h
index c247219..52a36a4 100644
--- a/skia/animator/SkDrawSaveLayer.h
+++ b/skia/animator/SkDrawSaveLayer.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawSaveLayer.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawShader.cpp b/skia/animator/SkDrawShader.cpp
index 2ff225b..b38718e 100644
--- a/skia/animator/SkDrawShader.cpp
+++ b/skia/animator/SkDrawShader.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawShader.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -78,9 +78,9 @@ SkShader* SkDrawBitmapShader::getShader() {
// note: bitmap shader now supports independent tile modes for X and Y
// we pass the same to both, but later we should extend this flexibility
// to the xml (e.g. tileModeX="repeat" tileModeY="clmap")
- // <reed>
+ //
// oops, bitmapshader no longer takes filterBitmap, but deduces it at
- // draw-time from the paint <reed>
+ // draw-time from the paint
SkShader* shader = SkShader::CreateBitmapShader(image->fBitmap,
(SkShader::TileMode) tileMode,
(SkShader::TileMode) tileMode);
@@ -89,4 +89,3 @@ SkShader* SkDrawBitmapShader::getShader() {
(void)autoDel.detach();
return shader;
}
-
diff --git a/skia/animator/SkDrawShader.h b/skia/animator/SkDrawShader.h
index 9fd94a5..35ca419 100644
--- a/skia/animator/SkDrawShader.h
+++ b/skia/animator/SkDrawShader.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawShader.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawText.cpp b/skia/animator/SkDrawText.cpp
index d2f3992..dcc3a75 100644
--- a/skia/animator/SkDrawText.cpp
+++ b/skia/animator/SkDrawText.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawText.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawText.h b/skia/animator/SkDrawText.h
index cc5ce80..cb1d1b9 100644
--- a/skia/animator/SkDrawText.h
+++ b/skia/animator/SkDrawText.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawText.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawTextBox.cpp b/skia/animator/SkDrawTextBox.cpp
index 2c3108f..4c4ac76 100644
--- a/skia/animator/SkDrawTextBox.cpp
+++ b/skia/animator/SkDrawTextBox.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawTextBox.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawTextBox.h b/skia/animator/SkDrawTextBox.h
index 6396eac..ee97c22 100644
--- a/skia/animator/SkDrawTextBox.h
+++ b/skia/animator/SkDrawTextBox.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawTextBox.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawTo.cpp b/skia/animator/SkDrawTo.cpp
index 7176e40..342f7d4 100644
--- a/skia/animator/SkDrawTo.cpp
+++ b/skia/animator/SkDrawTo.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawTo.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawTo.h b/skia/animator/SkDrawTo.h
index c9268ae..0ad78e8c 100644
--- a/skia/animator/SkDrawTo.h
+++ b/skia/animator/SkDrawTo.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawTo.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawTransparentShader.cpp b/skia/animator/SkDrawTransparentShader.cpp
index 8282248..c1da687 100644
--- a/skia/animator/SkDrawTransparentShader.cpp
+++ b/skia/animator/SkDrawTransparentShader.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawTransparentShader.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawTransparentShader.h b/skia/animator/SkDrawTransparentShader.h
index 8c0c49e..e831883 100644
--- a/skia/animator/SkDrawTransparentShader.h
+++ b/skia/animator/SkDrawTransparentShader.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawTransparentShader.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawable.cpp b/skia/animator/SkDrawable.cpp
index 631ebb1..6968fe1 100644
--- a/skia/animator/SkDrawable.cpp
+++ b/skia/animator/SkDrawable.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawable.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDrawable.h b/skia/animator/SkDrawable.h
index 1f932ad..7284a25 100644
--- a/skia/animator/SkDrawable.h
+++ b/skia/animator/SkDrawable.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDrawable.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDump.cpp b/skia/animator/SkDump.cpp
index 5e8b92d..eac956c 100644
--- a/skia/animator/SkDump.cpp
+++ b/skia/animator/SkDump.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDump.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkDump.h b/skia/animator/SkDump.h
index 8b38f35..73a6957 100644
--- a/skia/animator/SkDump.h
+++ b/skia/animator/SkDump.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkDump.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkExtras.h b/skia/animator/SkExtras.h
index b792758..88e9b2d 100644
--- a/skia/animator/SkExtras.h
+++ b/skia/animator/SkExtras.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkExtras.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkGetCondensedInfo.cpp b/skia/animator/SkGetCondensedInfo.cpp
index 35f7171..ee91caa 100644
--- a/skia/animator/SkGetCondensedInfo.cpp
+++ b/skia/animator/SkGetCondensedInfo.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkGetCondensedInfo.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkHitClear.cpp b/skia/animator/SkHitClear.cpp
index e88ab92..e7e301dc 100644
--- a/skia/animator/SkHitClear.cpp
+++ b/skia/animator/SkHitClear.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkHitClear.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkHitClear.h b/skia/animator/SkHitClear.h
index 8a41e0c..f2b50c0 100644
--- a/skia/animator/SkHitClear.h
+++ b/skia/animator/SkHitClear.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkHitClear.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkHitTest.cpp b/skia/animator/SkHitTest.cpp
index f54ca9a..585249a 100644
--- a/skia/animator/SkHitTest.cpp
+++ b/skia/animator/SkHitTest.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkHitTest.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkHitTest.h b/skia/animator/SkHitTest.h
index a786cb2..b3a9d85 100644
--- a/skia/animator/SkHitTest.h
+++ b/skia/animator/SkHitTest.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkHitTest.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkIntArray.h b/skia/animator/SkIntArray.h
index bb58541..b2a49c1 100644
--- a/skia/animator/SkIntArray.h
+++ b/skia/animator/SkIntArray.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkIntArray.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkMatrixParts.cpp b/skia/animator/SkMatrixParts.cpp
index d5bdcc1..56bb2d0 100644
--- a/skia/animator/SkMatrixParts.cpp
+++ b/skia/animator/SkMatrixParts.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkMatrixParts.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkMatrixParts.h b/skia/animator/SkMatrixParts.h
index 5fcf115..d97d9fb 100644
--- a/skia/animator/SkMatrixParts.h
+++ b/skia/animator/SkMatrixParts.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkMatrixParts.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkMemberInfo.cpp b/skia/animator/SkMemberInfo.cpp
index d4f4e51..50536c2 100644
--- a/skia/animator/SkMemberInfo.cpp
+++ b/skia/animator/SkMemberInfo.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkMemberInfo.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkMemberInfo.h b/skia/animator/SkMemberInfo.h
index 00dd7b6..e45994e 100644
--- a/skia/animator/SkMemberInfo.h
+++ b/skia/animator/SkMemberInfo.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkMemberInfo.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkOperand.h b/skia/animator/SkOperand.h
index 65ee592..2c7e93b 100644
--- a/skia/animator/SkOperand.h
+++ b/skia/animator/SkOperand.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkOperand.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkOperandInterpolator.h b/skia/animator/SkOperandInterpolator.h
index d623475..f155276 100644
--- a/skia/animator/SkOperandInterpolator.h
+++ b/skia/animator/SkOperandInterpolator.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkOperandInterpolator.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkOperandIterpolator.cpp b/skia/animator/SkOperandIterpolator.cpp
index 0204221..2bddd34 100644
--- a/skia/animator/SkOperandIterpolator.cpp
+++ b/skia/animator/SkOperandIterpolator.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkOperandIterpolator.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkPaintParts.cpp b/skia/animator/SkPaintParts.cpp
index a6c0fa1..48799c6 100644
--- a/skia/animator/SkPaintParts.cpp
+++ b/skia/animator/SkPaintParts.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkPaintParts.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkPaintParts.h b/skia/animator/SkPaintParts.h
index 615a028..a8bb8bd 100644
--- a/skia/animator/SkPaintParts.h
+++ b/skia/animator/SkPaintParts.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkPaintParts.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkPathParts.cpp b/skia/animator/SkPathParts.cpp
index e015d66..46d2232 100644
--- a/skia/animator/SkPathParts.cpp
+++ b/skia/animator/SkPathParts.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkPathParts.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkPathParts.h b/skia/animator/SkPathParts.h
index 4af0295b..72e4185 100644
--- a/skia/animator/SkPathParts.h
+++ b/skia/animator/SkPathParts.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkPathParts.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkPostParts.cpp b/skia/animator/SkPostParts.cpp
index b1469fc..254b17d 100644
--- a/skia/animator/SkPostParts.cpp
+++ b/skia/animator/SkPostParts.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkPostParts.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkPostParts.h b/skia/animator/SkPostParts.h
index f02b4b0..ef41fe5 100644
--- a/skia/animator/SkPostParts.h
+++ b/skia/animator/SkPostParts.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkPostParts.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkSVGPath.cpp b/skia/animator/SkSVGPath.cpp
index e1c83c0..86eeee8 100644
--- a/skia/animator/SkSVGPath.cpp
+++ b/skia/animator/SkSVGPath.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkSVGPath.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkScript.cpp b/skia/animator/SkScript.cpp
index c6c9b73..3b67d7b 100644
--- a/skia/animator/SkScript.cpp
+++ b/skia/animator/SkScript.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkScript.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkScript.h b/skia/animator/SkScript.h
index ca095ba..bb7d9782 100644
--- a/skia/animator/SkScript.h
+++ b/skia/animator/SkScript.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkScript.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkScriptDecompile.cpp b/skia/animator/SkScriptDecompile.cpp
index 22bd7b4..d582d33 100644
--- a/skia/animator/SkScriptDecompile.cpp
+++ b/skia/animator/SkScriptDecompile.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkScriptDecompile.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkSnapshot.cpp b/skia/animator/SkSnapshot.cpp
index 0b331f5..b65c517 100644
--- a/skia/animator/SkSnapshot.cpp
+++ b/skia/animator/SkSnapshot.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkSnapshot.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkSnapshot.h b/skia/animator/SkSnapshot.h
index b63145d..c459fbb 100644
--- a/skia/animator/SkSnapshot.h
+++ b/skia/animator/SkSnapshot.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkSnapshot.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkTDArray_Experimental.h b/skia/animator/SkTDArray_Experimental.h
index c59f670..94d78711 100644
--- a/skia/animator/SkTDArray_Experimental.h
+++ b/skia/animator/SkTDArray_Experimental.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkTDArray_Experimental.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkTextOnPath.cpp b/skia/animator/SkTextOnPath.cpp
index af0eb4c..1a06746 100644
--- a/skia/animator/SkTextOnPath.cpp
+++ b/skia/animator/SkTextOnPath.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkTextOnPath.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkTextOnPath.h b/skia/animator/SkTextOnPath.h
index f01e118..3c78b5b 100644
--- a/skia/animator/SkTextOnPath.h
+++ b/skia/animator/SkTextOnPath.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkTextOnPath.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkTextToPath.cpp b/skia/animator/SkTextToPath.cpp
index 2a3fa8d..44036a3 100644
--- a/skia/animator/SkTextToPath.cpp
+++ b/skia/animator/SkTextToPath.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkTextToPath.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkTextToPath.h b/skia/animator/SkTextToPath.h
index 2ba41cf..6d93239 100644
--- a/skia/animator/SkTextToPath.h
+++ b/skia/animator/SkTextToPath.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkTextToPath.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkTime.cpp b/skia/animator/SkTime.cpp
index de091fe..a36a95a 100644
--- a/skia/animator/SkTime.cpp
+++ b/skia/animator/SkTime.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkTime.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkTypedArray.cpp b/skia/animator/SkTypedArray.cpp
index fb5ba2c..075c607 100644
--- a/skia/animator/SkTypedArray.cpp
+++ b/skia/animator/SkTypedArray.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkTypedArray.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkTypedArray.h b/skia/animator/SkTypedArray.h
index 0535426..a658f29 100644
--- a/skia/animator/SkTypedArray.h
+++ b/skia/animator/SkTypedArray.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkTypedArray.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkXMLAnimatorWriter.cpp b/skia/animator/SkXMLAnimatorWriter.cpp
index 86a43a1..b26bc733 100644
--- a/skia/animator/SkXMLAnimatorWriter.cpp
+++ b/skia/animator/SkXMLAnimatorWriter.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkXMLAnimatorWriter.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/animator/SkXMLAnimatorWriter.h b/skia/animator/SkXMLAnimatorWriter.h
index cc02b1c..c5830cd 100644
--- a/skia/animator/SkXMLAnimatorWriter.h
+++ b/skia/animator/SkXMLAnimatorWriter.h
@@ -1,6 +1,6 @@
/* libs/graphics/animator/SkXMLAnimatorWriter.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/corecg/Android.mk b/skia/corecg/Android.mk
index ead28bd..1bcd9ca 100644
--- a/skia/corecg/Android.mk
+++ b/skia/corecg/Android.mk
@@ -10,11 +10,12 @@ LOCAL_SRC_FILES:= \
SkCordic.cpp \
SkDebug.cpp \
SkDebug_stdio.cpp \
- SkFloat.cpp \
+ SkFloatBits.cpp \
SkInterpolator.cpp \
SkMath.cpp \
SkMatrix.cpp \
SkMemory_stdlib.cpp \
+ SkPageFlipper.cpp \
SkPoint.cpp \
SkRect.cpp \
SkRegion.cpp
diff --git a/skia/corecg/NOTICE b/skia/corecg/NOTICE
index 29f81d8..70c5422 100644
--- a/skia/corecg/NOTICE
+++ b/skia/corecg/NOTICE
@@ -1,3 +1,16 @@
+
+ Copyright (c) 2005-2008, The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
@@ -175,27 +188,3 @@
END OF TERMS AND CONDITIONS
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/skia/corecg/Sk64.cpp b/skia/corecg/Sk64.cpp
index 028a4ae..6013bd7 100644
--- a/skia/corecg/Sk64.cpp
+++ b/skia/corecg/Sk64.cpp
@@ -1,6 +1,6 @@
/* libs/corecg/Sk64.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/corecg/SkBuffer.cpp b/skia/corecg/SkBuffer.cpp
index 1a8f069..5768ca4 100644
--- a/skia/corecg/SkBuffer.cpp
+++ b/skia/corecg/SkBuffer.cpp
@@ -1,6 +1,6 @@
/* libs/corecg/SkBuffer.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/corecg/SkChunkAlloc.cpp b/skia/corecg/SkChunkAlloc.cpp
index b9cfd90..ae37ec0 100644
--- a/skia/corecg/SkChunkAlloc.cpp
+++ b/skia/corecg/SkChunkAlloc.cpp
@@ -1,6 +1,6 @@
/* libs/corecg/SkChunkAlloc.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/corecg/SkCordic.cpp b/skia/corecg/SkCordic.cpp
index accbd95..539bc9b 100644
--- a/skia/corecg/SkCordic.cpp
+++ b/skia/corecg/SkCordic.cpp
@@ -1,6 +1,6 @@
/* libs/corecg/SkCordic.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/corecg/SkCordic.h b/skia/corecg/SkCordic.h
index 70c70b5..9f45a81 100644
--- a/skia/corecg/SkCordic.h
+++ b/skia/corecg/SkCordic.h
@@ -1,6 +1,6 @@
/* libs/corecg/SkCordic.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/corecg/SkDebug.cpp b/skia/corecg/SkDebug.cpp
index 5d5518d..64ea8b4 100644
--- a/skia/corecg/SkDebug.cpp
+++ b/skia/corecg/SkDebug.cpp
@@ -1,6 +1,6 @@
/* libs/corecg/SkDebug.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/corecg/SkDebug_stdio.cpp b/skia/corecg/SkDebug_stdio.cpp
index 6da09af..d455131 100644
--- a/skia/corecg/SkDebug_stdio.cpp
+++ b/skia/corecg/SkDebug_stdio.cpp
@@ -1,6 +1,6 @@
/* libs/corecg/SkDebug_stdio.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -42,11 +42,12 @@ void Android_SkDebugf(const char* file, int line, const char* function,
va_end(args);
}
-#elif defined(SK_DEBUG)
+#else
#include <stdarg.h>
#include <stdio.h>
+#if 0
void SkDebugf(const char format[], ...)
{
char buffer[kBufferSize + 1];
@@ -56,6 +57,7 @@ void SkDebugf(const char format[], ...)
va_end(args);
fprintf(stderr, buffer);
}
+#endif
#endif
diff --git a/skia/corecg/SkFloat.cpp b/skia/corecg/SkFloat.cpp
index bb96947..504c1d3 100644
--- a/skia/corecg/SkFloat.cpp
+++ b/skia/corecg/SkFloat.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2008 Google Inc.
+ * Copyright (C) 2006-2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/skia/corecg/SkFloat.h b/skia/corecg/SkFloat.h
index 2a2abac..31aaeed 100644
--- a/skia/corecg/SkFloat.h
+++ b/skia/corecg/SkFloat.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2008 Google Inc.
+ * Copyright (C) 2006-2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/skia/corecg/SkFloatBits.cpp b/skia/corecg/SkFloatBits.cpp
new file mode 100644
index 0000000..1f15df2
--- /dev/null
+++ b/skia/corecg/SkFloatBits.cpp
@@ -0,0 +1,205 @@
+#include "SkFloatBits.h"
+#include "SkMath.h"
+
+/******************************************************************************
+ SkFloatBits_toInt[Floor, Round, Ceil] are identical except for what they
+ do right before they return ... >> exp;
+ Floor - adds nothing
+ Round - adds 1 << (exp - 1)
+ Ceil - adds (1 << exp) - 1
+
+ Floor and Cast are very similar, but Cast applies its sign after all other
+ computations on value. Also, Cast does not need to check for negative zero,
+ as that value (0x80000000) "does the right thing" for Ceil. Note that it
+ doesn't for Floor/Round/Ceil, hence the explicit check.
+******************************************************************************/
+
+#define EXP_BIAS (127+23)
+#define MATISSA_MAGIC_BIG (1 << 23)
+
+static inline int unpack_exp(uint32_t packed) {
+ return (packed << 1 >> 24);
+}
+
+#if 0
+// the ARM compiler generates an extra BIC, so I use the dirty version instead
+static inline int unpack_matissa(uint32_t packed) {
+ // we could mask with 0x7FFFFF, but that is harder for ARM to encode
+ return (packed & ~0xFF000000) | MATISSA_MAGIC_BIG;
+}
+#endif
+
+// returns the low 24-bits, so we need to OR in the magic_bit afterwards
+static inline int unpack_matissa_dirty(uint32_t packed) {
+ return packed & ~0xFF000000;
+}
+
+// same as (int)float
+int32_t SkFloatBits_toIntCast(int32_t packed) {
+ int exp = unpack_exp(packed) - EXP_BIAS;
+ int value = unpack_matissa_dirty(packed) | MATISSA_MAGIC_BIG;
+
+ if (exp >= 0) {
+ if (exp > 7) { // overflow
+ value = SK_MaxS32;
+ } else {
+ value <<= exp;
+ }
+ } else {
+ exp = -exp;
+ if (exp > 25) { // underflow
+ exp = 25;
+ }
+ value >>= exp;
+ }
+ return SkApplySign(value, SkExtractSign(packed));
+}
+
+// same as (int)floor(float)
+int32_t SkFloatBits_toIntFloor(int32_t packed) {
+ // curse you negative 0
+ if ((packed << 1) == 0) {
+ return 0;
+ }
+
+ int exp = unpack_exp(packed) - EXP_BIAS;
+ int value = unpack_matissa_dirty(packed) | MATISSA_MAGIC_BIG;
+
+ if (exp >= 0) {
+ if (exp > 7) { // overflow
+ value = SK_MaxS32;
+ } else {
+ value <<= exp;
+ }
+ // apply the sign after we check for overflow
+ return SkApplySign(value, SkExtractSign(packed));
+ } else {
+ // apply the sign before we right-shift
+ value = SkApplySign(value, SkExtractSign(packed));
+ exp = -exp;
+ if (exp > 25) { // underflow
+ exp = 25;
+ }
+ // int add = 0;
+ return value >> exp;
+ }
+}
+
+// same as (int)floor(float + 0.5)
+int32_t SkFloatBits_toIntRound(int32_t packed) {
+ // curse you negative 0
+ if ((packed << 1) == 0) {
+ return 0;
+ }
+
+ int exp = unpack_exp(packed) - EXP_BIAS;
+ int value = unpack_matissa_dirty(packed) | MATISSA_MAGIC_BIG;
+
+ if (exp >= 0) {
+ if (exp > 7) { // overflow
+ value = SK_MaxS32;
+ } else {
+ value <<= exp;
+ }
+ // apply the sign after we check for overflow
+ return SkApplySign(value, SkExtractSign(packed));
+ } else {
+ // apply the sign before we right-shift
+ value = SkApplySign(value, SkExtractSign(packed));
+ exp = -exp;
+ if (exp > 25) { // underflow
+ exp = 25;
+ }
+ int add = 1 << (exp - 1);
+ return (value + add) >> exp;
+ }
+}
+
+// same as (int)ceil(float)
+int32_t SkFloatBits_toIntCeil(int32_t packed) {
+ // curse you negative 0
+ if ((packed << 1) == 0) {
+ return 0;
+ }
+
+ int exp = unpack_exp(packed) - EXP_BIAS;
+ int value = unpack_matissa_dirty(packed) | MATISSA_MAGIC_BIG;
+
+ if (exp >= 0) {
+ if (exp > 7) { // overflow
+ value = SK_MaxS32;
+ } else {
+ value <<= exp;
+ }
+ // apply the sign after we check for overflow
+ return SkApplySign(value, SkExtractSign(packed));
+ } else {
+ // apply the sign before we right-shift
+ value = SkApplySign(value, SkExtractSign(packed));
+ exp = -exp;
+ if (exp > 25) { // underflow
+ exp = 25;
+ }
+ int add = (1 << exp) - 1;
+ return (value + add) >> exp;
+ }
+}
+
+float SkFloatBits_intToFloatNative(int x);
+float SkFloatBits_intToFloatNative(int x) {
+ return x;
+}
+
+float SkIntToFloatCast(int32_t value) {
+ if (0 == value) {
+ return 0;
+ }
+
+ int shift = EXP_BIAS;
+
+ // record the sign and make value positive
+ int sign = SkExtractSign(value);
+ value = SkApplySign(value, sign);
+
+ if (value >> 24) { // value is too big (has more than 24 bits set)
+ int bias = 8 - SkCLZ(value);
+ SkDebugf("value = %d, bias = %d\n", value, bias);
+ SkASSERT(bias > 0 && bias < 8);
+ value >>= bias; // need to round?
+ shift += bias;
+ } else {
+ int zeros = SkCLZ(value << 8);
+ SkASSERT(zeros >= 0 && zeros <= 23);
+ value <<= zeros;
+ shift -= zeros;
+ }
+
+ // now value is left-aligned to 24 bits
+ SkASSERT((value >> 23) == 1);
+ SkASSERT(shift >= 0 && shift <= 255);
+
+ SkFloatIntUnion data;
+ data.fSignBitInt = (sign << 31) | (shift << 23) | (value & ~MATISSA_MAGIC_BIG);
+ return data.fFloat;
+}
+
+float SkIntToFloatCast_NoOverflowCheck(int32_t value) {
+ if (0 == value) {
+ return 0;
+ }
+
+ int shift = EXP_BIAS;
+
+ // record the sign and make value positive
+ int sign = SkExtractSign(value);
+ value = SkApplySign(value, sign);
+
+ int zeros = SkCLZ(value << 8);
+ value <<= zeros;
+ shift -= zeros;
+
+ SkFloatIntUnion data;
+ data.fSignBitInt = (sign << 31) | (shift << 23) | (value & ~MATISSA_MAGIC_BIG);
+ return data.fFloat;
+}
+
diff --git a/skia/corecg/SkFloatBits.h b/skia/corecg/SkFloatBits.h
index 012770a..a1f67d8 100644
--- a/skia/corecg/SkFloatBits.h
+++ b/skia/corecg/SkFloatBits.h
@@ -1,43 +1,2 @@
-#ifndef SkFloatBits_DEFINED
-#define SkFloatBits_DEFINED
-
-#include "SkTypes.h"
-
-/** Convert a sign-bit int (i.e. float interpreted as int) into a 2s compliement
- int. This also converts -0 (0x80000000) to 0. Doing this to a float allows
- it to be compared using normal C operators (<, <=, etc.)
-*/
-static inline int32_t SkSignBitTo2sCompliment(int32_t x) {
- if (x < 0) {
- x &= 0x7FFFFFFF;
- x = -x;
- }
- return x;
-}
-
-#ifdef SK_CAN_USE_FLOAT
-
-union SkFloatIntUnion {
- float fFloat;
- int32_t fSignBitInt;
-};
-
-/** Return the float as a 2s compliment int. Just just be used to compare floats
- to each other or against positive float-bit-constants (like 0)
-*/
-static int32_t SkFloatAsInt(float x) {
- SkFloatIntUnion data;
- data.fFloat = x;
- return SkSignBitTo2sCompliment(data.fSignBitInt);
-}
-
-#endif
-
-#ifdef SK_SCALAR_IS_FLOAT
- #define SkScalarAsInt(x) SkFloatAsInt(x)
-#else
- #define SkScalarAsInt(x) (x)
-#endif
-
-#endif
-
+// TODO(brettw) remove this file!
+#include "../include/corecg/SkFloatBits.h"
diff --git a/skia/corecg/SkInterpolator.cpp b/skia/corecg/SkInterpolator.cpp
index 1576708..e4ecd95 100644
--- a/skia/corecg/SkInterpolator.cpp
+++ b/skia/corecg/SkInterpolator.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2008 Google Inc.
+ * Copyright (C) 2006-2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -80,7 +80,7 @@ SkInterpolatorBase::Result SkInterpolatorBase::timeToT(SkMSec time, SkScalar* T,
SkASSERT(fFrameCount > 0);
Result result = kNormal_Result;
if (fRepeat != SK_Scalar1) {
- SkMSec startTime = 0, endTime = 0;
+ SkMSec startTime, endTime;
this->getDuration(&startTime, &endTime);
SkMSec totalTime = endTime - startTime;
SkMSec offsetTime = time - startTime;
diff --git a/skia/corecg/SkMath.cpp b/skia/corecg/SkMath.cpp
index 42ea107..c627d9b 100644
--- a/skia/corecg/SkMath.cpp
+++ b/skia/corecg/SkMath.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2008 Google Inc.
+ * Copyright (C) 2006-2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
#include "SkMath.h"
#include "SkCordic.h"
+#include "SkFloatBits.h"
#include "SkFloatingPoint.h"
#include "Sk64.h"
#include "SkScalar.h"
@@ -214,7 +215,7 @@ int SkFixedMulCommon(SkFixed a, int b, int bias) {
#endif
SkFixed SkFixedFastInvert(SkFixed x) {
-/* Adapted (stolen) from Mathias' gglRecip()
+/* Adapted (stolen) from gglRecip()
*/
if (x == SK_Fixed1) {
@@ -585,6 +586,116 @@ static void check_length(const SkPoint& p, SkScalar targetLen) {
}
#endif
+#ifdef SK_CAN_USE_FLOAT
+
+static float nextFloat(SkRandom& rand) {
+ SkFloatIntUnion data;
+ data.fSignBitInt = rand.nextU();
+ return data.fFloat;
+}
+
+/* returns true if a == b as resulting from (int)x. Since it is undefined
+ what to do if the float exceeds 2^32-1, we check for that explicitly.
+*/
+static bool equal_float_native_skia(float x, uint32_t ni, uint32_t si) {
+ if (!(x == x)) { // NAN
+ return si == SK_MaxS32 || si == SK_MinS32;
+ }
+ // for out of range, C is undefined, but skia always should return NaN32
+ if (x > SK_MaxS32) {
+ return si == SK_MaxS32;
+ }
+ if (x < -SK_MaxS32) {
+ return si == SK_MinS32;
+ }
+ return si == ni;
+}
+
+static void assert_float_equal(const char op[], float x, uint32_t ni,
+ uint32_t si) {
+ if (!equal_float_native_skia(x, ni, si)) {
+ SkDebugf("-- %s float %g bits %x native %x skia %x\n", op, x, ni, si);
+ SkASSERT(!"oops");
+ }
+}
+
+static void test_float_cast(float x) {
+ int ix = (int)x;
+ int iix = SkFloatToIntCast(x);
+ assert_float_equal("cast", x, ix, iix);
+}
+
+static void test_float_floor(float x) {
+ int ix = (int)floor(x);
+ int iix = SkFloatToIntFloor(x);
+ assert_float_equal("floor", x, ix, iix);
+}
+
+static void test_float_round(float x) {
+ double xx = x + 0.5; // need intermediate double to avoid temp loss
+ int ix = (int)floor(xx);
+ int iix = SkFloatToIntRound(x);
+ assert_float_equal("round", x, ix, iix);
+}
+
+static void test_float_ceil(float x) {
+ int ix = (int)ceil(x);
+ int iix = SkFloatToIntCeil(x);
+ assert_float_equal("ceil", x, ix, iix);
+}
+
+static void test_float_conversions(float x) {
+ test_float_cast(x);
+ test_float_floor(x);
+ test_float_round(x);
+ test_float_ceil(x);
+}
+
+static void test_int2float(int ival) {
+ float x0 = (float)ival;
+ float x1 = SkIntToFloatCast(ival);
+ float x2 = SkIntToFloatCast_NoOverflowCheck(ival);
+ SkASSERT(x0 == x1);
+ SkASSERT(x0 == x2);
+}
+
+static void unittest_fastfloat() {
+ SkRandom rand;
+ size_t i;
+
+ static const float gFloats[] = {
+ 0.f, 1.f, 0.5f, 0.499999f, 0.5000001f, 1.f/3,
+ 0.000000001f, 1000000000.f, // doesn't overflow
+ 0.0000000001f, 10000000000.f // does overflow
+ };
+ for (i = 0; i < SK_ARRAY_COUNT(gFloats); i++) {
+// SkDebugf("---- test floats %g %d\n", gFloats[i], (int)gFloats[i]);
+ test_float_conversions(gFloats[i]);
+ test_float_conversions(-gFloats[i]);
+ }
+
+ for (int outer = 0; outer < 100; outer++) {
+ rand.setSeed(outer);
+ for (i = 0; i < 100000; i++) {
+ float x = nextFloat(rand);
+ test_float_conversions(x);
+ }
+
+ test_int2float(0);
+ test_int2float(1);
+ test_int2float(-1);
+ for (i = 0; i < 100000; i++) {
+ // for now only test ints that are 24bits or less, since we don't
+ // round (down) large ints the same as IEEE...
+ int ival = rand.nextU() & 0xFFFFFF;
+ test_int2float(ival);
+ test_int2float(-ival);
+ }
+ }
+}
+
+#endif
+
static void test_muldiv255() {
for (int a = 0; a <= 255; a++) {
for (int b = 0; b <= 255; b++) {
@@ -606,7 +717,7 @@ static void test_muldiv255() {
}
}
-void SkMath::UnitTest() {
+void SkMath::UnitTest() {
#ifdef SK_SUPPORT_UNITTEST
int i;
int32_t x;
@@ -696,8 +807,10 @@ void SkMath::UnitTest() {
SkASSERT(result == 1);
}
+#ifdef SK_CAN_USE_FLOAT
+ unittest_fastfloat();
+#endif
-
#ifdef SkLONGLONG
for (i = 0; i < 100000; i++) {
SkFixed numer = rand.nextS();
@@ -817,4 +930,3 @@ void SkMath::UnitTest() {
}
#endif
-
diff --git a/skia/corecg/SkMatrix.cpp b/skia/corecg/SkMatrix.cpp
index 4c9a087..d556884 100644
--- a/skia/corecg/SkMatrix.cpp
+++ b/skia/corecg/SkMatrix.cpp
@@ -1,6 +1,6 @@
/* libs/corecg/SkMatrix.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -65,19 +65,21 @@ enum {
uint8_t SkMatrix::computeTypeMask() const {
unsigned mask = 0;
- if (SkScalarAsInt(fMat[kMPersp0]) | SkScalarAsInt(fMat[kMPersp1]) |
- (SkScalarAsInt(fMat[kMPersp2]) - kPersp1Int)) {
+ if (SkScalarAs2sCompliment(fMat[kMPersp0]) |
+ SkScalarAs2sCompliment(fMat[kMPersp1]) |
+ (SkScalarAs2sCompliment(fMat[kMPersp2]) - kPersp1Int)) {
mask |= kPerspective_Mask;
}
- if (SkScalarAsInt(fMat[kMTransX]) | SkScalarAsInt(fMat[kMTransY])) {
+ if (SkScalarAs2sCompliment(fMat[kMTransX]) |
+ SkScalarAs2sCompliment(fMat[kMTransY])) {
mask |= kTranslate_Mask;
}
- int m00 = SkScalarAsInt(fMat[SkMatrix::kMScaleX]);
- int m01 = SkScalarAsInt(fMat[SkMatrix::kMSkewX]);
- int m10 = SkScalarAsInt(fMat[SkMatrix::kMSkewY]);
- int m11 = SkScalarAsInt(fMat[SkMatrix::kMScaleY]);
+ int m00 = SkScalarAs2sCompliment(fMat[SkMatrix::kMScaleX]);
+ int m01 = SkScalarAs2sCompliment(fMat[SkMatrix::kMSkewX]);
+ int m10 = SkScalarAs2sCompliment(fMat[SkMatrix::kMSkewY]);
+ int m11 = SkScalarAs2sCompliment(fMat[SkMatrix::kMScaleY]);
if (m01 | m10) {
mask |= kAffine_Mask;
@@ -112,7 +114,7 @@ uint8_t SkMatrix::computeTypeMask() const {
///////////////////////////////////////////////////////////////////////////////
void SkMatrix::setTranslate(SkScalar dx, SkScalar dy) {
- if (SkScalarAsInt(dx) | SkScalarAsInt(dy)) {
+ if (SkScalarAs2sCompliment(dx) | SkScalarAs2sCompliment(dy)) {
fMat[kMTransX] = dx;
fMat[kMTransY] = dy;
@@ -134,7 +136,7 @@ bool SkMatrix::preTranslate(SkScalar dx, SkScalar dy) {
return this->preConcat(m);
}
- if (SkScalarAsInt(dx) | SkScalarAsInt(dy)) {
+ if (SkScalarAs2sCompliment(dx) | SkScalarAs2sCompliment(dy)) {
fMat[kMTransX] += SkScalarMul(fMat[kMScaleX], dx) +
SkScalarMul(fMat[kMSkewX], dy);
fMat[kMTransY] += SkScalarMul(fMat[kMSkewY], dx) +
@@ -152,7 +154,7 @@ bool SkMatrix::postTranslate(SkScalar dx, SkScalar dy) {
return this->postConcat(m);
}
- if (SkScalarAsInt(dx) | SkScalarAsInt(dy)) {
+ if (SkScalarAs2sCompliment(dx) | SkScalarAs2sCompliment(dy)) {
fMat[kMTransX] += dx;
fMat[kMTransY] += dy;
this->setTypeMask(kUnknown_Mask);
@@ -643,11 +645,15 @@ bool SkMatrix::setConcat(const SkMatrix& a, const SkMatrix& b) {
}
bool SkMatrix::preConcat(const SkMatrix& mat) {
- return this->setConcat(*this, mat);
+ // check for identity first, so we don't do a needless copy of ourselves
+ // to ourselves inside setConcat()
+ return mat.isIdentity() || this->setConcat(*this, mat);
}
bool SkMatrix::postConcat(const SkMatrix& mat) {
- return this->setConcat(mat, *this);
+ // check for identity first, so we don't do a needless copy of ourselves
+ // to ourselves inside setConcat()
+ return mat.isIdentity() || this->setConcat(mat, *this);
}
///////////////////////////////////////////////////////////////////////////////
@@ -672,7 +678,6 @@ bool SkMatrix::postConcat(const SkMatrix& mat) {
if (SkScalarNearlyZero((float)det, SK_ScalarNearlyZero * SK_ScalarNearlyZero)) {
return 0;
}
-
return (float)(1.0 / det);
}
#else
diff --git a/skia/corecg/SkMemory_stdlib.cpp b/skia/corecg/SkMemory_stdlib.cpp
index 6ceca33..befcda6 100644
--- a/skia/corecg/SkMemory_stdlib.cpp
+++ b/skia/corecg/SkMemory_stdlib.cpp
@@ -1,6 +1,6 @@
/* libs/corecg/SkMemory_stdlib.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/corecg/SkPageFlipper.cpp b/skia/corecg/SkPageFlipper.cpp
new file mode 100644
index 0000000..526ba09
--- /dev/null
+++ b/skia/corecg/SkPageFlipper.cpp
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "SkPageFlipper.h"
+
+SkPageFlipper::SkPageFlipper() {
+ fWidth = 0;
+ fHeight = 0;
+ fDirty0 = &fDirty0Storage;
+ fDirty1 = &fDirty1Storage;
+
+ fDirty0->setEmpty();
+ fDirty1->setEmpty();
+}
+
+SkPageFlipper::SkPageFlipper(int width, int height) {
+ fWidth = width;
+ fHeight = height;
+ fDirty0 = &fDirty0Storage;
+ fDirty1 = &fDirty1Storage;
+
+ fDirty0->setRect(0, 0, width, height);
+ fDirty1->setEmpty();
+}
+
+void SkPageFlipper::resize(int width, int height) {
+ fWidth = width;
+ fHeight = height;
+
+ // this is the opposite of the constructors
+ fDirty1->setRect(0, 0, width, height);
+ fDirty0->setEmpty();
+}
+
+void SkPageFlipper::inval() {
+ fDirty1->setRect(0, 0, fWidth, fHeight);
+}
+
+void SkPageFlipper::inval(const SkIRect& rect) {
+ SkIRect r;
+ r.set(0, 0, fWidth, fHeight);
+ if (r.intersect(rect)) {
+ fDirty1->op(r, SkRegion::kUnion_Op);
+ }
+}
+
+void SkPageFlipper::inval(const SkRegion& rgn) {
+ SkRegion r;
+ r.setRect(0, 0, fWidth, fHeight);
+ if (r.op(rgn, SkRegion::kIntersect_Op)) {
+ fDirty1->op(r, SkRegion::kUnion_Op);
+ }
+}
+
+void SkPageFlipper::inval(const SkRect& rect, bool antialias) {
+ SkIRect r;
+ rect.round(&r);
+ if (antialias) {
+ r.inset(-1, -1);
+ }
+ this->inval(r);
+}
+
+const SkRegion& SkPageFlipper::update(SkRegion* copyBits) {
+ // Copy over anything new from page0 that isn't dirty in page1
+ copyBits->op(*fDirty0, *fDirty1, SkRegion::kDifference_Op);
+ SkTSwap<SkRegion*>(fDirty0, fDirty1);
+ fDirty1->setEmpty();
+ return *fDirty0;
+}
+
+
diff --git a/skia/corecg/SkPoint.cpp b/skia/corecg/SkPoint.cpp
index 9d6acdf..704c2ba 100644
--- a/skia/corecg/SkPoint.cpp
+++ b/skia/corecg/SkPoint.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2008 Google Inc.
+ * Copyright (C) 2006-2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/skia/corecg/SkRect.cpp b/skia/corecg/SkRect.cpp
index f32b27e..d602754 100644
--- a/skia/corecg/SkRect.cpp
+++ b/skia/corecg/SkRect.cpp
@@ -1,19 +1,18 @@
-/* libs/corecg/SkRect.cpp
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#include "SkRect.h"
@@ -67,17 +66,33 @@ void SkRect::set(const SkPoint pts[], int count)
{
SkASSERT((pts && count > 0) || count == 0);
- if (count <= 0)
- memset(this, 0, sizeof(SkRect));
- else
- {
+ if (count <= 0) {
+ bzero(this, sizeof(SkRect));
+ } else {
+#ifdef SK_SCALAR_SLOW_COMPARES
+ int32_t l, t, r, b;
+
+ l = r = SkScalarAs2sCompliment(pts[0].fX);
+ t = b = SkScalarAs2sCompliment(pts[0].fY);
+
+ for (int i = 1; i < count; i++) {
+ int32_t x = SkScalarAs2sCompliment(pts[i].fX);
+ int32_t y = SkScalarAs2sCompliment(pts[i].fY);
+
+ if (x < l) l = x; else if (x > r) r = x;
+ if (y < t) t = y; else if (y > b) b = y;
+ }
+ this->set(Sk2sComplimentAsScalar(l),
+ Sk2sComplimentAsScalar(t),
+ Sk2sComplimentAsScalar(r),
+ Sk2sComplimentAsScalar(b));
+#else
SkScalar l, t, r, b;
l = r = pts[0].fX;
t = b = pts[0].fY;
- for (int i = 1; i < count; i++)
- {
+ for (int i = 1; i < count; i++) {
SkScalar x = pts[i].fX;
SkScalar y = pts[i].fY;
@@ -85,6 +100,7 @@ void SkRect::set(const SkPoint pts[], int count)
if (y < t) t = y; else if (y > b) b = y;
}
this->set(l, t, r, b);
+#endif
}
}
diff --git a/skia/corecg/SkRegion.cpp b/skia/corecg/SkRegion.cpp
index a0860b6e..4edd222 100644
--- a/skia/corecg/SkRegion.cpp
+++ b/skia/corecg/SkRegion.cpp
@@ -1,6 +1,6 @@
/* libs/corecg/SkRegion.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -430,6 +430,46 @@ const SkRegion::RunType* SkRegion::getRuns(RunType tmpStorage[], int* count) con
/////////////////////////////////////////////////////////////////////////////////////
+bool SkRegion::intersects(const SkIRect& r) const {
+ if (this->isEmpty() || r.isEmpty()) {
+ return false;
+ }
+
+ if (!SkIRect::Intersects(fBounds, r)) {
+ return false;
+ }
+
+ if (this->isRect()) {
+ return true;
+ }
+
+ // we are complex
+ SkRegion tmp;
+ return tmp.op(*this, r, kIntersect_Op);
+}
+
+bool SkRegion::intersects(const SkRegion& rgn) const {
+ if (this->isEmpty() || rgn.isEmpty()) {
+ return false;
+ }
+
+ if (!SkIRect::Intersects(fBounds, rgn.fBounds)) {
+ return false;
+ }
+
+ if (this->isRect() && rgn.isRect()) {
+ return true;
+ }
+
+ // one or both of us is complex
+ // TODO: write a faster version that aborts as soon as we write the first
+ // non-empty span, to avoid build the entire result
+ SkRegion tmp;
+ return tmp.op(*this, rgn, kIntersect_Op);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////
+
int operator==(const SkRegion& a, const SkRegion& b)
{
SkDEBUGCODE(a.validate();)
diff --git a/skia/corecg/SkRegionPriv.h b/skia/corecg/SkRegionPriv.h
index 80e2e83..70f8828 100644
--- a/skia/corecg/SkRegionPriv.h
+++ b/skia/corecg/SkRegionPriv.h
@@ -1,6 +1,6 @@
/* libs/corecg/SkRegionPriv.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/corecg/SkSinTable.h b/skia/corecg/SkSinTable.h
index eb3a31c..9b4477d 100644
--- a/skia/corecg/SkSinTable.h
+++ b/skia/corecg/SkSinTable.h
@@ -1,6 +1,6 @@
/* libs/corecg/SkSinTable.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/corecg/SkTSort.h b/skia/corecg/SkTSort.h
index 44f05bb..6193dff 100644
--- a/skia/corecg/SkTSort.h
+++ b/skia/corecg/SkTSort.h
@@ -1,6 +1,6 @@
/* libs/corecg/SkTSort.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/effects/Sk1DPathEffect.cpp b/skia/effects/Sk1DPathEffect.cpp
index 325d402..fe299c9 100644
--- a/skia/effects/Sk1DPathEffect.cpp
+++ b/skia/effects/Sk1DPathEffect.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/effects/Sk1DPathEffect.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/effects/Sk2DPathEffect.cpp b/skia/effects/Sk2DPathEffect.cpp
index 48c3a4c..405b194 100644
--- a/skia/effects/Sk2DPathEffect.cpp
+++ b/skia/effects/Sk2DPathEffect.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/effects/Sk2DPathEffect.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/effects/SkAvoidXfermode.cpp b/skia/effects/SkAvoidXfermode.cpp
index 6781e9f..eed4012 100644
--- a/skia/effects/SkAvoidXfermode.cpp
+++ b/skia/effects/SkAvoidXfermode.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/effects/SkAvoidXfermode.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/effects/SkBlurDrawLooper.cpp b/skia/effects/SkBlurDrawLooper.cpp
index 61b69eb..6ad0136 100644
--- a/skia/effects/SkBlurDrawLooper.cpp
+++ b/skia/effects/SkBlurDrawLooper.cpp
@@ -84,3 +84,8 @@ void SkBlurDrawLooper::restore()
}
}
+///////////////////////////////////////////////////////////////////////////////
+
+static SkFlattenable::Registrar gReg("SkBlurDrawLooper",
+ SkBlurDrawLooper::CreateProc);
+
diff --git a/skia/effects/SkBlurMask.cpp b/skia/effects/SkBlurMask.cpp
index f2c07a8..a7b3202 100644
--- a/skia/effects/SkBlurMask.cpp
+++ b/skia/effects/SkBlurMask.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/effects/SkBlurMask.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/effects/SkBlurMask.h b/skia/effects/SkBlurMask.h
index 2df5731..8f61d54 100644
--- a/skia/effects/SkBlurMask.h
+++ b/skia/effects/SkBlurMask.h
@@ -1,6 +1,6 @@
/* libs/graphics/effects/SkBlurMask.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/effects/SkBlurMaskFilter.cpp b/skia/effects/SkBlurMaskFilter.cpp
index 3ff1d81..2db60a5 100644
--- a/skia/effects/SkBlurMaskFilter.cpp
+++ b/skia/effects/SkBlurMaskFilter.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/effects/SkBlurMaskFilter.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -34,11 +34,12 @@ public:
// This method is not exported to java.
virtual void flatten(SkFlattenableWriteBuffer&);
+ static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
+
private:
SkScalar fRadius;
SkBlurMaskFilter::BlurStyle fBlurStyle;
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
SkBlurMaskFilterImpl(SkFlattenableReadBuffer&);
typedef SkMaskFilter INHERITED;
@@ -115,3 +116,8 @@ void SkBlurMaskFilterImpl::flatten(SkFlattenableWriteBuffer& buffer)
buffer.write32(fBlurStyle);
}
+///////////////////////////////////////////////////////////////////////////////
+
+static SkFlattenable::Registrar gReg("SkBlurMaskFilter",
+ SkBlurMaskFilterImpl::CreateProc);
+
diff --git a/skia/effects/SkCamera.cpp b/skia/effects/SkCamera.cpp
index 469b175..b02499f 100644
--- a/skia/effects/SkCamera.cpp
+++ b/skia/effects/SkCamera.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/effects/SkCamera.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/effects/SkColorFilters.cpp b/skia/effects/SkColorFilters.cpp
index f5178a8..50be1ad 100644
--- a/skia/effects/SkColorFilters.cpp
+++ b/skia/effects/SkColorFilters.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/effects/SkColorFilters.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/effects/SkColorMatrixFilter.cpp b/skia/effects/SkColorMatrixFilter.cpp
index 751cd30..07c8d2f 100644
--- a/skia/effects/SkColorMatrixFilter.cpp
+++ b/skia/effects/SkColorMatrixFilter.cpp
@@ -65,9 +65,10 @@ static void ScaleAdd(SkColorMatrixFilter::State* state,
const int shift = state->fShift;
int32_t* SK_RESTRICT result = state->fResult;
- result[0] = (array[0] * r + array[4]) >> shift;
- result[1] = (array[6] * g + array[9]) >> shift;
- result[2] = (array[12] * b + array[14]) >> shift;
+ // cast to (int) to keep the expression signed for the shift
+ result[0] = (array[0] * (int)r + array[4]) >> shift;
+ result[1] = (array[6] * (int)g + array[9]) >> shift;
+ result[2] = (array[12] * (int)b + array[14]) >> shift;
result[3] = a;
}
@@ -76,9 +77,10 @@ static void ScaleAdd16(SkColorMatrixFilter::State* state,
const int32_t* SK_RESTRICT array = state->fArray;
int32_t* SK_RESTRICT result = state->fResult;
- result[0] = (array[0] * r + array[4]) >> 16;
- result[1] = (array[6] * g + array[9]) >> 16;
- result[2] = (array[12] * b + array[14]) >> 16;
+ // cast to (int) to keep the expression signed for the shift
+ result[0] = (array[0] * (int)r + array[4]) >> 16;
+ result[1] = (array[6] * (int)g + array[9]) >> 16;
+ result[2] = (array[12] * (int)b + array[14]) >> 16;
result[3] = a;
}
@@ -137,7 +139,7 @@ void SkColorMatrixFilter::setup(const SkScalar SK_RESTRICT src[20]) {
fState.fShift = 16; // we are starting out as fixed 16.16
if (bits < 9) {
- bits = 8 - bits;
+ bits = 9 - bits;
fState.fShift -= bits;
for (i = 0; i < 20; i++) {
array[i] >>= bits;
@@ -269,9 +271,6 @@ void SkColorMatrixFilter::filterSpan(const SkPMColor src[], int count,
}
}
-#define SK_RG_BITS_DIFF (SK_G16_BITS - SK_R16_BITS)
-#define SK_BG_BITS_DIFF (SK_G16_BITS - SK_B16_BITS)
-
void SkColorMatrixFilter::filterSpan16(const uint16_t src[], int count,
uint16_t dst[]) {
SkASSERT(fFlags & SkColorFilter::kHasFilter16_Flag);
@@ -290,18 +289,19 @@ void SkColorMatrixFilter::filterSpan16(const uint16_t src[], int count,
for (int i = 0; i < count; i++) {
uint16_t c = src[i];
- unsigned r = SkGetPackedR16(c);
- unsigned g = SkGetPackedG16(c);
- unsigned b = SkGetPackedB16(c);
+ // expand to 8bit components (since our matrix translate is 8bit biased
+ unsigned r = SkPacked16ToR32(c);
+ unsigned g = SkPacked16ToG32(c);
+ unsigned b = SkPacked16ToB32(c);
- r = (r << SK_RG_BITS_DIFF) | (r >> (SK_R16_BITS - 1));
- b = (b << SK_BG_BITS_DIFF) | (b >> (SK_B16_BITS - 1));
proc(state, r, g, b, 0);
- r = pin(result[0], SK_G16_MASK) >> SK_RG_BITS_DIFF;
- g = pin(result[1], SK_G16_MASK);
- b = pin(result[2], SK_G16_MASK) >> SK_BG_BITS_DIFF;
- dst[i] = SkPackRGB16(r, g, b);
+ r = pin(result[0], SK_R32_MASK);
+ g = pin(result[1], SK_G32_MASK);
+ b = pin(result[2], SK_B32_MASK);
+
+ // now packed it back down to 16bits (hmmm, could dither...)
+ dst[i] = SkPack888ToRGB16(r, g, b);
}
}
diff --git a/skia/effects/SkCornerPathEffect.cpp b/skia/effects/SkCornerPathEffect.cpp
index ad92af1..43d571a 100644
--- a/skia/effects/SkCornerPathEffect.cpp
+++ b/skia/effects/SkCornerPathEffect.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/effects/SkCornerPathEffect.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/effects/SkCullPoints.cpp b/skia/effects/SkCullPoints.cpp
index 1b50349..23d00b6 100644
--- a/skia/effects/SkCullPoints.cpp
+++ b/skia/effects/SkCullPoints.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/effects/SkCullPoints.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -36,10 +36,10 @@ bool SkCullPoints::sect_test(int x0, int y0, int x1, int y1) const
{
const SkIRect& r = fR;
- if ((x0 < r.fLeft && x1 < r.fLeft) ||
- (x0 > r.fRight && x1 > r.fRight) ||
- (y0 < r.fTop && y1 < r.fTop) ||
- (y0 > r.fBottom && y1 > r.fBottom))
+ if (x0 < r.fLeft && x1 < r.fLeft ||
+ x0 > r.fRight && x1 > r.fRight ||
+ y0 < r.fTop && y1 < r.fTop ||
+ y0 > r.fBottom && y1 > r.fBottom)
return false;
// since the crossprod test is a little expensive, check for easy-in cases first
diff --git a/skia/effects/SkDashPathEffect.cpp b/skia/effects/SkDashPathEffect.cpp
index 2c29009..48581b5 100644
--- a/skia/effects/SkDashPathEffect.cpp
+++ b/skia/effects/SkDashPathEffect.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/effects/SkDashPathEffect.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/effects/SkDiscretePathEffect.cpp b/skia/effects/SkDiscretePathEffect.cpp
index d19b23a..6286045 100644
--- a/skia/effects/SkDiscretePathEffect.cpp
+++ b/skia/effects/SkDiscretePathEffect.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/effects/SkDiscretePathEffect.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/effects/SkEmbossMask.cpp b/skia/effects/SkEmbossMask.cpp
index 9a77df1..28e38a1 100644
--- a/skia/effects/SkEmbossMask.cpp
+++ b/skia/effects/SkEmbossMask.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/effects/SkEmbossMask.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/effects/SkEmbossMask.h b/skia/effects/SkEmbossMask.h
index 093e53d..8e56d6f 100644
--- a/skia/effects/SkEmbossMask.h
+++ b/skia/effects/SkEmbossMask.h
@@ -1,6 +1,6 @@
/* libs/graphics/effects/SkEmbossMask.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/effects/SkEmbossMaskFilter.cpp b/skia/effects/SkEmbossMaskFilter.cpp
index 0af2ae05..fcfad9d 100644
--- a/skia/effects/SkEmbossMaskFilter.cpp
+++ b/skia/effects/SkEmbossMaskFilter.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/effects/SkEmbossMaskFilter.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/effects/SkEmbossMask_Table.h b/skia/effects/SkEmbossMask_Table.h
index d936c32..775fe25 100644
--- a/skia/effects/SkEmbossMask_Table.h
+++ b/skia/effects/SkEmbossMask_Table.h
@@ -1,6 +1,6 @@
/* libs/graphics/effects/SkEmbossMask_Table.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/effects/SkGradientShader.cpp b/skia/effects/SkGradientShader.cpp
index 1f279f9..a1674cb 100644
--- a/skia/effects/SkGradientShader.cpp
+++ b/skia/effects/SkGradientShader.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/effects/SkGradientShader.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -607,15 +607,12 @@ private:
typedef Gradient_Shader INHERITED;
};
-#if 0
-// Used by a section that's currently #if 0 Linear_Gradient::shadeSpan
// Return true if fx, fx+dx, fx+2*dx, ... is always in range
static bool no_need_for_clamp(int fx, int dx, int count)
{
SkASSERT(count > 0);
return (unsigned)((fx | (fx + (count - 1) * dx)) >> 8) <= 0xFF;
}
-#endif
void Linear_Gradient::shadeSpan(int x, int y, SkPMColor dstC[], int count)
{
@@ -1505,11 +1502,26 @@ void Sweep_Gradient::shadeSpan16(int x, int y, uint16_t dstC[], int count)
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
+// assumes colors is SkColor* and pos is SkScalar*
+#define EXPAND_1_COLOR(count) \
+ SkColor tmp[2]; \
+ do { \
+ if (1 == count) { \
+ tmp[0] = tmp[1] = colors[0]; \
+ colors = tmp; \
+ pos = NULL; \
+ count = 2; \
+ } \
+ } while (0)
+
SkShader* SkGradientShader::CreateLinear( const SkPoint pts[2],
const SkColor colors[], const SkScalar pos[], int colorCount,
SkShader::TileMode mode, SkUnitMapper* mapper)
{
- SkASSERT(pts && colors && colorCount >= 2);
+ if (NULL == pts || NULL == colors || colorCount < 1) {
+ return NULL;
+ }
+ EXPAND_1_COLOR(colorCount);
return SkNEW_ARGS(Linear_Gradient, (pts, colors, pos, colorCount, mode, mapper));
}
@@ -1518,7 +1530,10 @@ SkShader* SkGradientShader::CreateRadial( const SkPoint& center, SkScalar radi
const SkColor colors[], const SkScalar pos[], int colorCount,
SkShader::TileMode mode, SkUnitMapper* mapper)
{
- SkASSERT(radius > 0 && colors && colorCount >= 2);
+ if (radius <= 0 || NULL == colors || colorCount < 1) {
+ return NULL;
+ }
+ EXPAND_1_COLOR(colorCount);
return SkNEW_ARGS(Radial_Gradient, (center, radius, colors, pos, colorCount, mode, mapper));
}
@@ -1528,8 +1543,11 @@ SkShader* SkGradientShader::CreateSweep(SkScalar cx, SkScalar cy,
const SkScalar pos[],
int count, SkUnitMapper* mapper)
{
- SkASSERT(colors && count >= 2);
-
+ if (NULL == colors || count < 1) {
+ return NULL;
+ }
+ EXPAND_1_COLOR(count);
+
return SkNEW_ARGS(Sweep_Gradient, (cx, cy, colors, pos, count, mapper));
}
diff --git a/skia/effects/SkLayerDrawLooper.cpp b/skia/effects/SkLayerDrawLooper.cpp
new file mode 100644
index 0000000..f2d8ba8
--- /dev/null
+++ b/skia/effects/SkLayerDrawLooper.cpp
@@ -0,0 +1,130 @@
+#include "SkCanvas.h"
+#include "SkLayerDrawLooper.h"
+#include "SkPaint.h"
+
+SkLayerDrawLooper::SkLayerDrawLooper() {
+ fRecs = NULL;
+ fCount = 0;
+}
+
+SkLayerDrawLooper::~SkLayerDrawLooper() {
+ Rec* rec = fRecs;
+ while (rec) {
+ Rec* next = rec->fNext;
+ SkDELETE(rec);
+ rec = next;
+ }
+}
+
+SkPaint* SkLayerDrawLooper::addLayer(SkScalar dx, SkScalar dy) {
+ fCount += 1;
+
+ Rec* rec = SkNEW(Rec);
+ rec->fNext = fRecs;
+ rec->fOffset.set(dx, dy);
+ fRecs = rec;
+
+ return &rec->fPaint;
+}
+
+void SkLayerDrawLooper::init(SkCanvas* canvas, SkPaint* paint) {
+ fIter.fSavedPaint = *paint;
+ fIter.fPaint = paint;
+ fIter.fCanvas = canvas;
+ fIter.fRec = fRecs;
+ canvas->save(SkCanvas::kMatrix_SaveFlag);
+}
+
+bool SkLayerDrawLooper::next() {
+ Rec* rec = fIter.fRec;
+ if (rec) {
+ *fIter.fPaint = rec->fPaint;
+ fIter.fCanvas->restore();
+ fIter.fCanvas->save(SkCanvas::kMatrix_SaveFlag);
+ fIter.fCanvas->translate(rec->fOffset.fX, rec->fOffset.fY);
+
+ fIter.fRec = rec->fNext;
+ return true;
+ }
+ return false;
+}
+
+void SkLayerDrawLooper::restore() {
+ fIter.fCanvas->restore();
+ *fIter.fPaint = fIter.fSavedPaint;
+}
+
+SkLayerDrawLooper::Rec* SkLayerDrawLooper::Rec::Reverse(Rec* head) {
+ Rec* rec = head;
+ Rec* prev = NULL;
+ while (rec) {
+ Rec* next = rec->fNext;
+ rec->fNext = prev;
+ prev = rec;
+ rec = next;
+ }
+ return prev;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void SkLayerDrawLooper::flatten(SkFlattenableWriteBuffer& buffer) {
+ this->INHERITED::flatten(buffer);
+
+#ifdef SK_DEBUG
+ {
+ Rec* rec = fRecs;
+ int count = 0;
+ while (rec) {
+ rec = rec->fNext;
+ count += 1;
+ }
+ SkASSERT(count == fCount);
+ }
+#endif
+
+ buffer.writeInt(fCount);
+
+ Rec* rec = fRecs;
+ for (int i = 0; i < fCount; i++) {
+ buffer.writeScalar(rec->fOffset.fX);
+ buffer.writeScalar(rec->fOffset.fY);
+ rec->fPaint.flatten(buffer);
+ rec = rec->fNext;
+ }
+}
+
+SkLayerDrawLooper::SkLayerDrawLooper(SkFlattenableReadBuffer& buffer)
+ : INHERITED(buffer) {
+ fRecs = NULL;
+ fCount = 0;
+
+ int count = buffer.readInt();
+
+ for (int i = 0; i < count; i++) {
+ SkScalar dx = buffer.readScalar();
+ SkScalar dy = buffer.readScalar();
+ this->addLayer(dx, dy)->unflatten(buffer);
+ }
+ SkASSERT(count == fCount);
+
+ // we're in reverse order, so fix it now
+ fRecs = Rec::Reverse(fRecs);
+
+#ifdef SK_DEBUG
+ {
+ Rec* rec = fRecs;
+ int n = 0;
+ while (rec) {
+ rec = rec->fNext;
+ n += 1;
+ }
+ SkASSERT(count == n);
+ }
+#endif
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+static SkFlattenable::Registrar gReg("SkLayerDrawLooper",
+ SkLayerDrawLooper::CreateProc);
diff --git a/skia/effects/SkLayerRasterizer.cpp b/skia/effects/SkLayerRasterizer.cpp
index b21f885..390e3a3 100644
--- a/skia/effects/SkLayerRasterizer.cpp
+++ b/skia/effects/SkLayerRasterizer.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/effects/SkLayerRasterizer.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/effects/SkNinePatch.cpp b/skia/effects/SkNinePatch.cpp
index 267c39e..b8e11fb 100644
--- a/skia/effects/SkNinePatch.cpp
+++ b/skia/effects/SkNinePatch.cpp
@@ -1,5 +1,5 @@
/*
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -90,10 +90,10 @@ void SkNinePatch::DrawMesh(SkCanvas* canvas, const SkRect& bounds,
return;
}
- // should try a quick-reject test before calling lockPixels <reed>
+ // should try a quick-reject test before calling lockPixels
SkAutoLockPixels alp(bitmap);
- // after the lock, it is valid to check getPixels()
- if (bitmap.getPixels() == NULL) {
+ // after the lock, it is valid to check
+ if (!bitmap.readyToDraw()) {
return;
}
@@ -224,17 +224,64 @@ void SkNinePatch::DrawMesh(SkCanvas* canvas, const SkRect& bounds,
mesh.fIndices, indexCount, p);
}
+///////////////////////////////////////////////////////////////////////////////
+
+static void drawNineViaRects(SkCanvas* canvas, const SkRect& dst,
+ const SkBitmap& bitmap, const SkIRect& margins,
+ const SkPaint* paint) {
+ const int32_t srcX[4] = {
+ 0, margins.fLeft, bitmap.width() - margins.fRight, bitmap.width()
+ };
+ const int32_t srcY[4] = {
+ 0, margins.fTop, bitmap.height() - margins.fBottom, bitmap.height()
+ };
+ const SkScalar dstX[4] = {
+ dst.fLeft, dst.fLeft + SkIntToScalar(margins.fLeft),
+ dst.fRight - SkIntToScalar(margins.fRight), dst.fRight
+ };
+ const SkScalar dstY[4] = {
+ dst.fTop, dst.fTop + SkIntToScalar(margins.fTop),
+ dst.fBottom - SkIntToScalar(margins.fBottom), dst.fBottom
+ };
+
+ SkIRect s;
+ SkRect d;
+ for (int y = 0; y < 3; y++) {
+ s.fTop = srcY[y];
+ s.fBottom = srcY[y+1];
+ d.fTop = dstY[y];
+ d.fBottom = dstY[y+1];
+ for (int x = 0; x < 3; x++) {
+ s.fLeft = srcX[x];
+ s.fRight = srcX[x+1];
+ d.fLeft = dstX[x];
+ d.fRight = dstX[x+1];
+ canvas->drawBitmapRect(bitmap, &s, d, paint);
+ }
+ }
+}
+
void SkNinePatch::DrawNine(SkCanvas* canvas, const SkRect& bounds,
const SkBitmap& bitmap, const SkIRect& margins,
const SkPaint* paint) {
- int32_t xDivs[2];
- int32_t yDivs[2];
-
- xDivs[0] = margins.fLeft;
- xDivs[1] = bitmap.width() - margins.fRight;
- yDivs[0] = margins.fTop;
- yDivs[1] = bitmap.height() - margins.fBottom;
-
- SkNinePatch::DrawMesh(canvas, bounds, bitmap, xDivs, 2, yDivs, 2, paint);
+ /** Our vertices code has numerical precision problems if the transformed
+ coordinates land directly on a 1/2 pixel boundary. To work around that
+ for now, we only take the vertices case if we are in opengl. Also,
+ when not in GL, the vertices impl is slower (more math) than calling
+ the viaRects code.
+ */
+ if (canvas->getViewport(NULL)) { // returns true for OpenGL
+ int32_t xDivs[2];
+ int32_t yDivs[2];
+
+ xDivs[0] = margins.fLeft;
+ xDivs[1] = bitmap.width() - margins.fRight;
+ yDivs[0] = margins.fTop;
+ yDivs[1] = bitmap.height() - margins.fBottom;
+
+ SkNinePatch::DrawMesh(canvas, bounds, bitmap,
+ xDivs, 2, yDivs, 2, paint);
+ } else {
+ drawNineViaRects(canvas, bounds, bitmap, margins, paint);
+ }
}
-
diff --git a/skia/effects/SkRadialGradient_Table.h b/skia/effects/SkRadialGradient_Table.h
index ed9712f..2336237 100644
--- a/skia/effects/SkRadialGradient_Table.h
+++ b/skia/effects/SkRadialGradient_Table.h
@@ -1,6 +1,6 @@
/* libs/graphics/effects/SkRadialGradient_Table.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/effects/SkShaderExtras.cpp b/skia/effects/SkShaderExtras.cpp
index 6bfe517..84a1647 100644
--- a/skia/effects/SkShaderExtras.cpp
+++ b/skia/effects/SkShaderExtras.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/effects/SkShaderExtras.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/effects/SkTransparentShader.cpp b/skia/effects/SkTransparentShader.cpp
index 0c08543..6b79839 100644
--- a/skia/effects/SkTransparentShader.cpp
+++ b/skia/effects/SkTransparentShader.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/effects/SkTransparentShader.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/gl/SkGL.cpp b/skia/gl/SkGL.cpp
index e4effba..0634709 100644
--- a/skia/gl/SkGL.cpp
+++ b/skia/gl/SkGL.cpp
@@ -151,9 +151,14 @@ static bool canBeTexture(const SkBitmap& bm, GLenum* format, GLenum* type) {
*type = GL_UNSIGNED_SHORT_4_4_4_4;
break;
case SkBitmap::kIndex8_Config:
+#ifdef SK_GL_SUPPORT_COMPRESSEDTEXIMAGE2D
+ *format = GL_PALETTE8_RGBA8_OES;
+ *type = GL_UNSIGNED_BYTE; // unused I think
+#else
// we promote index to argb32
*format = GL_RGBA;
*type = GL_UNSIGNED_BYTE;
+#endif
break;
case SkBitmap::kA8_Config:
*format = GL_ALPHA;
@@ -165,8 +170,11 @@ static bool canBeTexture(const SkBitmap& bm, GLenum* format, GLenum* type) {
return true;
}
+#define SK_GL_SIZE_OF_PALETTE (256 * sizeof(SkPMColor))
+
size_t SkGL::ComputeTextureMemorySize(const SkBitmap& bitmap) {
int shift = 0;
+ size_t adder = 0;
switch (bitmap.config()) {
case SkBitmap::kARGB_8888_Config:
case SkBitmap::kRGB_565_Config:
@@ -175,22 +183,74 @@ size_t SkGL::ComputeTextureMemorySize(const SkBitmap& bitmap) {
// we're good as is
break;
case SkBitmap::kIndex8_Config:
+#ifdef SK_GL_SUPPORT_COMPRESSEDTEXIMAGE2D
+ // account for the colortable
+ adder = SK_GL_SIZE_OF_PALETTE;
+#else
// we promote index to argb32
shift = 2;
+#endif
break;
default:
return 0;
}
- return bitmap.getSize() << shift;
+ return (bitmap.getSize() << shift) + adder;
+}
+
+#ifdef SK_GL_SUPPORT_COMPRESSEDTEXIMAGE2D
+/* Fill out buffer with the compressed format GL expects from a colortable
+ based bitmap. [palette (colortable) + indices].
+
+ At the moment I always take the 8bit version, since that's what my data
+ is. I could detect that the colortable.count is <= 16, and then repack the
+ indices as nibbles to save RAM, but it would take more time (i.e. a lot
+ slower than memcpy), so I'm skipping that for now.
+
+ GL wants a full 256 palette entry, even though my ctable is only as big
+ as the colortable.count says it is. I presume it is OK to leave any
+ trailing entries uninitialized, since none of my indices should exceed
+ ctable->count().
+*/
+static void build_compressed_data(void* buffer, const SkBitmap& bitmap) {
+ SkASSERT(SkBitmap::kIndex8_Config == bitmap.config());
+
+ SkColorTable* ctable = bitmap.getColorTable();
+ uint8_t* dst = (uint8_t*)buffer;
+
+ memcpy(dst, ctable->lockColors(), ctable->count() * sizeof(SkPMColor));
+ ctable->unlockColors(false);
+
+ // always skip a full 256 number of entries, even if we memcpy'd fewer
+ dst += SK_GL_SIZE_OF_PALETTE;
+ memcpy(dst, bitmap.getPixels(), bitmap.getSize());
+}
+#endif
+
+/* Return true if the bitmap cannot be supported in its current config as a
+ texture, and it needs to be promoted to ARGB32.
+ */
+static bool needToPromoteTo32bit(const SkBitmap& bitmap) {
+ if (bitmap.config() == SkBitmap::kIndex8_Config) {
+#ifdef SK_GL_SUPPORT_COMPRESSEDTEXIMAGE2D
+ const int w = bitmap.width();
+ const int h = bitmap.height();
+ if (SkNextPow2(w) == w && SkNextPow2(h) == h) {
+ // we can handle Indx8 if we're a POW2
+ return false;
+ }
+#endif
+ return true; // must promote to ARGB32
+ }
+ return false;
}
GLuint SkGL::BindNewTexture(const SkBitmap& origBitmap, SkPoint* max) {
SkBitmap tmpBitmap;
const SkBitmap* bitmap = &origBitmap;
- if (origBitmap.config() == SkBitmap::kIndex8_Config) {
- // we promote index to argb32
+ if (needToPromoteTo32bit(origBitmap)) {
origBitmap.copyTo(&tmpBitmap, SkBitmap::kARGB_8888_Config);
+ // now bitmap points to our temp, which has been promoted to 32bits
bitmap = &tmpBitmap;
}
@@ -200,7 +260,7 @@ GLuint SkGL::BindNewTexture(const SkBitmap& origBitmap, SkPoint* max) {
}
SkAutoLockPixels alp(*bitmap);
- if (bitmap->getPixels() == NULL) {
+ if (!bitmap->readyToDraw()) {
return 0;
}
@@ -218,15 +278,30 @@ GLuint SkGL::BindNewTexture(const SkBitmap& origBitmap, SkPoint* max) {
glPixelStorei(GL_UNPACK_ALIGNMENT, bitmap->bytesPerPixel());
// check if we need to scale to create power-of-2 dimensions
- if (ow != nw || oh != nh) {
- glTexImage2D(GL_TEXTURE_2D, 0, format, nw, nh, 0,
- format, type, NULL);
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, ow, oh,
- format, type, bitmap->getPixels());
- } else {
- // easy case, the bitmap is already pow2
- glTexImage2D(GL_TEXTURE_2D, 0, format, ow, oh, 0,
- format, type, bitmap->getPixels());
+#ifdef SK_GL_SUPPORT_COMPRESSEDTEXIMAGE2D
+ if (SkBitmap::kIndex8_Config == bitmap->config()) {
+ size_t imagesize = bitmap->getSize() + SK_GL_SIZE_OF_PALETTE;
+ SkAutoMalloc storage(imagesize);
+
+ build_compressed_data(storage.get(), *bitmap);
+ // we only support POW2 here (GLES 1.0 restriction)
+ SkASSERT(ow == nw);
+ SkASSERT(oh == nh);
+ glCompressedTexImage2D(GL_TEXTURE_2D, 0, format, ow, oh, 0,
+ imagesize, storage.get());
+ } else // fall through to non-compressed logic
+#endif
+ {
+ if (ow != nw || oh != nh) {
+ glTexImage2D(GL_TEXTURE_2D, 0, format, nw, nh, 0,
+ format, type, NULL);
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, ow, oh,
+ format, type, bitmap->getPixels());
+ } else {
+ // easy case, the bitmap is already pow2
+ glTexImage2D(GL_TEXTURE_2D, 0, format, ow, oh, 0,
+ format, type, bitmap->getPixels());
+ }
}
#ifdef TRACE_TEXTURE_CREATION
diff --git a/skia/gl/SkGL.h b/skia/gl/SkGL.h
index cf3c65e..d4cd3b6 100644
--- a/skia/gl/SkGL.h
+++ b/skia/gl/SkGL.h
@@ -23,16 +23,12 @@ class SkGLClipIter;
//#define TRACE_TEXTURE_CREATE
-static inline void* SkGetGLContext() {
-#ifdef ANDROID
- return (void*)eglGetCurrentContext();
-#else
- return NULL;
-#endif
-}
-
///////////////////////////////////////////////////////////////////////////////
+#if GL_OES_compressed_paletted_texture
+ #define SK_GL_SUPPORT_COMPRESSEDTEXIMAGE2D
+#endif
+
#if GL_OES_fixed_point && defined(SK_SCALAR_IS_FIXED)
#define SK_GLType GL_FIXED
#else
diff --git a/skia/gl/SkGLCanvas.cpp b/skia/gl/SkGLCanvas.cpp
index d9f2201..2e93209 100644
--- a/skia/gl/SkGLCanvas.cpp
+++ b/skia/gl/SkGLCanvas.cpp
@@ -90,18 +90,11 @@ SkDevice* SkGLCanvas::createDevice(SkBitmap::Config, int width, int height,
static SkMutex gTextureCacheMutex;
static SkTextureCache gTextureCache(kTexCountMax_Default, kTexSizeMax_Default);
-static void* gTextureGLContext;
SkGLDevice::TexCache* SkGLDevice::LockTexCache(const SkBitmap& bitmap,
GLuint* name, SkPoint* size) {
SkAutoMutexAcquire amc(gTextureCacheMutex);
- void* ctx = SkGetGLContext();
- if (gTextureGLContext != ctx) {
- gTextureGLContext = ctx;
- gTextureCache.zapAllTextures();
- }
-
SkTextureCache::Entry* entry = gTextureCache.lock(bitmap);
if (NULL != entry) {
if (name) {
@@ -141,3 +134,46 @@ void SkGLCanvas::SetTextureCacheMaxSize(size_t size) {
gTextureCache.setMaxSize(size);
}
+///////////////////////////////////////////////////////////////////////////////
+
+#include "SkGLTextCache.h"
+
+static bool deleteCachesProc(SkGlyphCache* cache, void* texturesAreValid) {
+ void* auxData;
+ if (cache->getAuxProcData(SkGLDevice::GlyphCacheAuxProc, &auxData)) {
+ bool valid = texturesAreValid != NULL;
+ SkGLTextCache* textCache = static_cast<SkGLTextCache*>(auxData);
+ // call this before delete, in case valid is false
+ textCache->deleteAllStrikes(valid);
+ // now free the memory for the cache itself
+ SkDELETE(textCache);
+ // now remove the entry in the glyphcache (does not call the proc)
+ cache->removeAuxProc(SkGLDevice::GlyphCacheAuxProc);
+ }
+ return false; // keep going
+}
+
+void SkGLCanvas::DeleteAllTextures() {
+ // free the textures in our cache
+
+ gTextureCacheMutex.acquire();
+ gTextureCache.deleteAllCaches(true);
+ gTextureCacheMutex.release();
+
+ // now free the textures in the font cache
+
+ SkGlyphCache::VisitAllCaches(deleteCachesProc, reinterpret_cast<void*>(true));
+}
+
+void SkGLCanvas::AbandonAllTextures() {
+ // abandon the textures in our cache
+
+ gTextureCacheMutex.acquire();
+ gTextureCache.deleteAllCaches(false);
+ gTextureCacheMutex.release();
+
+ // abandon the textures in the font cache
+
+ SkGlyphCache::VisitAllCaches(deleteCachesProc, reinterpret_cast<void*>(false));
+}
+
diff --git a/skia/gl/SkGLDevice.cpp b/skia/gl/SkGLDevice.cpp
index 2271b05..70968e2 100644
--- a/skia/gl/SkGLDevice.cpp
+++ b/skia/gl/SkGLDevice.cpp
@@ -21,11 +21,8 @@ public:
glTexCoordPointer(2, SK_TextGLType, 0, fTexs);
glDisableClientState(GL_COLOR_ARRAY);
glVertexPointer(2, SK_TextGLType, 0, fVerts);
-
- fCtx = SkGetGLContext();
}
- void* ctx() const { return fCtx; }
GLenum texture() const { return fCurrTexture; }
void flush() {
@@ -68,7 +65,6 @@ private:
int fCurrQuad;
int fViewportHeight;
const SkRegion* fClip;
- void* fCtx;
};
///////////////////////////////////////////////////////////////////////////////
@@ -177,7 +173,7 @@ SkGLDevice::TexCache* SkGLDevice::setupGLPaintShader(const SkPaint& paint) {
}
bitmap.lockPixels();
- if (bitmap.getPixels() == NULL) {
+ if (!bitmap.readyToDraw()) {
return NULL;
}
@@ -327,7 +323,7 @@ void SkGLDevice::drawBitmap(const SkDraw& draw, const SkBitmap& bitmap,
TRACE_DRAW("coreDrawBitmap", this, draw);
SkAutoLockPixels alp(bitmap);
- if (bitmap.getPixels() == NULL) {
+ if (!bitmap.readyToDraw()) {
return;
}
@@ -396,7 +392,7 @@ void SkGLDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
TRACE_DRAW("coreDrawSprite", this, draw);
SkAutoLockPixels alp(bitmap);
- if (bitmap.getPixels() == NULL) {
+ if (!bitmap.readyToDraw()) {
return;
}
@@ -539,11 +535,8 @@ DONE:
#include "SkGlyphCache.h"
#include "SkGLTextCache.h"
-static void SkGL_GlyphCacheAuxProc(void* data) {
- SkGLTextCache* cache = (SkGLTextCache*)data;
-
- SkDebugf("-------------- delete text texture cache, ctx=%p\n",
- cache->getCtx());
+void SkGLDevice::GlyphCacheAuxProc(void* data) {
+ SkDebugf("-------------- delete text texture cache\n");
SkDELETE((SkGLTextCache*)data);
}
@@ -576,19 +569,13 @@ static void SkGL_Draw1Glyph(const SkDraw1Glyph& state, const SkGlyph& glyph,
void* auxData;
SkGLTextCache* textCache = NULL;
- if (gcache->getAuxProcData(SkGL_GlyphCacheAuxProc, &auxData)) {
- textCache = (SkGLTextCache*)auxData;
- if (textCache->getCtx() != procs->ctx()) {
- SkDebugf("------- textcache: old ctx %p new ctx %p\n",
- textCache->getCtx(), procs->ctx());
- SkDELETE(textCache);
- textCache = NULL;
- }
+ if (gcache->getAuxProcData(SkGLDevice::GlyphCacheAuxProc, &auxData)) {
+ textCache = (SkGLTextCache*)auxData;
}
if (NULL == textCache) {
// need to create one
textCache = SkNEW(SkGLTextCache);
- gcache->setAuxProc(SkGL_GlyphCacheAuxProc, textCache);
+ gcache->setAuxProc(SkGLDevice::GlyphCacheAuxProc, textCache);
}
int offset;
diff --git a/skia/gl/SkGLDevice.h b/skia/gl/SkGLDevice.h
index 9e86f3f..0fc9e47 100644
--- a/skia/gl/SkGLDevice.h
+++ b/skia/gl/SkGLDevice.h
@@ -12,6 +12,9 @@ public:
SkGLDevice(const SkBitmap& bitmap, bool offscreen);
virtual ~SkGLDevice();
+ // used to identify GLTextCache data in the glyphcache
+ static void GlyphCacheAuxProc(void* data);
+
enum TexOrientation {
kNo_TexOrientation,
kTopToBottom_TexOrientation,
diff --git a/skia/gl/SkGLTextCache.cpp b/skia/gl/SkGLTextCache.cpp
index 25f822e..141e100 100644
--- a/skia/gl/SkGLTextCache.cpp
+++ b/skia/gl/SkGLTextCache.cpp
@@ -84,7 +84,7 @@ SkGLTextCache::Strike::addGlyphAndBind(const SkGlyph& glyph,
if (fGlyphCount == kMaxGlyphCount ||
fNextFreeOffsetX + rowBytes >= fStrikeWidth) {
// this will bind the next texture for us
- SkDebugf("--- extend strike %p\n", this);
+// SkDebugf("--- extend strike %p\n", this);
strike = SkNEW_ARGS(Strike, (this, rowBytes, glyph.fHeight));
} else {
glBindTexture(GL_TEXTURE_2D, fTexName);
@@ -127,36 +127,30 @@ SkGLTextCache::Strike::addGlyphAndBind(const SkGlyph& glyph,
///////////////////////////////////////////////////////////////////////////////
SkGLTextCache::SkGLTextCache() {
- fCtx = SkGetGLContext();
bzero(fStrikeList, sizeof(fStrikeList));
}
SkGLTextCache::~SkGLTextCache() {
- SkDebugf("--- delete textcache %p\n", this);
-
- // if true, we need to not call glDeleteTexture, since they will have
- // already gone out of scope
- bool zap = SkGetGLContext() != fCtx;
+ this->deleteAllStrikes(true);
+}
+void SkGLTextCache::deleteAllStrikes(bool texturesAreValid) {
for (size_t i = 0; i < SK_ARRAY_COUNT(fStrikeList); i++) {
Strike* strike = fStrikeList[i];
while (strike != NULL) {
Strike* next = strike->fNext;
- if (zap) {
- strike->zapTexture();
+ if (!texturesAreValid) {
+ strike->abandonTexture();
}
SkDELETE(strike);
strike = next;
}
}
+ bzero(fStrikeList, sizeof(fStrikeList));
}
SkGLTextCache::Strike* SkGLTextCache::findGlyph(const SkGlyph& glyph,
int* offset) {
- if (SkGetGLContext() != fCtx) {
- SkDebugf("====== stale context for text texture\n");
- }
-
SkASSERT(glyph.fWidth != 0);
SkASSERT(glyph.fHeight != 0);
@@ -175,10 +169,6 @@ SkGLTextCache::Strike* SkGLTextCache::findGlyph(const SkGlyph& glyph,
SkGLTextCache::Strike* SkGLTextCache::addGlyphAndBind(const SkGlyph& glyph,
const uint8_t image[], int* offset) {
- if (SkGetGLContext() != fCtx) {
- SkDebugf("====== stale context for text texture\n");
- }
-
SkASSERT(image != NULL);
SkASSERT(glyph.fWidth != 0);
SkASSERT(glyph.fHeight != 0);
diff --git a/skia/gl/SkGLTextCache.h b/skia/gl/SkGLTextCache.h
index 386b274..eb552aa 100644
--- a/skia/gl/SkGLTextCache.h
+++ b/skia/gl/SkGLTextCache.h
@@ -9,8 +9,13 @@ class SkGLTextCache {
public:
SkGLTextCache();
~SkGLTextCache();
-
- void* getCtx() const { return fCtx; }
+
+ /** Delete all of the strikes in the cache. Pass true if the texture IDs are
+ still valid, in which case glDeleteTextures will be called. Pass false
+ if they are invalid (e.g. the gl-context has changed), in which case
+ they will just be abandoned.
+ */
+ void deleteAllStrikes(bool texturesAreValid);
class Strike {
public:
@@ -22,7 +27,7 @@ public:
// call this to force us to ignore the texture name in our destructor
// only call it right before our destructor
- void zapTexture() { fTexName = 0; }
+ void abandonTexture() { fTexName = 0; }
private:
// if next is non-null, its height must match our height
@@ -66,8 +71,6 @@ public:
Strike* addGlyphAndBind(const SkGlyph&, const uint8_t image[], int* offset);
private:
- void* fCtx;
-
enum {
// greater than this we won't cache
kMaxGlyphHeightShift = 9,
diff --git a/skia/gl/SkTextureCache.cpp b/skia/gl/SkTextureCache.cpp
index 6d578fe..17b37ca 100644
--- a/skia/gl/SkTextureCache.cpp
+++ b/skia/gl/SkTextureCache.cpp
@@ -1,6 +1,7 @@
#include "SkTextureCache.h"
//#define TRACE_HASH_HITS
+//#define TRACE_TEXTURE_CACHE_PURGE
SkTextureCache::Entry::Entry(const SkBitmap& bitmap)
: fName(0), fKey(bitmap), fPrev(NULL), fNext(NULL) {
@@ -37,6 +38,30 @@ SkTextureCache::~SkTextureCache() {
this->validate();
}
+void SkTextureCache::deleteAllCaches(bool texturesAreValid) {
+ this->validate();
+
+ Entry* entry = fHead;
+ while (entry) {
+ Entry* next = entry->fNext;
+ if (!texturesAreValid) {
+ entry->abandonTexture();
+ }
+ SkDELETE(entry);
+ entry = next;
+ }
+
+ fSorted.reset();
+ bzero(fHash, sizeof(fHash));
+
+ fTexCount = 0;
+ fTexSize = 0;
+
+ fTail = fHead = NULL;
+
+ this->validate();
+}
+
///////////////////////////////////////////////////////////////////////////////
int SkTextureCache::findInSorted(const Key& key) const {
@@ -237,8 +262,10 @@ void SkTextureCache::purgeIfNecessary(size_t extraSize) {
}
// now delete it
+#ifdef TRACE_TEXTURE_CACHE_PURGE
SkDebugf("---- purge texture cache %d size=%d\n",
entry->name(), entry->memSize());
+#endif
SkDELETE(entry);
// keep going
@@ -264,32 +291,6 @@ void SkTextureCache::setMaxSize(size_t size) {
///////////////////////////////////////////////////////////////////////////////
-void SkTextureCache::zapAllTextures() {
- SkDebugf("---- zapAllTextures\n");
-
- this->validate();
-
- Entry* entry = fHead;
- while (entry) {
- Entry* next = entry->fNext;
- entry->zapName();
- SkDELETE(entry);
- entry = next;
- }
-
- fSorted.reset();
- bzero(fHash, sizeof(fHash));
-
- fTexCount = 0;
- fTexSize = 0;
-
- fTail = fHead = NULL;
-
- this->validate();
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
#ifdef SK_DEBUG
void SkTextureCache::validate() const {
if (0 == fTexCount) {
diff --git a/skia/gl/SkTextureCache.h b/skia/gl/SkTextureCache.h
index e4ffc78..0bc3091 100644
--- a/skia/gl/SkTextureCache.h
+++ b/skia/gl/SkTextureCache.h
@@ -17,11 +17,12 @@ public:
void setMaxCount(size_t count);
void setMaxSize(size_t size);
- /** Call this if the context has changed behind our backs, and the cache
- needs to abandon all of its existing textures. This saves us from using
- or deleting a texture created from a different context
+ /** Deletes all the caches. Pass true if the texture IDs are still valid,
+ and if so, it will call glDeleteTextures. Pass false if the texture IDs
+ are invalid (e.g. the gl-context has changed), in which case they will
+ just be abandoned.
*/
- void zapAllTextures();
+ void deleteAllCaches(bool texturesAreValid);
static int HashMask() { return kHashMask; }
@@ -90,7 +91,7 @@ public:
// call this to clear the texture name, in case the context has changed
// in which case we should't reference or delete this texture in GL
- void zapName() { fName = 0; }
+ void abandonTexture() { fName = 0; }
private:
Entry(const SkBitmap& bitmap);
diff --git a/skia/images/SkFDStream.cpp b/skia/images/SkFDStream.cpp
new file mode 100644
index 0000000..db4a51a
--- /dev/null
+++ b/skia/images/SkFDStream.cpp
@@ -0,0 +1,85 @@
+#include "SkStream.h"
+#include <unistd.h>
+
+//#define TRACE_FDSTREAM
+
+SkFDStream::SkFDStream(int fileDesc, bool closeWhenDone)
+ : fFD(fileDesc), fCloseWhenDone(closeWhenDone) {
+}
+
+SkFDStream::~SkFDStream() {
+ if (fFD >= 0 && fCloseWhenDone) {
+ ::close(fFD);
+ }
+}
+
+bool SkFDStream::rewind() {
+ if (fFD >= 0) {
+ off_t value = ::lseek(fFD, 0, SEEK_SET);
+#ifdef TRACE_FDSTREAM
+ if (value) {
+ SkDebugf("xxxxxxxxxxxxxx rewind failed %d\n", value);
+ }
+#endif
+ return value == 0;
+ }
+ return false;
+}
+
+size_t SkFDStream::read(void* buffer, size_t size) {
+ if (fFD >= 0) {
+ if (buffer == NULL && size == 0) { // request total size
+ off_t curr = ::lseek(fFD, 0, SEEK_CUR);
+ if (curr < 0) {
+#ifdef TRACE_FDSTREAM
+ SkDebugf("xxxxxxxxxxxxx lseek failed 0 CURR\n");
+#endif
+ return 0; // error
+ }
+ off_t size = ::lseek(fFD, 0, SEEK_END);
+ if (size < 0) {
+#ifdef TRACE_FDSTREAM
+ SkDebugf("xxxxxxxxxxxxx lseek failed 0 END\n");
+#endif
+ size = 0; // error
+ }
+ if (::lseek(fFD, curr, SEEK_SET) != curr) {
+ // can't restore, error
+#ifdef TRACE_FDSTREAM
+ SkDebugf("xxxxxxxxxxxxx lseek failed %d SET\n", curr);
+#endif
+ return 0;
+ }
+ return size;
+ } else if (NULL == buffer) { // skip
+ off_t oldCurr = ::lseek(fFD, 0, SEEK_CUR);
+ if (oldCurr < 0) {
+#ifdef TRACE_FDSTREAM
+ SkDebugf("xxxxxxxxxxxxx lseek1 failed %d CUR\n", oldCurr);
+#endif
+ return 0; // error;
+ }
+ off_t newCurr = ::lseek(fFD, size, SEEK_CUR);
+ if (newCurr < 0) {
+#ifdef TRACE_FDSTREAM
+ SkDebugf("xxxxxxxxxxxxx lseek2 failed %d CUR\n", newCurr);
+#endif
+ return 0; // error;
+ }
+ // return the actual amount we skipped
+ return newCurr - oldCurr;
+ } else { // read
+ ssize_t actual = ::read(fFD, buffer, size);
+ // our API can't return an error, so we return 0
+ if (actual < 0) {
+#ifdef TRACE_FDSTREAM
+ SkDebugf("xxxxxxxxxxxxx read failed %d actual %d\n", size, actual);
+#endif
+ actual = 0;
+ }
+ return actual;
+ }
+ }
+ return 0;
+}
+
diff --git a/skia/images/SkFlipPixelRef.cpp b/skia/images/SkFlipPixelRef.cpp
new file mode 100644
index 0000000..95403cc
--- /dev/null
+++ b/skia/images/SkFlipPixelRef.cpp
@@ -0,0 +1,127 @@
+#include "SkFlipPixelRef.h"
+#include "SkFlattenable.h"
+#include "SkRegion.h"
+
+SkFlipPixelRef::SkFlipPixelRef(SkBitmap::Config config, int width, int height)
+: fFlipper(width, height) {
+ fConfig = config;
+ fSize = SkBitmap::ComputeSize(config, width, height);
+ fStorage = sk_malloc_throw(fSize << 1);
+ fPage0 = fStorage;
+ fPage1 = (char*)fStorage + fSize;
+}
+
+SkFlipPixelRef::~SkFlipPixelRef() {
+ sk_free(fStorage);
+}
+
+const SkRegion& SkFlipPixelRef::beginUpdate(SkBitmap* device) {
+ void* writeAddr;
+ const void* readAddr;
+ this->getFrontBack(&readAddr, &writeAddr);
+
+ device->setConfig(fConfig, fFlipper.width(), fFlipper.height());
+ device->setPixels(writeAddr);
+
+ SkRegion copyBits;
+ const SkRegion& dirty = fFlipper.update(&copyBits);
+
+ SkFlipPixelRef::CopyBitsFromAddr(*device, copyBits, readAddr);
+ return dirty;
+}
+
+void SkFlipPixelRef::endUpdate() {
+ this->swapPages();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void* SkFlipPixelRef::onLockPixels(SkColorTable** ct) {
+ fMutex.acquire();
+ *ct = NULL;
+ return fPage0;
+}
+
+void SkFlipPixelRef::onUnlockPixels() {
+ fMutex.release();
+}
+
+void SkFlipPixelRef::swapPages() {
+ fMutex.acquire();
+ SkTSwap<void*>(fPage0, fPage1);
+ fMutex.release();
+}
+
+void SkFlipPixelRef::flatten(SkFlattenableWriteBuffer& buffer) const {
+ this->INHERITED::flatten(buffer);
+
+ buffer.write32(fSize);
+ // only need to write page0
+ buffer.writePad(fPage0, fSize);
+}
+
+SkFlipPixelRef::SkFlipPixelRef(SkFlattenableReadBuffer& buffer)
+ : INHERITED(buffer, NULL) {
+ fSize = buffer.readU32();
+ fStorage = sk_malloc_throw(fSize << 1);
+ fPage0 = fStorage;
+ fPage1 = (char*)fStorage + fSize;
+ buffer.read(fPage0, fSize);
+}
+
+SkPixelRef* SkFlipPixelRef::Create(SkFlattenableReadBuffer& buffer) {
+ return SkNEW_ARGS(SkFlipPixelRef, (buffer));
+}
+
+static SkPixelRef::Registrar::Registrar reg("SkFlipPixelRef",
+ SkFlipPixelRef::Create);
+
+///////////////////////////////////////////////////////////////////////////////
+
+static void copyRect(const SkBitmap& dst, const SkIRect& rect,
+ const void* srcAddr, int shift) {
+ const size_t offset = rect.fTop * dst.rowBytes() + (rect.fLeft << shift);
+ char* dstP = static_cast<char*>(dst.getPixels()) + offset;
+ const char* srcP = static_cast<const char*>(srcAddr) + offset;
+ const size_t rb = dst.rowBytes();
+ const size_t bytes = rect.width() << shift;
+
+ int height = rect.height();
+ while (--height >= 0) {
+ memcpy(dstP, srcP, bytes);
+ dstP += rb;
+ srcP += rb;
+ }
+}
+
+static int getShift(SkBitmap::Config config) {
+ switch (config) {
+ case SkBitmap::kARGB_8888_Config:
+ return 2;
+ case SkBitmap::kRGB_565_Config:
+ case SkBitmap::kARGB_4444_Config:
+ return 1;
+ case SkBitmap::kIndex8_Config:
+ case SkBitmap::kA8_Config:
+ return 0;
+ default:
+ return -1; // signal not supported
+ }
+}
+
+void SkFlipPixelRef::CopyBitsFromAddr(const SkBitmap& dst, const SkRegion& clip,
+ const void* srcAddr) {
+ const int shift = getShift(dst.config());
+ if (shift < 0) {
+ return;
+ }
+
+ const SkIRect bounds = {0, 0, dst.width(), dst.height()};
+ SkRegion::Cliperator iter(clip, bounds);
+
+ while (!iter.done()) {
+ copyRect(dst, iter.rect(), srcAddr, shift);
+ iter.next();
+ }
+}
+
diff --git a/skia/images/SkImageDecoder.cpp b/skia/images/SkImageDecoder.cpp
index 3579e3c..405b660 100644
--- a/skia/images/SkImageDecoder.cpp
+++ b/skia/images/SkImageDecoder.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/images/SkImageDecoder.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -89,6 +89,29 @@ bool SkImageDecoder::allocPixelRef(SkBitmap* bitmap,
///////////////////////////////////////////////////////////////////////////////
+bool SkImageDecoder::decode(SkStream* stream, SkBitmap* bm,
+ SkBitmap::Config pref, Mode mode) {
+ SkBitmap tmp;
+
+ // we reset this to false before calling onDecode
+ fShouldCancelDecode = false;
+
+ // pass a temporary bitmap, so that if we return false, we are assured of
+ // leaving the caller's bitmap untouched.
+ if (this->onDecode(stream, &tmp, pref, mode)) {
+ /* We operate on a tmp bitmap until we know we succeed. This way
+ we're sure we don't change the caller's bitmap and then later
+ return false. Returning false must mean that their parameter
+ is unchanged.
+ */
+ bm->swap(tmp);
+ return true;
+ }
+ return false;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
bool SkImageDecoder::DecodeFile(const char file[], SkBitmap* bm,
SkBitmap::Config pref, Mode mode) {
SkASSERT(file);
@@ -115,23 +138,14 @@ bool SkImageDecoder::DecodeStream(SkStream* stream, SkBitmap* bm,
SkASSERT(stream);
SkASSERT(bm);
+ bool success = false;
SkImageDecoder* codec = SkImageDecoder::Factory(stream);
+
if (NULL != codec) {
- SkBitmap tmp;
-
- SkAutoTDelete<SkImageDecoder> ad(codec);
-
- if (codec->onDecode(stream, &tmp, pref, mode)) {
- /* We operate on a tmp bitmap until we know we succeed. This way
- we're sure we don't change the caller's bitmap and then later
- return false. Returning false must mean that their parameter
- is unchanged.
- */
- bm->swap(tmp);
- return true;
- }
+ success = codec->decode(stream, bm, pref, mode);
+ delete codec;
}
- return false;
+ return success;
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/skia/images/SkImageDecoder_fpdfemb.cpp b/skia/images/SkImageDecoder_fpdfemb.cpp
new file mode 100644
index 0000000..7f37e3d
--- /dev/null
+++ b/skia/images/SkImageDecoder_fpdfemb.cpp
@@ -0,0 +1,236 @@
+/*
+ * Copyright 2007, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "SkImageDecoder.h"
+#include "SkScaledBitmapSampler.h"
+#include "SkStream.h"
+#include "SkColorPriv.h"
+#include "SkTDArray.h"
+
+#include "fpdfemb.h"
+
+class SkFPDFEMBImageDecoder : public SkImageDecoder {
+public:
+ SkFPDFEMBImageDecoder() {}
+
+ virtual Format getFormat() const {
+ return kBMP_Format;
+ }
+
+protected:
+ virtual bool onDecode(SkStream* stream, SkBitmap* bm,
+ SkBitmap::Config pref, Mode mode);
+
+private:
+ bool render(FPDFEMB_PAGE page, const FPDFEMB_RECT& bounds, SkBitmap* bm,
+ SkBitmap::Config prefConfig, SkImageDecoder::Mode mode);
+};
+
+SkImageDecoder* SkImageDecoder_FPDFEMB_Factory(SkStream*);
+SkImageDecoder* SkImageDecoder_FPDFEMB_Factory(SkStream* stream) {
+ static const char kPDFSig[] = { '%', 'P', 'D', 'F' };
+
+ size_t len = stream->getLength();
+ char buffer[sizeof(kPDFSig)];
+
+ SkDebugf("---- SkImageDecoder_FPDFEMB_Factory len=%d\n", len);
+
+ if (len != 12683) { return NULL; }
+
+ if (len > sizeof(kPDFSig) &&
+ stream->read(buffer, sizeof(kPDFSig)) == sizeof(kPDFSig) &&
+ !memcmp(buffer, kPDFSig, sizeof(kPDFSig))) {
+ return SkNEW(SkFPDFEMBImageDecoder);
+ }
+ return NULL;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+extern "C" {
+ static void* pdf_alloc(FPDFEMB_MEMMGR* pMgr, unsigned int size) {
+ void* addr = sk_malloc_throw(size);
+ // SkDebugf("---- pdf_alloc %d %p\n", size, addr);
+ return addr;
+ }
+
+ static void* pdf_alloc_nl(FPDFEMB_MEMMGR* pMgr, unsigned int size) {
+ void* addr = sk_malloc_flags(size, 0);
+ // SkDebugf("---- pdf_alloc_nl %d %p\n", size, addr);
+ return addr;
+ }
+
+ static void* pdf_realloc(FPDFEMB_MEMMGR*, void* addr, unsigned int size) {
+ void* newaddr = sk_realloc_throw(addr, size);
+ // SkDebugf("---- pdf_realloc %p %d %p\n", addr, size, newaddr);
+ return newaddr;
+ }
+
+ static void pdf_free(FPDFEMB_MEMMGR* pMgr, void* pointer) {
+ // SkDebugf("---- pdf_free %p\n", pointer);
+ sk_free(pointer);
+ }
+
+ void FX_OUTPUT_LOG_FUNC(const char* format, ...) {
+ SkDebugf("---- LOG_FUNC %s\n", format);
+ }
+
+ static unsigned int file_getsize(FPDFEMB_FILE_ACCESS* file) {
+ SkStream* stream = (SkStream*)file->user;
+ return stream->getLength();
+ }
+
+ static FPDFEMB_RESULT file_readblock(FPDFEMB_FILE_ACCESS* file, void* dst,
+ unsigned int offset, unsigned int size) {
+ SkStream* stream = (SkStream*)file->user;
+// SkDebugf("---- readblock %p %p %d %d\n", stream, dst, offset, size);
+ if (!stream->rewind()) {
+ SkDebugf("---- rewind failed\n");
+ return FPDFERR_ERROR;
+ }
+ if (stream->skip(offset) != offset) {
+ SkDebugf("---- skip failed\n");
+ return FPDFERR_ERROR;
+ }
+ if (stream->read(dst, size) != size) {
+ SkDebugf("---- read failed\n");
+ return FPDFERR_ERROR;
+ }
+ return FPDFERR_SUCCESS;
+ }
+
+ static void pdf_oom_handler(void* memory, int size) {
+ SkDebugf("======== pdf OOM %p %d\n", memory, size);
+ }
+}
+
+static inline int PDF2Pixels(int x) { return x / 100; }
+static inline SkScalar PDF2Scalar(int x) {
+ return SkScalarMulDiv(SK_Scalar1, x, 100);
+}
+
+bool SkFPDFEMBImageDecoder::render(FPDFEMB_PAGE page, const FPDFEMB_RECT& bounds, SkBitmap* bm,
+ SkBitmap::Config prefConfig, SkImageDecoder::Mode mode) {
+ int width = PDF2Pixels(bounds.right - bounds.left);
+ int height = PDF2Pixels(bounds.top - bounds.bottom);
+
+ SkDebugf("----- bitmap size [%d %d], mode=%d\n", width, height, mode);
+ bm->setConfig(SkBitmap::kARGB_8888_Config, width, height);
+ if (SkImageDecoder::kDecodeBounds_Mode == mode) {
+ return true;
+ }
+
+ // USE THE CODEC TO ALLOCATE THE PIXELS!!!!
+ if (!this->allocPixelRef(bm, NULL)) {
+ SkDebugf("----- failed to alloc pixels\n");
+ return false;
+ }
+
+ bm->eraseColor(0);
+
+ FPDFEMB_RESULT result;
+ FPDFEMB_BITMAP dib;
+
+ result = FPDFEMB_CreateDIB(width, height, FPDFDIB_BGRA, bm->getPixels(),
+ bm->rowBytes(), &dib);
+ SkDebugf("---- createdib %d\n", result);
+
+ result = FPDFEMB_StartRender(dib, page, 0, 0, width, height, 0, 0, NULL, NULL);
+ SkDebugf("---- render %d\n", result);
+
+ result = FPDFEMB_DestroyDIB(dib);
+ SkDebugf("---- destroydib %d\n", result);
+
+ SkPMColor* dst = bm->getAddr32(0, 0);
+ const uint8_t* src = (uint8_t*)dst;
+ int n = bm->getSize() >> 2;
+ for (int i = 0; i < n; i++) {
+ int b = *src++;
+ int g = *src++;
+ int r = *src++;
+ int a = *src++;
+ *dst++ = SkPackARGB32(a, r, g, b);
+ }
+
+ return true;
+}
+
+#define USE_FIXED_MEM (4 * 1024 * 1024)
+
+bool SkFPDFEMBImageDecoder::onDecode(SkStream* stream, SkBitmap* bm,
+ SkBitmap::Config prefConfig, Mode mode) {
+
+ FPDFEMB_RESULT result;
+#ifdef USE_FIXED_MEM
+ SkAutoMalloc storage(USE_FIXED_MEM);
+ result = FPDFEMB_InitFixedMemory(storage.get(), USE_FIXED_MEM,
+ pdf_oom_handler);
+#else
+ FPDFEMB_MEMMGR memmgr;
+ memmgr.Alloc = pdf_alloc;
+ memmgr.AllocNL = pdf_alloc_nl;
+ memmgr.Realloc = pdf_realloc;
+ memmgr.Free = pdf_free;
+
+ result = FPDFEMB_Init(&memmgr);
+#endif
+ SkDebugf("----- SkImageDecoder_FPDFEMB_Factory init %d, streamLen = %d\n", result, stream->getLength());
+
+ FPDFEMB_FILE_ACCESS file;
+ file.GetSize = file_getsize;
+ file.ReadBlock = file_readblock;
+ file.user = stream;
+
+ FPDFEMB_DOCUMENT document;
+ result = FPDFEMB_StartLoadDocument(&file, NULL, &document, NULL);
+ SkDebugf("----- SkImageDecoder_FPDFEMB_Factory open %d %p\n", result, document);
+
+ int pageCount = FPDFEMB_GetPageCount(document);
+ SkDebugf("----- SkImageDecoder_FPDFEMB_Factory pageCount %d\n", pageCount);
+
+ if (pageCount > 0) {
+ FPDFEMB_PAGE page;
+ result = FPDFEMB_LoadPage(document, 0, &page);
+ SkDebugf("----- SkImageDecoder_FPDFEMB_Factory load page %d\n", result);
+
+ int width, height;
+ result = FPDFEMB_GetPageSize(page, &width, &height);
+ SkDebugf("----- SkImageDecoder_FPDFEMB_Factory page size %d [%d %d]\n", result, width, height);
+
+ FPDFEMB_RECT rect;
+ result = FPDFEMB_GetPageBBox(page, &rect);
+ SkDebugf("----- SkImageDecoder_FPDFEMB_Factory page rect %d [%d %d %d %d]\n", result,
+ rect.left, rect.top, rect.right, rect.bottom);
+
+ SkDebugf("----- SkImageDecoder_FPDFEMB_Factory begin page parse...\n");
+ result = FPDFEMB_StartParse(page, false, NULL);
+ SkDebugf("----- SkImageDecoder_FPDFEMB_Factory page parse %d\n", result);
+
+ if (0 == result) {
+ this->render(page, rect, bm, prefConfig, mode);
+ }
+
+ result = FPDFEMB_ClosePage(page);
+ SkDebugf("----- SkImageDecoder_FPDFEMB_Factory close page %d\n", result);
+ }
+
+ result = FPDFEMB_CloseDocument(document);
+ SkDebugf("----- SkImageDecoder_FPDFEMB_Factory close %d\n", result);
+
+ // FPDFEMB_Exit();
+
+ return true;
+}
diff --git a/skia/images/SkImageDecoder_libbmp.cpp b/skia/images/SkImageDecoder_libbmp.cpp
index 0de760f..32a7a6d 100644
--- a/skia/images/SkImageDecoder_libbmp.cpp
+++ b/skia/images/SkImageDecoder_libbmp.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2007, Google Inc.
+ * Copyright 2007, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/skia/images/SkImageDecoder_libgif.cpp b/skia/images/SkImageDecoder_libgif.cpp
index 3b5e420..c894c9d 100644
--- a/skia/images/SkImageDecoder_libgif.cpp
+++ b/skia/images/SkImageDecoder_libgif.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/images/SkImageDecoder_libgif.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -145,11 +145,20 @@ static int find_transpIndex(const SavedImage& image, int colorCount) {
return transpIndex;
}
+static bool error_return(GifFileType* gif, const SkBitmap& bm,
+ const char msg[]) {
+#if 0
+ SkDebugf("libgif error <%s> bitmap [%d %d] pixels %p colortable %p\n",
+ msg, bm.width(), bm.height(), bm.getPixels(), bm.getColorTable());
+#endif
+ return false;
+}
+
bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm,
SkBitmap::Config prefConfig, Mode mode) {
GifFileType* gif = DGifOpen(sk_stream, DecodeCallBackProc);
if (NULL == gif) {
- return false;
+ return error_return(gif, *bm, "DGifOpen");
}
SkAutoTCallIProc<GifFileType, DGifCloseFile> acp(gif);
@@ -165,17 +174,17 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm,
do {
if (DGifGetRecordType(gif, &recType) == GIF_ERROR) {
- return false;
+ return error_return(gif, *bm, "DGifGetRecordType");
}
switch (recType) {
case IMAGE_DESC_RECORD_TYPE: {
if (DGifGetImageDesc(gif) == GIF_ERROR) {
- return false;
+ return error_return(gif, *bm, "IMAGE_DESC_RECORD_TYPE");
}
if (gif->ImageCount < 1) { // sanity check
- return false;
+ return error_return(gif, *bm, "ImageCount < 1");
}
width = gif->SWidth;
@@ -183,7 +192,7 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm,
if (width <= 0 || height <= 0 ||
!this->chooseFromOneChoice(SkBitmap::kIndex8_Config,
width, height)) {
- return false;
+ return error_return(gif, *bm, "chooseFromOneChoice");
}
bm->setConfig(SkBitmap::kIndex8_Config, width, height);
@@ -197,7 +206,7 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm,
if ( (desc.Top | desc.Left) < 0 ||
desc.Left + desc.Width > width ||
desc.Top + desc.Height > height) {
- return false;
+ return error_return(gif, *bm, "TopLeft");
}
// now we decode the colortable
@@ -205,7 +214,7 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm,
{
const ColorMapObject* cmap = find_colormap(gif);
if (NULL == cmap) {
- return false;
+ return error_return(gif, *bm, "null cmap");
}
colorCount = cmap->ColorCount;
@@ -226,7 +235,7 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm,
SkAutoUnref aurts(ctable);
if (!this->allocPixelRef(bm, ctable)) {
- return false;
+ return error_return(gif, *bm, "allocPixelRef");
}
}
@@ -241,7 +250,7 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm,
// abort if either inner dimension is <= 0
if (innerWidth <= 0 || innerHeight <= 0) {
- return false;
+ return error_return(gif, *bm, "non-pos inner width/height");
}
// are we only a subset of the total bounds?
@@ -266,7 +275,7 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm,
{
uint8_t* row = scanline + iter.currY() * rowBytes;
if (DGifGetLine(gif, row, innerWidth) == GIF_ERROR) {
- return false;
+ return error_return(gif, *bm, "interlace DGifGetLine");
}
iter.next();
}
@@ -276,7 +285,7 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm,
// easy, non-interlace case
for (int y = 0; y < innerHeight; y++) {
if (DGifGetLine(gif, scanline, innerWidth) == GIF_ERROR) {
- return false;
+ return error_return(gif, *bm, "DGifGetLine");
}
scanline += rowBytes;
}
@@ -287,17 +296,17 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm,
case EXTENSION_RECORD_TYPE:
if (DGifGetExtension(gif, &temp_save.Function,
&extData) == GIF_ERROR) {
- return false;
+ return error_return(gif, *bm, "DGifGetExtension");
}
while (extData != NULL) {
/* Create an extension block with our data */
if (AddExtensionBlock(&temp_save, extData[0],
&extData[1]) == GIF_ERROR) {
- return false;
+ return error_return(gif, *bm, "AddExtensionBlock");
}
if (DGifGetExtensionNext(gif, &extData) == GIF_ERROR) {
- return false;
+ return error_return(gif, *bm, "DGifGetExtensionNext");
}
temp_save.Function = 0;
}
diff --git a/skia/images/SkImageDecoder_libico.cpp b/skia/images/SkImageDecoder_libico.cpp
index 8b1be08..b179a6b 100644
--- a/skia/images/SkImageDecoder_libico.cpp
+++ b/skia/images/SkImageDecoder_libico.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/images/SkImageDecoder_libico.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -82,6 +82,20 @@ static void editPixelBit32(const int pixelNo, const unsigned char* buf,
const int xorOffset, int& x, int y, const int w,
SkBitmap* bm, int alphaByte, int m, int shift, SkPMColor* colors);
+
+static int calculateRowBytesFor8888(int w, int bitCount)
+{
+ // Default rowBytes is w << 2 for kARGB_8888
+ // In the case of a 4 bit image with an odd width, we need to add some
+ // so we can go off the end of the drawn bitmap.
+ // Add 4 to ensure that it is still a multiple of 4.
+ if (4 == bitCount && (w & 0x1)) {
+ return (w + 1) << 2;
+ }
+ // Otherwise return 0, which will allow it to be calculated automatically.
+ return 0;
+}
+
bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm,
SkBitmap::Config pref, Mode mode)
{
@@ -241,11 +255,8 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm,
//FIXME: what is the tradeoff in size?
//if the andbitmap (mask) is all zeroes, then we can easily do an index bitmap
//however, with small images with large colortables, maybe it's better to still do argb_8888
- //default rowBytes is w << 2 for kARGB_8888
- //i'm adding one - it's only truly necessary in the case that w is odd and we are four bit
- //so we can go off the end of the drawn bitmap
- //FIXME: need to test with an odd width bitmap that is 4bit
- bm->setConfig(SkBitmap::kARGB_8888_Config, w, h, (w << 2) + (0x1 & w & (bitCount >> 2)));
+
+ bm->setConfig(SkBitmap::kARGB_8888_Config, w, h, calculateRowBytesFor8888(w, bitCount));
if (SkImageDecoder::kDecodeBounds_Mode == mode) {
delete[] colors;
@@ -298,7 +309,12 @@ static void editPixelBit1(const int pixelNo, const unsigned char* buf,
int byte = readByte(buf, xorOffset + (pixelNo >> 3));
int colorBit;
int alphaBit;
+ // Read all of the bits in this byte.
int i = x + 8;
+ // Pin to the width so we do not write outside the bounds of
+ // our color table.
+ i = i > w ? w : i;
+ // While loop to check all 8 bits individually.
while (x < i)
{
diff --git a/skia/images/SkImageDecoder_libjpeg.cpp b/skia/images/SkImageDecoder_libjpeg.cpp
index 0d8da7ef..492de23 100644
--- a/skia/images/SkImageDecoder_libjpeg.cpp
+++ b/skia/images/SkImageDecoder_libjpeg.cpp
@@ -1,16 +1,16 @@
/*
- * Copyright 2007, Google Inc.
+ * Copyright 2007, The Android Open Source Project
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -25,6 +25,7 @@
#include <stdio.h>
extern "C" {
#include "jpeglib.h"
+ #include "jerror.h"
}
// this enables timing code to report milliseconds for an encode
@@ -49,8 +50,21 @@ protected:
SkBitmap::Config pref, Mode);
};
-SkImageDecoder* SkImageDecoder_JPEG_Factory(SkStream* stream) {
- // !!! unimplemented; rely on PNG test first for now
+SkImageDecoder* SkImageDecoder_JPEG_Factory(SkStream* stream) {
+ static const char gHeader[] = { 0xFF, 0xD8, 0xFF };
+ static const size_t HEADER_SIZE = sizeof(gHeader);
+
+ char buffer[HEADER_SIZE];
+ size_t len = stream->read(buffer, HEADER_SIZE);
+
+ if (len != HEADER_SIZE) {
+ return NULL; // can't read enough
+ }
+
+ if (memcmp(buffer, gHeader, HEADER_SIZE)) {
+ return NULL;
+ }
+
return SkNEW(SkJPEGImageDecoder);
}
@@ -77,10 +91,12 @@ private:
/* our source struct for directing jpeg to our stream object
*/
struct sk_source_mgr : jpeg_source_mgr {
- sk_source_mgr(SkStream* stream);
+ sk_source_mgr(SkStream* stream, SkImageDecoder* decoder);
SkStream* fStream;
-
+ const void* fMemoryBase;
+ size_t fMemoryBaseSize;
+ SkImageDecoder* fDecoder;
enum {
kBufferSize = 1024
};
@@ -111,11 +127,13 @@ static void sk_init_source(j_decompress_ptr cinfo) {
static boolean sk_fill_input_buffer(j_decompress_ptr cinfo) {
sk_source_mgr* src = (sk_source_mgr*)cinfo->src;
+ if (src->fDecoder != NULL && src->fDecoder->shouldCancelDecode()) {
+ return FALSE;
+ }
size_t bytes = src->fStream->read(src->fBuffer, sk_source_mgr::kBufferSize);
// note that JPEG is happy with less than the full read,
// as long as the result is non-zero
if (bytes == 0) {
- cinfo->err->error_exit((j_common_ptr)cinfo);
return FALSE;
}
@@ -129,11 +147,13 @@ static void sk_skip_input_data(j_decompress_ptr cinfo, long num_bytes) {
sk_source_mgr* src = (sk_source_mgr*)cinfo->src;
- long skip = num_bytes - src->bytes_in_buffer;
+ long bytesToSkip = num_bytes - src->bytes_in_buffer;
- if (skip > 0) {
- size_t bytes = src->fStream->read(NULL, skip);
- if (bytes != (size_t)skip) {
+ // check if the skip amount exceeds the current buffer
+ if (bytesToSkip > 0) {
+ size_t bytes = src->fStream->skip(bytesToSkip);
+ if (bytes != (size_t)bytesToSkip) {
+// SkDebugf("xxxxxxxxxxxxxx failure to skip request %d actual %d\n", bytesToSkip, bytes);
cinfo->err->error_exit((j_common_ptr)cinfo);
}
src->next_input_byte = (const JOCTET*)src->fBuffer;
@@ -150,22 +170,69 @@ static boolean sk_resync_to_restart(j_decompress_ptr cinfo, int desired) {
// what is the desired param for???
if (!src->fStream->rewind()) {
- printf("------------- sk_resync_to_restart: stream->rewind() failed\n");
+ SkDebugf("xxxxxxxxxxxxxx failure to rewind\n");
cinfo->err->error_exit((j_common_ptr)cinfo);
return FALSE;
}
+ src->next_input_byte = (const JOCTET*)src->fBuffer;
+ src->bytes_in_buffer = 0;
return TRUE;
}
static void sk_term_source(j_decompress_ptr /*cinfo*/) {}
-sk_source_mgr::sk_source_mgr(SkStream* stream)
- : fStream(stream) {
- init_source = sk_init_source;
- fill_input_buffer = sk_fill_input_buffer;
- skip_input_data = sk_skip_input_data;
- resync_to_restart = sk_resync_to_restart;
- term_source = sk_term_source;
+///////////////////////////////////////////////////////////////////////////////
+
+static void skmem_init_source(j_decompress_ptr cinfo) {
+ sk_source_mgr* src = (sk_source_mgr*)cinfo->src;
+ src->next_input_byte = (const JOCTET*)src->fMemoryBase;
+ src->bytes_in_buffer = src->fMemoryBaseSize;
+}
+
+static boolean skmem_fill_input_buffer(j_decompress_ptr cinfo) {
+ SkDebugf("xxxxxxxxxxxxxx skmem_fill_input_buffer called\n");
+ return FALSE;
+}
+
+static void skmem_skip_input_data(j_decompress_ptr cinfo, long num_bytes) {
+ sk_source_mgr* src = (sk_source_mgr*)cinfo->src;
+// SkDebugf("xxxxxxxxxxxxxx skmem_skip_input_data called %d\n", num_bytes);
+ src->next_input_byte = (const JOCTET*)((const char*)src->next_input_byte + num_bytes);
+ src->bytes_in_buffer -= num_bytes;
+}
+
+static boolean skmem_resync_to_restart(j_decompress_ptr cinfo, int desired) {
+ SkDebugf("xxxxxxxxxxxxxx skmem_resync_to_restart called\n");
+ return TRUE;
+}
+
+static void skmem_term_source(j_decompress_ptr /*cinfo*/) {}
+
+///////////////////////////////////////////////////////////////////////////////
+
+sk_source_mgr::sk_source_mgr(SkStream* stream, SkImageDecoder* decoder) : fStream(stream) {
+ fDecoder = decoder;
+ const void* baseAddr = stream->getMemoryBase();
+ if (baseAddr && false) {
+ fMemoryBase = baseAddr;
+ fMemoryBaseSize = stream->getLength();
+
+ init_source = skmem_init_source;
+ fill_input_buffer = skmem_fill_input_buffer;
+ skip_input_data = skmem_skip_input_data;
+ resync_to_restart = skmem_resync_to_restart;
+ term_source = skmem_term_source;
+ } else {
+ fMemoryBase = NULL;
+ fMemoryBaseSize = 0;
+
+ init_source = sk_init_source;
+ fill_input_buffer = sk_fill_input_buffer;
+ skip_input_data = sk_skip_input_data;
+ resync_to_restart = sk_resync_to_restart;
+ term_source = sk_term_source;
+ }
+// SkDebugf("**************** use memorybase %p %d\n", fMemoryBase, fMemoryBaseSize);
}
#include <setjmp.h>
@@ -187,14 +254,29 @@ static void sk_error_exit(j_common_ptr cinfo) {
///////////////////////////////////////////////////////////////////////////////
-static void skip_src_rows(jpeg_decompress_struct* cinfo, void* buffer,
+static bool skip_src_rows(jpeg_decompress_struct* cinfo, void* buffer,
int count) {
for (int i = 0; i < count; i++) {
JSAMPLE* rowptr = (JSAMPLE*)buffer;
int row_count = jpeg_read_scanlines(cinfo, &rowptr, 1);
- SkASSERT(row_count == 1);
+ if (row_count != 1) {
+ return false;
+ }
}
-}
+ return true;
+}
+
+// This guy exists just to aid in debugging, as it allows debuggers to just
+// set a break-point in one place to see all error exists.
+static bool return_false(const jpeg_decompress_struct& cinfo,
+ const SkBitmap& bm, const char msg[]) {
+#if 0
+ SkDebugf("libjpeg error %d <%s> from %s [%d %d]", cinfo.err->msg_code,
+ cinfo.err->jpeg_message_table[cinfo.err->msg_code], msg,
+ bm.width(), bm.height());
+#endif
+ return false; // must always return false
+}
bool SkJPEGImageDecoder::onDecode(SkStream* stream, SkBitmap* bm,
SkBitmap::Config prefConfig, Mode mode) {
@@ -207,7 +289,7 @@ bool SkJPEGImageDecoder::onDecode(SkStream* stream, SkBitmap* bm,
jpeg_decompress_struct cinfo;
sk_error_mgr sk_err;
- sk_source_mgr sk_stream(stream);
+ sk_source_mgr sk_stream(stream, this);
cinfo.err = jpeg_std_error(&sk_err);
sk_err.error_exit = sk_error_exit;
@@ -215,7 +297,7 @@ bool SkJPEGImageDecoder::onDecode(SkStream* stream, SkBitmap* bm,
// All objects need to be instantiated before this setjmp call so that
// they will be cleaned up properly if an error occurs.
if (setjmp(sk_err.fJmpBuf)) {
- return false;
+ return return_false(cinfo, *bm, "setjmp");
}
jpeg_create_decompress(&cinfo);
@@ -224,7 +306,10 @@ bool SkJPEGImageDecoder::onDecode(SkStream* stream, SkBitmap* bm,
//jpeg_stdio_src(&cinfo, file);
cinfo.src = &sk_stream;
- jpeg_read_header(&cinfo, true);
+ int status = jpeg_read_header(&cinfo, true);
+ if (status != JPEG_HEADER_OK) {
+ return return_false(cinfo, *bm, "read_header");
+ }
/* Try to fulfill the requested sampleSize. Since jpeg can do it (when it
can) much faster that we, just use their num/denom api to approximate
@@ -236,55 +321,128 @@ bool SkJPEGImageDecoder::onDecode(SkStream* stream, SkBitmap* bm,
cinfo.scale_num = 1;
cinfo.scale_denom = sampleSize;
+ /* this gives about 30% performance improvement. In theory it may
+ reduce the visual quality, in practice I'm not seeing a difference
+ */
+ cinfo.do_fancy_upsampling = 0;
+
+ /* this gives another few percents */
+ cinfo.do_block_smoothing = 0;
+
+ /* default format is RGB */
+ cinfo.out_color_space = JCS_RGB;
+
+ SkBitmap::Config config = prefConfig;
+ // if no user preference, see what the device recommends
+ if (config == SkBitmap::kNo_Config)
+ config = SkImageDecoder::GetDeviceConfig();
+
+ // only these make sense for jpegs
+ if (config != SkBitmap::kARGB_8888_Config &&
+ config != SkBitmap::kARGB_4444_Config &&
+ config != SkBitmap::kRGB_565_Config) {
+ config = SkBitmap::kARGB_8888_Config;
+ }
+
+#ifdef ANDROID_RGB
+ cinfo.dither_mode = JDITHER_NONE;
+ if (config == SkBitmap::kARGB_8888_Config) {
+ cinfo.out_color_space = JCS_RGBA_8888;
+ } else if (config == SkBitmap::kRGB_565_Config) {
+ if (sampleSize == 1) {
+ // SkScaledBitmapSampler can't handle RGB_565 yet,
+ // so don't even try.
+ cinfo.out_color_space = JCS_RGB_565;
+ if (this->getDitherImage()) {
+ cinfo.dither_mode = JDITHER_ORDERED;
+ }
+ }
+ }
+#endif
+
/* image_width and image_height are the original dimensions, available
after jpeg_read_header(). To see the scaled dimensions, we have to call
jpeg_start_decompress(), and then read output_width and output_height.
*/
- jpeg_start_decompress(&cinfo);
+ if (!jpeg_start_decompress(&cinfo)) {
+ return return_false(cinfo, *bm, "start_decompress");
+ }
/* If we need to better match the request, we might examine the image and
output dimensions, and determine if the downsampling jpeg provided is
not sufficient. If so, we can recompute a modified sampleSize value to
make up the difference.
-
+
To skip this additional scaling, just set sampleSize = 1; below.
*/
sampleSize = sampleSize * cinfo.output_width / cinfo.image_width;
- // check for supported formats
- bool isRGB; // as opposed to gray8
- if (3 == cinfo.num_components && JCS_RGB == cinfo.out_color_space) {
- isRGB = true;
- } else if (1 == cinfo.num_components &&
- JCS_GRAYSCALE == cinfo.out_color_space) {
- isRGB = false; // could use Index8 config if we want...
- } else {
- SkDEBUGF(("SkJPEGImageDecoder: unsupported jpeg colorspace %d with %d components\n",
- cinfo.jpeg_color_space, cinfo.num_components));
- return false;
- }
-
- SkBitmap::Config config = prefConfig;
- // if no user preference, see what the device recommends
- if (config == SkBitmap::kNo_Config)
- config = SkImageDecoder::GetDeviceConfig();
-
- // only these make sense for jpegs
- if (config != SkBitmap::kARGB_8888_Config &&
- config != SkBitmap::kARGB_4444_Config &&
- config != SkBitmap::kRGB_565_Config) {
- config = SkBitmap::kARGB_8888_Config;
- }
// should we allow the Chooser (if present) to pick a config for us???
if (!this->chooseFromOneChoice(config, cinfo.output_width,
cinfo.output_height)) {
- return false;
+ return return_false(cinfo, *bm, "chooseFromOneChoice");
+ }
+
+#ifdef ANDROID_RGB
+ /* short-circuit the SkScaledBitmapSampler when possible, as this gives
+ a significant performance boost.
+ */
+ if (sampleSize == 1 &&
+ ((config == SkBitmap::kARGB_8888_Config &&
+ cinfo.out_color_space == JCS_RGBA_8888) ||
+ (config == SkBitmap::kRGB_565_Config &&
+ cinfo.out_color_space == JCS_RGB_565)))
+ {
+ bm->setConfig(config, cinfo.output_width, cinfo.output_height);
+ bm->setIsOpaque(true);
+ if (SkImageDecoder::kDecodeBounds_Mode == mode) {
+ return true;
+ }
+ if (!this->allocPixelRef(bm, NULL)) {
+ return return_false(cinfo, *bm, "allocPixelRef");
+ }
+ SkAutoLockPixels alp(*bm);
+ JSAMPLE* rowptr = (JSAMPLE*)bm->getPixels();
+ INT32 const bpr = bm->rowBytes();
+
+ while (cinfo.output_scanline < cinfo.output_height) {
+ int row_count = jpeg_read_scanlines(&cinfo, &rowptr, 1);
+ // if row_count == 0, then we didn't get a scanline, so abort.
+ // if we supported partial images, we might return true in this case
+ if (0 == row_count) {
+ return return_false(cinfo, *bm, "read_scanlines");
+ }
+ if (this->shouldCancelDecode()) {
+ return return_false(cinfo, *bm, "shouldCancelDecode");
+ }
+ rowptr += bpr;
+ }
+ jpeg_finish_decompress(&cinfo);
+ return true;
+ }
+#endif
+
+ // check for supported formats
+ SkScaledBitmapSampler::SrcConfig sc;
+ if (3 == cinfo.out_color_components && JCS_RGB == cinfo.out_color_space) {
+ sc = SkScaledBitmapSampler::kRGB;
+#ifdef ANDROID_RGB
+ } else if (JCS_RGBA_8888 == cinfo.out_color_space) {
+ sc = SkScaledBitmapSampler::kRGBX;
+ //} else if (JCS_RGB_565 == cinfo.out_color_space) {
+ // sc = SkScaledBitmapSampler::kRGB_565;
+#endif
+ } else if (1 == cinfo.out_color_components &&
+ JCS_GRAYSCALE == cinfo.out_color_space) {
+ sc = SkScaledBitmapSampler::kGray;
+ } else {
+ return return_false(cinfo, *bm, "jpeg colorspace");
}
SkScaledBitmapSampler sampler(cinfo.output_width, cinfo.output_height,
sampleSize);
-
+
bm->setConfig(config, sampler.scaledWidth(), sampler.scaledHeight());
// jpegs are always opauqe (i.e. have no per-pixel alpha)
bm->setIsOpaque(true);
@@ -293,38 +451,51 @@ bool SkJPEGImageDecoder::onDecode(SkStream* stream, SkBitmap* bm,
return true;
}
if (!this->allocPixelRef(bm, NULL)) {
- return false;
+ return return_false(cinfo, *bm, "allocPixelRef");
}
- SkAutoLockPixels alp(*bm);
-
- if (!sampler.begin(bm,
- isRGB ? SkScaledBitmapSampler::kRGB :
- SkScaledBitmapSampler::kGray,
- this->getDitherImage())) {
- return false;
+ SkAutoLockPixels alp(*bm);
+ if (!sampler.begin(bm, sc, this->getDitherImage())) {
+ return return_false(cinfo, *bm, "sampler.begin");
}
- uint8_t* srcRow = (uint8_t*)srcStorage.alloc(cinfo.output_width * 3);
+ uint8_t* srcRow = (uint8_t*)srcStorage.alloc(cinfo.output_width * 4);
+
+ // Possibly skip initial rows [sampler.srcY0]
+ if (!skip_src_rows(&cinfo, srcRow, sampler.srcY0())) {
+ return return_false(cinfo, *bm, "skip rows");
+ }
- skip_src_rows(&cinfo, srcRow, sampler.srcY0());
+ // now loop through scanlines until y == bm->height() - 1
for (int y = 0;; y++) {
JSAMPLE* rowptr = (JSAMPLE*)srcRow;
int row_count = jpeg_read_scanlines(&cinfo, &rowptr, 1);
- SkASSERT(row_count == 1);
+ if (0 == row_count) {
+ return return_false(cinfo, *bm, "read_scanlines");
+ }
+ if (this->shouldCancelDecode()) {
+ return return_false(cinfo, *bm, "shouldCancelDecode");
+ }
sampler.next(srcRow);
if (bm->height() - 1 == y) {
+ // we're done
break;
}
- skip_src_rows(&cinfo, srcRow, sampler.srcDY() - 1);
+
+ if (!skip_src_rows(&cinfo, srcRow, sampler.srcDY() - 1)) {
+ return return_false(cinfo, *bm, "skip rows");
+ }
}
- // ??? If I don't do this, I get an error from finish_decompress
- skip_src_rows(&cinfo, srcRow, cinfo.output_height - cinfo.output_scanline);
-
+ // we formally skip the rest, so we don't get a complaint from libjpeg
+ if (!skip_src_rows(&cinfo, srcRow,
+ cinfo.output_height - cinfo.output_scanline)) {
+ return return_false(cinfo, *bm, "skip rows");
+ }
jpeg_finish_decompress(&cinfo);
+// SkDebugf("------------------- bm2 size %d [%d %d] %d\n", bm->getSize(), bm->width(), bm->height(), bm->config());
return true;
}
@@ -383,11 +554,11 @@ static void rgb2yuv_4444(uint8_t dst[], U16CPU c) {
int r = SkGetPackedR4444(c);
int g = SkGetPackedG4444(c);
int b = SkGetPackedB4444(c);
-
+
int y = ( CYR*r + CYG*g + CYB*b ) >> (CSHIFT - 4);
int u = ( CUR*r + CUG*g + CUB*b ) >> (CSHIFT - 4);
int v = ( CVR*r + CVG*g + CVB*b ) >> (CSHIFT - 4);
-
+
dst[0] = SkToU8(y);
dst[1] = SkToU8(u + 128);
dst[2] = SkToU8(v + 128);
@@ -397,11 +568,11 @@ static void rgb2yuv_16(uint8_t dst[], U16CPU c) {
int r = SkGetPackedR16(c);
int g = SkGetPackedG16(c);
int b = SkGetPackedB16(c);
-
+
int y = ( 2*CYR*r + CYG*g + 2*CYB*b ) >> (CSHIFT - 2);
int u = ( 2*CUR*r + CUG*g + 2*CUB*b ) >> (CSHIFT - 2);
int v = ( 2*CVR*r + CVG*g + 2*CVB*b ) >> (CSHIFT - 2);
-
+
dst[0] = SkToU8(y);
dst[1] = SkToU8(u + 128);
dst[2] = SkToU8(v + 128);
@@ -519,9 +690,9 @@ static boolean sk_empty_output_buffer(j_compress_ptr cinfo) {
// if (!dest->fStream->write(dest->fBuffer, sk_destination_mgr::kBufferSize - dest->free_in_buffer))
if (!dest->fStream->write(dest->fBuffer, sk_destination_mgr::kBufferSize)) {
- sk_throw();
+ ERREXIT(cinfo, JERR_FILE_WRITE);
+ return false;
}
- // ERREXIT(cinfo, JERR_FILE_WRITE);
dest->next_output_byte = dest->fBuffer;
dest->free_in_buffer = sk_destination_mgr::kBufferSize;
@@ -534,7 +705,8 @@ static void sk_term_destination (j_compress_ptr cinfo) {
size_t size = sk_destination_mgr::kBufferSize - dest->free_in_buffer;
if (size > 0) {
if (!dest->fStream->write(dest->fBuffer, size)) {
- sk_throw();
+ ERREXIT(cinfo, JERR_FILE_WRITE);
+ return;
}
}
dest->fStream->flush();
@@ -547,23 +719,6 @@ sk_destination_mgr::sk_destination_mgr(SkWStream* stream)
this->term_destination = sk_term_destination;
}
-class SkAutoLockColors : public SkNoncopyable {
-public:
- SkAutoLockColors(const SkBitmap& bm) {
- fCTable = bm.getColorTable();
- fColors = fCTable ? fCTable->lockColors() : NULL;
- }
- ~SkAutoLockColors() {
- if (fCTable) {
- fCTable->unlockColors(false);
- }
- }
- const SkPMColor* colors() const { return fColors; }
-private:
- SkColorTable* fCTable;
- const SkPMColor* fColors;
-};
-
class SkJPEGImageEncoder : public SkImageEncoder {
protected:
virtual bool onEncode(SkWStream* stream, const SkBitmap& bm, int quality) {
@@ -585,6 +740,10 @@ protected:
sk_error_mgr sk_err;
sk_destination_mgr sk_wstream(stream);
+ // allocate these before set call setjmp
+ SkAutoMalloc oneRow;
+ SkAutoLockColors ctLocker;
+
cinfo.err = jpeg_std_error(&sk_err);
sk_err.error_exit = sk_error_exit;
if (setjmp(sk_err.fJmpBuf)) {
@@ -606,17 +765,15 @@ protected:
jpeg_set_defaults(&cinfo);
jpeg_set_quality(&cinfo, quality, TRUE /* limit to baseline-JPEG values */);
cinfo.dct_method = JDCT_IFAST;
-
+
jpeg_start_compress(&cinfo, TRUE);
const int width = bm.width();
- SkAutoMalloc oneRow(width * 3);
- uint8_t* oneRowP = (uint8_t*)oneRow.get();
+ uint8_t* oneRowP = (uint8_t*)oneRow.alloc(width * 3);
- SkAutoLockColors alc(bm);
- const SkPMColor* colors = alc.colors();
+ const SkPMColor* colors = ctLocker.lockColors(bm);
const void* srcRow = bm.getPixels();
-
+
while (cinfo.next_scanline < cinfo.image_height) {
JSAMPROW row_pointer[1]; /* pointer to JSAMPLE row[s] */
diff --git a/skia/images/SkImageDecoder_libpng.cpp b/skia/images/SkImageDecoder_libpng.cpp
index 4378ca9..862ebf1 100644
--- a/skia/images/SkImageDecoder_libpng.cpp
+++ b/skia/images/SkImageDecoder_libpng.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/images/SkImageDecoder_libpng.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -83,7 +83,9 @@ static int sk_read_user_chunk(png_structp png_ptr, png_unknown_chunkp chunk) {
}
static void sk_error_fn(png_structp png_ptr, png_const_charp msg) {
+#if 0
SkDebugf("------ png error %s\n", msg);
+#endif
longjmp(png_jmpbuf(png_ptr), 1);
}
@@ -98,6 +100,24 @@ static bool pos_le(int value, int max) {
return value > 0 && value <= max;
}
+static bool substituteTranspColor(SkBitmap* bm, SkPMColor match) {
+ SkASSERT(bm->config() == SkBitmap::kARGB_8888_Config);
+
+ bool reallyHasAlpha = false;
+
+ for (int y = bm->height() - 1; y >= 0; --y) {
+ SkPMColor* p = bm->getAddr32(0, y);
+ for (int x = bm->width() - 1; x >= 0; --x) {
+ if (match == *p) {
+ *p = 0;
+ reallyHasAlpha = true;
+ }
+ p += 1;
+ }
+ }
+ return reallyHasAlpha;
+}
+
bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
SkBitmap::Config prefConfig, Mode mode) {
// SkAutoTrace apr("SkPNGImageDecoder::onDecode");
@@ -153,9 +173,30 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
png_get_IHDR(png_ptr, info_ptr, &origWidth, &origHeight, &bit_depth, &color_type,
&interlace_type, int_p_NULL, int_p_NULL);
+ /* tell libpng to strip 16 bit/color files down to 8 bits/color */
+ if (bit_depth == 16) {
+ png_set_strip_16(png_ptr);
+ }
+ /* Extract multiple pixels with bit depths of 1, 2, and 4 from a single
+ * byte into separate bytes (useful for paletted and grayscale images). */
+ if (bit_depth < 8) {
+ png_set_packing(png_ptr);
+ }
+ /* Expand grayscale images to the full 8 bits from 1, 2, or 4 bits/pixel */
+ if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) {
+ png_set_gray_1_2_4_to_8(png_ptr);
+ }
+
+ /* Make a grayscale image into RGB. */
+ if (color_type == PNG_COLOR_TYPE_GRAY ||
+ color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
+ png_set_gray_to_rgb(png_ptr);
+ }
+
SkBitmap::Config config;
bool hasAlpha = false;
bool doDither = this->getDitherImage();
+ SkPMColor theTranspColor = 0; // 0 tells us not to try to match
// check for sBIT chunk data, in case we should disable dithering because
// our data is not truely 8bits per component
@@ -176,11 +217,41 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
if (color_type == PNG_COLOR_TYPE_PALETTE) {
config = SkBitmap::kIndex8_Config; // defer sniffing for hasAlpha
} else {
- png_color_16p transColor;
+ png_color_16p transpColor = NULL;
+ int numTransp = 0;
+
+ png_get_tRNS(png_ptr, info_ptr, NULL, &numTransp, &transpColor);
- png_get_tRNS(png_ptr, info_ptr, NULL, NULL, &transColor);
+ bool valid = png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS);
- if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS) ||
+ if (valid && numTransp == 1 && transpColor != NULL) {
+ /* Compute our transparent color, which we'll match against later.
+ We don't really handle 16bit components properly here, since we
+ do our compare *after* the values have been knocked down to 8bit
+ which means we will find more matches than we should. The real
+ fix seems to be to see the actual 16bit components, do the
+ compare, and then knock it down to 8bits ourselves.
+ */
+ if (color_type & PNG_COLOR_MASK_COLOR) {
+ if (16 == bit_depth) {
+ theTranspColor = SkPackARGB32(0xFF, transpColor->red >> 8,
+ transpColor->green >> 8, transpColor->blue >> 8);
+ } else {
+ theTranspColor = SkPackARGB32(0xFF, transpColor->red,
+ transpColor->green, transpColor->blue);
+ }
+ } else { // gray
+ if (16 == bit_depth) {
+ theTranspColor = SkPackARGB32(0xFF, transpColor->gray >> 8,
+ transpColor->gray >> 8, transpColor->gray >> 8);
+ } else {
+ theTranspColor = SkPackARGB32(0xFF, transpColor->gray,
+ transpColor->gray, transpColor->gray);
+ }
+ }
+ }
+
+ if (valid ||
PNG_COLOR_TYPE_RGB_ALPHA == color_type ||
PNG_COLOR_TYPE_GRAY_ALPHA == color_type) {
hasAlpha = true;
@@ -212,26 +283,6 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
// from here down we are concerned with colortables and pixels
- /* tell libpng to strip 16 bit/color files down to 8 bits/color */
- if (bit_depth == 16) {
- png_set_strip_16(png_ptr);
- }
- /* Extract multiple pixels with bit depths of 1, 2, and 4 from a single
- * byte into separate bytes (useful for paletted and grayscale images). */
- if (bit_depth < 8) {
- png_set_packing(png_ptr);
- }
- /* Expand grayscale images to the full 8 bits from 1, 2, or 4 bits/pixel */
- if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) {
- png_set_gray_1_2_4_to_8(png_ptr);
- }
-
- /* Make a grayscale image into RGB. */
- if (color_type == PNG_COLOR_TYPE_GRAY ||
- color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
- png_set_gray_to_rgb(png_ptr);
- }
-
// we track if we actually see a non-opaque pixels, since sometimes a PNG sets its colortype
// to |= PNG_COLOR_MASK_ALPHA, but all of its pixels are in fact opaque. We care, since we
// draw lots faster if we can flag the bitmap has being opaque
@@ -295,7 +346,6 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
SkAutoUnref aur(colorTable);
if (!this->allocPixelRef(decodedBitmap, colorTable)) {
- delete colorTable;
return false;
}
@@ -374,14 +424,19 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
}
if (hasAlpha && !reallyHasAlpha) {
+#if 0
SkDEBUGF(("Image doesn't really have alpha [%d %d]\n",
origWidth, origHeight));
+#endif
}
}
/* read rest of file, and get additional chunks in info_ptr - REQUIRED */
png_read_end(png_ptr, info_ptr);
+ if (0 != theTranspColor) {
+ reallyHasAlpha |= substituteTranspColor(decodedBitmap, theTranspColor);
+ }
decodedBitmap->setIsOpaque(!reallyHasAlpha);
return true;
}
@@ -488,8 +543,19 @@ static void transform_scanline_4444(const char* SK_RESTRICT src, int width,
}
}
+static void transform_scanline_index8(const char* SK_RESTRICT src, int width,
+ char* SK_RESTRICT dst) {
+ memcpy(dst, src, width);
+}
+
static transform_scanline_proc choose_proc(SkBitmap::Config config,
bool hasAlpha) {
+ // we don't care about search on alpha if we're kIndex8, since only the
+ // colortable packing cares about that distinction, not the pixels
+ if (SkBitmap::kIndex8_Config == config) {
+ hasAlpha = false; // we store false in the table entries for kIndex8
+ }
+
static const struct {
SkBitmap::Config fConfig;
bool fHasAlpha;
@@ -500,6 +566,7 @@ static transform_scanline_proc choose_proc(SkBitmap::Config config,
{ SkBitmap::kARGB_8888_Config, true, transform_scanline_8888 },
{ SkBitmap::kARGB_4444_Config, false, transform_scanline_444 },
{ SkBitmap::kARGB_4444_Config, true, transform_scanline_4444 },
+ { SkBitmap::kIndex8_Config, false, transform_scanline_index8 },
};
for (int i = SK_ARRAY_COUNT(gMap) - 1; i >= 0; --i) {
@@ -511,6 +578,78 @@ static transform_scanline_proc choose_proc(SkBitmap::Config config,
return NULL;
}
+// return the minimum legal bitdepth (by png standards) for this many colortable
+// entries. SkBitmap always stores in 8bits per pixel, but for colorcount <= 16,
+// we can use fewer bits per in png
+static int computeBitDepth(int colorCount) {
+#if 0
+ int bits = SkNextLog2(colorCount);
+ SkASSERT(bits >= 1 && bits <= 8);
+ // now we need bits itself to be a power of 2 (e.g. 1, 2, 4, 8)
+ return SkNextPow2(bits);
+#else
+ // for the moment, we don't know how to pack bitdepth < 8
+ return 8;
+#endif
+}
+
+/* Pack palette[] with the corresponding colors, and if hasAlpha is true, also
+ pack trans[] and return the number of trans[] entries written. If hasAlpha
+ is false, the return value will always be 0.
+
+ Note: this routine takes care of unpremultiplying the RGB values when we
+ have alpha in the colortable, since png doesn't support premul colors
+*/
+static int pack_palette(SkColorTable* ctable, png_color* SK_RESTRICT palette,
+ png_byte* SK_RESTRICT trans, bool hasAlpha) {
+ SkAutoLockColors alc(ctable);
+ const SkPMColor* SK_RESTRICT colors = alc.colors();
+ const int ctCount = ctable->count();
+ int i, num_trans = 0;
+
+ if (hasAlpha) {
+ /* first see if we have some number of fully opaque at the end of the
+ ctable. PNG allows num_trans < num_palette, but all of the trans
+ entries must come first in the palette. If I was smarter, I'd
+ reorder the indices and ctable so that all non-opaque colors came
+ first in the palette. But, since that would slow down the encode,
+ I'm leaving the indices and ctable order as is, and just looking
+ at the tail of the ctable for opaqueness.
+ */
+ num_trans = ctCount;
+ for (i = ctCount - 1; i >= 0; --i) {
+ if (SkGetPackedA32(colors[i]) != 0xFF) {
+ break;
+ }
+ num_trans -= 1;
+ }
+
+ const SkUnPreMultiply::Scale* SK_RESTRICT table =
+ SkUnPreMultiply::GetScaleTable();
+
+ for (i = 0; i < num_trans; i++) {
+ const SkPMColor c = *colors++;
+ const unsigned a = SkGetPackedA32(c);
+ const SkUnPreMultiply::Scale s = table[a];
+ trans[i] = a;
+ palette[i].red = SkUnPreMultiply::ApplyScale(s, SkGetPackedR32(c));
+ palette[i].green = SkUnPreMultiply::ApplyScale(s,SkGetPackedG32(c));
+ palette[i].blue = SkUnPreMultiply::ApplyScale(s, SkGetPackedB32(c));
+ }
+ // now fall out of this if-block to use common code for the trailing
+ // opaque entries
+ }
+
+ // these (remaining) entries are opaque
+ for (i = num_trans; i < ctCount; i++) {
+ SkPMColor c = *colors++;
+ palette[i].red = SkGetPackedR32(c);
+ palette[i].green = SkGetPackedG32(c);
+ palette[i].blue = SkGetPackedB32(c);
+ }
+ return num_trans;
+}
+
class SkPNGImageEncoder : public SkImageEncoder {
protected:
virtual bool onEncode(SkWStream* stream, const SkBitmap& bm, int quality);
@@ -521,20 +660,25 @@ bool SkPNGImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bitmap,
SkBitmap::Config config = bitmap.getConfig();
const bool hasAlpha = !bitmap.isOpaque();
+ int colorType = PNG_COLOR_MASK_COLOR;
+ int bitDepth = 8; // default for color
png_color_8 sig_bit;
switch (config) {
+ case SkBitmap::kIndex8_Config:
+ colorType |= PNG_COLOR_MASK_PALETTE;
+ // fall through to the ARGB_8888 case
case SkBitmap::kARGB_8888_Config:
sig_bit.red = 8;
sig_bit.green = 8;
sig_bit.blue = 8;
- sig_bit.alpha = hasAlpha ? 8 : 0;
+ sig_bit.alpha = 8;
break;
case SkBitmap::kARGB_4444_Config:
sig_bit.red = 4;
sig_bit.green = 4;
sig_bit.blue = 4;
- sig_bit.alpha = hasAlpha ? 4 : 0;
+ sig_bit.alpha = 4;
break;
case SkBitmap::kRGB_565_Config:
sig_bit.red = 5;
@@ -543,16 +687,34 @@ bool SkPNGImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bitmap,
sig_bit.alpha = 0;
break;
default:
- SkDEBUGF(("SkPNGImageEncoder::onEncode can't encode %d config\n",
- config));
return false;
}
-
+
+ if (hasAlpha) {
+ // don't specify alpha if we're a palette, even if our ctable has alpha
+ if (!(colorType & PNG_COLOR_MASK_PALETTE)) {
+ colorType |= PNG_COLOR_MASK_ALPHA;
+ }
+ } else {
+ sig_bit.alpha = 0;
+ }
+
SkAutoLockPixels alp(bitmap);
- if (NULL == bitmap.getPixels()) {
+ // readyToDraw checks for pixels (and colortable if that is required)
+ if (!bitmap.readyToDraw()) {
return false;
}
-
+
+ // we must do this after we have locked the pixels
+ SkColorTable* ctable = bitmap.getColorTable();
+ if (NULL != ctable) {
+ if (ctable->count() == 0) {
+ return false;
+ }
+ // check if we can store in fewer than 8 bits
+ bitDepth = computeBitDepth(ctable->count());
+ }
+
png_structp png_ptr;
png_infop info_ptr;
@@ -587,12 +749,12 @@ bool SkPNGImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bitmap,
* currently be PNG_COMPRESSION_TYPE_BASE and PNG_FILTER_TYPE_BASE. REQUIRED
*/
- png_set_IHDR(png_ptr, info_ptr, bitmap.width(), bitmap.height(), 8,
- hasAlpha ? PNG_COLOR_TYPE_RGB_ALPHA : PNG_COLOR_TYPE_RGB,
+ png_set_IHDR(png_ptr, info_ptr, bitmap.width(), bitmap.height(),
+ bitDepth, colorType,
PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE,
PNG_FILTER_TYPE_BASE);
-#if 0 // need to support this some day <reed>
+#if 0 // need to support this some day
/* set the palette if there is one. REQUIRED for indexed-color images */
palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH
* png_sizeof (png_color));
@@ -620,15 +782,6 @@ bool SkPNGImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bitmap,
png_write_end(png_ptr, info_ptr);
-#if 0
- /* If you png_malloced a palette, free it here (don't free info_ptr->palette,
- as recommended in versions 1.0.5m and earlier of this example; if
- libpng mallocs info_ptr->palette, libpng will free it). If you
- allocated it with malloc() instead of png_malloc(), use free() instead
- of png_free(). */
- png_free(png_ptr, palette);
-#endif
-
/* clean up after the write, and free any memory allocated */
png_destroy_write_struct(&png_ptr, &info_ptr);
return true;
@@ -640,4 +793,3 @@ SkImageEncoder* SkImageEncoder_PNG_Factory() {
}
#endif /* SK_SUPPORT_IMAGE_ENCODE */
-
diff --git a/skia/images/SkImageDecoder_wbmp.cpp b/skia/images/SkImageDecoder_wbmp.cpp
index d2fea75..9d188f6 100644
--- a/skia/images/SkImageDecoder_wbmp.cpp
+++ b/skia/images/SkImageDecoder_wbmp.cpp
@@ -1,5 +1,5 @@
/**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/images/SkImageRef.cpp b/skia/images/SkImageRef.cpp
index 05960a2..bd7a07d 100644
--- a/skia/images/SkImageRef.cpp
+++ b/skia/images/SkImageRef.cpp
@@ -58,7 +58,7 @@ bool SkImageRef::getInfo(SkBitmap* bitmap) {
bool SkImageRef::onDecode(SkImageDecoder* codec, SkStream* stream,
SkBitmap* bitmap, SkBitmap::Config config,
SkImageDecoder::Mode mode) {
- return codec->onDecode(stream, bitmap, config, mode);
+ return codec->decode(stream, bitmap, config, mode);
}
bool SkImageRef::prepareBitmap(SkImageDecoder::Mode mode) {
@@ -68,6 +68,14 @@ bool SkImageRef::prepareBitmap(SkImageDecoder::Mode mode) {
return false;
}
+ /* As soon as we really know our config, we record it, so that on
+ subsequent calls to the codec, we are sure we will always get the same
+ result.
+ */
+ if (SkBitmap::kNo_Config != fBitmap.config()) {
+ fConfig = fBitmap.config();
+ }
+
if (NULL != fBitmap.getPixels() ||
(SkBitmap::kNo_Config != fBitmap.config() &&
SkImageDecoder::kDecodeBounds_Mode == mode)) {
diff --git a/skia/images/SkMovie_gif.cpp b/skia/images/SkMovie_gif.cpp
index 907ea82..c7db017 100644
--- a/skia/images/SkMovie_gif.cpp
+++ b/skia/images/SkMovie_gif.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/images/SkImageDecoder_libgif.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -143,7 +143,7 @@ bool SkGIFMovie::onGetBitmap(SkBitmap* bm)
if (NULL == gif)
return false;
- // should we check for the Image cmap or the global (SColorMap) first? <reed>
+ // should we check for the Image cmap or the global (SColorMap) first?
ColorMapObject* cmap = gif->SColorMap;
if (cmap == NULL)
cmap = gif->Image.ColorMap;
@@ -154,15 +154,22 @@ bool SkGIFMovie::onGetBitmap(SkBitmap* bm)
return false;
}
- SavedImage* gif_image = fCurrSavedImage;
const int width = gif->SWidth;
const int height = gif->SHeight;
- SkBitmap::Config config = SkBitmap::kIndex8_Config;
+ if (width <= 0 || height <= 0) {
+ return false;
+ }
+
+ SavedImage* gif_image = fCurrSavedImage;
+ SkBitmap::Config config = SkBitmap::kIndex8_Config;
SkColorTable* colorTable = SkNEW_ARGS(SkColorTable, (cmap->ColorCount));
+ SkAutoUnref aur(colorTable);
+
bm->setConfig(config, width, height, 0);
- bm->allocPixels(colorTable);
- colorTable->unref();
+ if (!bm->allocPixels(colorTable)) {
+ return false;
+ }
int transparent = -1;
for (int i = 0; i < gif_image->ExtensionBlockCount; ++i) {
diff --git a/skia/images/SkScaledBitmapSampler.cpp b/skia/images/SkScaledBitmapSampler.cpp
index 529be61..15f4432 100644
--- a/skia/images/SkScaledBitmapSampler.cpp
+++ b/skia/images/SkScaledBitmapSampler.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2007, Google Inc.
+ * Copyright 2007, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/skia/images/SkStream.cpp b/skia/images/SkStream.cpp
index 5c1eebe..b199a1b 100644
--- a/skia/images/SkStream.cpp
+++ b/skia/images/SkStream.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/images/SkStream.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -248,7 +248,7 @@ size_t SkFILEStream::read(void* buffer, size_t size)
return 0;
}
-////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////
SkMemoryStream::SkMemoryStream()
{
@@ -343,19 +343,20 @@ size_t SkMemoryStream::seek(size_t offset)
/////////////////////////////////////////////////////////////////////////////////////////////////////////
-SkBufferStream::SkBufferStream(SkStream& proxy, size_t bufferSize)
+SkBufferStream::SkBufferStream(SkStream* proxy, size_t bufferSize)
: fProxy(proxy)
{
- SkASSERT(&proxy != NULL);
+ SkASSERT(proxy != NULL);
+ proxy->ref();
this->init(NULL, bufferSize);
}
-SkBufferStream::SkBufferStream(SkStream& proxy, void* buffer, size_t bufferSize)
+SkBufferStream::SkBufferStream(SkStream* proxy, void* buffer, size_t bufferSize)
: fProxy(proxy)
{
- SkASSERT(&proxy != NULL);
+ SkASSERT(proxy != NULL);
SkASSERT(buffer == NULL || bufferSize != 0); // init(addr, 0) makes no sense, we must know how big their buffer is
-
+ proxy->ref();
this->init(buffer, bufferSize);
}
@@ -382,6 +383,7 @@ void SkBufferStream::init(void* buffer, size_t bufferSize)
SkBufferStream::~SkBufferStream()
{
+ fProxy->unref();
if (fWeOwnTheBuffer)
sk_free(fBuffer);
}
@@ -389,31 +391,43 @@ SkBufferStream::~SkBufferStream()
bool SkBufferStream::rewind()
{
fBufferOffset = fBufferSize = fOrigBufferSize;
- return fProxy.rewind();
+ return fProxy->rewind();
}
const char* SkBufferStream::getFileName()
{
- return fProxy.getFileName();
+ return fProxy->getFileName();
}
#ifdef SK_DEBUG
// #define SK_TRACE_BUFFERSTREAM
#endif
-size_t SkBufferStream::read(void* buffer, size_t size)
-{
+size_t SkBufferStream::read(void* buffer, size_t size) {
#ifdef SK_TRACE_BUFFERSTREAM
SkDebugf("Request %d", size);
#endif
- if (buffer == NULL && size == 0)
- return fProxy.read(buffer, size); // requesting total size
+ if (buffer == NULL && size == 0) {
+ return fProxy->read(buffer, size); // requesting total size
+ }
+
+ if (0 == size) {
+ return 0;
+ }
- if (buffer == NULL || size == 0)
- {
- fBufferOffset += size;
- return fProxy.read(buffer, size);
+ // skip size bytes
+ if (NULL == buffer) {
+ size_t remaining = fBufferSize - fBufferOffset;
+ if (remaining >= size) {
+ fBufferOffset += size;
+ return size;
+ }
+ // if we get here, we are being asked to skip beyond our current buffer
+ // so reset our offset to force a read next time, and skip the diff
+ // in our proxy
+ fBufferOffset = fOrigBufferSize;
+ return remaining + fProxy->read(NULL, size - remaining);
}
size_t s = size;
@@ -441,7 +455,7 @@ size_t SkBufferStream::read(void* buffer, size_t size)
if (size < fBufferSize) // lets try to read more than the request
{
- s = fProxy.read(fBuffer, fBufferSize);
+ s = fProxy->read(fBuffer, fBufferSize);
#ifdef SK_TRACE_BUFFERSTREAM
SkDebugf(" read %d into fBuffer", s);
#endif
@@ -461,7 +475,7 @@ size_t SkBufferStream::read(void* buffer, size_t size)
}
else // just do a direct read
{
- actuallyRead += fProxy.read(buffer, size);
+ actuallyRead += fProxy->read(buffer, size);
#ifdef SK_TRACE_BUFFERSTREAM
SkDebugf(" direct read %d", size);
#endif
@@ -475,7 +489,7 @@ size_t SkBufferStream::read(void* buffer, size_t size)
const void* SkBufferStream::getMemoryBase()
{
- return fProxy.getMemoryBase();
+ return fProxy->getMemoryBase();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -729,20 +743,63 @@ bool SkDebugWStream::write(const void* buffer, size_t size)
#include "SkRandom.h"
-void SkWStream::UnitTest()
-{
+#ifdef SK_SUPPORT_UNITTEST
+#define MAX_SIZE (256 * 1024)
+
+static void random_fill(SkRandom& rand, void* buffer, size_t size) {
+ char* p = (char*)buffer;
+ char* stop = p + size;
+ while (p < stop) {
+ *p++ = (char)(rand.nextU() >> 8);
+ }
+}
+
+static void test_buffer() {
+ SkRandom rand;
+ SkAutoMalloc am(MAX_SIZE * 2);
+ char* storage = (char*)am.get();
+ char* storage2 = storage + MAX_SIZE;
+
+ random_fill(rand, storage, MAX_SIZE);
+
+ for (int sizeTimes = 0; sizeTimes < 100; sizeTimes++) {
+ int size = rand.nextU() % MAX_SIZE;
+ if (size == 0) {
+ size = MAX_SIZE;
+ }
+ for (int times = 0; times < 100; times++) {
+ int bufferSize = 1 + (rand.nextU() & 0xFFFF);
+ SkMemoryStream mstream(storage, size);
+ SkBufferStream bstream(&mstream, bufferSize);
+
+ int bytesRead = 0;
+ while (bytesRead < size) {
+ int s = 17 + (rand.nextU() & 0xFFFF);
+ int ss = bstream.read(storage2, s);
+ SkASSERT(ss > 0 && ss <= s);
+ SkASSERT(bytesRead + ss <= size);
+ SkASSERT(memcmp(storage + bytesRead, storage2, ss) == 0);
+ bytesRead += ss;
+ }
+ SkASSERT(bytesRead == size);
+ }
+ }
+}
+#endif
+
+void SkStream::UnitTest() {
#ifdef SK_SUPPORT_UNITTEST
{
static const char s[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
char copy[sizeof(s)];
SkRandom rand;
-
+
for (int i = 0; i < 65; i++)
{
char* copyPtr = copy;
SkMemoryStream mem(s, sizeof(s));
- SkBufferStream buff(mem, i);
-
+ SkBufferStream buff(&mem, i);
+
do {
copyPtr += buff.read(copyPtr, rand.nextU() & 15);
} while (copyPtr < copy + sizeof(s));
@@ -750,6 +807,13 @@ void SkWStream::UnitTest()
SkASSERT(memcmp(s, copy, sizeof(s)) == 0);
}
}
+ test_buffer();
+#endif
+}
+
+void SkWStream::UnitTest()
+{
+#ifdef SK_SUPPORT_UNITTEST
{
SkDebugWStream s;
diff --git a/skia/images/bmpdecoderhelper.cpp b/skia/images/bmpdecoderhelper.cpp
index e390731..acabf44 100644
--- a/skia/images/bmpdecoderhelper.cpp
+++ b/skia/images/bmpdecoderhelper.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2007, Google Inc.
+ * Copyright 2007, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/skia/images/bmpdecoderhelper.h b/skia/images/bmpdecoderhelper.h
index 7da1326..07f0ae5 100644
--- a/skia/images/bmpdecoderhelper.h
+++ b/skia/images/bmpdecoderhelper.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2007, Google Inc.
+ * Copyright 2007, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,8 @@
#define IMAGE_CODEC_BMPDECODERHELPER_H__
///////////////////////////////////////////////////////////////////////////////
-// Some glue code that should be removed soon.
+// this section is my current "glue" between google3 code and android.
+// will be fixed soon
#include "SkTypes.h"
#include <limits.h>
diff --git a/skia/include/Sk1DPathEffect.h b/skia/include/Sk1DPathEffect.h
index 6679a26..db01055 100644
--- a/skia/include/Sk1DPathEffect.h
+++ b/skia/include/Sk1DPathEffect.h
@@ -1,17 +1,18 @@
-/* Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef Sk1DPathEffect_DEFINED
#define Sk1DPathEffect_DEFINED
diff --git a/skia/include/Sk2DPathEffect.h b/skia/include/Sk2DPathEffect.h
index 832dbcc..6e54d0a 100644
--- a/skia/include/Sk2DPathEffect.h
+++ b/skia/include/Sk2DPathEffect.h
@@ -1,19 +1,18 @@
-/* include/graphics/Sk2DPathEffect.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef Sk2DPathEffect_DEFINED
#define Sk2DPathEffect_DEFINED
diff --git a/skia/include/SkAnimator.h b/skia/include/SkAnimator.h
index 5bed8c7..04d342c 100644
--- a/skia/include/SkAnimator.h
+++ b/skia/include/SkAnimator.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkAnimator.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkAnimator_DEFINED
#define SkAnimator_DEFINED
diff --git a/skia/include/SkAnimatorView.h b/skia/include/SkAnimatorView.h
index 44e951c..3c6c8a1 100644
--- a/skia/include/SkAnimatorView.h
+++ b/skia/include/SkAnimatorView.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkAnimatorView.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkAnimatorView_DEFINED
#define SkAnimatorView_DEFINED
diff --git a/skia/include/SkApplication.h b/skia/include/SkApplication.h
index 91be3cf..4c4a4fb0 100644
--- a/skia/include/SkApplication.h
+++ b/skia/include/SkApplication.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkApplication.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkApplication_DEFINED
#define SkApplication_DEFINED
diff --git a/skia/include/SkAvoidXfermode.h b/skia/include/SkAvoidXfermode.h
index 0696b92..32bc049 100644
--- a/skia/include/SkAvoidXfermode.h
+++ b/skia/include/SkAvoidXfermode.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkAvoidXfermode.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkAvoidXfermode_DEFINED
#define SkAvoidXfermode_DEFINED
diff --git a/skia/include/SkBGViewArtist.h b/skia/include/SkBGViewArtist.h
index 3ea264d..1bca42f 100644
--- a/skia/include/SkBGViewArtist.h
+++ b/skia/include/SkBGViewArtist.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkBGViewArtist.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkBGViewArtist_DEFINED
#define SkBGViewArtist_DEFINED
diff --git a/skia/include/SkBML_WXMLParser.h b/skia/include/SkBML_WXMLParser.h
index b1da4ba..faa127d 100644
--- a/skia/include/SkBML_WXMLParser.h
+++ b/skia/include/SkBML_WXMLParser.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkBML_WXMLParser.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkBML_WXMLParser_DEFINED
#define SkBML_WXMLParser_DEFINED
diff --git a/skia/include/SkBML_XMLParser.h b/skia/include/SkBML_XMLParser.h
index e2c3e29..f056bca 100644
--- a/skia/include/SkBML_XMLParser.h
+++ b/skia/include/SkBML_XMLParser.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkBML_XMLParser.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkBML_XMLParser_DEFINED
#define SkBML_XMLParser_DEFINED
diff --git a/skia/include/SkBitmap.h b/skia/include/SkBitmap.h
index 18db5a9..02c8cd9 100644
--- a/skia/include/SkBitmap.h
+++ b/skia/include/SkBitmap.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2008 Google Inc.
+ * Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@
#include "SkRefCnt.h"
#if defined(SK_BUILD_FOR_MAC)
-#include <Carbon/Carbon.h>
+#include <carbon/carbon.h>
#endif
struct SkIRect;
@@ -172,6 +172,9 @@ public:
static int ComputeShiftPerPixel(Config c) {
return ComputeBytesPerPixel(c) >> 1;
}
+
+ static Sk64 ComputeSize64(Config, int width, int height);
+ static size_t ComputeSize(Config, int width, int height);
/** Set the bitmap's config and dimensions. If rowBytes is 0, then
ComputeRowBytes() is called to compute the optimal value. This resets
@@ -181,6 +184,10 @@ public:
/** Use this to assign a new pixel address for an existing bitmap. This
will automatically release any pixelref previously installed. Only call
this if you are handling ownership/lifetime of the pixel memory.
+
+ If the bitmap retains a reference to the colortable (assuming it is
+ not null) it will take care of incrementing the reference count.
+
@param pixels Address for the pixels, managed by the caller.
@param ctable ColorTable (or null) that matches the specified pixels
*/
@@ -191,6 +198,9 @@ public:
If this is called multiple times, a new pixelref object will be created
each time.
+ If the bitmap retains a reference to the colortable (assuming it is
+ not null) it will take care of incrementing the reference count.
+
@param ctable ColorTable (or null) to use with the pixels that will
be allocated. Only used if config == Index8_Config
@return true if the allocation succeeds. If not the pixelref field of
@@ -205,6 +215,9 @@ public:
If this is called multiple times, a new pixelref object will be created
each time.
+ If the bitmap retains a reference to the colortable (assuming it is
+ not null) it will take care of incrementing the reference count.
+
@param allocator The Allocator to use to create a pixelref that can
manage the pixel memory for the current
width/height/config. If allocator is NULL, the standard
@@ -243,6 +256,16 @@ public:
*/
void unlockPixels() const;
+ /** Call this to be sure that the bitmap is valid enough to be drawn (i.e.
+ it has non-null pixels, and if required by its config, it has a
+ non-null colortable. Returns true if all of the above are met.
+ */
+ bool readyToDraw() const {
+ return this->getPixels() != NULL &&
+ ((this->config() != kIndex8_Config && this->config() != kRLE_Index8_Config) ||
+ fColorTable != NULL);
+ }
+
/** Return the bitmap's colortable (if any). Does not affect the colortable's
reference count.
*/
@@ -568,6 +591,56 @@ private:
const SkBitmap& fBitmap;
};
+/** Helper class that performs the lock/unlockColors calls on a colortable.
+ The destructor will call unlockColors(false) if it has a bitmap's colortable
+*/
+class SkAutoLockColors : public SkNoncopyable {
+public:
+ /** Initialize with no bitmap. Call lockColors(bitmap) to lock bitmap's
+ colortable
+ */
+ SkAutoLockColors() : fCTable(NULL), fColors(NULL) {}
+ /** Initialize with bitmap, locking its colortable if present
+ */
+ explicit SkAutoLockColors(const SkBitmap& bm) {
+ fCTable = bm.getColorTable();
+ fColors = fCTable ? fCTable->lockColors() : NULL;
+ }
+ /** Initialize with a colortable (may be null)
+ */
+ explicit SkAutoLockColors(SkColorTable* ctable) {
+ fCTable = ctable;
+ fColors = ctable ? ctable->lockColors() : NULL;
+ }
+ ~SkAutoLockColors() {
+ if (fCTable) {
+ fCTable->unlockColors(false);
+ }
+ }
+
+ /** Return the currently locked colors, or NULL if no bitmap's colortable
+ is currently locked.
+ */
+ const SkPMColor* colors() const { return fColors; }
+
+ /** If a previous bitmap has been locked by this object, unlock its colors
+ first. If the specified bitmap has a colortable, lock its colors and
+ return them.
+ */
+ const SkPMColor* lockColors(const SkBitmap& bm) {
+ if (fCTable) {
+ fCTable->unlockColors(false);
+ }
+ fCTable = bm.getColorTable();
+ fColors = fCTable ? fCTable->lockColors() : NULL;
+ return fColors;
+ }
+
+private:
+ SkColorTable* fCTable;
+ const SkPMColor* fColors;
+};
+
///////////////////////////////////////////////////////////////////////////////
inline uint32_t* SkBitmap::getAddr32(int x, int y) const {
diff --git a/skia/include/SkBlurDrawLooper.h b/skia/include/SkBlurDrawLooper.h
index b1c3d20..028b2eb 100644
--- a/skia/include/SkBlurDrawLooper.h
+++ b/skia/include/SkBlurDrawLooper.h
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef SkBlurDrawLooper_DEFINED
#define SkBlurDrawLooper_DEFINED
@@ -9,7 +25,7 @@ class SkMaskFilter;
/** \class SkBlurDrawLooper
This class draws a shadow of the object (possibly offset), and then draws
the original object in its original position.
- <reed> should there be an option to just draw the shadow/blur layer? webkit?
+ should there be an option to just draw the shadow/blur layer? webkit?
*/
class SkBlurDrawLooper : public SkDrawLooper {
public:
@@ -21,6 +37,10 @@ public:
virtual bool next();
virtual void restore();
+ static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
+ return SkNEW_ARGS(SkBlurDrawLooper, (buffer));
+ }
+
protected:
SkBlurDrawLooper(SkFlattenableReadBuffer&);
// overrides from SkFlattenable
@@ -28,9 +48,6 @@ protected:
virtual Factory getFactory() { return CreateProc; }
private:
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
- return SkNEW_ARGS(SkBlurDrawLooper, (buffer)); }
-
SkCanvas* fCanvas;
SkPaint* fPaint;
SkMaskFilter* fBlur;
diff --git a/skia/include/SkBlurMaskFilter.h b/skia/include/SkBlurMaskFilter.h
index 9126b6b..b90ea5e 100644
--- a/skia/include/SkBlurMaskFilter.h
+++ b/skia/include/SkBlurMaskFilter.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkBlurMaskFilter.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkBlurMaskFilter_DEFINED
#define SkBlurMaskFilter_DEFINED
diff --git a/skia/include/SkBorderView.h b/skia/include/SkBorderView.h
index 400b1a7..94ccc1f 100644
--- a/skia/include/SkBorderView.h
+++ b/skia/include/SkBorderView.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkBorderView.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkBorderView_DEFINED
#define SkBorderView_DEFINED
diff --git a/skia/include/SkBounder.h b/skia/include/SkBounder.h
index 4ab44cb..f20961d 100644
--- a/skia/include/SkBounder.h
+++ b/skia/include/SkBounder.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkBounder.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkBounder_DEFINED
#define SkBounder_DEFINED
diff --git a/skia/include/SkCamera.h b/skia/include/SkCamera.h
index 3536b06..8bbcabf 100644
--- a/skia/include/SkCamera.h
+++ b/skia/include/SkCamera.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkCamera.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
diff --git a/skia/include/SkCanvas.h b/skia/include/SkCanvas.h
index d306073..a19a5ae 100644
--- a/skia/include/SkCanvas.h
+++ b/skia/include/SkCanvas.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2008 Google Inc.
+ * Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@
#include "SkPorterDuff.h"
#include "SkPath.h"
#include "SkRegion.h"
+#include "SkScalarCompare.h"
class SkBounder;
class SkDevice;
@@ -63,7 +64,16 @@ public:
///////////////////////////////////////////////////////////////////////////
- virtual bool getViewport(SkIPoint*) const;
+ /** If this subclass of SkCanvas supports GL viewports, return true and set
+ size (if not null) to the size of the viewport. If it is not supported,
+ ignore vp and return false.
+ */
+ virtual bool getViewport(SkIPoint* size) const;
+
+ /** If this subclass of SkCanvas supports GL viewports, return true and set
+ the viewport to the specified x and y dimensions. If it is not
+ supported, ignore x and y and return false.
+ */
virtual bool setViewport(int x, int y);
/** Return the canvas' device object, which may be null. The device holds
@@ -301,7 +311,7 @@ public:
in a way similar to quickReject, in that it tells you that drawing
outside of these bounds will be clipped out.
*/
- bool getClipBounds(SkRect* bounds) const;
+ bool getClipBounds(SkRect* bounds, EdgeType et = kAA_EdgeType) const;
/** Fill the entire canvas' bitmap (restricted to the current clip) with the
specified ARGB color, using the specified PorterDuff mode.
@@ -434,7 +444,9 @@ public:
const SkPaint& paint);
/** Draw the specified arc, which will be scaled to fit inside the
- specified oval.
+ specified oval. If the sweep angle is >= 360, then the oval is drawn
+ completely. Note that this differs slightly from SkPath::arcTo, which
+ treats the sweep angle mod 360.
@param oval The bounds of oval used to define the shape of the arc
@param startAngle Starting angle (in degrees) where the arc begins
@param sweepAngle Sweep angle (in degrees) measured clockwise
@@ -693,6 +705,7 @@ public:
SkDevice* device() const;
const SkMatrix& matrix() const;
const SkRegion& clip() const;
+ const SkPaint& paint() const;
int x() const;
int y() const;
@@ -700,9 +713,11 @@ public:
// used to embed the SkDrawIter object directly in our instance, w/o
// having to expose that class def to the public. There is an assert
// in our constructor to ensure that fStorage is large enough
- // (though needs to be a compile-time-assert!)
- uint32_t fStorage[11];
+ // (though needs to be a compile-time-assert!). We use intptr_t to work
+ // safely with 32 and 64 bit machines (to ensure the storage is enough)
+ intptr_t fStorage[12];
class SkDrawIter* fImpl; // this points at fStorage
+ SkPaint fDefaultPaint;
bool fDone;
};
@@ -736,6 +751,21 @@ private:
// shared by save() and saveLayer()
int internalSave(SaveFlags flags);
void internalRestore();
+
+ /* These maintain a cache of the clip bounds in local coordinates,
+ (converted to 2s-compliment if floats are slow).
+ */
+ mutable SkRectCompareType fLocalBoundsCompareType;
+ mutable bool fLocalBoundsCompareTypeDirty;
+
+ const SkRectCompareType& getLocalClipBoundsCompareType() const {
+ if (fLocalBoundsCompareTypeDirty) {
+ this->computeLocalClipBoundsCompareType();
+ fLocalBoundsCompareTypeDirty = false;
+ }
+ return fLocalBoundsCompareType;
+ }
+ void computeLocalClipBoundsCompareType() const;
};
/** Stack helper class to automatically call restoreToCount() on the canvas
diff --git a/skia/include/SkColor.h b/skia/include/SkColor.h
index f1cf1b1..c97a8ec 100644
--- a/skia/include/SkColor.h
+++ b/skia/include/SkColor.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkColor.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkColor_DEFINED
#define SkColor_DEFINED
diff --git a/skia/include/SkColorFilter.h b/skia/include/SkColorFilter.h
index bc89974..a1b3171 100644
--- a/skia/include/SkColorFilter.h
+++ b/skia/include/SkColorFilter.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkColorFilter.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkColorFilter_DEFINED
#define SkColorFilter_DEFINED
diff --git a/skia/include/SkColorMatrix.h b/skia/include/SkColorMatrix.h
index dd4b29f..cee5d6e 100644
--- a/skia/include/SkColorMatrix.h
+++ b/skia/include/SkColorMatrix.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 Google Inc.
+ * Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/skia/include/SkColorMatrixFilter.h b/skia/include/SkColorMatrixFilter.h
index 4798d37..f9194df 100644
--- a/skia/include/SkColorMatrixFilter.h
+++ b/skia/include/SkColorMatrixFilter.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 Google Inc.
+ * Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/skia/include/SkColorPriv.h b/skia/include/SkColorPriv.h
index 477af0d..09ddb63 100644
--- a/skia/include/SkColorPriv.h
+++ b/skia/include/SkColorPriv.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2008 Google Inc.
+ * Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@
In debugging, asserts that alpha is 0..255
*/
-static inline unsigned SkAlpha255To256(U8CPU alpha) {
+inline unsigned SkAlpha255To256(U8CPU alpha) {
SkASSERT(SkToU8(alpha) == alpha);
return alpha + (alpha >> 7);
}
@@ -69,7 +69,7 @@ inline int SkAlphaBlend(int src, int dst, int scale256) {
#define SkG16Assert(g) SkASSERT((unsigned)(g) <= SK_G16_MASK)
#define SkB16Assert(b) SkASSERT((unsigned)(b) <= SK_B16_MASK)
-static inline uint16_t SkPackRGB16(unsigned r, unsigned g, unsigned b) {
+inline uint16_t SkPackRGB16(unsigned r, unsigned g, unsigned b) {
SkASSERT(r <= SK_R16_MASK);
SkASSERT(g <= SK_G16_MASK);
SkASSERT(b <= SK_B16_MASK);
@@ -84,7 +84,7 @@ static inline uint16_t SkPackRGB16(unsigned r, unsigned g, unsigned b) {
/** Expand the 16bit color into a 32bit value that can be scaled all at once
by a value up to 32. Used in conjunction with SkCompact_rgb_16.
*/
-static inline uint32_t SkExpand_rgb_16(U16CPU c) {
+inline uint32_t SkExpand_rgb_16(U16CPU c) {
SkASSERT(c == (uint16_t)c);
return ((c & SK_G16_MASK_IN_PLACE) << 16) | (c & ~SK_G16_MASK_IN_PLACE);
@@ -96,7 +96,7 @@ static inline uint32_t SkExpand_rgb_16(U16CPU c) {
"clean" the top 16bits. However, the top 16 can contain garbage, so it is
up to the caller to safely ignore them.
*/
-static inline U16CPU SkCompact_rgb_16(uint32_t c) {
+inline U16CPU SkCompact_rgb_16(uint32_t c) {
return ((c >> 16) & SK_G16_MASK_IN_PLACE) | (c & ~SK_G16_MASK_IN_PLACE);
}
@@ -105,7 +105,7 @@ static inline U16CPU SkCompact_rgb_16(uint32_t c) {
to return 32bits, so that the compiler won't generate extra instructions to
"clean" the top 16bits.
*/
-static inline U16CPU SkAlphaMulRGB16(U16CPU c, unsigned scale) {
+inline U16CPU SkAlphaMulRGB16(U16CPU c, unsigned scale) {
return SkCompact_rgb_16(SkExpand_rgb_16(c) * (scale >> 3) >> 5);
}
@@ -117,7 +117,7 @@ static inline U16CPU SkAlphaMulRGB16(U16CPU c, unsigned scale) {
to return 32bits, so that the compiler won't generate extra instructions to
"clean" the top 16bits.
*/
-static inline U16CPU SkBlendRGB16(U16CPU src, U16CPU dst, int srcScale) {
+inline U16CPU SkBlendRGB16(U16CPU src, U16CPU dst, int srcScale) {
SkASSERT((unsigned)srcScale <= 256);
srcScale >>= 3;
@@ -127,7 +127,7 @@ static inline U16CPU SkBlendRGB16(U16CPU src, U16CPU dst, int srcScale) {
return SkCompact_rgb_16(dst32 + ((src32 - dst32) * srcScale >> 5));
}
-static inline void SkBlendRGB16(const uint16_t src[], uint16_t dst[],
+inline void SkBlendRGB16(const uint16_t src[], uint16_t dst[],
int srcScale, int count) {
SkASSERT(count > 0);
SkASSERT((unsigned)srcScale <= 256);
@@ -142,7 +142,7 @@ static inline void SkBlendRGB16(const uint16_t src[], uint16_t dst[],
}
#ifdef SK_DEBUG
- static U16CPU SkRGB16Add(U16CPU a, U16CPU b) {
+ U16CPU SkRGB16Add(U16CPU a, U16CPU b) {
SkASSERT(SkGetPackedR16(a) + SkGetPackedR16(b) <= SK_R16_MASK);
SkASSERT(SkGetPackedG16(a) + SkGetPackedG16(b) <= SK_G16_MASK);
SkASSERT(SkGetPackedB16(a) + SkGetPackedB16(b) <= SK_B16_MASK);
@@ -319,7 +319,7 @@ inline uint16_t SkDitherPixel32ToPixel16(SkPMColor c)
to saturate properly (and not overflow). If we take the 8 bits as is, it is
possible to overflow.
*/
-static inline uint32_t SkPMColorToExpanded16x5(SkPMColor c)
+inline uint32_t SkPMColorToExpanded16x5(SkPMColor c)
{
unsigned sr = SkPacked32ToR16(c);
unsigned sg = SkPacked32ToG16(c);
@@ -334,7 +334,7 @@ static inline uint32_t SkPMColorToExpanded16x5(SkPMColor c)
/* SrcOver the 32bit src color with the 16bit dst, returning a 16bit value
(with dirt in the high 16bits, so caller beware).
*/
-static inline U16CPU SkSrcOver32To16(SkPMColor src, uint16_t dst) {
+inline U16CPU SkSrcOver32To16(SkPMColor src, uint16_t dst) {
unsigned sr = SkGetPackedR32(src);
unsigned sg = SkGetPackedG32(src);
unsigned sb = SkGetPackedB32(src);
@@ -402,7 +402,7 @@ typedef uint16_t SkPMColor16;
#define SkG32To4444(g) ((unsigned)(g) >> 4)
#define SkB32To4444(b) ((unsigned)(b) >> 4)
-static inline U8CPU SkReplicateNibble(unsigned nib)
+inline U8CPU SkReplicateNibble(unsigned nib)
{
SkASSERT(nib <= 0xF);
return (nib << 4) | nib;
@@ -424,7 +424,7 @@ static inline U8CPU SkReplicateNibble(unsigned nib)
#define SkPacked4444ToB32(c) SkReplicateNibble(SkGetPackedB4444(c))
#ifdef SK_DEBUG
-static inline void SkPMColor16Assert(U16CPU c)
+inline void SkPMColor16Assert(U16CPU c)
{
unsigned a = SkGetPackedA4444(c);
unsigned r = SkGetPackedR4444(c);
@@ -440,14 +440,14 @@ static inline void SkPMColor16Assert(U16CPU c)
#define SkPMColor16Assert(c)
#endif
-static inline unsigned SkAlpha15To16(unsigned a)
+inline unsigned SkAlpha15To16(unsigned a)
{
SkASSERT(a <= 0xF);
return a + (a >> 3);
}
#ifdef SK_DEBUG
- static inline int SkAlphaMul4(int value, int scale)
+ inline int SkAlphaMul4(int value, int scale)
{
SkASSERT((unsigned)scale <= 0x10);
return value * scale >> 4;
@@ -456,25 +456,25 @@ static inline unsigned SkAlpha15To16(unsigned a)
#define SkAlphaMul4(value, scale) ((value) * (scale) >> 4)
#endif
-static inline unsigned SkR4444ToR565(unsigned r)
+inline unsigned SkR4444ToR565(unsigned r)
{
SkASSERT(r <= 0xF);
return (r << (SK_R16_BITS - 4)) | (r >> (8 - SK_R16_BITS));
}
-static inline unsigned SkG4444ToG565(unsigned g)
+inline unsigned SkG4444ToG565(unsigned g)
{
SkASSERT(g <= 0xF);
return (g << (SK_G16_BITS - 4)) | (g >> (8 - SK_G16_BITS));
}
-static inline unsigned SkB4444ToB565(unsigned b)
+inline unsigned SkB4444ToB565(unsigned b)
{
SkASSERT(b <= 0xF);
return (b << (SK_B16_BITS - 4)) | (b >> (8 - SK_B16_BITS));
}
-static inline SkPMColor16 SkPackARGB4444(unsigned a, unsigned r,
+inline SkPMColor16 SkPackARGB4444(unsigned a, unsigned r,
unsigned g, unsigned b)
{
SkASSERT(a <= 0xF);
@@ -523,13 +523,13 @@ inline uint32_t SkExpand_4444(U16CPU c)
would add 2 more instructions, slow us down. It is up to the caller to
perform the cast if needed.
*/
-static inline U16CPU SkCompact_4444(uint32_t c)
+inline U16CPU SkCompact_4444(uint32_t c)
{
const unsigned mask = 0xF0F; //gMask_0F0F;
return (c & mask) | ((c >> 12) & ~mask);
}
-static inline uint16_t SkSrcOver4444To16(SkPMColor16 s, uint16_t d)
+inline uint16_t SkSrcOver4444To16(SkPMColor16 s, uint16_t d)
{
unsigned sa = SkGetPackedA4444(s);
unsigned sr = SkR4444ToR565(SkGetPackedR4444(s));
@@ -555,14 +555,14 @@ static inline uint16_t SkSrcOver4444To16(SkPMColor16 s, uint16_t d)
return SkPackRGB16(sr + dr, sg + dg, sb + db);
}
-static inline uint16_t SkBlend4444To16(SkPMColor16 src, uint16_t dst, int scale16)
+inline uint16_t SkBlend4444To16(SkPMColor16 src, uint16_t dst, int scale16)
{
SkASSERT((unsigned)scale16 <= 16);
return SkSrcOver4444To16(SkAlphaMulQ4(src, scale16), dst);
}
-static inline uint16_t SkBlend4444(SkPMColor16 src, SkPMColor16 dst, int scale16)
+inline uint16_t SkBlend4444(SkPMColor16 src, SkPMColor16 dst, int scale16)
{
SkASSERT((unsigned)scale16 <= 16);
@@ -579,7 +579,7 @@ static inline uint16_t SkBlend4444(SkPMColor16 src, SkPMColor16 dst, int scale16
return SkCompact_4444((src32 + dst32) >> 4);
}
-static inline SkPMColor SkPixel4444ToPixel32(U16CPU c)
+inline SkPMColor SkPixel4444ToPixel32(U16CPU c)
{
uint32_t d = (SkGetPackedA4444(c) << SK_A32_SHIFT) |
(SkGetPackedR4444(c) << SK_R32_SHIFT) |
@@ -588,7 +588,7 @@ static inline SkPMColor SkPixel4444ToPixel32(U16CPU c)
return d | (d << 4);
}
-static inline SkPMColor16 SkPixel32ToPixel4444(SkPMColor c)
+inline SkPMColor16 SkPixel32ToPixel4444(SkPMColor c)
{
return (((c >> (SK_A32_SHIFT + 4)) & 0xF) << SK_A4444_SHIFT) |
(((c >> (SK_R32_SHIFT + 4)) & 0xF) << SK_R4444_SHIFT) |
@@ -597,7 +597,7 @@ static inline SkPMColor16 SkPixel32ToPixel4444(SkPMColor c)
}
// cheap 2x2 dither
-static inline SkPMColor16 SkDitherARGB32To4444(U8CPU a, U8CPU r,
+inline SkPMColor16 SkDitherARGB32To4444(U8CPU a, U8CPU r,
U8CPU g, U8CPU b)
{
a = ((a << 1) - ((a >> 4 << 4) | (a >> 4))) >> 4;
@@ -608,7 +608,7 @@ static inline SkPMColor16 SkDitherARGB32To4444(U8CPU a, U8CPU r,
return SkPackARGB4444(a, r, g, b);
}
-static inline SkPMColor16 SkDitherPixel32To4444(SkPMColor c)
+inline SkPMColor16 SkDitherPixel32To4444(SkPMColor c)
{
return SkDitherARGB32To4444(SkGetPackedA32(c), SkGetPackedR32(c),
SkGetPackedG32(c), SkGetPackedB32(c));
@@ -618,7 +618,7 @@ static inline SkPMColor16 SkDitherPixel32To4444(SkPMColor c)
Transforms a normal ARGB_8888 into the same byte order as
expanded ARGB_4444, but keeps each component 8bits
*/
-static inline uint32_t SkExpand_8888(SkPMColor c)
+inline uint32_t SkExpand_8888(SkPMColor c)
{
return (((c >> SK_R32_SHIFT) & 0xFF) << 24) |
(((c >> SK_G32_SHIFT) & 0xFF) << 8) |
@@ -629,7 +629,7 @@ static inline uint32_t SkExpand_8888(SkPMColor c)
/* Undo the operation of SkExpand_8888, turning the argument back into
a SkPMColor.
*/
-static inline SkPMColor SkCompact_8888(uint32_t c)
+inline SkPMColor SkCompact_8888(uint32_t c)
{
return (((c >> 24) & 0xFF) << SK_R32_SHIFT) |
(((c >> 8) & 0xFF) << SK_G32_SHIFT) |
@@ -641,7 +641,7 @@ static inline SkPMColor SkCompact_8888(uint32_t c)
but this routine just keeps the high 4bits of each component in the low
4bits of the result (just like a newly expanded PMColor16).
*/
-static inline uint32_t SkExpand32_4444(SkPMColor c)
+inline uint32_t SkExpand32_4444(SkPMColor c)
{
return (((c >> (SK_R32_SHIFT + 4)) & 0xF) << 24) |
(((c >> (SK_G32_SHIFT + 4)) & 0xF) << 8) |
diff --git a/skia/include/SkColorShader.h b/skia/include/SkColorShader.h
index 5a50fa9..f9c3dc3 100644
--- a/skia/include/SkColorShader.h
+++ b/skia/include/SkColorShader.h
@@ -1,17 +1,18 @@
-/* Copyright 2007, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkColorShader_DEFINED
#define SkColorShader_DEFINED
diff --git a/skia/include/SkCornerPathEffect.h b/skia/include/SkCornerPathEffect.h
index c62718b..a459478 100644
--- a/skia/include/SkCornerPathEffect.h
+++ b/skia/include/SkCornerPathEffect.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkCornerPathEffect.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkCornerPathEffect_DEFINED
#define SkCornerPathEffect_DEFINED
diff --git a/skia/include/SkCullPoints.h b/skia/include/SkCullPoints.h
index 1a4ef52..cee64e2 100644
--- a/skia/include/SkCullPoints.h
+++ b/skia/include/SkCullPoints.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkCullPoints.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkCullPoints_DEFINED
#define SkCullPoints_DEFINED
diff --git a/skia/include/SkDOM.h b/skia/include/SkDOM.h
index 3cd184d..74e2492 100644
--- a/skia/include/SkDOM.h
+++ b/skia/include/SkDOM.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2008 Google Inc.
+ * Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/skia/include/SkDashPathEffect.h b/skia/include/SkDashPathEffect.h
index cb7161e..cc414e3 100644
--- a/skia/include/SkDashPathEffect.h
+++ b/skia/include/SkDashPathEffect.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkDashPathEffect.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkDashPathEffect_DEFINED
#define SkDashPathEffect_DEFINED
diff --git a/skia/include/SkDeque.h b/skia/include/SkDeque.h
index b66a541..cbed930 100644
--- a/skia/include/SkDeque.h
+++ b/skia/include/SkDeque.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkDeque.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkDeque_DEFINED
#define SkDeque_DEFINED
diff --git a/skia/include/SkDescriptor.h b/skia/include/SkDescriptor.h
index 870390b..8074cff 100644
--- a/skia/include/SkDescriptor.h
+++ b/skia/include/SkDescriptor.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkDescriptor.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkDescriptor_DEFINED
#define SkDescriptor_DEFINED
diff --git a/skia/include/SkDevice.h b/skia/include/SkDevice.h
index cc3fe5e..4d678c6 100644
--- a/skia/include/SkDevice.h
+++ b/skia/include/SkDevice.h
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef SkDevice_DEFINED
#define SkDevice_DEFINED
diff --git a/skia/include/SkDiscretePathEffect.h b/skia/include/SkDiscretePathEffect.h
index c5fc9d4..2950950 100644
--- a/skia/include/SkDiscretePathEffect.h
+++ b/skia/include/SkDiscretePathEffect.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkDiscretePathEffect.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkDiscretePathEffect_DEFINED
#define SkDiscretePathEffect_DEFINED
diff --git a/skia/include/SkDither.h b/skia/include/SkDither.h
index d486437..5b2552d 100644
--- a/skia/include/SkDither.h
+++ b/skia/include/SkDither.h
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef SkDither_DEFINED
#define SkDither_DEFINED
diff --git a/skia/include/SkDraw.h b/skia/include/SkDraw.h
index 39fe9206..2d775a4 100644
--- a/skia/include/SkDraw.h
+++ b/skia/include/SkDraw.h
@@ -1,19 +1,18 @@
-/* libs/graphics/sgl/SkDraw.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkDraw_DEFINED
#define SkDraw_DEFINED
@@ -55,9 +54,9 @@ public:
int scalarsPerPosition, const SkPaint& paint) const;
void drawTextOnPath(const char text[], size_t byteLength,
const SkPath&, const SkMatrix*, const SkPaint&) const;
- void drawVertices(SkCanvas::VertexMode vmode, int count,
+ void drawVertices(SkCanvas::VertexMode mode, int count,
const SkPoint vertices[], const SkPoint textures[],
- const SkColor colors[], SkXfermode* mode,
+ const SkColor colors[], SkXfermode* xmode,
const uint16_t indices[], int ptCount,
const SkPaint& paint) const;
diff --git a/skia/include/SkDrawExtraPathEffect.h b/skia/include/SkDrawExtraPathEffect.h
index 50a43c6..65e255a 100644
--- a/skia/include/SkDrawExtraPathEffect.h
+++ b/skia/include/SkDrawExtraPathEffect.h
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef SK_DRAW_EXTRA_PATH_EFFECT_H
#define SK_DRAW_EXTRA_PATH_EFFECT_H
class SkAnimator;
diff --git a/skia/include/SkDrawFilter.h b/skia/include/SkDrawFilter.h
index ddf0f74..db5a685 100644
--- a/skia/include/SkDrawFilter.h
+++ b/skia/include/SkDrawFilter.h
@@ -1,9 +1,25 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef SkDrawFilter_DEFINED
#define SkDrawFilter_DEFINED
#include "SkRefCnt.h"
-////////////////// EXPERIMENTAL <reed> //////////////////////////
+////////////////// EXPERIMENTAL //////////////////////////
class SkCanvas;
class SkPaint;
diff --git a/skia/include/SkDrawLooper.h b/skia/include/SkDrawLooper.h
index 80c11c3..333fb41 100644
--- a/skia/include/SkDrawLooper.h
+++ b/skia/include/SkDrawLooper.h
@@ -1,9 +1,25 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef SkDrawLooper_DEFINED
#define SkDrawLooper_DEFINED
#include "SkFlattenable.h"
-////////////////// EXPERIMENTAL <reed> //////////////////////////
+////////////////// EXPERIMENTAL //////////////////////////
class SkCanvas;
class SkPaint;
@@ -30,12 +46,19 @@ public:
virtual bool next() { return false; }
/** Called after the looper has finally returned false from next(), allowing
the looper to restore the canvas/paint to their original states.
- <reed> is this required, since the subclass knows when it is done???
- <reed> should we pass the canvas/paint here, and/or to the next call
+ is this required, since the subclass knows when it is done???
+ should we pass the canvas/paint here, and/or to the next call
so that subclasses don't need to retain pointers to them during the
loop?
*/
virtual void restore() {}
+
+protected:
+ SkDrawLooper() {}
+ SkDrawLooper(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {}
+
+private:
+ typedef SkFlattenable INHERITED;
};
#endif
diff --git a/skia/include/SkEmbossMaskFilter.h b/skia/include/SkEmbossMaskFilter.h
index dfb8cc6..042a2a6 100644
--- a/skia/include/SkEmbossMaskFilter.h
+++ b/skia/include/SkEmbossMaskFilter.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkEmbossMaskFilter.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkEmbossMaskFilter_DEFINED
#define SkEmbossMaskFilter_DEFINED
diff --git a/skia/include/SkEvent.h b/skia/include/SkEvent.h
index 1830be3..2b43f34 100644
--- a/skia/include/SkEvent.h
+++ b/skia/include/SkEvent.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkEvent.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkEvent_DEFINED
#define SkEvent_DEFINED
diff --git a/skia/include/SkEventSink.h b/skia/include/SkEventSink.h
index 071b651..27a6743 100644
--- a/skia/include/SkEventSink.h
+++ b/skia/include/SkEventSink.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkEventSink.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkEventSink_DEFINED
#define SkEventSink_DEFINED
diff --git a/skia/include/SkFlattenable.h b/skia/include/SkFlattenable.h
index 8b2db8a..d23e20f 100644
--- a/skia/include/SkFlattenable.h
+++ b/skia/include/SkFlattenable.h
@@ -1,18 +1,17 @@
-/* include/graphics/SkFlattenable.h
- **
- ** Copyright 2006, Google Inc.
- **
- ** Licensed under the Apache License, Version 2.0 (the "License");
- ** you may not use this file except in compliance with the License.
- ** You may obtain a copy of the License at
- **
- ** http://www.apache.org/licenses/LICENSE-2.0
- **
- ** Unless required by applicable law or agreed to in writing, software
- ** distributed under the License is distributed on an "AS IS" BASIS,
- ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ** See the License for the specific language governing permissions and
- ** limitations under the License.
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
#ifndef SkFlattenable_DEFINED
diff --git a/skia/include/SkFlipPixelRef.h b/skia/include/SkFlipPixelRef.h
new file mode 100644
index 0000000..3b4e97a
--- /dev/null
+++ b/skia/include/SkFlipPixelRef.h
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SkFlipPixelRef_DEFINED
+#define SkFlipPixelRef_DEFINED
+
+#include "SkBitmap.h"
+#include "SkPageFlipper.h"
+#include "SkPixelRef.h"
+#include "SkThread.h"
+
+class SkRegion;
+
+class SkFlipPixelRef : public SkPixelRef {
+public:
+ SkFlipPixelRef(SkBitmap::Config, int width, int height);
+ virtual ~SkFlipPixelRef();
+
+ bool isDirty() const { return fFlipper.isDirty(); }
+ const SkRegion& dirtyRgn() const { return fFlipper.dirtyRgn(); }
+
+ void inval() { fFlipper.inval(); }
+ void inval(const SkIRect& rect) { fFlipper.inval(rect); }
+ void inval(const SkRegion& rgn) { fFlipper.inval(rgn); }
+ void inval(const SkRect& r, bool doAA) { fFlipper.inval(r, doAA); }
+
+ const SkRegion& beginUpdate(SkBitmap* device);
+ void endUpdate();
+
+private:
+ void getFrontBack(const void** front, void** back) const {
+ if (front) {
+ *front = fPage0;
+ }
+ if (back) {
+ *back = fPage1;
+ }
+ }
+
+ void swapPages();
+
+ // Helper to copy pixels from srcAddr to the dst bitmap, clipped to clip.
+ // srcAddr points to memory with the same config as dst.
+ static void CopyBitsFromAddr(const SkBitmap& dst, const SkRegion& clip,
+ const void* srcAddr);
+
+ // serialization
+
+public:
+ virtual Factory getFactory() const { return Create; }
+ virtual void flatten(SkFlattenableWriteBuffer&) const;
+ static SkPixelRef* Create(SkFlattenableReadBuffer& buffer);
+
+protected:
+ virtual void* onLockPixels(SkColorTable**);
+ virtual void onUnlockPixels();
+
+ SkFlipPixelRef(SkFlattenableReadBuffer&);
+
+private:
+ SkMutex fMutex;
+ SkPageFlipper fFlipper;
+
+ void* fStorage;
+ void* fPage0; // points into fStorage;
+ void* fPage1; // points into fStorage;
+ size_t fSize; // size of 1 page. fStorage holds 2 pages
+ SkBitmap::Config fConfig;
+
+ typedef SkPixelRef INHERITED;
+};
+
+class SkAutoFlipUpdate : SkNoncopyable {
+public:
+ SkAutoFlipUpdate(SkFlipPixelRef* ref) : fRef(ref) {
+ fDirty = &ref->beginUpdate(&fBitmap);
+ }
+ ~SkAutoFlipUpdate() {
+ if (fRef) {
+ fRef->endUpdate();
+ }
+ }
+
+ const SkBitmap& bitmap() const { return fBitmap; }
+ const SkRegion& dirty() const { return *fDirty; }
+
+ // optional. This gets automatically called in the destructor (only once)
+ void endUpdate() {
+ if (fRef) {
+ fRef->endUpdate();
+ fRef = NULL;
+ }
+ }
+
+private:
+ SkFlipPixelRef* fRef;
+ SkBitmap fBitmap;
+ const SkRegion* fDirty;
+};
+
+#endif
diff --git a/skia/include/SkFontCodec.h b/skia/include/SkFontCodec.h
index 0a4ca05..09725dc 100644
--- a/skia/include/SkFontCodec.h
+++ b/skia/include/SkFontCodec.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkFontCodec.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkFontCodec_DEFINED
#define SkFontCodec_DEFINED
diff --git a/skia/include/SkFontHost.h b/skia/include/SkFontHost.h
index 7440295..73010e7 100644
--- a/skia/include/SkFontHost.h
+++ b/skia/include/SkFontHost.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkFontHost.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkFontHost_DEFINED
#define SkFontHost_DEFINED
diff --git a/skia/include/SkGLCanvas.h b/skia/include/SkGLCanvas.h
index bb731b4..40fc52d 100644
--- a/skia/include/SkGLCanvas.h
+++ b/skia/include/SkGLCanvas.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2008 Google Inc.
+ * Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,10 +46,24 @@ public:
// settings for the global texture cache
static size_t GetTextureCacheMaxCount();
- static size_t GetTextureCacheMaxSize();
static void SetTextureCacheMaxCount(size_t count);
+
+ static size_t GetTextureCacheMaxSize();
static void SetTextureCacheMaxSize(size_t size);
-
+
+ /** Call glDeleteTextures for all textures (including those for text)
+ This should be called while the gl-context is still valid. Its purpose
+ is to free up gl resources. Note that if a bitmap or text is drawn after
+ this call, new caches will be created.
+ */
+ static void DeleteAllTextures();
+
+ /** Forget all textures without calling delete (including those for text).
+ This should be called if the gl-context has changed, and the texture
+ IDs that have been cached are no longer valid.
+ */
+ static void AbandonAllTextures();
+
private:
SkIPoint fViewportSize;
diff --git a/skia/include/SkGlobals.h b/skia/include/SkGlobals.h
index 586f689..8e28290 100644
--- a/skia/include/SkGlobals.h
+++ b/skia/include/SkGlobals.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkGlobals.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkGlobals_DEFINED
#define SkGlobals_DEFINED
diff --git a/skia/include/SkGradientShader.h b/skia/include/SkGradientShader.h
index ee1c976..9a8696c 100644
--- a/skia/include/SkGradientShader.h
+++ b/skia/include/SkGradientShader.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkGradientShader.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkGradientShader_DEFINED
#define SkGradientShader_DEFINED
diff --git a/skia/include/SkGraphics.h b/skia/include/SkGraphics.h
index 841e1a3..cb06128 100644
--- a/skia/include/SkGraphics.h
+++ b/skia/include/SkGraphics.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkGraphics.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkGraphics_DEFINED
#define SkGraphics_DEFINED
diff --git a/skia/include/SkImageDecoder.h b/skia/include/SkImageDecoder.h
index 8a93ef9..e6389e4 100644
--- a/skia/include/SkImageDecoder.h
+++ b/skia/include/SkImageDecoder.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkImageDecoder.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkImageDecoder_DEFINED
#define SkImageDecoder_DEFINED
@@ -101,8 +100,28 @@ public:
// approximate the sample size.
int getSampleSize() const { return fSampleSize; }
void setSampleSize(int size);
+
+ /** Reset the sampleSize to its default of 1
+ */
void resetSampleSize() { this->setSampleSize(1); }
+ /** Decoding is synchronous, but for long decodes, a different thread can
+ call this method safely. This sets a state that the decoders will
+ periodically check, and if they see it changed to cancel, they will
+ cancel. This will result in decode() returning false. However, there is
+ no guarantee that the decoder will see the state change in time, so
+ it is possible that cancelDecode() will be called, but will be ignored
+ and decode() will return true (assuming no other problems were
+ encountered).
+
+ This state is automatically reset at the beginning of decode().
+ */
+ void cancelDecode() {
+ // now the subclass must query shouldCancelDecode() to be informed
+ // of the request
+ fShouldCancelDecode = true;
+ }
+
/** Passed to the decode method. If kDecodeBounds_Mode is passed, then
only the bitmap's width/height/config need be set. If kDecodePixels_Mode
is passed, then the bitmap must have pixels or a pixelRef.
@@ -120,10 +139,9 @@ public:
bitmap. It can then set the pixels with the decompressed image.
If the image cannot be decompressed, return false.
- note: document use of Allocator, Peeker and Chooser <reed>
+ note: document use of Allocator, Peeker and Chooser
*/
- virtual bool onDecode(SkStream*, SkBitmap* bitmap, SkBitmap::Config pref,
- Mode) = 0;
+ bool decode(SkStream*, SkBitmap* bitmap, SkBitmap::Config pref, Mode);
/** Given a stream, this will try to find an appropriate decoder object.
If none is found, the method returns NULL.
@@ -206,6 +224,23 @@ public:
/** @endcond */
protected:
+ // must be overridden in subclasses. This guy is called by decode(...)
+ virtual bool onDecode(SkStream*, SkBitmap* bitmap, SkBitmap::Config pref,
+ Mode) = 0;
+
+ /** Can be queried from within onDecode, to see if the user (possibly in
+ a different thread) has requested the decode to cancel. If this returns
+ true, your onDecode() should stop and return false.
+ Each subclass needs to decide how often it can query this, to balance
+ responsiveness with performance.
+
+ Calling this outside of onDecode() may return undefined values.
+ */
+
+public:
+ bool shouldCancelDecode() const { return fShouldCancelDecode; }
+
+protected:
SkImageDecoder();
// helper function for decoders to handle the (common) case where there is only
@@ -224,6 +259,7 @@ private:
SkBitmap::Allocator* fAllocator;
int fSampleSize;
bool fDitherImage;
+ mutable bool fShouldCancelDecode;
// illegal
SkImageDecoder(const SkImageDecoder&);
@@ -258,4 +294,3 @@ protected:
///////////////////////////////////////////////////////////////////////
#endif
-
diff --git a/skia/include/SkImageRef.h b/skia/include/SkImageRef.h
index 6ffb340..1e1ed59 100644
--- a/skia/include/SkImageRef.h
+++ b/skia/include/SkImageRef.h
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef SkImageRef_DEFINED
#define SkImageRef_DEFINED
@@ -34,6 +50,9 @@ public:
/** Return true if the image can be decoded. If so, and bitmap is non-null,
call its setConfig() with the corresponding values, but explicitly will
not set its pixels or colortable. Use SkPixelRef::lockPixels() for that.
+
+ If there has been an error decoding the bitmap, this will return false
+ and ignore the bitmap parameter.
*/
bool getInfo(SkBitmap* bm);
diff --git a/skia/include/SkImageRef_GlobalPool.h b/skia/include/SkImageRef_GlobalPool.h
index 5469697..a9d4dce 100644
--- a/skia/include/SkImageRef_GlobalPool.h
+++ b/skia/include/SkImageRef_GlobalPool.h
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef SkImageRef_GlobalPool_DEFINED
#define SkImageRef_GlobalPool_DEFINED
diff --git a/skia/include/SkImageView.h b/skia/include/SkImageView.h
index 974a611..157abb1 100644
--- a/skia/include/SkImageView.h
+++ b/skia/include/SkImageView.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkImageView.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkImageView_DEFINED
#define SkImageView_DEFINED
diff --git a/skia/include/SkJS.h b/skia/include/SkJS.h
index f584d6f..fe76352 100644
--- a/skia/include/SkJS.h
+++ b/skia/include/SkJS.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkJS.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#include "SkTypes.h"
#include "SkWindow.h"
diff --git a/skia/include/SkKernel33MaskFilter.h b/skia/include/SkKernel33MaskFilter.h
index 3fbc9cd..84136e2 100644
--- a/skia/include/SkKernel33MaskFilter.h
+++ b/skia/include/SkKernel33MaskFilter.h
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef SkKernel33MaskFilter_DEFINED
#define SkKernel33MaskFilter_DEFINED
diff --git a/skia/include/SkKey.h b/skia/include/SkKey.h
index 2d0a8aa..3fd5114 100644
--- a/skia/include/SkKey.h
+++ b/skia/include/SkKey.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkKey.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkKey_DEFINED
#define SkKey_DEFINED
diff --git a/skia/include/SkLayerDrawLooper.h b/skia/include/SkLayerDrawLooper.h
new file mode 100644
index 0000000..670ac23
--- /dev/null
+++ b/skia/include/SkLayerDrawLooper.h
@@ -0,0 +1,70 @@
+#ifndef SkLayerDrawLooper_DEFINED
+#define SkLayerDrawLooper_DEFINED
+
+#include "SkDrawLooper.h"
+
+struct SkPoint;
+
+class SkLayerDrawLooper : public SkDrawLooper {
+public:
+ SkLayerDrawLooper();
+ virtual ~SkLayerDrawLooper();
+
+ /** Call for each layer you want to add (from top to bottom).
+ This returns a paint you can modify, but that ptr is only valid until
+ the next call made to this object.
+ */
+ SkPaint* addLayer(SkScalar dx, SkScalar dy);
+
+ /** Helper for addLayer() which passes (0, 0) for the offset parameters
+ */
+ SkPaint* addLayer() {
+ return this->addLayer(0, 0);
+ }
+
+ // overrides from SkDrawLooper
+ virtual void init(SkCanvas*, SkPaint*);
+ virtual bool next();
+ virtual void restore();
+
+ // must be public for Registrar :(
+ static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
+ return SkNEW_ARGS(SkLayerDrawLooper, (buffer));
+ }
+
+protected:
+ SkLayerDrawLooper(SkFlattenableReadBuffer&);
+
+ // overrides from SkFlattenable
+ virtual void flatten(SkFlattenableWriteBuffer& );
+ virtual Factory getFactory() { return CreateProc; }
+
+private:
+ struct Rec {
+ Rec* fNext;
+ SkPaint fPaint;
+ SkPoint fOffset;
+
+ static Rec* Reverse(Rec*);
+ };
+ Rec* fRecs;
+ int fCount;
+
+ struct Iter {
+ SkPaint fSavedPaint;
+ SkPaint* fPaint;
+ SkCanvas* fCanvas;
+ Rec* fRec;
+ };
+ Iter fIter;
+
+ class MyRegistrar : public SkFlattenable::Registrar {
+ public:
+ MyRegistrar();
+ };
+
+ typedef SkDrawLooper INHERITED;
+};
+
+
+#endif
diff --git a/skia/include/SkLayerRasterizer.h b/skia/include/SkLayerRasterizer.h
index 6a59e94..820f6fc 100644
--- a/skia/include/SkLayerRasterizer.h
+++ b/skia/include/SkLayerRasterizer.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkLayerRasterizer.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkLayerRasterizer_DEFINED
#define SkLayerRasterizer_DEFINED
diff --git a/skia/include/SkMMapStream.h b/skia/include/SkMMapStream.h
index 196231b..600c621 100644
--- a/skia/include/SkMMapStream.h
+++ b/skia/include/SkMMapStream.h
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef SkMMapStream_DEFINED
#define SkMMapStream_DEFINED
diff --git a/skia/include/SkMallocPixelRef.h b/skia/include/SkMallocPixelRef.h
new file mode 100644
index 0000000..b6a013d
--- /dev/null
+++ b/skia/include/SkMallocPixelRef.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SkMallocPixelRef_DEFINED
+#define SkMallocPixelRef_DEFINED
+
+#include "SkPixelRef.h"
+
+/** We explicitly use the same allocator for our pixels that SkMask does,
+ so that we can freely assign memory allocated by one class to the other.
+*/
+class SkMallocPixelRef : public SkPixelRef {
+public:
+ /** Allocate the specified buffer for pixels. The memory is freed when the
+ last owner of this pixelref is gone.
+ */
+ SkMallocPixelRef(void* addr, size_t size, SkColorTable* ctable);
+ virtual ~SkMallocPixelRef();
+
+ //! Return the allocation size for the pixels
+ size_t getSize() const { return fSize; }
+
+ // overrides from SkPixelRef
+ virtual void flatten(SkFlattenableWriteBuffer&) const;
+ virtual Factory getFactory() const {
+ return Create;
+ }
+ static SkPixelRef* Create(SkFlattenableReadBuffer& buffer) {
+ return SkNEW_ARGS(SkMallocPixelRef, (buffer));
+ }
+
+protected:
+ // overrides from SkPixelRef
+ virtual void* onLockPixels(SkColorTable**);
+ virtual void onUnlockPixels();
+
+ SkMallocPixelRef(SkFlattenableReadBuffer& buffer);
+
+private:
+ void* fStorage;
+ size_t fSize;
+ SkColorTable* fCTable;
+
+ typedef SkPixelRef INHERITED;
+};
+
+#endif
diff --git a/skia/include/SkMask.h b/skia/include/SkMask.h
index d5c14ea..764ead6 100644
--- a/skia/include/SkMask.h
+++ b/skia/include/SkMask.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkMask.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkMask_DEFINED
#define SkMask_DEFINED
diff --git a/skia/include/SkMaskFilter.h b/skia/include/SkMaskFilter.h
index 243972f..749a73a 100644
--- a/skia/include/SkMaskFilter.h
+++ b/skia/include/SkMaskFilter.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkMaskFilter.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkMaskFilter_DEFINED
#define SkMaskFilter_DEFINED
diff --git a/skia/include/SkMetaData.h b/skia/include/SkMetaData.h
index e87278b..21739fe 100644
--- a/skia/include/SkMetaData.h
+++ b/skia/include/SkMetaData.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2008 Google Inc.
+ * Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/skia/include/SkMovie.h b/skia/include/SkMovie.h
index d1ac280..45962a5 100644
--- a/skia/include/SkMovie.h
+++ b/skia/include/SkMovie.h
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef SkMovie_DEFINED
#define SkMovie_DEFINED
diff --git a/skia/include/SkNinePatch.h b/skia/include/SkNinePatch.h
index a10d8be..a655621 100644
--- a/skia/include/SkNinePatch.h
+++ b/skia/include/SkNinePatch.h
@@ -1,19 +1,18 @@
/*
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkNinePatch_DEFINED
#define SkNinePatch_DEFINED
diff --git a/skia/include/SkOSFile.h b/skia/include/SkOSFile.h
index a62d65a..de8090c 100644
--- a/skia/include/SkOSFile.h
+++ b/skia/include/SkOSFile.h
@@ -1,21 +1,19 @@
-/* include/graphics/SkOSFile.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
-// Copyright Skia Inc. 2004 - 2005
//
#ifndef SkOSFile_DEFINED
#define SkOSFile_DEFINED
diff --git a/skia/include/SkOSMenu.h b/skia/include/SkOSMenu.h
index 3b429b4..433a601 100644
--- a/skia/include/SkOSMenu.h
+++ b/skia/include/SkOSMenu.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkOSMenu.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkOSMenu_DEFINED
#define SkOSMenu_DEFINED
diff --git a/skia/include/SkOSSound.h b/skia/include/SkOSSound.h
index 034e1bd..5d77955 100644
--- a/skia/include/SkOSSound.h
+++ b/skia/include/SkOSSound.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkOSSound.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkOSSound_DEFINED
#define SkOSSound_DEFINED
diff --git a/skia/include/SkOSWindow_Mac.h b/skia/include/SkOSWindow_Mac.h
index 8c4628f..1f6a1fa 100644
--- a/skia/include/SkOSWindow_Mac.h
+++ b/skia/include/SkOSWindow_Mac.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkOSWindow_Mac.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkOSWindow_Mac_DEFINED
#define SkOSWindow_Mac_DEFINED
diff --git a/skia/include/SkOSWindow_Unix.h b/skia/include/SkOSWindow_Unix.h
index b616ca9..26f51be 100644
--- a/skia/include/SkOSWindow_Unix.h
+++ b/skia/include/SkOSWindow_Unix.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkOSWindow_Unix.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkOSWindow_Unix_DEFINED
#define SkOSWindow_Unix_DEFINED
diff --git a/skia/include/SkOSWindow_Win.h b/skia/include/SkOSWindow_Win.h
index 79b99e7..6d821db 100644
--- a/skia/include/SkOSWindow_Win.h
+++ b/skia/include/SkOSWindow_Win.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkOSWindow_Win.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkOSWindow_Win_DEFINED
#define SkOSWindow_Win_DEFINED
diff --git a/skia/include/SkOSWindow_wxwidgets.h b/skia/include/SkOSWindow_wxwidgets.h
index 7d7bb80e..c5dfc7c 100644
--- a/skia/include/SkOSWindow_wxwidgets.h
+++ b/skia/include/SkOSWindow_wxwidgets.h
@@ -1,25 +1,23 @@
-/* include/graphics/SkOSWindow_wxwidgets.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
/*
* SkOSWindow_wxwidgets.h
* wxwidgets
*
- * Created by phanna on 12/14/05.
* Copyright 2005 __MyCompanyName__. All rights reserved.
*
*/
@@ -52,4 +50,3 @@ private:
};
#endifpedef SkWindow INHERITED;
-
diff --git a/skia/include/SkPackBits.h b/skia/include/SkPackBits.h
index 4bbfb55..c11231b 100644
--- a/skia/include/SkPackBits.h
+++ b/skia/include/SkPackBits.h
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef SkPackBits_DEFINED
#define SkPackBits_DEFINED
diff --git a/skia/include/SkPaint.h b/skia/include/SkPaint.h
index cc6f760..bb386c6 100644
--- a/skia/include/SkPaint.h
+++ b/skia/include/SkPaint.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkPaint.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkPaint_DEFINED
#define SkPaint_DEFINED
@@ -368,6 +367,35 @@ public:
*/
bool getFillPath(const SkPath& src, SkPath* dst) const;
+ /** Returns true if the current paint settings allow for fast computation of
+ bounds (i.e. there is nothing complex like a patheffect that would make
+ the bounds computation expensive.
+ */
+ bool canComputeFastBounds() const;
+
+ /** Only call this if canComputeFastBounds() returned true. This takes a
+ raw rectangle (the raw bounds of a shape), and adjusts it for stylistic
+ effects in the paint (e.g. stroking). If needed, it uses the storage
+ rect parameter. It returns the adjusted bounds that can then be used
+ for quickReject tests.
+
+ The returned rect will either be orig or storage, thus the caller
+ should not rely on storage being set to the result, but should always
+ use the retured value. It is legal for orig and storage to be the same
+ rect.
+
+ e.g.
+ if (paint.canComputeFastBounds()) {
+ SkRect r, storage;
+ path.computeBounds(&r, SkPath::kFast_BoundsType);
+ const SkRect& fastR = paint.computeFastBounds(r, &storage);
+ if (canvas->quickReject(fastR, ...)) {
+ // don't draw the path
+ }
+ }
+ */
+ const SkRect& computeFastBounds(const SkRect& orig, SkRect* storage) const;
+
/** Get the paint's shader object.
<p />
The shader's reference count is not affected.
diff --git a/skia/include/SkPaintFlagsDrawFilter.h b/skia/include/SkPaintFlagsDrawFilter.h
index 7f489f9..941be245 100644
--- a/skia/include/SkPaintFlagsDrawFilter.h
+++ b/skia/include/SkPaintFlagsDrawFilter.h
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef SkPaintFlagsDrawFilter_DEFINED
#define SkPaintFlagsDrawFilter_DEFINED
diff --git a/skia/include/SkParse.h b/skia/include/SkParse.h
index b066f6a..57d040c 100644
--- a/skia/include/SkParse.h
+++ b/skia/include/SkParse.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkParse.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkParse_DEFINED
#define SkParse_DEFINED
diff --git a/skia/include/SkParsePaint.h b/skia/include/SkParsePaint.h
index 32b84f9..d23cd92 100644
--- a/skia/include/SkParsePaint.h
+++ b/skia/include/SkParsePaint.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkParsePaint.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkParsePaint_DEFINED
#define SkParsePaint_DEFINED
diff --git a/skia/include/SkPath.h b/skia/include/SkPath.h
index f5859a9..e2409ad 100644
--- a/skia/include/SkPath.h
+++ b/skia/include/SkPath.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2008 Google Inc.
+ * Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@
class SkFlattenableReadBuffer;
class SkFlattenableWriteBuffer;
+class SkAutoPathBoundsUpdate;
class SkString;
/** \class SkPath
@@ -296,11 +297,12 @@ public:
the path is different from the path's current last point, then an
automatic lineTo() is added to connect the current contour to the start
of the arc. However, if the path is empty, then we call moveTo() with
- the first point of the arc.
+ the first point of the arc. The sweep angle is treated mod 360.
@param oval The bounding oval defining the shape and size of the arc
@param startAngle Starting angle (in degrees) where the arc begins
- @param sweepAngle Sweep angle (in degrees) measured clockwise
+ @param sweepAngle Sweep angle (in degrees) measured clockwise. This is
+ treated mod 360.
@param forceMoveTo If true, always begin a new contour with the arc
*/
void arcTo(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle,
@@ -579,6 +581,7 @@ private:
void reversePathTo(const SkPath&);
friend const SkPoint* sk_get_path_points(const SkPath&, int index);
+ friend class SkAutoPathBoundsUpdate;
};
#endif
diff --git a/skia/include/SkPathEffect.h b/skia/include/SkPathEffect.h
index 03ea6a4..f97adb7 100644
--- a/skia/include/SkPathEffect.h
+++ b/skia/include/SkPathEffect.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkPathEffect.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkPathEffect_DEFINED
#define SkPathEffect_DEFINED
diff --git a/skia/include/SkPathMeasure.h b/skia/include/SkPathMeasure.h
index f1ce8ab..5ab97ca 100644
--- a/skia/include/SkPathMeasure.h
+++ b/skia/include/SkPathMeasure.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkPathMeasure.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkPathMeasure_DEFINED
#define SkPathMeasure_DEFINED
diff --git a/skia/include/SkPicture.h b/skia/include/SkPicture.h
index 15836de..fa614c9 100644
--- a/skia/include/SkPicture.h
+++ b/skia/include/SkPicture.h
@@ -1,19 +1,18 @@
/*
-**
-** Copyright 2007, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkPicture_DEFINED
#define SkPicture_DEFINED
@@ -87,6 +86,12 @@ public:
void serialize(SkWStream*) const;
+ /** Signals that the caller is prematurely done replaying the drawing
+ commands. This can be called from a canvas virtual while the picture
+ is drawing. Has no effect if the picture is not drawing.
+ */
+ void abortPlayback();
+
private:
int fWidth, fHeight;
SkPictureRecord* fRecord;
diff --git a/skia/include/SkPixelRef.h b/skia/include/SkPixelRef.h
index 4bab04e..0ddfedc 100644
--- a/skia/include/SkPixelRef.h
+++ b/skia/include/SkPixelRef.h
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef SkPixelRef_DEFINED
#define SkPixelRef_DEFINED
diff --git a/skia/include/SkPixelXorXfermode.h b/skia/include/SkPixelXorXfermode.h
index d755d11..369e0e5 100644
--- a/skia/include/SkPixelXorXfermode.h
+++ b/skia/include/SkPixelXorXfermode.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 Google Inc.
+ * Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/skia/include/SkPorterDuff.h b/skia/include/SkPorterDuff.h
index 8ea2363..f03e9cb 100644
--- a/skia/include/SkPorterDuff.h
+++ b/skia/include/SkPorterDuff.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkPorterDuff.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkPorterDuff_DEFINED
#define SkPorterDuff_DEFINED
@@ -45,8 +44,8 @@ public:
kSrcATop_Mode, //!< [Da, Sc * Da + (1 - Sa) * Dc]
kDstATop_Mode, //!< [Sa, Sa * Dc + Sc * (1 - Da)]
kXor_Mode, //!< [Sa + Da - 2 * Sa * Da, Sc * (1 - Da) + (1 - Sa) * Dc]
- kDarken_Mode, //!< [Sa + Da - Sa*Da, Sc\u00B7(1 - Da) + Dc\u00B7(1 - Sa) + min(Sc, Dc)]
- kLighten_Mode, //!< [Sa + Da - Sa*Da, Sc\u00B7(1 - Da) + Dc\u00B7(1 - Sa) + max(Sc, Dc)]
+ kDarken_Mode, //!< [Sa + Da - Sa*Da, Sc*(1 - Da) + Dc*(1 - Sa) + min(Sc, Dc)]
+ kLighten_Mode, //!< [Sa + Da - Sa*Da, Sc*(1 - Da) + Dc*(1 - Sa) + max(Sc, Dc)]
kMultiply_Mode, //!< [Sa * Da, Sc * Dc]
kScreen_Mode, //!< [Sa + Da - Sa * Da, Sc + Dc - Sc * Dc]
diff --git a/skia/include/SkProgressBarView.h b/skia/include/SkProgressBarView.h
index 5783f83..6341fcb 100644
--- a/skia/include/SkProgressBarView.h
+++ b/skia/include/SkProgressBarView.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkProgressBarView.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkProgressBarView_DEFINED
#define SkProgressBarView_DEFINED
diff --git a/skia/include/SkPtrRecorder.h b/skia/include/SkPtrRecorder.h
index 969b816..ff1e14d 100644
--- a/skia/include/SkPtrRecorder.h
+++ b/skia/include/SkPtrRecorder.h
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef SkPtrRecorder_DEFINED
#define SkPtrRecorder_DEFINED
@@ -8,7 +24,7 @@ class SkPtrRecorder : public SkRefCnt {
public:
uint32_t recordPtr(void*);
- size_t count() const { return fList.count(); }
+ int count() const { return fList.count(); }
void getPtrs(void* array[]) const;
void reset();
diff --git a/skia/include/SkRasterizer.h b/skia/include/SkRasterizer.h
index b717c14..d81e613 100644
--- a/skia/include/SkRasterizer.h
+++ b/skia/include/SkRasterizer.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkRasterizer.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkRasterizer_DEFINED
#define SkRasterizer_DEFINED
diff --git a/skia/include/SkReader32.h b/skia/include/SkReader32.h
index 174c1ec..1c72a87 100644
--- a/skia/include/SkReader32.h
+++ b/skia/include/SkReader32.h
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef SkReader32_DEFINED
#define SkReader32_DEFINED
@@ -22,8 +38,8 @@ public:
fStop = (const char*)data + size;
}
- uint32_t size() const { return static_cast<uint32_t>(fStop - fBase); }
- uint32_t offset() const { return static_cast<uint32_t>(fCurr - fBase); }
+ uint32_t size() const { return fStop - fBase; }
+ uint32_t offset() const { return fCurr - fBase; }
bool eof() const { return fCurr >= fStop; }
const void* base() const { return fBase; }
const void* peek() const { return fCurr; }
diff --git a/skia/include/SkRefCnt.h b/skia/include/SkRefCnt.h
index 8a5abbf..adb59dd 100644
--- a/skia/include/SkRefCnt.h
+++ b/skia/include/SkRefCnt.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkRefCnt.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkRefCnt_DEFINED
#define SkRefCnt_DEFINED
diff --git a/skia/include/SkSVGAttribute.h b/skia/include/SkSVGAttribute.h
index 4b14d04..810d11c 100644
--- a/skia/include/SkSVGAttribute.h
+++ b/skia/include/SkSVGAttribute.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkSVGAttribute.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkSVGAttribute_DEFINED
#define SkSVGAttribute_DEFINED
diff --git a/skia/include/SkSVGBase.h b/skia/include/SkSVGBase.h
index fff98cc..4d24aed 100644
--- a/skia/include/SkSVGBase.h
+++ b/skia/include/SkSVGBase.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkSVGBase.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkSVGBase_DEFINED
#define SkSVGBase_DEFINED
diff --git a/skia/include/SkSVGPaintState.h b/skia/include/SkSVGPaintState.h
index 2f30e42..f3f74e1 100644
--- a/skia/include/SkSVGPaintState.h
+++ b/skia/include/SkSVGPaintState.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkSVGPaintState.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkSVGPaintState_DEFINED
#define SkSVGPaintState_DEFINED
diff --git a/skia/include/SkSVGParser.h b/skia/include/SkSVGParser.h
index 60cbcbd..86ae4c2 100644
--- a/skia/include/SkSVGParser.h
+++ b/skia/include/SkSVGParser.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkSVGParser.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkSVGParser_DEFINED
#define SkSVGParser_DEFINED
diff --git a/skia/include/SkSVGTypes.h b/skia/include/SkSVGTypes.h
index 24404ad..38d63ce 100644
--- a/skia/include/SkSVGTypes.h
+++ b/skia/include/SkSVGTypes.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkSVGTypes.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkSVGTypes_DEFINED
#define SkSVGTypes_DEFINED
diff --git a/skia/include/SkScalerContext.h b/skia/include/SkScalerContext.h
index 0b8981f..ec2cd0d 100644
--- a/skia/include/SkScalerContext.h
+++ b/skia/include/SkScalerContext.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkScalerContext.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkScalerContext_DEFINED
#define SkScalerContext_DEFINED
@@ -90,7 +89,10 @@ struct SkGlyph {
kSubBits = 2,
kSubMask = ((1 << kSubBits) - 1),
kSubShift = 24, // must be large enough for glyphs and unichars
- kCodeMask = ((1 << kSubShift) - 1)
+ kCodeMask = ((1 << kSubShift) - 1),
+ // relative offsets for X and Y subpixel bits
+ kSubShiftX = kSubBits,
+ kSubShiftY = 0
};
static unsigned ID2Code(uint32_t id) {
@@ -98,11 +100,11 @@ struct SkGlyph {
}
static unsigned ID2SubX(uint32_t id) {
- return id >> (kSubShift + kSubBits);
+ return id >> (kSubShift + kSubShiftX);
}
static unsigned ID2SubY(uint32_t id) {
- return (id >> kSubShift) & kSubMask;
+ return (id >> (kSubShift + kSubShiftY)) & kSubMask;
}
static unsigned FixedToSub(SkFixed n) {
@@ -122,7 +124,9 @@ struct SkGlyph {
SkASSERT(code <= kCodeMask);
x = FixedToSub(x);
y = FixedToSub(y);
- return (x << (kSubShift + kSubBits)) | (y << kSubShift) | code;
+ return (x << (kSubShift + kSubShiftX)) |
+ (y << (kSubShift + kSubShiftY)) |
+ code;
}
void toMask(SkMask* mask) const;
diff --git a/skia/include/SkScrollBarView.h b/skia/include/SkScrollBarView.h
index 514ad74..b8a5209 100644
--- a/skia/include/SkScrollBarView.h
+++ b/skia/include/SkScrollBarView.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkScrollBarView.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkScrollBarView_DEFINED
#define SkScrollBarView_DEFINED
diff --git a/skia/include/SkShader.h b/skia/include/SkShader.h
index 69ae15a..7c13e3d 100644
--- a/skia/include/SkShader.h
+++ b/skia/include/SkShader.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkShader.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkShader_DEFINED
#define SkShader_DEFINED
diff --git a/skia/include/SkShaderExtras.h b/skia/include/SkShaderExtras.h
index 8c43f5c..765f411 100644
--- a/skia/include/SkShaderExtras.h
+++ b/skia/include/SkShaderExtras.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkShaderExtras.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkShaderExtras_DEFINED
#define SkShaderExtras_DEFINED
diff --git a/skia/include/SkStackViewLayout.h b/skia/include/SkStackViewLayout.h
index f0bb092..8000319 100644
--- a/skia/include/SkStackViewLayout.h
+++ b/skia/include/SkStackViewLayout.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkStackViewLayout.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkStackViewLayout_DEFINED
#define SkStackViewLayout_DEFINED
diff --git a/skia/include/SkStream.h b/skia/include/SkStream.h
index 4612abb..26ef43f 100644
--- a/skia/include/SkStream.h
+++ b/skia/include/SkStream.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkStream.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkStream_DEFINED
#define SkStream_DEFINED
@@ -69,6 +68,8 @@ public:
bool readBool() { return this->readU8() != 0; }
SkScalar readScalar();
size_t readPackedUInt();
+
+ static void UnitTest();
};
class SkWStream : SkNoncopyable {
@@ -101,7 +102,7 @@ public:
bool writeStream(SkStream* input, size_t length);
- SkDEBUGCODE(static void UnitTest();)
+ static void UnitTest();
};
////////////////////////////////////////////////////////////////////////////////////////
@@ -110,9 +111,15 @@ public:
struct SkFILE;
+/** A stream that reads from a FILE*, which is opened in the constructor and
+ closed in the destructor
+ */
class SkFILEStream : public SkStream {
public:
- SkFILEStream(const char path[] = NULL);
+ /** Initialize the stream by calling fopen on the specified path. Will be
+ closed in the destructor.
+ */
+ explicit SkFILEStream(const char path[] = NULL);
virtual ~SkFILEStream();
/** Returns true if the current path could be opened.
@@ -122,8 +129,6 @@ public:
path. If path is NULL, just close the current file.
*/
void setPath(const char path[]);
-
- SkFILE* getSkFILE() const { return fFILE; }
virtual bool rewind();
virtual size_t read(void* buffer, size_t size);
@@ -134,6 +139,30 @@ private:
SkString fName;
};
+/** A stream that reads from a file descriptor
+ */
+class SkFDStream : public SkStream {
+public:
+ /** Initialize the stream with a dup() of the specified file descriptor.
+ If closeWhenDone is true, then the descriptor will be closed in the
+ destructor.
+ */
+ SkFDStream(int fileDesc, bool closeWhenDone);
+ virtual ~SkFDStream();
+
+ /** Returns true if the current path could be opened.
+ */
+ bool isValid() const { return fFD >= 0; }
+
+ virtual bool rewind();
+ virtual size_t read(void* buffer, size_t size);
+ virtual const char* getFileName() { return NULL; }
+
+private:
+ int fFD;
+ bool fCloseWhenDone;
+};
+
class SkMemoryStream : public SkStream {
public:
SkMemoryStream();
@@ -175,14 +204,18 @@ public:
/** Provide the stream to be buffered (proxy), and the size of the buffer that
should be used. This will be allocated and freed automatically. If bufferSize is 0,
a default buffer size will be used.
+ The proxy stream is referenced, and will be unreferenced in when the
+ bufferstream is destroyed.
*/
- SkBufferStream(SkStream& proxy, size_t bufferSize = 0);
+ SkBufferStream(SkStream* proxy, size_t bufferSize = 0);
/** Provide the stream to be buffered (proxy), and a buffer and size to be used.
This buffer is owned by the caller, and must be at least bufferSize bytes big.
Passing NULL for buffer will cause the buffer to be allocated/freed automatically.
If buffer is not NULL, it is an error for bufferSize to be 0.
+ The proxy stream is referenced, and will be unreferenced in when the
+ bufferstream is destroyed.
*/
- SkBufferStream(SkStream& proxy, void* buffer, size_t bufferSize);
+ SkBufferStream(SkStream* proxy, void* buffer, size_t bufferSize);
virtual ~SkBufferStream();
virtual bool rewind();
@@ -198,7 +231,7 @@ private:
SkBufferStream(const SkBufferStream&);
SkBufferStream& operator=(const SkBufferStream&);
- SkStream& fProxy;
+ SkStream* fProxy;
char* fBuffer;
size_t fOrigBufferSize, fBufferSize, fBufferOffset;
bool fWeOwnTheBuffer;
diff --git a/skia/include/SkStream_Win.h b/skia/include/SkStream_Win.h
index 02ab5b1..1b17450 100644
--- a/skia/include/SkStream_Win.h
+++ b/skia/include/SkStream_Win.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkStream_Win.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkStream_Win_DEFINED
#define SkStream_Win_DEFINED
diff --git a/skia/include/SkString.h b/skia/include/SkString.h
index 3c02b22..46b1d9e 100644
--- a/skia/include/SkString.h
+++ b/skia/include/SkString.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkString.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkString_DEFINED
#define SkString_DEFINED
diff --git a/skia/include/SkStroke.h b/skia/include/SkStroke.h
index bc1ca4a..b593b69 100644
--- a/skia/include/SkStroke.h
+++ b/skia/include/SkStroke.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkStroke.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkStroke_DEFINED
#define SkStroke_DEFINED
diff --git a/skia/include/SkSystemEventTypes.h b/skia/include/SkSystemEventTypes.h
index 726d880..8dfe8be 100644
--- a/skia/include/SkSystemEventTypes.h
+++ b/skia/include/SkSystemEventTypes.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkSystemEventTypes.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkSystemEventTypes_DEFINED
#define SkSystemEventTypes_DEFINED
diff --git a/skia/include/SkTDArray.h b/skia/include/SkTDArray.h
index 620ecc5..4d2d7f7 100644
--- a/skia/include/SkTDArray.h
+++ b/skia/include/SkTDArray.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkTDArray.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkTDArray_DEFINED
#define SkTDArray_DEFINED
@@ -88,7 +87,7 @@ public:
}
bool isEmpty() const { return fCount == 0; }
- size_t count() const { return fCount; }
+ int count() const { return fCount; }
T* begin() const { return fArray; }
T* end() const { return fArray ? fArray + fCount : NULL; }
T& operator[](int index) const {
diff --git a/skia/include/SkTDStack.h b/skia/include/SkTDStack.h
index e070cb9..5bc10ee 100644
--- a/skia/include/SkTDStack.h
+++ b/skia/include/SkTDStack.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkTDStack.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkTDStack_DEFINED
#define SkTDStack_DEFINED
diff --git a/skia/include/SkTDict.h b/skia/include/SkTDict.h
index cd7d555..0b92779 100644
--- a/skia/include/SkTDict.h
+++ b/skia/include/SkTDict.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkTDict.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkTDict_DEFINED
#define SkTDict_DEFINED
diff --git a/skia/include/SkTextBox.h b/skia/include/SkTextBox.h
index 1d7f46c..2c34448 100644
--- a/skia/include/SkTextBox.h
+++ b/skia/include/SkTextBox.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkTextBox.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkTextBox_DEFINED
#define SkTextBox_DEFINED
diff --git a/skia/include/SkTime.h b/skia/include/SkTime.h
index 6733501..9ee7110 100644
--- a/skia/include/SkTime.h
+++ b/skia/include/SkTime.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkTime.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkTime_DEFINED
#define SkTime_DEFINED
diff --git a/skia/include/SkTransparentShader.h b/skia/include/SkTransparentShader.h
index 82b56da..8bc60ff 100644
--- a/skia/include/SkTransparentShader.h
+++ b/skia/include/SkTransparentShader.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkTransparentShader.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkTransparentShader_DEFINED
#define SkTransparentShader_DEFINED
diff --git a/skia/include/SkTypeface.h b/skia/include/SkTypeface.h
index bcdb021..546edca 100644
--- a/skia/include/SkTypeface.h
+++ b/skia/include/SkTypeface.h
@@ -1,17 +1,18 @@
-/* Copyright 2006-2008, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkTypeface_DEFINED
#define SkTypeface_DEFINED
diff --git a/skia/include/SkUnPreMultiply.h b/skia/include/SkUnPreMultiply.h
index bbbcea1..4bdb980 100644
--- a/skia/include/SkUnPreMultiply.h
+++ b/skia/include/SkUnPreMultiply.h
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
diff --git a/skia/include/SkUnitMapper.h b/skia/include/SkUnitMapper.h
index 9d7c65b..5d1ea35 100644
--- a/skia/include/SkUnitMapper.h
+++ b/skia/include/SkUnitMapper.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkUnitMapper.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkUnitMapper_DEFINED
#define SkUnitMapper_DEFINED
diff --git a/skia/include/SkUnitMappers.h b/skia/include/SkUnitMappers.h
index a1331bb..51708b6 100644
--- a/skia/include/SkUnitMappers.h
+++ b/skia/include/SkUnitMappers.h
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef SkUnitMappers_DEFINED
#define SkUnitMappers_DEFINED
diff --git a/skia/include/SkUtils.h b/skia/include/SkUtils.h
index 5ec3caa..f3e3341 100644
--- a/skia/include/SkUtils.h
+++ b/skia/include/SkUtils.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkUtils.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkUtils_DEFINED
#define SkUtils_DEFINED
diff --git a/skia/include/SkView.h b/skia/include/SkView.h
index feb186d..d5d89df 100644
--- a/skia/include/SkView.h
+++ b/skia/include/SkView.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkView.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkView_DEFINED
#define SkView_DEFINED
diff --git a/skia/include/SkViewInflate.h b/skia/include/SkViewInflate.h
index 354aed4..3ec65a6 100644
--- a/skia/include/SkViewInflate.h
+++ b/skia/include/SkViewInflate.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkViewInflate.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkViewInflate_DEFINED
#define SkViewInflate_DEFINED
diff --git a/skia/include/SkWidget.h b/skia/include/SkWidget.h
index 9087330..db85f01 100644
--- a/skia/include/SkWidget.h
+++ b/skia/include/SkWidget.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkWidget.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkWidget_DEFINED
#define SkWidget_DEFINED
diff --git a/skia/include/SkWidgetViews.h b/skia/include/SkWidgetViews.h
index 0b74156..4dd8866 100644
--- a/skia/include/SkWidgetViews.h
+++ b/skia/include/SkWidgetViews.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkWidgetViews.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkWidgetViews_DEFINED
#define SkWidgetViews_DEFINED
diff --git a/skia/include/SkWindow.h b/skia/include/SkWindow.h
index e70e04b..96262ee 100644
--- a/skia/include/SkWindow.h
+++ b/skia/include/SkWindow.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkWindow.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkWindow_DEFINED
#define SkWindow_DEFINED
diff --git a/skia/include/SkWriter32.h b/skia/include/SkWriter32.h
index 66910d1..aeeb37d 100644
--- a/skia/include/SkWriter32.h
+++ b/skia/include/SkWriter32.h
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef SkWriter32_DEFINED
#define SkWriter32_DEFINED
diff --git a/skia/include/SkXMLParser.h b/skia/include/SkXMLParser.h
index 98f106c..ddad273 100644
--- a/skia/include/SkXMLParser.h
+++ b/skia/include/SkXMLParser.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkXMLParser.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkXMLParser_DEFINED
#define SkXMLParser_DEFINED
diff --git a/skia/include/SkXMLWriter.h b/skia/include/SkXMLWriter.h
index f60aef4..742e7f1 100644
--- a/skia/include/SkXMLWriter.h
+++ b/skia/include/SkXMLWriter.h
@@ -1,19 +1,18 @@
-/* include/graphics/SkXMLWriter.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkXMLWriter_DEFINED
#define SkXMLWriter_DEFINED
diff --git a/skia/include/SkXfermode.h b/skia/include/SkXfermode.h
index 8de5e65d..f7e6510 100644
--- a/skia/include/SkXfermode.h
+++ b/skia/include/SkXfermode.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Google Inc.
+ * Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/skia/include/corecg/Sk64.h b/skia/include/corecg/Sk64.h
index 4d5343c..c4ae41e 100644
--- a/skia/include/corecg/Sk64.h
+++ b/skia/include/corecg/Sk64.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2008 Google Inc.
+ * Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/skia/include/corecg/SkBuffer.h b/skia/include/corecg/SkBuffer.h
index b1cfefc..bc11a1e 100644
--- a/skia/include/corecg/SkBuffer.h
+++ b/skia/include/corecg/SkBuffer.h
@@ -1,19 +1,18 @@
-/* include/corecg/SkBuffer.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkBuffer_DEFINED
#define SkBuffer_DEFINED
diff --git a/skia/include/corecg/SkChunkAlloc.h b/skia/include/corecg/SkChunkAlloc.h
index aa4ebde..0e9ad18 100644
--- a/skia/include/corecg/SkChunkAlloc.h
+++ b/skia/include/corecg/SkChunkAlloc.h
@@ -1,19 +1,18 @@
-/* include/corecg/SkChunkAlloc.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkChunkAlloc_DEFINED
#define SkChunkAlloc_DEFINED
diff --git a/skia/include/corecg/SkEndian.h b/skia/include/corecg/SkEndian.h
index 0897914..f08a9a9 100644
--- a/skia/include/corecg/SkEndian.h
+++ b/skia/include/corecg/SkEndian.h
@@ -1,19 +1,18 @@
-/* include/corecg/SkEndian.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkEndian_DEFINED
#define SkEndian_DEFINED
diff --git a/skia/include/corecg/SkFDot6.h b/skia/include/corecg/SkFDot6.h
index 57d4516..a4b9cf7 100644
--- a/skia/include/corecg/SkFDot6.h
+++ b/skia/include/corecg/SkFDot6.h
@@ -1,19 +1,18 @@
-/* include/corecg/SkFDot6.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkFDot6_DEFINED
#define SkFDot6_DEFINED
diff --git a/skia/include/corecg/SkFixed.h b/skia/include/corecg/SkFixed.h
index e77d455..be4bf99 100644
--- a/skia/include/corecg/SkFixed.h
+++ b/skia/include/corecg/SkFixed.h
@@ -1,19 +1,18 @@
-/* include/corecg/SkFixed.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkFixed_DEFINED
#define SkFixed_DEFINED
diff --git a/skia/include/corecg/SkFloatBits.h b/skia/include/corecg/SkFloatBits.h
new file mode 100644
index 0000000..1628f6e
--- /dev/null
+++ b/skia/include/corecg/SkFloatBits.h
@@ -0,0 +1,150 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SkFloatBits_DEFINED
+#define SkFloatBits_DEFINED
+
+#include "SkTypes.h"
+
+/** Convert a sign-bit int (i.e. float interpreted as int) into a 2s compliement
+ int. This also converts -0 (0x80000000) to 0. Doing this to a float allows
+ it to be compared using normal C operators (<, <=, etc.)
+*/
+static inline int32_t SkSignBitTo2sCompliment(int32_t x) {
+ if (x < 0) {
+ x &= 0x7FFFFFFF;
+ x = -x;
+ }
+ return x;
+}
+
+/** Convert a 2s compliment int to a sign-bit (i.e. int interpreted as float).
+ This undoes the result of SkSignBitTo2sCompliment().
+ */
+static inline int32_t Sk2sComplimentToSignBit(int32_t x) {
+ int sign = x >> 31;
+ // make x positive
+ x = (x ^ sign) - sign;
+ // set the sign bit as needed
+ x |= sign << 31;
+ return x;
+}
+
+/** Given the bit representation of a float, return its value cast to an int.
+ If the value is out of range, or NaN, return return +/- SK_MaxS32
+*/
+int32_t SkFloatBits_toIntCast(int32_t floatBits);
+
+/** Given the bit representation of a float, return its floor as an int.
+ If the value is out of range, or NaN, return return +/- SK_MaxS32
+ */
+int32_t SkFloatBits_toIntFloor(int32_t floatBits);
+
+/** Given the bit representation of a float, return it rounded to an int.
+ If the value is out of range, or NaN, return return +/- SK_MaxS32
+ */
+int32_t SkFloatBits_toIntRound(int32_t floatBits);
+
+/** Given the bit representation of a float, return its ceiling as an int.
+ If the value is out of range, or NaN, return return +/- SK_MaxS32
+ */
+int32_t SkFloatBits_toIntCeil(int32_t floatBits);
+
+
+#ifdef SK_CAN_USE_FLOAT
+
+union SkFloatIntUnion {
+ float fFloat;
+ int32_t fSignBitInt;
+};
+
+// Helper to see a float as its bit pattern (w/o aliasing warnings)
+static inline int32_t SkFloat2Bits(float x) {
+ SkFloatIntUnion data;
+ data.fFloat = x;
+ return data.fSignBitInt;
+}
+
+// Helper to see a bit pattern as a float (w/o aliasing warnings)
+static inline float SkBits2Float(int32_t floatAsBits) {
+ SkFloatIntUnion data;
+ data.fSignBitInt = floatAsBits;
+ return data.fFloat;
+}
+
+/** Return the float as a 2s compliment int. Just to be used to compare floats
+ to each other or against positive float-bit-constants (like 0). This does
+ not return the int equivalent of the float, just something cheaper for
+ compares-only.
+ */
+static inline int32_t SkFloatAs2sCompliment(float x) {
+ return SkSignBitTo2sCompliment(SkFloat2Bits(x));
+}
+
+/** Return the 2s compliment int as a float. This undos the result of
+ SkFloatAs2sCompliment
+ */
+static inline float Sk2sComplimentAsFloat(int32_t x) {
+ return SkBits2Float(Sk2sComplimentToSignBit(x));
+}
+
+/** Return x cast to a float (i.e. (float)x)
+*/
+float SkIntToFloatCast(int x);
+float SkIntToFloatCast_NoOverflowCheck(int x);
+
+/** Return the float cast to an int.
+ If the value is out of range, or NaN, return +/- SK_MaxS32
+*/
+static inline int32_t SkFloatToIntCast(float x) {
+ return SkFloatBits_toIntCast(SkFloat2Bits(x));
+}
+
+/** Return the floor of the float as an int.
+ If the value is out of range, or NaN, return +/- SK_MaxS32
+*/
+static inline int32_t SkFloatToIntFloor(float x) {
+ return SkFloatBits_toIntFloor(SkFloat2Bits(x));
+}
+
+/** Return the float rounded to an int.
+ If the value is out of range, or NaN, return +/- SK_MaxS32
+*/
+static inline int32_t SkFloatToIntRound(float x) {
+ return SkFloatBits_toIntRound(SkFloat2Bits(x));
+}
+
+/** Return the ceiling of the float as an int.
+ If the value is out of range, or NaN, return +/- SK_MaxS32
+*/
+static inline int32_t SkFloatToIntCeil(float x) {
+ return SkFloatBits_toIntCeil(SkFloat2Bits(x));
+}
+
+#endif
+
+// Scalar wrappers for float-bit routines
+
+#ifdef SK_SCALAR_IS_FLOAT
+ #define SkScalarAs2sCompliment(x) SkFloatAs2sCompliment(x)
+ #define Sk2sComplimentAsScalar(x) Sk2sComplimentAsFloat(x)
+#else
+ #define SkScalarAs2sCompliment(x) (x)
+ #define Sk2sComplimentAsScalar(x) (x)
+#endif
+
+#endif
+
diff --git a/skia/include/corecg/SkFloatingPoint.h b/skia/include/corecg/SkFloatingPoint.h
index b7c0435..d3a6fc5 100644
--- a/skia/include/corecg/SkFloatingPoint.h
+++ b/skia/include/corecg/SkFloatingPoint.h
@@ -1,19 +1,18 @@
-/* include/corecg/SkFloatingPoint.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkFloatingPoint_DEFINED
#define SkFloatingPoint_DEFINED
@@ -24,6 +23,7 @@
#include <math.h>
#include <float.h>
+#include "SkFloatBits.h"
#ifdef SK_BUILD_FOR_WINCE
#define sk_float_sqrt(x) (float)::sqrt(x)
@@ -61,5 +61,15 @@
#define sk_float_isNaN(x) _isnan(x)
#endif
+#ifdef SK_USE_FLOATBITS
+ #define sk_float_floor2int(x) SkFloatToIntFloor(x)
+ #define sk_float_round2int(x) SkFloatToIntRound(x)
+ #define sk_float_ceil2int(x) SkFloatToIntCeil(x)
+#else
+ #define sk_float_floor2int(x) (int)sk_float_floor(x)
+ #define sk_float_round2int(x) (int)sk_float_floor((x) + 0.5f)
+ #define sk_float_ceil2int(x) (int)sk_float_ceil(x)
+#endif
+
#endif
#endif
diff --git a/skia/include/corecg/SkInterpolator.h b/skia/include/corecg/SkInterpolator.h
index d98196d..c03eb23 100644
--- a/skia/include/corecg/SkInterpolator.h
+++ b/skia/include/corecg/SkInterpolator.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2008 Google Inc.
+ * Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/skia/include/corecg/SkMath.h b/skia/include/corecg/SkMath.h
index d9fb274..5c2b475 100644
--- a/skia/include/corecg/SkMath.h
+++ b/skia/include/corecg/SkMath.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2008 Google Inc.
+ * Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/skia/include/corecg/SkMatrix.h b/skia/include/corecg/SkMatrix.h
index 60fdd42..04751f2 100644
--- a/skia/include/corecg/SkMatrix.h
+++ b/skia/include/corecg/SkMatrix.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2008 Google Inc.
+ * Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/skia/include/corecg/SkPageFlipper.h b/skia/include/corecg/SkPageFlipper.h
new file mode 100644
index 0000000..0d791ee
--- /dev/null
+++ b/skia/include/corecg/SkPageFlipper.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SkPageFlipper_DEFINED
+#define SkPageFlipper_DEFINED
+
+#include "SkRegion.h"
+
+/** SkPageFlipper manages alternating inval/dirty regions for a rectangular area
+ (like a bitmap). You call inval() to accumulate inval areas, and then when
+ you're ready to "flip" pages (i.e. draw into the one you've been
+ invalidating) you call update, which swaps the inval regions, and returns
+ two things to you: 1) the final inval region to be drawn into, and 2) the
+ region of pixels that should be copied from the "front" page onto the one
+ you're about to draw into. This copyBits region will be disjoint from the
+ inval region, so both need to be handled.
+ */
+class SkPageFlipper {
+public:
+ SkPageFlipper();
+ SkPageFlipper(int width, int height);
+
+ int width() const { return fWidth; }
+ int height() const { return fHeight; }
+
+ void resize(int width, int height);
+
+ bool isDirty() const { return !fDirty1->isEmpty(); }
+ const SkRegion& dirtyRgn() const { return *fDirty1; }
+
+ void inval();
+ void inval(const SkIRect&);
+ void inval(const SkRegion&);
+ void inval(const SkRect&, bool antialias);
+
+ /** When you're ready to write to the back page, call update. The returned
+ region is the invalidate are that needs to be drawn to. The copyBits
+ region (provided by the caller) is the area that should be copied from
+ the front page to the back page (will not intersect with the returned
+ inval region.
+
+ Once this is called, the two internal regions are swapped, so the *new*
+ back inval region is ready to receive new inval calls.
+ */
+ const SkRegion& update(SkRegion* copyBits);
+
+private:
+ SkRegion* fDirty0;
+ SkRegion* fDirty1;
+ SkRegion fDirty0Storage;
+ SkRegion fDirty1Storage;
+ int fWidth;
+ int fHeight;
+};
+
+#endif
+
diff --git a/skia/include/corecg/SkPerspIter.h b/skia/include/corecg/SkPerspIter.h
index 1a5d82f..81ce7c8 100644
--- a/skia/include/corecg/SkPerspIter.h
+++ b/skia/include/corecg/SkPerspIter.h
@@ -1,19 +1,18 @@
-/* include/corecg/SkPerspIter.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkPerspIter_DEFINED
#define SkPerspIter_DEFINED
diff --git a/skia/include/corecg/SkPoint.h b/skia/include/corecg/SkPoint.h
index 4493ce3..f038afb 100644
--- a/skia/include/corecg/SkPoint.h
+++ b/skia/include/corecg/SkPoint.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2008 Google Inc.
+ * Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/skia/include/corecg/SkPostConfig.h b/skia/include/corecg/SkPostConfig.h
index 3ca5f75..b2190ba 100644
--- a/skia/include/corecg/SkPostConfig.h
+++ b/skia/include/corecg/SkPostConfig.h
@@ -1,19 +1,18 @@
-/* include/corecg/SkPostConfig.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkPostConfig_DEFINED
#define SkPostConfig_DEFINED
@@ -64,6 +63,8 @@
#endif
#endif
+///////////////////////////////////////////////////////////////////////////////
+
#ifndef SkNEW
#define SkNEW(type_name) new type_name
#define SkNEW_ARGS(type_name, args) new type_name args
@@ -82,6 +83,13 @@
///////////////////////////////////////////////////////////////////////////////
+#if defined(SK_SOFTWARE_FLOAT) && defined(SK_SCALAR_IS_FLOAT)
+ // if this is defined, we convert floats to 2scompliment ints for compares
+ #ifndef SK_SCALAR_SLOW_COMPARES
+ #define SK_SCALAR_SLOW_COMPARES
+ #endif
+#endif
+
#ifdef SK_BUILD_FOR_WIN
//////////////////////////////////////////////////////////////////////
// Begin Chrome-specific changes
diff --git a/skia/include/corecg/SkPreConfig.h b/skia/include/corecg/SkPreConfig.h
index c651dd4..04f1987 100644
--- a/skia/include/corecg/SkPreConfig.h
+++ b/skia/include/corecg/SkPreConfig.h
@@ -1,19 +1,18 @@
-/* include/corecg/SkPreConfig.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkPreConfig_DEFINED
#define SkPreConfig_DEFINED
diff --git a/skia/include/corecg/SkRandom.h b/skia/include/corecg/SkRandom.h
index 8994fc4..33b563a 100644
--- a/skia/include/corecg/SkRandom.h
+++ b/skia/include/corecg/SkRandom.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2008 Google Inc.
+ * Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/skia/include/corecg/SkRect.h b/skia/include/corecg/SkRect.h
index 65a562e..a9f25aa 100644
--- a/skia/include/corecg/SkRect.h
+++ b/skia/include/corecg/SkRect.h
@@ -1,19 +1,18 @@
-/* include/corecg/SkRect.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkRect_DEFINED
#define SkRect_DEFINED
@@ -280,6 +279,16 @@ struct SkRect {
fRight = right;
fBottom = bottom;
}
+
+ /** Initialize the rect with the 4 specified integers. The routine handles
+ converting them to scalars (by calling SkIntToScalar)
+ */
+ void iset(int left, int top, int right, int bottom) {
+ fLeft = SkIntToScalar(left);
+ fTop = SkIntToScalar(top);
+ fRight = SkIntToScalar(right);
+ fBottom = SkIntToScalar(bottom);
+ }
/** Set this rectangle to be the bounds of the array of points.
If the array is empty (count == 0), then set this rectangle
diff --git a/skia/include/corecg/SkRegion.h b/skia/include/corecg/SkRegion.h
index 238524a..d3bfb4a 100644
--- a/skia/include/corecg/SkRegion.h
+++ b/skia/include/corecg/SkRegion.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005-2007 Google Inc.
+ * Copyright (C) 2005 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -108,6 +108,16 @@ public:
drawn by the path (with no antialiasing) with the specified clip.
*/
bool setPath(const SkPath&, const SkRegion& clip);
+
+ /** Returns true if the specified rectangle has a non-empty intersection
+ with this region.
+ */
+ bool intersects(const SkIRect&) const;
+
+ /** Returns true if the specified region has a non-empty intersection
+ with this region.
+ */
+ bool intersects(const SkRegion&) const;
/** Return true if the specified x,y coordinate is inside the region.
*/
diff --git a/skia/include/corecg/SkScalar.h b/skia/include/corecg/SkScalar.h
index 3e737ae..86341eb 100644
--- a/skia/include/corecg/SkScalar.h
+++ b/skia/include/corecg/SkScalar.h
@@ -1,19 +1,18 @@
-/* include/corecg/SkScalar.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkScalar_DEFINED
#define SkScalar_DEFINED
@@ -82,13 +81,13 @@
#define SkScalarFraction(x) sk_float_mod(x, 1.0f)
/** Rounds the SkScalar to the nearest integer value
*/
- #define SkScalarRound(x) (int)sk_float_floor((x) + 0.5f)
+ #define SkScalarRound(x) sk_float_round2int(x)
/** Returns the smallest integer that is >= the specified SkScalar
*/
- #define SkScalarCeil(x) (int)sk_float_ceil(x)
+ #define SkScalarCeil(x) sk_float_ceil2int(x)
/** Returns the largest integer that is <= the specified SkScalar
*/
- #define SkScalarFloor(x) (int)sk_float_floor(x)
+ #define SkScalarFloor(x) sk_float_floor2int(x)
/** Returns the absolute value of the specified SkScalar
*/
#define SkScalarAbs(x) sk_float_abs(x)
@@ -228,13 +227,7 @@
#define SkMinScalar(a, b) SkMin32(a, b)
#endif
-#ifndef SK_SCALAR_IS_FLOAT
-#define SK_ScalarNearlyZero SK_FixedNearlyZero
-#else
-/* Allow a little more flexibility for floating-point scalars
- */
-#define SK_ScalarNearlyZero (SK_Scalar1 / (1<<15))
-#endif
+#define SK_ScalarNearlyZero (SK_Scalar1 / (1 << 12))
/* <= is slower than < for floats, so we use < for our tolerance test
*/
diff --git a/skia/include/corecg/SkScalarCompare.h b/skia/include/corecg/SkScalarCompare.h
new file mode 100644
index 0000000..fee554c
--- /dev/null
+++ b/skia/include/corecg/SkScalarCompare.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SkScalarCompare_DEFINED
+#define SkScalarCompare_DEFINED
+
+#include "SkFloatBits.h"
+#include "SkRect.h"
+
+#ifdef SK_SCALAR_SLOW_COMPARES
+ typedef int32_t SkScalarCompareType;
+ typedef SkIRect SkRectCompareType;
+ #define SkScalarToCompareType(x) SkScalarAs2sCompliment(x)
+#else
+ typedef SkScalar SkScalarCompareType;
+ typedef SkRect SkRectCompareType;
+ #define SkScalarToCompareType(x) (x)
+#endif
+
+#endif
+
diff --git a/skia/include/corecg/SkTSearch.h b/skia/include/corecg/SkTSearch.h
index ca1e467..f29e6f5 100644
--- a/skia/include/corecg/SkTSearch.h
+++ b/skia/include/corecg/SkTSearch.h
@@ -1,19 +1,18 @@
-/* include/corecg/SkTSearch.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkTSearch_DEFINED
#define SkTSearch_DEFINED
diff --git a/skia/include/corecg/SkTemplates.h b/skia/include/corecg/SkTemplates.h
index cfe42d9..c81be2a 100644
--- a/skia/include/corecg/SkTemplates.h
+++ b/skia/include/corecg/SkTemplates.h
@@ -1,19 +1,18 @@
-/* include/corecg/SkTemplates.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkTemplates_DEFINED
#define SkTemplates_DEFINED
diff --git a/skia/include/corecg/SkThread.h b/skia/include/corecg/SkThread.h
index 8dc2402..637492d 100644
--- a/skia/include/corecg/SkThread.h
+++ b/skia/include/corecg/SkThread.h
@@ -1,19 +1,18 @@
-/* include/corecg/SkThread.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkThread_DEFINED
#define SkThread_DEFINED
diff --git a/skia/include/corecg/SkThread_platform.h b/skia/include/corecg/SkThread_platform.h
index b94bc42..825b737 100644
--- a/skia/include/corecg/SkThread_platform.h
+++ b/skia/include/corecg/SkThread_platform.h
@@ -1,19 +1,18 @@
-/* include/corecg/SkThread_platform.h
-**
-** Copyright 2006, Google Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef SkThread_platform_DEFINED
#define SkThread_platform_DEFINED
diff --git a/skia/include/corecg/SkTypes.h b/skia/include/corecg/SkTypes.h
index b67cf1d..0554c73 100644
--- a/skia/include/corecg/SkTypes.h
+++ b/skia/include/corecg/SkTypes.h
@@ -1,16 +1,16 @@
/*
- * Copyright 2006, Google Inc.
+ * Copyright (C) 2006 The Android Open Source Project
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
* limitations under the License.
*/
diff --git a/skia/picture/SkPathHeap.cpp b/skia/picture/SkPathHeap.cpp
new file mode 100644
index 0000000..f6dae5d
--- /dev/null
+++ b/skia/picture/SkPathHeap.cpp
@@ -0,0 +1,55 @@
+#include "SkPathHeap.h"
+#include "SkPath.h"
+#include "SkStream.h"
+#include "SkFlattenable.h"
+#include <new>
+
+#define kPathCount 64
+
+SkPathHeap::SkPathHeap() : fHeap(kPathCount * sizeof(SkPath)) {
+}
+
+SkPathHeap::SkPathHeap(SkFlattenableReadBuffer& buffer)
+ : fHeap(kPathCount * sizeof(SkPath)) {
+ int count = buffer.readS32();
+
+ fPaths.setCount(count);
+ SkPath** ptr = fPaths.begin();
+ SkPath* p = (SkPath*)fHeap.allocThrow(count * sizeof(SkPath));
+
+ for (int i = 0; i < count; i++) {
+ new (p) SkPath;
+ p->unflatten(buffer);
+ *ptr++ = p; // record the pointer
+ p++; // move to the next storage location
+ }
+}
+
+SkPathHeap::~SkPathHeap() {
+ SkPath** iter = fPaths.begin();
+ SkPath** stop = fPaths.end();
+ while (iter < stop) {
+ (*iter)->~SkPath();
+ iter++;
+ }
+}
+
+int SkPathHeap::append(const SkPath& path) {
+ SkPath* p = (SkPath*)fHeap.allocThrow(sizeof(SkPath));
+ new (p) SkPath(path);
+ *fPaths.append() = p;
+ return fPaths.count();
+}
+
+void SkPathHeap::flatten(SkFlattenableWriteBuffer& buffer) const {
+ int count = fPaths.count();
+
+ buffer.write32(count);
+ SkPath** iter = fPaths.begin();
+ SkPath** stop = fPaths.end();
+ while (iter < stop) {
+ (*iter)->flatten(buffer);
+ iter++;
+ }
+}
+
diff --git a/skia/picture/SkPathHeap.h b/skia/picture/SkPathHeap.h
new file mode 100644
index 0000000..b8f3bd3
--- /dev/null
+++ b/skia/picture/SkPathHeap.h
@@ -0,0 +1,37 @@
+#ifndef SkPathHeap_DEFINED
+#define SkPathHeap_DEFINED
+
+#include "SkRefCnt.h"
+#include "SkChunkAlloc.h"
+#include "SkTDArray.h"
+
+class SkPath;
+class SkFlattenableReadBuffer;
+class SkFlattenableWriteBuffer;
+
+class SkPathHeap : public SkRefCnt {
+public:
+ SkPathHeap();
+ SkPathHeap(SkFlattenableReadBuffer&);
+ virtual ~SkPathHeap();
+
+ // called during picture-record
+ int append(const SkPath&);
+
+ // called during picture-playback
+ int count() const { return fPaths.count(); }
+ const SkPath& operator[](int index) const {
+ return *fPaths[index];
+ }
+
+ void flatten(SkFlattenableWriteBuffer&) const;
+
+private:
+ // we store the paths in the heap (placement new)
+ SkChunkAlloc fHeap;
+ // we just store ptrs into fHeap here
+ SkTDArray<SkPath*> fPaths;
+};
+
+#endif
+
diff --git a/skia/sgl/SkPicture.cpp b/skia/picture/SkPicture.cpp
index 0847004..07cb0a6 100644
--- a/skia/sgl/SkPicture.cpp
+++ b/skia/picture/SkPicture.cpp
@@ -1,6 +1,6 @@
/*
**
-** Copyright 2007, Google Inc.
+** Copyright 2007, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -236,3 +236,11 @@ void SkPicture::serialize(SkWStream* stream) const {
}
}
+void SkPicture::abortPlayback() {
+ if (NULL == fPlayback) {
+ return;
+ }
+ fPlayback->abort();
+}
+
+
diff --git a/skia/picture/SkPictureFlat.cpp b/skia/picture/SkPictureFlat.cpp
index ba7119e..e221e55 100644
--- a/skia/picture/SkPictureFlat.cpp
+++ b/skia/picture/SkPictureFlat.cpp
@@ -206,15 +206,6 @@ void SkFlatPaint::dump() const {
}
#endif
-SkFlatPath* SkFlatPath::Flatten(SkChunkAlloc* heap, const SkPath& path, int index) {
- SkFlattenableWriteBuffer buffer(1024);
- path.flatten(buffer);
- uint32_t size = buffer.size();
- SkFlatPath* result = (SkFlatPath*) INHERITED::Alloc(heap, size, index);
- buffer.flatten(&result->fPathData);
- return result;
-}
-
SkFlatRegion* SkFlatRegion::Flatten(SkChunkAlloc* heap, const SkRegion& region, int index) {
uint32_t size = region.flatten(NULL);
SkFlatRegion* result = (SkFlatRegion*) INHERITED::Alloc(heap, size, index);
diff --git a/skia/picture/SkPictureFlat.h b/skia/picture/SkPictureFlat.h
index 64a7359..9e7fc5e 100644
--- a/skia/picture/SkPictureFlat.h
+++ b/skia/picture/SkPictureFlat.h
@@ -24,11 +24,12 @@ enum DrawType {
DRAW_POINTS,
DRAW_POS_TEXT,
DRAW_POS_TEXT_H,
- DRAW_RECT_GENERAL,
- DRAW_RECT_SIMPLE,
+ DRAW_POS_TEXT_H_TOP_BOTTOM, // fast variant of DRAW_POS_TEXT_H
+ DRAW_RECT,
DRAW_SPRITE,
DRAW_TEXT,
DRAW_TEXT_ON_PATH,
+ DRAW_TEXT_TOP_BOTTOM, // fast variant of DRAW_TEXT
DRAW_VERTICES,
RESTORE,
ROTATE,
@@ -48,7 +49,7 @@ enum DrawVertexFlags {
class SkRefCntPlayback {
public:
SkRefCntPlayback();
- virtual ~SkRefCntPlayback();
+ ~SkRefCntPlayback();
int count() const { return fCount; }
@@ -183,26 +184,6 @@ private:
typedef SkFlatData INHERITED;
};
-class SkFlatPath : public SkFlatData {
-public:
- static SkFlatPath* Flatten(SkChunkAlloc* heap, const SkPath& path, int index);
-
- void unflatten(SkPath* path) const {
- SkFlattenableReadBuffer buffer(fPathData);
- path->unflatten(buffer);
- }
-
-#ifdef SK_DEBUG_VALIDATE
- void validate() const {
- // to be written
- }
-#endif
-
-private:
- char fPathData[1];
- typedef SkFlatData INHERITED;
-};
-
class SkFlatRegion : public SkFlatData {
public:
static SkFlatRegion* Flatten(SkChunkAlloc* heap, const SkRegion& region, int index);
diff --git a/skia/picture/SkPicturePlayback.cpp b/skia/picture/SkPicturePlayback.cpp
index 3bf162e..64f8f1c 100644
--- a/skia/picture/SkPicturePlayback.cpp
+++ b/skia/picture/SkPicturePlayback.cpp
@@ -102,16 +102,8 @@ SkPicturePlayback::SkPicturePlayback(const SkPictureRecord& record) {
}
}
- const SkTDArray<const SkFlatPath* >& paths = record.getPaths();
- fPathCount = paths.count();
- if (fPathCount > 0) {
- fPaths = SkNEW_ARRAY(SkPath, fPathCount);
- for (const SkFlatPath** flatPathPtr = paths.begin();
- flatPathPtr != paths.end(); flatPathPtr++) {
- const SkFlatPath* flatPath = *flatPathPtr;
- flatPath->unflatten(&fPaths[flatPath->index() - 1]);
- }
- }
+ fPathHeap = record.fPathHeap;
+ fPathHeap->safeRef();
const SkTDArray<SkPicture* >& pictures = record.getPictureRefs();
fPictureCount = pictures.count();
@@ -185,11 +177,8 @@ SkPicturePlayback::SkPicturePlayback(const SkPicturePlayback& src) {
fPaints[i] = src.fPaints[i];
}
- fPathCount = src.fPathCount;
- fPaths = SkNEW_ARRAY(SkPath, fPathCount);
- for (i = 0; i < fPathCount; i++) {
- fPaths[i] = src.fPaths[i];
- }
+ fPathHeap = src.fPathHeap;
+ fPathHeap->safeRef();
fPictureCount = src.fPictureCount;
fPictureRefs = SkNEW_ARRAY(SkPicture*, fPictureCount);
@@ -209,10 +198,10 @@ void SkPicturePlayback::init() {
fBitmaps = NULL;
fMatrices = NULL;
fPaints = NULL;
- fPaths = NULL;
+ fPathHeap = NULL;
fPictureRefs = NULL;
fRegions = NULL;
- fBitmapCount = fMatrixCount = fPaintCount = fPathCount = fPictureCount =
+ fBitmapCount = fMatrixCount = fPaintCount = fPictureCount =
fRegionCount = 0;
fFactoryPlayback = NULL;
@@ -224,8 +213,9 @@ SkPicturePlayback::~SkPicturePlayback() {
SkDELETE_ARRAY(fBitmaps);
SkDELETE_ARRAY(fMatrices);
SkDELETE_ARRAY(fPaints);
- SkDELETE_ARRAY(fPaths);
SkDELETE_ARRAY(fRegions);
+
+ fPathHeap->safeUnref();
for (int i = 0; i < fPictureCount; i++) {
fPictureRefs[i]->unref();
@@ -241,7 +231,7 @@ void SkPicturePlayback::dumpSize() const {
fBitmapCount, fBitmapCount * sizeof(SkBitmap),
fMatrixCount, fMatrixCount * sizeof(SkMatrix),
fPaintCount, fPaintCount * sizeof(SkPaint),
- fPathCount,
+ fPathHeap ? fPathHeap->count() : 0,
fRegionCount);
}
@@ -341,9 +331,12 @@ void SkPicturePlayback::serialize(SkWStream* stream) const {
fPaints[i].flatten(buffer);
}
- writeTagSize(buffer, PICT_PATH_TAG, fPathCount);
- for (i = 0; i < fPathCount; i++) {
- fPaths[i].flatten(buffer);
+ {
+ int count = fPathHeap ? fPathHeap->count() : 0;
+ writeTagSize(buffer, PICT_PATH_TAG, count);
+ if (count > 0) {
+ fPathHeap->flatten(buffer);
+ }
}
writeTagSize(buffer, PICT_REGION_TAG, fRegionCount);
@@ -449,10 +442,11 @@ SkPicturePlayback::SkPicturePlayback(SkStream* stream) {
fPaints[i].unflatten(buffer);
}
- fPathCount = readTagSize(buffer, PICT_PATH_TAG);
- fPaths = SkNEW_ARRAY(SkPath, fPathCount);
- for (i = 0; i < fPathCount; i++) {
- fPaths[i].unflatten(buffer);
+ {
+ int count = readTagSize(buffer, PICT_PATH_TAG);
+ if (count > 0) {
+ fPathHeap = SkNEW_ARGS(SkPathHeap, (buffer));
+ }
}
fRegionCount = readTagSize(buffer, PICT_REGION_TAG);
@@ -474,8 +468,6 @@ void SkPicturePlayback::draw(SkCanvas& canvas) {
TextContainer text;
fReader.rewind();
- bool clipBoundsDirty = true;
- SkRect clipBounds;
while (!fReader.eof()) {
switch (fReader.readInt()) {
@@ -483,12 +475,11 @@ void SkPicturePlayback::draw(SkCanvas& canvas) {
const SkPath& path = getPath();
SkRegion::Op op = (SkRegion::Op) getInt();
size_t offsetToRestore = getInt();
- // HACK (false) until I can handle op==kReplace <reed>
+ // HACK (false) until I can handle op==kReplace
if (!canvas.clipPath(path, op) && false) {
//SkDebugf("---- skip clipPath for %d bytes\n", offsetToRestore - fReader.offset());
fReader.setOffset(offsetToRestore);
}
- clipBoundsDirty = true;
} break;
case CLIP_REGION: {
const SkRegion& region = getRegion();
@@ -498,7 +489,6 @@ void SkPicturePlayback::draw(SkCanvas& canvas) {
//SkDebugf("---- skip clipDeviceRgn for %d bytes\n", offsetToRestore - fReader.offset());
fReader.setOffset(offsetToRestore);
}
- clipBoundsDirty = true;
} break;
case CLIP_RECT: {
const SkRect* rect = fReader.skipRect();
@@ -508,11 +498,9 @@ void SkPicturePlayback::draw(SkCanvas& canvas) {
//SkDebugf("---- skip clipRect for %d bytes\n", offsetToRestore - fReader.offset());
fReader.setOffset(offsetToRestore);
}
- clipBoundsDirty = true;
} break;
case CONCAT:
canvas.concat(*getMatrix());
- clipBoundsDirty = true;
break;
case DRAW_BITMAP: {
const SkPaint* paint = getPaint();
@@ -538,8 +526,7 @@ void SkPicturePlayback::draw(SkCanvas& canvas) {
break;
case DRAW_PATH: {
const SkPaint& paint = *getPaint();
- const SkPath& path = getPath();
- canvas.drawPath(path, paint);
+ canvas.drawPath(getPath(), paint);
} break;
case DRAW_PICTURE:
canvas.drawPicture(getPicture());
@@ -561,43 +548,29 @@ void SkPicturePlayback::draw(SkCanvas& canvas) {
case DRAW_POS_TEXT_H: {
const SkPaint& paint = *getPaint();
getText(&text);
- size_t points = getInt();
- size_t byteLength = text.length();
- const SkScalar* xpos = (const SkScalar*)fReader.skip((3 + points) * sizeof(SkScalar));
+ size_t xCount = getInt();
+ const SkScalar constY = getScalar();
+ const SkScalar* xpos = (const SkScalar*)fReader.skip(xCount * sizeof(SkScalar));
+ canvas.drawPosTextH(text.text(), text.length(), xpos, constY,
+ paint);
+ } break;
+ case DRAW_POS_TEXT_H_TOP_BOTTOM: {
+ const SkPaint& paint = *getPaint();
+ getText(&text);
+ size_t xCount = getInt();
+ const SkScalar* xpos = (const SkScalar*)fReader.skip((3 + xCount) * sizeof(SkScalar));
const SkScalar top = *xpos++;
const SkScalar bottom = *xpos++;
const SkScalar constY = *xpos++;
- // would be nice to do this before we load the other fields
- // (especially the text block). To do that we'd need to record
- // the number of bytes to skip...
- if (clipBoundsDirty) {
- if (!canvas.getClipBounds(&clipBounds)) {
- clipBounds.setEmpty();
- }
- clipBoundsDirty = false;
- }
- if (top < clipBounds.fBottom && bottom > clipBounds.fTop) {
- canvas.drawPosTextH(text.text(), byteLength, xpos, constY,
- paint);
+ if (!canvas.quickRejectY(top, bottom, SkCanvas::kAA_EdgeType)) {
+ canvas.drawPosTextH(text.text(), text.length(), xpos,
+ constY, paint);
}
} break;
- case DRAW_RECT_GENERAL: {
+ case DRAW_RECT: {
const SkPaint& paint = *getPaint();
canvas.drawRect(*fReader.skipRect(), paint);
} break;
- case DRAW_RECT_SIMPLE: {
- const SkPaint& paint = *getPaint();
- const SkRect* rect = fReader.skipRect();
- if (clipBoundsDirty) {
- if (!canvas.getClipBounds(&clipBounds)) {
- clipBounds.setEmpty();
- }
- clipBoundsDirty = false;
- }
- if (SkRect::Intersects(clipBounds, *rect)) {
- canvas.drawRect(*rect, paint);
- }
- } break;
case DRAW_SPRITE: {
const SkPaint* paint = getPaint();
const SkBitmap& bitmap = getBitmap();
@@ -608,18 +581,20 @@ void SkPicturePlayback::draw(SkCanvas& canvas) {
case DRAW_TEXT: {
const SkPaint& paint = *getPaint();
getText(&text);
+ SkScalar x = getScalar();
+ SkScalar y = getScalar();
+ canvas.drawText(text.text(), text.length(), x, y, paint);
+ } break;
+ case DRAW_TEXT_TOP_BOTTOM: {
+ const SkPaint& paint = *getPaint();
+ getText(&text);
const SkScalar* ptr = (const SkScalar*)fReader.skip(4 * sizeof(SkScalar));
// ptr[0] == x
// ptr[1] == y
// ptr[2] == top
// ptr[3] == bottom
- if (clipBoundsDirty) {
- if (!canvas.getClipBounds(&clipBounds)) {
- clipBounds.setEmpty();
- }
- clipBoundsDirty = false;
- }
- if (ptr[2] < clipBounds.fBottom && ptr[3] > clipBounds.fTop) {
+ if (!canvas.quickRejectY(ptr[2], ptr[3],
+ SkCanvas::kAA_EdgeType)) {
canvas.drawText(text.text(), text.length(), ptr[0], ptr[1],
paint);
}
@@ -661,11 +636,9 @@ void SkPicturePlayback::draw(SkCanvas& canvas) {
} break;
case RESTORE:
canvas.restore();
- clipBoundsDirty = true;
break;
case ROTATE:
canvas.rotate(getScalar());
- clipBoundsDirty = true;
break;
case SAVE:
canvas.save((SkCanvas::SaveFlags) getInt());
@@ -679,19 +652,16 @@ void SkPicturePlayback::draw(SkCanvas& canvas) {
SkScalar sx = getScalar();
SkScalar sy = getScalar();
canvas.scale(sx, sy);
- clipBoundsDirty = true;
} break;
case SKEW: {
SkScalar sx = getScalar();
SkScalar sy = getScalar();
canvas.skew(sx, sy);
- clipBoundsDirty = true;
} break;
case TRANSLATE: {
SkScalar dx = getScalar();
SkScalar dy = getScalar();
canvas.translate(dx, dy);
- clipBoundsDirty = true;
} break;
default:
SkASSERT(0);
@@ -701,6 +671,10 @@ void SkPicturePlayback::draw(SkCanvas& canvas) {
// this->dumpSize();
}
+void SkPicturePlayback::abort() {
+ fReader.skip(fReader.size() - fReader.offset());
+}
+
///////////////////////////////////////////////////////////////////////////////
#if 0
@@ -1212,8 +1186,7 @@ void SkPicturePlayback::dumpStream() {
DUMP_SCALAR(constY);
DUMP_POINT_ARRAY(points);
} break;
- case DRAW_RECT_GENERAL:
- case DRAW_RECT_SIMPLE: {
+ case DRAW_RECT: {
DUMP_PTR(SkPaint, getPaint());
DUMP_RECT(rect);
} break;
@@ -1363,4 +1336,3 @@ void SkPicturePlayback::dump() const {
}
#endif
-
diff --git a/skia/picture/SkPicturePlayback.h b/skia/picture/SkPicturePlayback.h
index 7e99bd0..b4e69ca 100644
--- a/skia/picture/SkPicturePlayback.h
+++ b/skia/picture/SkPicturePlayback.h
@@ -8,6 +8,7 @@
#include "SkMatrix.h"
#include "SkPaint.h"
#include "SkPath.h"
+#include "SkPathHeap.h"
#include "SkRegion.h"
#include "SkPictureFlat.h"
@@ -29,6 +30,10 @@ public:
void serialize(SkWStream*) const;
void dumpSize() const;
+
+ // Can be called in the middle of playback (the draw() call). WIll abort the
+ // drawing and return from draw() after the "current" op code is done
+ void abort();
private:
@@ -59,9 +64,7 @@ private:
}
const SkPath& getPath() {
- int index = getInt();
- SkASSERT(index > 0 && index <= fPathCount);
- return fPaths[index - 1];
+ return (*fPathHeap)[getInt() - 1];
}
SkPicture& getPicture() {
@@ -143,14 +146,13 @@ public:
#endif
private:
+ SkPathHeap* fPathHeap; // reference counted
SkBitmap* fBitmaps;
int fBitmapCount;
SkMatrix* fMatrices;
int fMatrixCount;
SkPaint* fPaints;
int fPaintCount;
- SkPath* fPaths;
- int fPathCount;
SkRegion* fRegions;
int fRegionCount;
mutable SkFlattenableReadBuffer fReader;
diff --git a/skia/picture/SkPictureRecord.cpp b/skia/picture/SkPictureRecord.cpp
index 718526b..6e7c645 100644
--- a/skia/picture/SkPictureRecord.cpp
+++ b/skia/picture/SkPictureRecord.cpp
@@ -6,7 +6,7 @@
SkPictureRecord::SkPictureRecord() :
fHeap(HEAP_BLOCK_SIZE), fWriter(MIN_WRITER_SIZE) {
- fBitmapIndex = fMatrixIndex = fPaintIndex = fPathIndex = fRegionIndex = 1;
+ fBitmapIndex = fMatrixIndex = fPaintIndex = fRegionIndex = 1;
#ifdef SK_DEBUG_SIZE
fPointBytes = fRectBytes = fTextBytes = 0;
fPointWrites = fRectWrites = fTextWrites = 0;
@@ -14,6 +14,8 @@ SkPictureRecord::SkPictureRecord() :
fRestoreOffsetStack.setReserve(32);
fRestoreOffsetStack.push(0);
+
+ fPathHeap = NULL; // lazy allocate
}
SkPictureRecord::~SkPictureRecord() {
@@ -158,17 +160,8 @@ void SkPictureRecord::drawPoints(PointMode mode, size_t count, const SkPoint pts
validate();
}
-// return true if geometry drawn with this paint will just be filled
-// i.e. its bounding rect will not be larger than the original geometry
-static bool is_simple_fill(const SkPaint& paint) {
- return paint.getStyle() == SkPaint::kFill_Style &&
- paint.getPathEffect() == NULL &&
- paint.getMaskFilter() == NULL &&
- paint.getRasterizer() == NULL;
-}
-
void SkPictureRecord::drawRect(const SkRect& rect, const SkPaint& paint) {
- addDraw(is_simple_fill(paint) ? DRAW_RECT_SIMPLE : DRAW_RECT_GENERAL);
+ addDraw(DRAW_RECT);
addPaint(paint);
addRect(rect);
validate();
@@ -224,18 +217,29 @@ void SkPictureRecord::addFontMetricsTopBottom(const SkPaint& paint,
SkScalar baselineY) {
SkPaint::FontMetrics metrics;
paint.getFontMetrics(&metrics);
- addScalar(metrics.fTop + baselineY);
- addScalar(metrics.fBottom + baselineY);
+ SkRect bounds;
+ // construct a rect so we can see any adjustments from the paint.
+ // we use 0,1 for left,right, just so the rect isn't empty
+ bounds.set(0, metrics.fTop + baselineY,
+ SK_Scalar1, metrics.fBottom + baselineY);
+ (void)paint.computeFastBounds(bounds, &bounds);
+ // now record the top and bottom
+ addScalar(bounds.fTop);
+ addScalar(bounds.fBottom);
}
void SkPictureRecord::drawText(const void* text, size_t byteLength, SkScalar x,
SkScalar y, const SkPaint& paint) {
- addDraw(DRAW_TEXT);
+ bool fast = paint.canComputeFastBounds();
+
+ addDraw(fast ? DRAW_TEXT_TOP_BOTTOM : DRAW_TEXT);
addPaint(paint);
addText(text, byteLength);
addScalar(x);
addScalar(y);
- addFontMetricsTopBottom(paint, y);
+ if (fast) {
+ addFontMetricsTopBottom(paint, y);
+ }
validate();
}
@@ -257,7 +261,13 @@ void SkPictureRecord::drawPosText(const void* text, size_t byteLength,
}
}
- addDraw(canUseDrawH ? DRAW_POS_TEXT_H : DRAW_POS_TEXT);
+ bool fast = canUseDrawH && paint.canComputeFastBounds();
+
+ if (fast) {
+ addDraw(DRAW_POS_TEXT_H_TOP_BOTTOM);
+ } else {
+ addDraw(canUseDrawH ? DRAW_POS_TEXT_H : DRAW_POS_TEXT);
+ }
addPaint(paint);
addText(text, byteLength);
addInt(points);
@@ -266,7 +276,9 @@ void SkPictureRecord::drawPosText(const void* text, size_t byteLength,
size_t start = fWriter.size();
#endif
if (canUseDrawH) {
- addFontMetricsTopBottom(paint, pos[0].fY);
+ if (fast) {
+ addFontMetricsTopBottom(paint, pos[0].fY);
+ }
addScalar(pos[0].fY);
SkScalar* xptr = (SkScalar*)fWriter.reserve(points * sizeof(SkScalar));
for (size_t index = 0; index < points; index++)
@@ -289,7 +301,9 @@ void SkPictureRecord::drawPosTextH(const void* text, size_t byteLength,
if (0 == points)
return;
- addDraw(DRAW_POS_TEXT_H);
+ bool fast = paint.canComputeFastBounds();
+
+ addDraw(fast ? DRAW_POS_TEXT_H_TOP_BOTTOM : DRAW_POS_TEXT_H);
addPaint(paint);
addText(text, byteLength);
addInt(points);
@@ -297,7 +311,9 @@ void SkPictureRecord::drawPosTextH(const void* text, size_t byteLength,
#ifdef SK_DEBUG_SIZE
size_t start = fWriter.size();
#endif
- addFontMetricsTopBottom(paint, constY);
+ if (fast) {
+ addFontMetricsTopBottom(paint, constY);
+ }
addScalar(constY);
fWriter.writeMul4(xpos, points * sizeof(SkScalar));
#ifdef SK_DEBUG_SIZE
@@ -361,10 +377,12 @@ void SkPictureRecord::drawVertices(VertexMode vmode, int vertexCount,
///////////////////////////////////////////////////////////////////////////////
void SkPictureRecord::reset() {
+ fPathHeap->safeUnref();
+ fPathHeap = NULL;
+
fBitmaps.reset();
fMatrices.reset();
fPaints.reset();
- fPaths.reset();
fPictureRefs.unrefAll();
fRegions.reset();
fWriter.reset();
@@ -398,7 +416,10 @@ void SkPictureRecord::addPaintPtr(const SkPaint* paint) {
}
void SkPictureRecord::addPath(const SkPath& path) {
- addInt(find(fPaths, path));
+ if (NULL == fPathHeap) {
+ fPathHeap = SkNEW(SkPathHeap);
+ }
+ addInt(fPathHeap->append(path));
}
void SkPictureRecord::addPicture(SkPicture& picture) {
@@ -518,17 +539,6 @@ int SkPictureRecord::find(SkTDArray<const SkFlatPaint* >& paints, const SkPaint*
return fPaintIndex++;
}
-int SkPictureRecord::find(SkTDArray<const SkFlatPath* >& paths, const SkPath& path) {
- SkFlatPath* flat = SkFlatPath::Flatten(&fHeap, path, fPathIndex);
- int index = SkTSearch<SkFlatData>((const SkFlatData**) paths.begin(),
- paths.count(), (SkFlatData*) flat, sizeof(flat), &SkFlatData::Compare);
- if (index >= 0)
- return paths[index]->index();
- index = ~index;
- *paths.insert(index) = flat;
- return fPathIndex++;
-}
-
int SkPictureRecord::find(SkTDArray<const SkFlatRegion* >& regions, const SkRegion& region) {
SkFlatRegion* flat = SkFlatRegion::Flatten(&fHeap, region, fRegionIndex);
int index = SkTSearch<SkFlatData>((const SkFlatData**) regions.begin(),
diff --git a/skia/picture/SkPictureRecord.h b/skia/picture/SkPictureRecord.h
index 350040e..d25d23a 100644
--- a/skia/picture/SkPictureRecord.h
+++ b/skia/picture/SkPictureRecord.h
@@ -3,6 +3,7 @@
#include "SkCanvas.h"
#include "SkFlattenable.h"
+#include "SkPathHeap.h"
#include "SkPicture.h"
#include "SkPictureFlat.h"
#include "SkTemplates.h"
@@ -65,9 +66,6 @@ public:
const SkTDArray<const SkFlatPaint* >& getPaints() const {
return fPaints;
}
- const SkTDArray<const SkFlatPath* >& getPaths() const {
- return fPaths;
- }
const SkTDArray<SkPicture* >& getPictureRefs() const {
return fPictureRefs;
}
@@ -117,7 +115,6 @@ private:
int find(SkTDArray<const SkFlatMatrix* >& matrices,
const SkMatrix* matrix);
int find(SkTDArray<const SkFlatPaint* >& paints, const SkPaint* paint);
- int find(SkTDArray<const SkFlatPath* >& paths, const SkPath& path);
int find(SkTDArray<const SkFlatRegion* >& regions, const SkRegion& region);
#ifdef SK_DEBUG_DUMP
@@ -162,10 +159,9 @@ private:
SkTDArray<const SkFlatMatrix* > fMatrices;
int fPaintIndex;
SkTDArray<const SkFlatPaint* > fPaints;
- int fPathIndex;
- SkTDArray<const SkFlatPath* > fPaths;
int fRegionIndex;
SkTDArray<const SkFlatRegion* > fRegions;
+ SkPathHeap* fPathHeap; // reference counted
SkWriter32 fWriter;
// we ref each item in this array
diff --git a/skia/ports/SkFontHost_FONTPATH.cpp b/skia/ports/SkFontHost_FONTPATH.cpp
index 94f068c..3cbccaf 100644
--- a/skia/ports/SkFontHost_FONTPATH.cpp
+++ b/skia/ports/SkFontHost_FONTPATH.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/ports/SkFontHost_android.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/ports/SkFontHost_FreeType.cpp b/skia/ports/SkFontHost_FreeType.cpp
index 5a18d51..3ad4a65 100644
--- a/skia/ports/SkFontHost_FreeType.cpp
+++ b/skia/ports/SkFontHost_FreeType.cpp
@@ -1,17 +1,17 @@
/* libs/graphics/ports/SkFontHost_FreeType.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
**
-** http://www.apache.org/licenses/LICENSE-2.0
+** http://www.apache.org/licenses/LICENSE-2.0
**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
** limitations under the License.
*/
@@ -32,8 +32,11 @@
#include FT_OUTLINE_H
#include FT_SIZES_H
#include FT_TRUETYPE_TABLES_H
+#ifdef FT_ADVANCES_H
+#include FT_ADVANCES_H
+#endif
-//#define ENABLE_GLYPH_SPEW // for tracing calls to generateMetrics/generateImage
+//#define ENABLE_GLYPH_SPEW // for tracing calls
//#define DUMP_STRIKE_CREATION
#ifdef SK_DEBUG
@@ -69,7 +72,8 @@ protected:
virtual void generateMetrics(SkGlyph* glyph);
virtual void generateImage(const SkGlyph& glyph);
virtual void generatePath(const SkGlyph& glyph, SkPath* path);
- virtual void generateFontMetrics(SkPaint::FontMetrics* mx, SkPaint::FontMetrics* my);
+ virtual void generateFontMetrics(SkPaint::FontMetrics* mx,
+ SkPaint::FontMetrics* my);
private:
SkFaceRec* fFaceRec;
@@ -95,9 +99,8 @@ struct SkFaceRec {
uint32_t fRefCnt;
uint32_t fFontID;
- SkFaceRec(SkStream* strm, uint32_t fontID);
- ~SkFaceRec()
- {
+ SkFaceRec(SkStream* strm, uint32_t fontID);
+ ~SkFaceRec() {
SkFontHost::CloseStream(fFontID, fSkStream);
}
};
@@ -106,21 +109,15 @@ extern "C" {
static unsigned long sk_stream_read(FT_Stream stream,
unsigned long offset,
unsigned char* buffer,
- unsigned long count )
- {
+ unsigned long count ) {
SkStream* str = (SkStream*)stream->descriptor.pointer;
- if (count)
- {
- if (!str->rewind())
- {
+ if (count) {
+ if (!str->rewind()) {
return 0;
- }
- else
- {
+ } else {
unsigned long ret;
- if (offset)
- {
+ if (offset) {
ret = str->read(NULL, offset);
if (ret != offset) {
return 0;
@@ -136,30 +133,24 @@ extern "C" {
return count;
}
- static void sk_stream_close( FT_Stream stream)
- {
- }
+ static void sk_stream_close( FT_Stream stream) {}
}
SkFaceRec::SkFaceRec(SkStream* strm, uint32_t fontID)
- : fSkStream(strm), fFontID(fontID)
-{
+ : fSkStream(strm), fFontID(fontID) {
// SkDEBUGF(("SkFaceRec: opening %s (%p)\n", key.c_str(), strm));
- memset(&fFTStream, 0, sizeof(fFTStream));
- fFTStream.size = fSkStream->read(NULL, 0); // find out how big the stream is
+ bzero(&fFTStream, sizeof(fFTStream));
+ fFTStream.size = fSkStream->getLength();
fFTStream.descriptor.pointer = fSkStream;
fFTStream.read = sk_stream_read;
fFTStream.close = sk_stream_close;
}
-static SkFaceRec* ref_ft_face(uint32_t fontID)
-{
+static SkFaceRec* ref_ft_face(uint32_t fontID) {
SkFaceRec* rec = gFaceRecHead;
- while (rec)
- {
- if (rec->fFontID == fontID)
- {
+ while (rec) {
+ if (rec->fFontID == fontID) {
SkASSERT(rec->fFace);
rec->fRefCnt += 1;
return rec;
@@ -168,8 +159,7 @@ static SkFaceRec* ref_ft_face(uint32_t fontID)
}
SkStream* strm = SkFontHost::OpenStream(fontID);
- if (NULL == strm)
- {
+ if (NULL == strm) {
SkDEBUGF(("SkFontHost::OpenStream failed opening %x\n", fontID));
sk_throw();
return 0;
@@ -182,15 +172,12 @@ static SkFaceRec* ref_ft_face(uint32_t fontID)
memset(&args, 0, sizeof(args));
const void* memoryBase = strm->getMemoryBase();
- if (NULL != memoryBase)
- {
+ if (NULL != memoryBase) {
//printf("mmap(%s)\n", keyString.c_str());
args.flags = FT_OPEN_MEMORY;
args.memory_base = (const FT_Byte*)memoryBase;
args.memory_size = strm->getLength();
- }
- else
- {
+ } else {
//printf("fopen(%s)\n", keyString.c_str());
args.flags = FT_OPEN_STREAM;
args.stream = &rec->fFTStream;
@@ -198,15 +185,12 @@ static SkFaceRec* ref_ft_face(uint32_t fontID)
FT_Error err = FT_Open_Face(gFTLibrary, &args, 0, &rec->fFace);
- if (err) // bad filename, try the default font
- {
+ if (err) { // bad filename, try the default font
fprintf(stderr, "ERROR: unable to open font '%x'\n", fontID);
SkDELETE(rec);
sk_throw();
return 0;
- }
- else
- {
+ } else {
SkASSERT(rec->fFace);
//fprintf(stderr, "Opened font '%s'\n", filename.c_str());
rec->fNext = gFaceRecHead;
@@ -216,22 +200,18 @@ static SkFaceRec* ref_ft_face(uint32_t fontID)
}
}
-static void unref_ft_face(FT_Face face)
-{
+static void unref_ft_face(FT_Face face) {
SkFaceRec* rec = gFaceRecHead;
SkFaceRec* prev = NULL;
- while (rec)
- {
+ while (rec) {
SkFaceRec* next = rec->fNext;
- if (rec->fFace == face)
- {
- if (--rec->fRefCnt == 0)
- {
- if (prev)
+ if (rec->fFace == face) {
+ if (--rec->fRefCnt == 0) {
+ if (prev) {
prev->fNext = next;
- else
+ } else {
gFaceRecHead = next;
-
+ }
FT_Done_Face(face);
SkDELETE(rec);
}
@@ -246,14 +226,12 @@ static void unref_ft_face(FT_Face face)
///////////////////////////////////////////////////////////////////////////
SkScalerContext_FreeType::SkScalerContext_FreeType(const SkDescriptor* desc)
- : SkScalerContext(desc), fFTSize(NULL)
-{
+ : SkScalerContext(desc), fFTSize(NULL) {
SkAutoMutexAcquire ac(gFTMutex);
FT_Error err;
- if (gFTCount == 0)
- {
+ if (gFTCount == 0) {
err = FT_Init_FreeType(&gFTLibrary);
// SkDEBUGF(("FT_Init_FreeType returned %d\n", err));
SkASSERT(err == 0);
@@ -261,10 +239,8 @@ SkScalerContext_FreeType::SkScalerContext_FreeType(const SkDescriptor* desc)
++gFTCount;
// load the font file
- {
- fFaceRec = ref_ft_face(fRec.fFontID);
- fFace = fFaceRec ? fFaceRec->fFace : NULL;
- }
+ fFaceRec = ref_ft_face(fRec.fFontID);
+ fFace = fFaceRec ? fFaceRec->fFace : NULL;
// compute our factors from the record
@@ -286,8 +262,8 @@ SkScalerContext_FreeType::SkScalerContext_FreeType(const SkDescriptor* desc)
SkScalar sx = m.getScaleX();
SkScalar sy = m.getScaleY();
- if (m.getSkewX() || m.getSkewY() || sx < 0 || sy < 0) // sort of give up on hinting
- {
+ if (m.getSkewX() || m.getSkewY() || sx < 0 || sy < 0) {
+ // sort of give up on hinting
sx = SkMaxScalar(SkScalarAbs(sx), SkScalarAbs(m.getSkewX()));
sy = SkMaxScalar(SkScalarAbs(m.getSkewY()), SkScalarAbs(sy));
sx = sy = SkScalarAve(sx, sy);
@@ -299,9 +275,7 @@ SkScalerContext_FreeType::SkScalerContext_FreeType(const SkDescriptor* desc)
fMatrix22.xy = -SkScalarToFixed(SkScalarMul(m.getSkewX(), inv));
fMatrix22.yx = -SkScalarToFixed(SkScalarMul(m.getSkewY(), inv));
fMatrix22.yy = SkScalarToFixed(SkScalarMul(m.getScaleY(), inv));
- }
- else
- {
+ } else {
fMatrix22.xx = fMatrix22.yy = SK_Fixed1;
fMatrix22.xy = fMatrix22.yx = 0;
}
@@ -315,19 +289,14 @@ SkScalerContext_FreeType::SkScalerContext_FreeType(const SkDescriptor* desc)
uint32_t render_flags = FT_LOAD_TARGET_NORMAL;
// we force autohinting at the moment
- // (no patent rights to apple's stuff)
switch (fRec.fHints) {
case kNo_Hints:
flags |= FT_LOAD_NO_HINTING;
break;
case kSubpixel_Hints:
-#if 1 // this is clearer (vertically), but ~2x slower
flags |= FT_LOAD_FORCE_AUTOHINT;
render_flags = FT_LOAD_TARGET_LIGHT;
-#else
- flags |= FT_LOAD_NO_HINTING;
-#endif
break;
case kNormal_Hints:
// Uncommenting the following line disables the font's hinting
@@ -335,8 +304,14 @@ SkScalerContext_FreeType::SkScalerContext_FreeType(const SkDescriptor* desc)
// generate baselines that look at little like Firefox. It's
// expected that Mike Reed will rework this code sometime soon so
// we don't wish to make more extensive changes.
-
- // flags |= FT_LOAD_FORCE_AUTOHINT;
+ //flags |= FT_LOAD_FORCE_AUTOHINT;
+#ifdef ANDROID
+ /* Switch to light hinting (vertical only) to address some chars
+ that behaved poorly with NORMAL. In the future we could consider
+ making this choice exposed at runtime to the caller.
+ */
+ render_flags = FT_LOAD_TARGET_LIGHT;
+#endif
break;
}
@@ -382,18 +357,17 @@ SkScalerContext_FreeType::SkScalerContext_FreeType(const SkDescriptor* desc)
}
}
-SkScalerContext_FreeType::~SkScalerContext_FreeType()
-{
- if (fFTSize != NULL)
+SkScalerContext_FreeType::~SkScalerContext_FreeType() {
+ if (fFTSize != NULL) {
FT_Done_Size(fFTSize);
+ }
SkAutoMutexAcquire ac(gFTMutex);
- if (fFace != NULL)
+ if (fFace != NULL) {
unref_ft_face(fFace);
-
- if (--gFTCount == 0)
- {
+ }
+ if (--gFTCount == 0) {
// SkDEBUGF(("FT_Done_FreeType\n"));
FT_Done_FreeType(gFTLibrary);
SkDEBUGCODE(gFTLibrary = NULL;)
@@ -403,8 +377,7 @@ SkScalerContext_FreeType::~SkScalerContext_FreeType()
/* We call this before each use of the fFace, since we may be sharing
this face with other context (at different sizes).
*/
-FT_Error SkScalerContext_FreeType::setupSize()
-{
+FT_Error SkScalerContext_FreeType::setupSize() {
if (SkFontHost::ResolveTypeface(fRec.fFontID) == NULL) {
return (FT_Error)-1;
}
@@ -415,9 +388,7 @@ FT_Error SkScalerContext_FreeType::setupSize()
SkDEBUGF(("SkScalerContext_FreeType::FT_Activate_Size(%x, 0x%x, 0x%x) returned 0x%x\n",
fFaceRec->fFontID, fScaleX, fScaleY, err));
fFTSize = NULL;
- }
- else
- {
+ } else {
// seems we need to reset this every time (not sure why, but without it
// I get random italics from some other fFTSize)
FT_Set_Transform( fFace, &fMatrix22, NULL);
@@ -425,49 +396,71 @@ FT_Error SkScalerContext_FreeType::setupSize()
return err;
}
-unsigned SkScalerContext_FreeType::generateGlyphCount() const
-{
+unsigned SkScalerContext_FreeType::generateGlyphCount() const {
return fFace->num_glyphs;
}
-uint16_t SkScalerContext_FreeType::generateCharToGlyph(SkUnichar uni)
-{
+uint16_t SkScalerContext_FreeType::generateCharToGlyph(SkUnichar uni) {
return SkToU16(FT_Get_Char_Index( fFace, uni ));
}
-static FT_Pixel_Mode compute_pixel_mode(SkMask::Format format)
-{
+static FT_Pixel_Mode compute_pixel_mode(SkMask::Format format) {
switch (format) {
- case SkMask::kBW_Format:
- return FT_PIXEL_MODE_MONO;
- case SkMask::kLCD_Format:
- return FT_PIXEL_MODE_LCD;
- case SkMask::kA8_Format:
- default:
- return FT_PIXEL_MODE_GRAY;
+ case SkMask::kBW_Format:
+ return FT_PIXEL_MODE_MONO;
+ case SkMask::kLCD_Format:
+ return FT_PIXEL_MODE_LCD;
+ case SkMask::kA8_Format:
+ default:
+ return FT_PIXEL_MODE_GRAY;
}
}
-void SkScalerContext_FreeType::generateAdvance(SkGlyph* glyph)
-{
- // insert new freetype API when it is available
-#if 1
- this->generateMetrics(glyph);
-#else
- // hack
- SkAutoMutexAcquire ac(gFTMutex);
-
+static void set_glyph_metrics_on_error(SkGlyph* glyph) {
glyph->fRsbDelta = 0;
glyph->fLsbDelta = 0;
-
- glyph->fAdvanceX = fScaleX * 2 / 3;
+ glyph->fWidth = 0;
+ glyph->fHeight = 0;
+ glyph->fTop = 0;
+ glyph->fLeft = 0;
+ glyph->fAdvanceX = 0;
glyph->fAdvanceY = 0;
-#endif
+}
+
+void SkScalerContext_FreeType::generateAdvance(SkGlyph* glyph) {
+#ifdef FT_ADVANCES_H
+ /* unhinted and light hinted text have linearly scaled advances
+ * which are very cheap to compute with some font formats...
+ */
+ {
+ SkAutoMutexAcquire ac(gFTMutex);
+
+ if (this->setupSize()) {
+ set_glyph_metrics_on_error(glyph);
+ return;
+ }
+
+ FT_Error error;
+ FT_Fixed advance;
+
+ error = FT_Get_Advance( fFace, glyph->getGlyphID(fBaseGlyphCount),
+ fLoadGlyphFlags | FT_ADVANCE_FLAG_FAST_ONLY,
+ &advance );
+ if (0 == error) {
+ glyph->fRsbDelta = 0;
+ glyph->fLsbDelta = 0;
+ glyph->fAdvanceX = advance; // advance *2/3; //DEBUG
+ glyph->fAdvanceY = 0;
+ return;
+ }
+ }
+#endif /* FT_ADVANCES_H */
+ /* otherwise, we need to load/hint the glyph, which is slower */
+ this->generateMetrics(glyph);
return;
}
-void SkScalerContext_FreeType::generateMetrics(SkGlyph* glyph)
-{
+void SkScalerContext_FreeType::generateMetrics(SkGlyph* glyph) {
SkAutoMutexAcquire ac(gFTMutex);
glyph->fRsbDelta = 0;
@@ -475,41 +468,35 @@ void SkScalerContext_FreeType::generateMetrics(SkGlyph* glyph)
FT_Error err;
- if (this->setupSize())
+ if (this->setupSize()) {
goto ERROR;
+ }
err = FT_Load_Glyph( fFace, glyph->getGlyphID(fBaseGlyphCount), fLoadGlyphFlags );
- if (err != 0)
- {
+ if (err != 0) {
SkDEBUGF(("SkScalerContext_FreeType::generateMetrics(%x): FT_Load_Glyph(glyph:%d flags:%d) returned 0x%x\n",
fFaceRec->fFontID, glyph->getGlyphID(fBaseGlyphCount), fLoadGlyphFlags, err));
ERROR:
- glyph->fWidth = 0;
- glyph->fHeight = 0;
- glyph->fTop = 0;
- glyph->fLeft = 0;
- glyph->fAdvanceX = 0;
- glyph->fAdvanceY = 0;
+ set_glyph_metrics_on_error(glyph);
return;
}
-
- switch ( fFace->glyph->format )
- {
+
+ switch ( fFace->glyph->format ) {
case FT_GLYPH_FORMAT_OUTLINE:
FT_BBox bbox;
-
+
FT_Outline_Get_CBox(&fFace->glyph->outline, &bbox);
- if (kSubpixel_Hints == fRec.fHints)
- {
+ if (kSubpixel_Hints == fRec.fHints) {
int dx = glyph->getSubXFixed() >> 10;
int dy = glyph->getSubYFixed() >> 10;
+ // negate dy since freetype-y-goes-up and skia-y-goes-down
bbox.xMin += dx;
- bbox.yMin += dy;
+ bbox.yMin -= dy;
bbox.xMax += dx;
- bbox.yMax += dy;
+ bbox.yMax -= dy;
}
-
+
bbox.xMin &= ~63;
bbox.yMin &= ~63;
bbox.xMax = (bbox.xMax + 63) & ~63;
@@ -520,7 +507,7 @@ void SkScalerContext_FreeType::generateMetrics(SkGlyph* glyph)
glyph->fTop = -SkToS16(bbox.yMax >> 6);
glyph->fLeft = SkToS16(bbox.xMin >> 6);
break;
-
+
case FT_GLYPH_FORMAT_BITMAP:
glyph->fWidth = SkToU16(fFace->glyph->bitmap.width);
glyph->fHeight = SkToU16(fFace->glyph->bitmap.rows);
@@ -530,21 +517,17 @@ void SkScalerContext_FreeType::generateMetrics(SkGlyph* glyph)
default:
SkASSERT(!"unknown glyph format");
- goto ERROR;
+ goto ERROR;
}
-
- if (kNormal_Hints == fRec.fHints)
- {
+
+ if (kNormal_Hints == fRec.fHints) {
glyph->fAdvanceX = SkFDot6ToFixed(fFace->glyph->advance.x);
glyph->fAdvanceY = -SkFDot6ToFixed(fFace->glyph->advance.y);
- if (fRec.fFlags & kDevKernText_Flag)
- {
+ if (fRec.fFlags & kDevKernText_Flag) {
glyph->fRsbDelta = SkToS8(fFace->glyph->rsb_delta);
glyph->fLsbDelta = SkToS8(fFace->glyph->lsb_delta);
}
- }
- else
- {
+ } else {
glyph->fAdvanceX = SkFixedMul(fMatrix22.xx, fFace->glyph->linearHoriAdvance);
glyph->fAdvanceY = -SkFixedMul(fMatrix22.yx, fFace->glyph->linearHoriAdvance);
}
@@ -555,14 +538,14 @@ void SkScalerContext_FreeType::generateMetrics(SkGlyph* glyph)
#endif
}
-void SkScalerContext_FreeType::generateImage(const SkGlyph& glyph)
-{
+void SkScalerContext_FreeType::generateImage(const SkGlyph& glyph) {
SkAutoMutexAcquire ac(gFTMutex);
FT_Error err;
- if (this->setupSize())
+ if (this->setupSize()) {
goto ERROR;
+ }
err = FT_Load_Glyph( fFace, glyph.getGlyphID(fBaseGlyphCount), fLoadGlyphFlags);
if (err != 0) {
@@ -574,17 +557,17 @@ void SkScalerContext_FreeType::generateImage(const SkGlyph& glyph)
}
switch ( fFace->glyph->format ) {
- case FT_GLYPH_FORMAT_OUTLINE:
- {
+ case FT_GLYPH_FORMAT_OUTLINE: {
FT_Outline* outline = &fFace->glyph->outline;
FT_BBox bbox;
FT_Bitmap target;
int dx = 0, dy = 0;
- if (kSubpixel_Hints == fRec.fHints)
- {
+ if (kSubpixel_Hints == fRec.fHints) {
dx = glyph.getSubXFixed() >> 10;
dy = glyph.getSubYFixed() >> 10;
+ // negate dy since freetype-y-goes-up and skia-y-goes-down
+ dy = -dy;
}
FT_Outline_Get_CBox(outline, &bbox);
/*
@@ -602,21 +585,20 @@ void SkScalerContext_FreeType::generateImage(const SkGlyph& glyph)
target.rows = glyph.fHeight;
target.pitch = glyph.rowBytes();
target.buffer = reinterpret_cast<uint8_t*>(glyph.fImage);
- target.pixel_mode = compute_pixel_mode((SkMask::Format)fRec.fMaskFormat);
+ target.pixel_mode = compute_pixel_mode(
+ (SkMask::Format)fRec.fMaskFormat);
target.num_grays = 256;
-
+
memset(glyph.fImage, 0, glyph.rowBytes() * glyph.fHeight);
FT_Outline_Get_Bitmap(gFTLibrary, outline, &target);
- }
- break;
-
- case FT_GLYPH_FORMAT_BITMAP:
- SkASSERT_CONTINUE(glyph.fWidth == fFace->glyph->bitmap.width);
- SkASSERT_CONTINUE(glyph.fHeight == fFace->glyph->bitmap.rows);
- SkASSERT_CONTINUE(glyph.fTop == -fFace->glyph->bitmap_top);
- SkASSERT_CONTINUE(glyph.fLeft == fFace->glyph->bitmap_left);
-
- {
+ } break;
+
+ case FT_GLYPH_FORMAT_BITMAP: {
+ SkASSERT_CONTINUE(glyph.fWidth == fFace->glyph->bitmap.width);
+ SkASSERT_CONTINUE(glyph.fHeight == fFace->glyph->bitmap.rows);
+ SkASSERT_CONTINUE(glyph.fTop == -fFace->glyph->bitmap_top);
+ SkASSERT_CONTINUE(glyph.fLeft == fFace->glyph->bitmap_left);
+
const uint8_t* src = (const uint8_t*)fFace->glyph->bitmap.buffer;
uint8_t* dst = (uint8_t*)glyph.fImage;
unsigned srcRowBytes = fFace->glyph->bitmap.pitch;
@@ -624,23 +606,21 @@ void SkScalerContext_FreeType::generateImage(const SkGlyph& glyph)
unsigned minRowBytes = SkMin32(srcRowBytes, dstRowBytes);
unsigned extraRowBytes = dstRowBytes - minRowBytes;
- for (int y = fFace->glyph->bitmap.rows - 1; y >= 0; --y)
- {
+ for (int y = fFace->glyph->bitmap.rows - 1; y >= 0; --y) {
memcpy(dst, src, minRowBytes);
memset(dst + minRowBytes, 0, extraRowBytes);
src += srcRowBytes;
dst += dstRowBytes;
}
- }
- break;
-
+ } break;
+
default:
SkASSERT(!"unknown glyph format");
goto ERROR;
}
}
-///////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
#define ft2sk(x) SkFixedToScalar((x) << 10)
@@ -650,37 +630,36 @@ void SkScalerContext_FreeType::generateImage(const SkGlyph& glyph)
#define CONST_PARAM
#endif
-static int move_proc(CONST_PARAM FT_Vector* pt, void* ctx)
-{
+static int move_proc(CONST_PARAM FT_Vector* pt, void* ctx) {
SkPath* path = (SkPath*)ctx;
path->close(); // to close the previous contour (if any)
path->moveTo(ft2sk(pt->x), -ft2sk(pt->y));
return 0;
}
-static int line_proc(CONST_PARAM FT_Vector* pt, void* ctx)
-{
+static int line_proc(CONST_PARAM FT_Vector* pt, void* ctx) {
SkPath* path = (SkPath*)ctx;
path->lineTo(ft2sk(pt->x), -ft2sk(pt->y));
return 0;
}
-static int quad_proc(CONST_PARAM FT_Vector* pt0, CONST_PARAM FT_Vector* pt1, void* ctx)
-{
+static int quad_proc(CONST_PARAM FT_Vector* pt0, CONST_PARAM FT_Vector* pt1,
+ void* ctx) {
SkPath* path = (SkPath*)ctx;
path->quadTo(ft2sk(pt0->x), -ft2sk(pt0->y), ft2sk(pt1->x), -ft2sk(pt1->y));
return 0;
}
-static int cubic_proc(CONST_PARAM FT_Vector* pt0, CONST_PARAM FT_Vector* pt1, CONST_PARAM FT_Vector* pt2, void* ctx)
-{
+static int cubic_proc(CONST_PARAM FT_Vector* pt0, CONST_PARAM FT_Vector* pt1,
+ CONST_PARAM FT_Vector* pt2, void* ctx) {
SkPath* path = (SkPath*)ctx;
- path->cubicTo(ft2sk(pt0->x), -ft2sk(pt0->y), ft2sk(pt1->x), -ft2sk(pt1->y), ft2sk(pt2->x), -ft2sk(pt2->y));
+ path->cubicTo(ft2sk(pt0->x), -ft2sk(pt0->y), ft2sk(pt1->x),
+ -ft2sk(pt1->y), ft2sk(pt2->x), -ft2sk(pt2->y));
return 0;
}
-void SkScalerContext_FreeType::generatePath(const SkGlyph& glyph, SkPath* path)
-{
+void SkScalerContext_FreeType::generatePath(const SkGlyph& glyph,
+ SkPath* path) {
SkAutoMutexAcquire ac(gFTMutex);
SkASSERT(&glyph && path);
@@ -769,19 +748,21 @@ SkFontHost_VDMX_Parse(int* ymax, int* ymin,
return result;
}
-void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx, SkPaint::FontMetrics* my)
-{
- if (NULL == mx && NULL == my)
+void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx,
+ SkPaint::FontMetrics* my) {
+ if (NULL == mx && NULL == my) {
return;
+ }
SkAutoMutexAcquire ac(gFTMutex);
- if (this->setupSize())
- {
- if (mx)
- memset(mx, 0, sizeof(SkPaint::FontMetrics));
- if (my)
- memset(my, 0, sizeof(SkPaint::FontMetrics));
+ if (this->setupSize()) {
+ if (mx) {
+ bzero(mx, sizeof(SkPaint::FontMetrics));
+ }
+ if (my) {
+ bzero(my, sizeof(SkPaint::FontMetrics));
+ }
return;
}
@@ -795,8 +776,9 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx, SkP
SkScalar xrange = static_cast<SkScalar>(face->bbox.xMax - face->bbox.xMin) / upem;
int leading = face->height - face->ascender + face->descender;
- if (leading < 0)
+ if (leading < 0) {
leading = 0;
+ }
// Try to get the OS/2 table from the font. This contains the specific
// average font width metrics which Windows uses.
@@ -827,16 +809,14 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx, SkP
}
// convert upem-y values into scalar points
- for (int i = 0; i < 7; i++)
- {
+ for (int i = 0; i < 7; i++) {
SkFixed y = SkMulDiv(scaleY, ys[i], upem);
SkFixed x = SkFixedMul(mxy, y);
y = SkFixedMul(myy, y);
pts[i].set(SkFixedToScalar(x), SkFixedToScalar(y));
}
- if (mx)
- {
+ if (mx) {
mx->fTop = pts[0].fX;
mx->fAscent = pts[1].fX;
mx->fDescent = pts[2].fX;
@@ -851,8 +831,7 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx, SkP
// I believe
my->fVDMXMetricsValid = false;
}
- if (my)
- {
+ if (my) {
my->fTop = pts[0].fY;
my->fAscent = pts[1].fY;
my->fDescent = pts[2].fY;
@@ -878,8 +857,7 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx, SkP
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
-SkScalerContext* SkFontHost::CreateScalerContext(const SkDescriptor* desc)
-{
+SkScalerContext* SkFontHost::CreateScalerContext(const SkDescriptor* desc) {
return SkNEW_ARGS(SkScalerContext_FreeType, (desc));
}
@@ -888,20 +866,19 @@ SkScalerContext* SkFontHost::CreateScalerContext(const SkDescriptor* desc)
/* Export this so that other parts of our FonttHost port can make use of our
ability to extract the name+style from a stream, using FreeType's api.
*/
-SkTypeface::Style find_name_and_style(SkStream* stream, SkString* name)
-{
+SkTypeface::Style find_name_and_style(SkStream* stream, SkString* name) {
FT_Library library;
if (FT_Init_FreeType(&library)) {
name->set(NULL);
return SkTypeface::kNormal;
}
-
+
FT_Open_Args args;
memset(&args, 0, sizeof(args));
-
+
const void* memoryBase = stream->getMemoryBase();
FT_StreamRec streamRec;
-
+
if (NULL != memoryBase) {
args.flags = FT_OPEN_MEMORY;
args.memory_base = (const FT_Byte*)memoryBase;
@@ -912,28 +889,28 @@ SkTypeface::Style find_name_and_style(SkStream* stream, SkString* name)
streamRec.descriptor.pointer = stream;
streamRec.read = sk_stream_read;
streamRec.close = sk_stream_close;
-
+
args.flags = FT_OPEN_STREAM;
args.stream = &streamRec;
}
-
+
FT_Face face;
if (FT_Open_Face(library, &args, 0, &face)) {
FT_Done_FreeType(library);
name->set(NULL);
return SkTypeface::kNormal;
}
-
+
name->set(face->family_name);
int style = SkTypeface::kNormal;
-
+
if (face->style_flags & FT_STYLE_FLAG_BOLD) {
style |= SkTypeface::kBold;
- }
+ }
if (face->style_flags & FT_STYLE_FLAG_ITALIC) {
style |= SkTypeface::kItalic;
}
-
+
FT_Done_Face(face);
FT_Done_FreeType(library);
return (SkTypeface::Style)style;
diff --git a/skia/ports/SkFontHost_android.cpp b/skia/ports/SkFontHost_android.cpp
index d7613c6..665c788 100644
--- a/skia/ports/SkFontHost_android.cpp
+++ b/skia/ports/SkFontHost_android.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/ports/SkFontHost_android.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -276,6 +276,7 @@ public:
virtual SkStream* openStream() = 0;
virtual void closeStream(SkStream*) = 0;
+ virtual const char* getUniqueString() const = 0;
private:
bool fIsSysFont;
@@ -301,7 +302,8 @@ public:
// overrides
virtual SkStream* openStream() { return fStream; }
virtual void closeStream(SkStream*) {}
-
+ virtual const char* getUniqueString() const { return NULL; }
+
private:
SkStream* fStream;
@@ -344,7 +346,14 @@ public:
{
SkDELETE(stream);
}
-
+ virtual const char* getUniqueString() const {
+ const char* str = strrchr(fPath.c_str(), '/');
+ if (str) {
+ str += 1; // skip the '/'
+ }
+ return str;
+ }
+
private:
SkString fPath;
@@ -387,8 +396,8 @@ static const char* gSansNames[] = {
};
static const char* gSerifNames[] = {
- "serif", "times", "times new roman", "palatino", "goudy",
- "fantasy", "cursive", NULL
+ "serif", "times", "times new roman", "palatino", "georgia", "baskerville",
+ "goudy", "fantasy", "cursive", "ITC Stone Serif", NULL
};
static const char* gMonoNames[] = {
@@ -479,6 +488,51 @@ static void load_system_fonts()
///////////////////////////////////////////////////////////////////////////////
+void SkFontHost::Serialize(const SkTypeface* face, SkWStream* stream) {
+ const char* name = ((FamilyTypeface*)face)->getUniqueString();
+
+ stream->write8((uint8_t)face->getStyle());
+
+ if (NULL == name || 0 == *name) {
+ stream->writePackedUInt(0);
+// SkDebugf("--- fonthost serialize null\n");
+ } else {
+ uint32_t len = strlen(name);
+ stream->writePackedUInt(len);
+ stream->write(name, len);
+// SkDebugf("--- fonthost serialize <%s> %d\n", name, face->getStyle());
+ }
+}
+
+SkTypeface* SkFontHost::Deserialize(SkStream* stream) {
+ load_system_fonts();
+
+ int style = stream->readU8();
+
+ int len = stream->readPackedUInt();
+ if (len > 0) {
+ SkString str;
+ str.resize(len);
+ stream->read(str.writable_str(), len);
+
+ const FontInitRec* rec = gSystemFonts;
+ for (size_t i = 0; i < SK_ARRAY_COUNT(gSystemFonts); i++) {
+ if (strcmp(rec[i].fFileName, str.c_str()) == 0) {
+ // backup until we hit the fNames
+ for (int j = i; j >= 0; --j) {
+ if (rec[j].fNames != NULL) {
+ return SkFontHost::FindTypeface(NULL, rec[j].fNames[0],
+ (SkTypeface::Style)style);
+ }
+ }
+ }
+ }
+ }
+ return SkFontHost::FindTypeface(NULL, NULL, (SkTypeface::Style)style);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
SkTypeface* SkFontHost::FindTypeface(const SkTypeface* familyFace,
const char familyName[],
SkTypeface::Style style)
@@ -495,6 +549,7 @@ SkTypeface* SkFontHost::FindTypeface(const SkTypeface* familyFace,
if (NULL != familyFace) {
tf = find_typeface(familyFace, style);
} else if (NULL != familyName) {
+// SkDebugf("======= familyName <%s>\n", familyName);
tf = find_typeface(familyName, style);
}
diff --git a/skia/ports/SkFontHost_gamma.cpp b/skia/ports/SkFontHost_gamma.cpp
index 28c7051..0b95bce 100644
--- a/skia/ports/SkFontHost_gamma.cpp
+++ b/skia/ports/SkFontHost_gamma.cpp
@@ -1,42 +1,95 @@
-
#include "SkFontHost.h"
#include <math.h>
+// define this to use pre-compiled tables for gamma. This is slightly faster,
+// and doesn't create any RW global memory, but means we cannot change the
+// gamma at runtime.
+#define USE_PREDEFINED_GAMMA_TABLES
+
+#ifndef USE_PREDEFINED_GAMMA_TABLES
+ // define this if you want to spew out the "C" code for the tables, given
+ // the current values for SK_BLACK_GAMMA and SK_WHITE_GAMMA.
+ #define DUMP_GAMMA_TABLESx
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+
+#ifdef USE_PREDEFINED_GAMMA_TABLES
+
+#include "sk_predefined_gamma.h"
+
+#else // use writable globals for gamma tables
+
+static bool gGammaIsBuilt;
+static uint8_t gBlackGamma[256], gWhiteGamma[256];
+
+#define SK_BLACK_GAMMA (1.4f)
+#define SK_WHITE_GAMMA (1/1.4f)
+
static void build_power_table(uint8_t table[], float ee)
{
-// printf("------ build_power_table %g\n", ee);
+ // printf("------ build_power_table %g\n", ee);
for (int i = 0; i < 256; i++)
{
float x = i / 255.f;
- // printf(" %d %g", i, x);
+ // printf(" %d %g", i, x);
x = powf(x, ee);
- // printf(" %g", x);
+ // printf(" %g", x);
int xx = SkScalarRound(SkFloatToScalar(x * 255));
- // printf(" %d\n", xx);
+ // printf(" %d\n", xx);
table[i] = SkToU8(xx);
}
}
-static bool gGammaIsBuilt;
-static uint8_t gBlackGamma[256], gWhiteGamma[256];
+#ifdef DUMP_GAMMA_TABLES
+
+#include "SkString.h"
-#define ANDROID_BLACK_GAMMA (1.4f)
-#define ANDROID_WHITE_GAMMA (1/1.4f)
+static void dump_a_table(const char name[], const uint8_t table[],
+ float gamma) {
+ SkDebugf("\n");
+ SkDebugf("\/\/ Gamma table for %g\n", gamma);
+ SkDebugf("static const uint8_t %s[] = {\n", name);
+ for (int y = 0; y < 16; y++) {
+ SkString line, tmp;
+ for (int x = 0; x < 16; x++) {
+ tmp.printf("0x%02X, ", *table++);
+ line.append(tmp);
+ }
+ SkDebugf(" %s\n", line.c_str());
+ }
+ SkDebugf("};\n");
+}
+
+#endif
+
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
void SkFontHost::GetGammaTables(const uint8_t* tables[2])
{
- // would be cleaner if these tables were precomputed and just linked in
+#ifndef USE_PREDEFINED_GAMMA_TABLES
if (!gGammaIsBuilt)
{
- build_power_table(gBlackGamma, ANDROID_BLACK_GAMMA);
- build_power_table(gWhiteGamma, ANDROID_WHITE_GAMMA);
+ build_power_table(gBlackGamma, SK_BLACK_GAMMA);
+ build_power_table(gWhiteGamma, SK_WHITE_GAMMA);
gGammaIsBuilt = true;
+
+#ifdef DUMP_GAMMA_TABLES
+ dump_a_table("gBlackGamma", gBlackGamma, SK_BLACK_GAMMA);
+ dump_a_table("gWhiteGamma", gWhiteGamma, SK_WHITE_GAMMA);
+#endif
}
+#endif
tables[0] = gBlackGamma;
tables[1] = gWhiteGamma;
}
+// If the luminance is <= this value, then apply the black gamma table
#define BLACK_GAMMA_THRESHOLD 0x40
+
+// If the luminance is >= this value, then apply the white gamma table
#define WHITE_GAMMA_THRESHOLD 0xC0
int SkFontHost::ComputeGammaFlag(const SkPaint& paint)
diff --git a/skia/ports/SkFontHost_linux.cpp b/skia/ports/SkFontHost_linux.cpp
new file mode 100644
index 0000000..f75718d
--- /dev/null
+++ b/skia/ports/SkFontHost_linux.cpp
@@ -0,0 +1,604 @@
+/* libs/graphics/ports/SkFontHost_android.cpp
+ **
+ ** Copyright 2006, The Android Open Source Project
+ **
+ ** Licensed under the Apache License, Version 2.0 (the "License");
+ ** you may not use this file except in compliance with the License.
+ ** You may obtain a copy of the License at
+ **
+ ** http://www.apache.org/licenses/LICENSE-2.0
+ **
+ ** Unless required by applicable law or agreed to in writing, software
+ ** distributed under the License is distributed on an "AS IS" BASIS,
+ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ** See the License for the specific language governing permissions and
+ ** limitations under the License.
+ */
+
+#include "SkFontHost.h"
+#include "SkDescriptor.h"
+#include "SkMMapStream.h"
+#include "SkOSFile.h"
+#include "SkPaint.h"
+#include "SkString.h"
+#include "SkStream.h"
+#include "SkThread.h"
+#include "SkTSearch.h"
+#include <stdio.h>
+
+#define FONT_CACHE_MEMORY_BUDGET (1 * 1024 * 1024)
+
+#ifndef SK_FONT_FILE_PREFIX
+ #define SK_FONT_FILE_PREFIX "/usr/share/fonts/truetype/msttcorefonts/"
+#endif
+
+SkTypeface::Style find_name_and_style(SkStream* stream, SkString* name);
+
+static void GetFullPathForSysFonts(SkString* full, const char name[])
+{
+ full->append(SK_FONT_FILE_PREFIX);
+ full->append(name);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+struct FamilyRec;
+
+/* This guy holds a mapping of a name -> family, used for looking up fonts.
+ Since it is stored in a stretchy array that doesn't preserve object
+ semantics, we don't use constructor/destructors, but just have explicit
+ helpers to manage our internal bookkeeping.
+ */
+struct NameFamilyPair {
+ const char* fName; // we own this
+ FamilyRec* fFamily; // we don't own this, we just reference it
+
+ void construct(const char name[], FamilyRec* family)
+ {
+ fName = strdup(name);
+ fFamily = family; // we don't own this, so just record the referene
+ }
+ void destruct()
+ {
+ free((char*)fName);
+ // we don't own family, so just ignore our reference
+ }
+};
+
+// we use atomic_inc to grow this for each typeface we create
+static int32_t gUniqueFontID;
+
+// this is the mutex that protects these globals
+static SkMutex gFamilyMutex;
+static FamilyRec* gFamilyHead;
+static SkTDArray<NameFamilyPair> gNameList;
+
+struct FamilyRec {
+ FamilyRec* fNext;
+ SkTypeface* fFaces[4];
+
+ FamilyRec()
+ {
+ fNext = gFamilyHead;
+ memset(fFaces, 0, sizeof(fFaces));
+ gFamilyHead = this;
+ }
+};
+
+static SkTypeface* find_best_face(const FamilyRec* family,
+ SkTypeface::Style style)
+{
+ SkTypeface* const* faces = family->fFaces;
+
+ if (faces[style] != NULL) { // exact match
+ return faces[style];
+ }
+ // look for a matching bold
+ style = (SkTypeface::Style)(style ^ SkTypeface::kItalic);
+ if (faces[style] != NULL) {
+ return faces[style];
+ }
+ // look for the plain
+ if (faces[SkTypeface::kNormal] != NULL) {
+ return faces[SkTypeface::kNormal];
+ }
+ // look for anything
+ for (int i = 0; i < 4; i++) {
+ if (faces[i] != NULL) {
+ return faces[i];
+ }
+ }
+ // should never get here, since the faces list should not be empty
+ SkASSERT(!"faces list is empty");
+ return NULL;
+}
+
+static FamilyRec* find_family(const SkTypeface* member)
+{
+ FamilyRec* curr = gFamilyHead;
+ while (curr != NULL) {
+ for (int i = 0; i < 4; i++) {
+ if (curr->fFaces[i] == member) {
+ return curr;
+ }
+ }
+ curr = curr->fNext;
+ }
+ return NULL;
+}
+
+static SkTypeface* resolve_uniqueID(uint32_t uniqueID)
+{
+ FamilyRec* curr = gFamilyHead;
+ while (curr != NULL) {
+ for (int i = 0; i < 4; i++) {
+ SkTypeface* face = curr->fFaces[i];
+ if (face != NULL && face->uniqueID() == uniqueID) {
+ return face;
+ }
+ }
+ curr = curr->fNext;
+ }
+ return NULL;
+}
+
+/* Remove reference to this face from its family. If the resulting family
+ is empty (has no faces), return that family, otherwise return NULL
+ */
+static FamilyRec* remove_from_family(const SkTypeface* face)
+{
+ FamilyRec* family = find_family(face);
+ SkASSERT(family->fFaces[face->style()] == face);
+ family->fFaces[face->style()] = NULL;
+
+ for (int i = 0; i < 4; i++) {
+ if (family->fFaces[i] != NULL) { // family is non-empty
+ return NULL;
+ }
+ }
+ return family; // return the empty family
+}
+
+// maybe we should make FamilyRec be doubly-linked
+static void detach_and_delete_family(FamilyRec* family)
+{
+ FamilyRec* curr = gFamilyHead;
+ FamilyRec* prev = NULL;
+
+ while (curr != NULL) {
+ FamilyRec* next = curr->fNext;
+ if (curr == family) {
+ if (prev == NULL) {
+ gFamilyHead = next;
+ } else {
+ prev->fNext = next;
+ }
+ SkDELETE(family);
+ return;
+ }
+ prev = curr;
+ curr = next;
+ }
+ SkASSERT(!"Yikes, couldn't find family in our list to remove/delete");
+}
+
+static FamilyRec* find_familyrec(const char name[]) {
+ const NameFamilyPair* list = gNameList.begin();
+ int index = SkStrLCSearch(&list[0].fName, gNameList.count(), name,
+ sizeof(list[0]));
+ return index >= 0 ? list[index].fFamily : NULL;
+}
+
+static SkTypeface* find_typeface(const char name[], SkTypeface::Style style) {
+ FamilyRec* rec = find_familyrec(name);
+ return rec ? find_best_face(rec, style) : NULL;
+}
+
+static SkTypeface* find_typeface(const SkTypeface* familyMember,
+ SkTypeface::Style style)
+{
+ const FamilyRec* family = find_family(familyMember);
+ return family ? find_best_face(family, style) : NULL;
+}
+
+static void add_name(const char name[], FamilyRec* family)
+{
+ SkAutoAsciiToLC tolc(name);
+ name = tolc.lc();
+
+ NameFamilyPair* list = gNameList.begin();
+ int count = gNameList.count();
+
+ int index = SkStrLCSearch(&list[0].fName, count, name, sizeof(list[0]));
+
+ if (index < 0) {
+ list = gNameList.insert(~index);
+ list->construct(name, family);
+ }
+}
+
+static void remove_from_names(FamilyRec* emptyFamily)
+{
+#ifdef SK_DEBUG
+ for (int i = 0; i < 4; i++) {
+ SkASSERT(emptyFamily->fFaces[i] == NULL);
+ }
+#endif
+
+ SkTDArray<NameFamilyPair>& list = gNameList;
+
+ // must go backwards when removing
+ for (int i = list.count() - 1; i >= 0; --i) {
+ NameFamilyPair* pair = &list[i];
+ if (pair->fFamily == emptyFamily) {
+ pair->destruct();
+ list.remove(i);
+ }
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+class FamilyTypeface : public SkTypeface {
+public:
+ FamilyTypeface(Style style, bool sysFont, FamilyRec* family)
+ : SkTypeface(style, sk_atomic_inc(&gUniqueFontID) + 1)
+ {
+ fIsSysFont = sysFont;
+
+ SkAutoMutexAcquire ac(gFamilyMutex);
+
+ if (NULL == family) {
+ family = SkNEW(FamilyRec);
+ }
+ family->fFaces[style] = this;
+ fFamilyRec = family; // just record it so we can return it if asked
+ }
+
+ virtual ~FamilyTypeface()
+ {
+ SkAutoMutexAcquire ac(gFamilyMutex);
+
+ // remove us from our family. If the family is now empty, we return
+ // that and then remove that family from the name list
+ FamilyRec* family = remove_from_family(this);
+ if (NULL != family) {
+ remove_from_names(family);
+ detach_and_delete_family(family);
+ }
+ }
+
+ bool isSysFont() const { return fIsSysFont; }
+ FamilyRec* getFamily() const { return fFamilyRec; }
+
+ virtual SkStream* openStream() = 0;
+ virtual void closeStream(SkStream*) = 0;
+ virtual const char* getUniqueString() const = 0;
+
+private:
+ FamilyRec* fFamilyRec; // we don't own this, just point to it
+ bool fIsSysFont;
+
+ typedef SkTypeface INHERITED;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
+class StreamTypeface : public FamilyTypeface {
+public:
+ StreamTypeface(Style style, bool sysFont, FamilyRec* family,
+ SkStream* stream)
+ : INHERITED(style, sysFont, family)
+ {
+ fStream = stream;
+ }
+ virtual ~StreamTypeface()
+ {
+ SkDELETE(fStream);
+ }
+
+ // overrides
+ virtual SkStream* openStream() { return fStream; }
+ virtual void closeStream(SkStream*) {}
+ virtual const char* getUniqueString() const { return NULL; }
+
+private:
+ SkStream* fStream;
+
+ typedef FamilyTypeface INHERITED;
+};
+
+class FileTypeface : public FamilyTypeface {
+public:
+ FileTypeface(Style style, bool sysFont, FamilyRec* family,
+ const char path[])
+ : INHERITED(style, sysFont, family) {
+ fPath.set(path);
+ }
+
+ // overrides
+ virtual SkStream* openStream()
+ {
+ SkStream* stream = SkNEW_ARGS(SkMMAPStream, (fPath.c_str()));
+
+ // check for failure
+ if (stream->getLength() <= 0) {
+ SkDELETE(stream);
+ // maybe MMAP isn't supported. try FILE
+ stream = SkNEW_ARGS(SkFILEStream, (fPath.c_str()));
+ if (stream->getLength() <= 0) {
+ SkDELETE(stream);
+ stream = NULL;
+ }
+ }
+ return stream;
+ }
+ virtual void closeStream(SkStream* stream)
+ {
+ SkDELETE(stream);
+ }
+ virtual const char* getUniqueString() const {
+ const char* str = strrchr(fPath.c_str(), '/');
+ if (str) {
+ str += 1; // skip the '/'
+ }
+ return str;
+ }
+
+private:
+ SkString fPath;
+
+ typedef FamilyTypeface INHERITED;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+
+static bool get_name_and_style(const char path[], SkString* name,
+ SkTypeface::Style* style)
+{
+ SkMMAPStream stream(path);
+ if (stream.getLength() > 0) {
+ *style = find_name_and_style(&stream, name);
+ return true;
+ }
+ else {
+ SkFILEStream stream(path);
+ if (stream.getLength() > 0) {
+ *style = find_name_and_style(&stream, name);
+ return true;
+ }
+ }
+
+ SkDebugf("---- failed to open <%s> as a font\n", path);
+ return false;
+}
+
+// these globals are assigned (once) by load_system_fonts()
+static SkTypeface* gFallBackTypeface;
+static FamilyRec* gDefaultFamily;
+static SkTypeface* gDefaultNormal;
+
+static void load_system_fonts()
+{
+ // check if we've already be called
+ if (NULL != gDefaultNormal) {
+ return;
+ }
+
+ SkOSFile::Iter iter(SK_FONT_FILE_PREFIX, ".ttf");
+ SkString name;
+
+ while (iter.next(&name, false)) {
+ SkString filename;
+ GetFullPathForSysFonts(&filename, name.c_str());
+// while (filename.size() == 0) { filename.set("/usr/share/fonts/truetype/msttcorefonts/Arial.ttf");
+
+ SkString realname;
+ SkTypeface::Style style;
+
+ if (!get_name_and_style(filename.c_str(), &realname, &style)) {
+ SkDebugf("------ can't load <%s> as a font\n", filename.c_str());
+ continue;
+ }
+
+// SkDebugf("font: <%s> %d <%s>\n", realname.c_str(), style, filename.c_str());
+
+ FamilyRec* family = find_familyrec(realname.c_str());
+ // this constructor puts us into the global gFamilyHead llist
+ FamilyTypeface* tf = SkNEW_ARGS(FileTypeface,
+ (style,
+ true, // system-font (cannot delete)
+ family, // what family to join
+ filename.c_str()) // filename
+ );
+
+ if (NULL == family) {
+ add_name(realname.c_str(), tf->getFamily());
+ }
+ }
+
+ // do this after all fonts are loaded. This is our default font, and it
+ // acts as a sentinel so we only execute load_system_fonts() once
+ static const char* gDefaultNames[] = {
+ "Arial", "Verdana", "Times New Roman", NULL
+ };
+ const char** names = gDefaultNames;
+ while (*names) {
+ SkTypeface* tf = find_typeface(*names++, SkTypeface::kNormal);
+ if (tf) {
+ gDefaultNormal = tf;
+ break;
+ }
+ }
+ // check if we found *something*
+ if (NULL == gDefaultNormal) {
+ if (NULL == gFamilyHead) {
+ sk_throw();
+ }
+ for (int i = 0; i < 4; i++) {
+ if ((gDefaultNormal = gFamilyHead->fFaces[i]) != NULL) {
+ break;
+ }
+ }
+ }
+ if (NULL == gDefaultNormal) {
+ sk_throw();
+ }
+ gFallBackTypeface = gDefaultNormal;
+ gDefaultFamily = find_family(gDefaultNormal);
+
+// SkDebugf("---- default %p head %p family %p\n", gDefaultNormal, gFamilyHead, gDefaultFamily);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void SkFontHost::Serialize(const SkTypeface* face, SkWStream* stream) {
+#if 0
+ const char* name = ((FamilyTypeface*)face)->getUniqueString();
+
+ stream->write8((uint8_t)face->getStyle());
+
+ if (NULL == name || 0 == *name) {
+ stream->writePackedUInt(0);
+ // SkDebugf("--- fonthost serialize null\n");
+ } else {
+ uint32_t len = strlen(name);
+ stream->writePackedUInt(len);
+ stream->write(name, len);
+ // SkDebugf("--- fonthost serialize <%s> %d\n", name, face->getStyle());
+ }
+#endif
+ sk_throw();
+}
+
+SkTypeface* SkFontHost::Deserialize(SkStream* stream) {
+#if 0
+ load_system_fonts();
+
+ int style = stream->readU8();
+
+ int len = stream->readPackedUInt();
+ if (len > 0) {
+ SkString str;
+ str.resize(len);
+ stream->read(str.writable_str(), len);
+
+ const FontInitRec* rec = gSystemFonts;
+ for (size_t i = 0; i < SK_ARRAY_COUNT(gSystemFonts); i++) {
+ if (strcmp(rec[i].fFileName, str.c_str()) == 0) {
+ // backup until we hit the fNames
+ for (int j = i; j >= 0; --j) {
+ if (rec[j].fNames != NULL) {
+ return SkFontHost::FindTypeface(NULL, rec[j].fNames[0],
+ (SkTypeface::Style)style);
+ }
+ }
+ }
+ }
+ }
+ return SkFontHost::FindTypeface(NULL, NULL, (SkTypeface::Style)style);
+#endif
+ sk_throw();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+SkTypeface* SkFontHost::FindTypeface(const SkTypeface* familyFace,
+ const char familyName[],
+ SkTypeface::Style style)
+{
+ load_system_fonts();
+
+ SkAutoMutexAcquire ac(gFamilyMutex);
+
+ // clip to legal style bits
+ style = (SkTypeface::Style)(style & SkTypeface::kBoldItalic);
+
+ SkTypeface* tf = NULL;
+
+ if (NULL != familyFace) {
+ tf = find_typeface(familyFace, style);
+ } else if (NULL != familyName) {
+ // SkDebugf("======= familyName <%s>\n", familyName);
+ tf = find_typeface(familyName, style);
+ }
+
+ if (NULL == tf) {
+ tf = find_best_face(gDefaultFamily, style);
+ }
+
+ return tf;
+}
+
+SkTypeface* SkFontHost::ResolveTypeface(uint32_t fontID)
+{
+ SkAutoMutexAcquire ac(gFamilyMutex);
+
+ return resolve_uniqueID(fontID);
+}
+
+SkStream* SkFontHost::OpenStream(uint32_t fontID)
+{
+
+ FamilyTypeface* tf = (FamilyTypeface*)SkFontHost::ResolveTypeface(fontID);
+ SkStream* stream = tf ? tf->openStream() : NULL;
+
+ if (NULL == stream || stream->getLength() == 0) {
+ delete stream;
+ stream = NULL;
+ }
+ return stream;
+}
+
+void SkFontHost::CloseStream(uint32_t fontID, SkStream* stream)
+{
+ FamilyTypeface* tf = (FamilyTypeface*)SkFontHost::ResolveTypeface(fontID);
+ if (NULL != tf) {
+ tf->closeStream(stream);
+ }
+}
+
+SkScalerContext* SkFontHost::CreateFallbackScalerContext(
+ const SkScalerContext::Rec& rec)
+{
+ load_system_fonts();
+
+ SkAutoDescriptor ad(sizeof(rec) + SkDescriptor::ComputeOverhead(1));
+ SkDescriptor* desc = ad.getDesc();
+
+ desc->init();
+ SkScalerContext::Rec* newRec =
+ (SkScalerContext::Rec*)desc->addEntry(kRec_SkDescriptorTag,
+ sizeof(rec), &rec);
+ newRec->fFontID = gFallBackTypeface->uniqueID();
+ desc->computeChecksum();
+
+ return SkFontHost::CreateScalerContext(desc);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+SkTypeface* SkFontHost::CreateTypeface(SkStream* stream)
+{
+ if (NULL == stream || stream->getLength() <= 0) {
+ SkDELETE(stream);
+ return NULL;
+ }
+
+ SkString name;
+ SkTypeface::Style style = find_name_and_style(stream, &name);
+
+ return SkNEW_ARGS(StreamTypeface, (style, false, NULL, stream));
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+size_t SkFontHost::ShouldPurgeFontCache(size_t sizeAllocatedSoFar)
+{
+ if (sizeAllocatedSoFar > FONT_CACHE_MEMORY_BUDGET)
+ return sizeAllocatedSoFar - FONT_CACHE_MEMORY_BUDGET;
+ else
+ return 0; // nothing to do
+}
+
diff --git a/skia/ports/SkFontHost_mac.cpp b/skia/ports/SkFontHost_mac.cpp
new file mode 100644
index 0000000..9e1151c
--- /dev/null
+++ b/skia/ports/SkFontHost_mac.cpp
@@ -0,0 +1,562 @@
+/*
+ ** Copyright 2006, The Android Open Source Project
+ **
+ ** Licensed under the Apache License, Version 2.0 (the "License");
+ ** you may not use this file except in compliance with the License.
+ ** You may obtain a copy of the License at
+ **
+ ** http://www.apache.org/licenses/LICENSE-2.0
+ **
+ ** Unless required by applicable law or agreed to in writing, software
+ ** distributed under the License is distributed on an "AS IS" BASIS,
+ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ** See the License for the specific language governing permissions and
+ ** limitations under the License.
+*/
+
+#include "SkFontHost.h"
+#include "SkDescriptor.h"
+
+// Give 1MB font cache budget
+#define FONT_CACHE_MEMORY_BUDGET (1024 * 1024)
+
+const char* gDefaultfont = "Arial"; // hard code for now
+static SkMutex gFTMutex;
+
+inline SkPoint F32PtToSkPoint(const Float32Point p)
+{
+ SkPoint sp = { SkFloatToFixed(p.x),SkFloatToFixed(p.y) };
+ return sp;
+}
+
+static inline uint32_t _rotl(uint32_t v, uint32_t r)
+{
+ return (v << r | v >> (32 - r));
+}
+
+// This will generate a unique ID based on the fontname + fontstyle
+// and also used by upper layer
+uint32_t FontFaceChecksum(const char *name,SkTypeface::Style style)
+{
+ if (!name) return style;
+
+ char* q = (char*)name;
+
+ // From "Performance in Practice of String Hashing Functions"
+ // Ramakrishna & Zobel
+ const uint32_t L = 5;
+ const uint32_t R = 2;
+
+ uint32_t h = 0x12345678;
+ while (*q) {
+ uint32_t ql = tolower(*q);
+ h ^= ((h << L) + (h >> R) + ql);
+ q ++;
+ }
+
+ // add style
+ h = _rotl(h, 3) ^ style;
+
+ return h;
+}
+
+#pragma mark -
+struct SkFaceRec {
+ SkFaceRec* fNext;
+ uint32_t fRefCnt;
+ ATSUFontID fFontID;
+ ATSUStyle fStyle;
+
+ SkFaceRec() : fFontID(0), fRefCnt(0), fStyle(NULL) {};
+
+ ~SkFaceRec() {
+ if (fStyle) {
+ ::ATSUDisposeStyle(fStyle);
+ fStyle = NULL;
+ }
+ }
+
+ uint32_t ref() {
+ return ++fRefCnt;
+ }
+};
+
+// Font Face list
+static SkFaceRec* gFaceRecHead = NULL;
+
+static SkFaceRec* find_ft_face(const ATSUFontID fontID) {
+ SkFaceRec* rec = gFaceRecHead;
+ while (rec) {
+ if (rec->fFontID == fontID) {
+ return rec;
+ }
+ rec = rec->fNext;
+ }
+
+ return NULL;
+}
+
+static SkFaceRec* insert_ft_face(const ATSUFontID afontID, const ATSUStyle atsuStyle) {
+ SkFaceRec* rec = find_ft_face(afontID);
+ if (rec) {
+ return rec; // found?
+ }
+
+ rec = SkNEW(SkFaceRec);
+ rec->fFontID = afontID;
+ rec->fStyle = atsuStyle;
+ rec->fNext = gFaceRecHead;
+ gFaceRecHead = rec;
+
+ return rec;
+}
+
+static void unref_ft_face(const ATSUFontID fontID) {
+
+ SkFaceRec* rec = gFaceRecHead;
+ SkFaceRec* prev = NULL;
+ while (rec) {
+ SkFaceRec* next = rec->fNext;
+ if (rec->fFontID == fontID) {
+ if (--rec->fRefCnt == 0) {
+ if (prev)
+ prev->fNext = next;
+ else
+ gFaceRecHead = next;
+
+ SkDELETE(rec);
+ }
+ return;
+ }
+ prev = rec;
+ rec = next;
+ }
+ SkASSERT("shouldn't get here, face not in list");
+}
+
+#pragma mark -
+
+// have to do this because SkTypeface::SkTypeface() is protected
+class SkTypeface_Mac : public SkTypeface {
+public:
+ SkTypeface_Mac(SkTypeface::Style style, uint32_t id) : SkTypeface(style, id) {}
+
+ ~SkTypeface_Mac() {}
+};
+
+#pragma mark -
+
+static SkTypeface* CreateTypeface_(const char *name, const SkTypeface::Style style) {
+
+ OSStatus err;
+ ATSUStyle atsuStyle;
+ ::ATSUCreateStyle(&atsuStyle);
+ if (name != NULL) {
+ static const ATSUAttributeTag fontTag = kATSUFontTag;
+ static const ByteCount fontTagSize = sizeof(ATSUFontID);
+
+ ATSUFontID fontID = 0;
+#if 1
+ err = ::ATSUFindFontFromName(
+ name,strlen(name),kFontNoNameCode, /* instead of regular, kFontFamilyName returns bold and/or italic sometimes, but why this works?? */
+ kFontMacintoshPlatform,kFontNoScriptCode,kFontNoLanguageCode,&fontID);
+#else
+ CFStringRef cfontName = CFStringCreateWithCString(NULL, name, kCFStringEncodingASCII);
+ ATSFontRef fontRef = ::ATSFontFindFromName(cfontName,kATSOptionFlagsDefault);
+ fontID = ::FMGetFontFromATSFontRef(fontRef);
+ CFRelease(cfontName);
+#endif
+ if (0 != fontID) {
+ const ATSUAttributeValuePtr values[] = { &fontID };
+ err = ::ATSUSetAttributes(atsuStyle,1,&fontTag,&fontTagSize,values);
+ }
+ else {
+ }
+ }
+ if (style != SkTypeface::kNormal) {
+ Boolean fontItalic = ((style & SkTypeface::kItalic) != 0);
+ Boolean fontBold = ((style & SkTypeface::kBold) != 0);
+ const ATSUAttributeTag tags[2] = { kATSUQDBoldfaceTag, kATSUQDItalicTag };
+ const ATSUAttributeValuePtr values[2] = { &fontBold, &fontItalic };
+ const ByteCount sizes[2] = { sizeof(Boolean), sizeof(Boolean) };
+ err = ::ATSUSetAttributes(atsuStyle,2,tags,sizes,values);
+ }
+
+ uint32_t cs = FontFaceChecksum(name,style);
+ SkTypeface_Mac* ptypeface = new SkTypeface_Mac(style,cs);
+
+ if (NULL == ptypeface) {
+ SkASSERT(false);
+ return NULL;
+ }
+
+ SkFaceRec* rec = insert_ft_face(cs, atsuStyle);
+ SkASSERT(rec);
+
+ return ptypeface;
+}
+
+static SkTypeface* CreateTypeface_(const SkFaceRec* rec, const SkTypeface::Style style) {
+
+ OSStatus err;
+ ATSUStyle atsuStyle;
+ err = ::ATSUCreateAndCopyStyle(rec->fStyle, &atsuStyle);
+
+ Boolean fontItalic = ((style & SkTypeface::kItalic) != 0);
+ Boolean fontBold = ((style & SkTypeface::kBold) != 0);
+ const ATSUAttributeTag tags[2] = { kATSUQDBoldfaceTag, kATSUQDItalicTag };
+ const ATSUAttributeValuePtr values[2] = { &fontBold, &fontItalic };
+ const ByteCount sizes[2] = { sizeof(Boolean), sizeof(Boolean) };
+ err = ::ATSUSetAttributes(atsuStyle,2,tags,sizes,values);
+
+ // get old font id and name
+ ATSUFontID fontID = 0;
+ ByteCount actual = 0;
+ err = ::ATSUGetAttribute(rec->fStyle,kATSUFontTag,sizeof(ATSUFontID),&fontID,&actual);
+
+ ByteCount actualLength = 0;
+ char *fontname = NULL;
+ err = ::ATSUFindFontName(fontID , kFontFamilyName, kFontUnicodePlatform, kFontNoScriptCode,
+ kFontNoLanguageCode , 0 , NULL , &actualLength , NULL );
+ if ( err == noErr)
+ {
+ actualLength += 1 ;
+ fontname = (char*)malloc( actualLength );
+ err = ::ATSUFindFontName(fontID, kFontFamilyName, kFontUnicodePlatform, kFontNoScriptCode,
+ kFontNoLanguageCode, actualLength, fontname , NULL, NULL);
+ }
+
+ SkTypeface_Mac* ptypeface = NULL;
+ if (fontname == NULL) {
+ ptypeface = new SkTypeface_Mac(style,rec->fFontID);
+ return ptypeface;
+ }
+ else {
+ uint32_t cs = FontFaceChecksum(fontname,style);
+ ptypeface = new SkTypeface_Mac(style, cs);
+
+ if (NULL == ptypeface) {
+ SkASSERT(false);
+ return NULL;
+ }
+
+ free(fontname);
+
+ insert_ft_face(cs,atsuStyle);
+ }
+ return ptypeface;
+}
+
+#pragma mark -
+
+class SkScalerContext_Mac : public SkScalerContext {
+public:
+ SkScalerContext_Mac(const SkDescriptor* desc);
+ virtual ~SkScalerContext_Mac();
+
+protected:
+ virtual unsigned generateGlyphCount() const;
+ virtual uint16_t generateCharToGlyph(SkUnichar uni);
+ virtual void generateAdvance(SkGlyph* glyph);
+ virtual void generateMetrics(SkGlyph* glyph);
+ virtual void generateImage(const SkGlyph& glyph);
+ virtual void generatePath(const SkGlyph& glyph, SkPath* path);
+ virtual void generateLineHeight(SkPoint* ascent, SkPoint* descent);
+ virtual void generateFontMetrics(SkPaint::FontMetrics* mX, SkPaint::FontMetrics* mY);
+ virtual SkDeviceContext getDC() { return NULL; } // not implemented on Mac
+
+private:
+ ATSUTextLayout fLayout;
+ ATSUStyle fStyle;
+
+ static OSStatus MoveTo(const Float32Point *pt, void *cb);
+ static OSStatus Line(const Float32Point *pt, void *cb);
+ static OSStatus Curve(const Float32Point *pt1, const Float32Point *pt2, const Float32Point *pt3, void *cb);
+ static OSStatus Close(void *cb);
+};
+
+SkScalerContext_Mac::SkScalerContext_Mac(const SkDescriptor* desc)
+ : SkScalerContext(desc), fLayout(0), fStyle(0)
+{
+ SkAutoMutexAcquire ac(gFTMutex);
+ OSStatus err;
+
+ SkFaceRec* rec = find_ft_face(fRec.fFontID);
+ if (rec) {
+ rec->ref();
+ err = ::ATSUCreateAndCopyStyle(rec->fStyle, &fStyle);
+ }
+ else {
+ SkASSERT(false);
+ // create a default
+ err = ::ATSUCreateStyle(&fStyle);
+ }
+
+ uint32_t size = SkFixedFloor(fRec.fTextSize);
+ Fixed fixedSize = IntToFixed(size);
+ static const ATSUAttributeTag sizeTag = kATSUSizeTag;
+ static const ByteCount sizeTagSize = sizeof(Fixed);
+ const ATSUAttributeValuePtr values[] = { &fixedSize };
+ err = ::ATSUSetAttributes(fStyle,1,&sizeTag,&sizeTagSize,values);
+
+ err = ::ATSUCreateTextLayout(&fLayout);
+}
+
+SkScalerContext_Mac::~SkScalerContext_Mac()
+{
+ unref_ft_face(fRec.fFontID);
+
+ ::ATSUDisposeTextLayout(fLayout);
+ ::ATSUDisposeStyle(fStyle);
+}
+
+unsigned SkScalerContext_Mac::generateGlyphCount() const
+{
+ return 0xFFFF;
+}
+
+uint16_t SkScalerContext_Mac::generateCharToGlyph(SkUnichar uni)
+{
+ SkAutoMutexAcquire ac(gFTMutex);
+
+ OSStatus err;
+ UniChar achar = uni;
+ err = ::ATSUSetTextPointerLocation(fLayout,&achar,0,1,1);
+ err = ::ATSUSetRunStyle(fLayout,fStyle,kATSUFromTextBeginning,kATSUToTextEnd);
+
+ ATSLayoutRecord *layoutPtr;
+ ItemCount count;
+ ATSGlyphRef glyph;
+
+ err = ::ATSUDirectGetLayoutDataArrayPtrFromTextLayout(fLayout,0,kATSUDirectDataLayoutRecordATSLayoutRecordCurrent,(void**)&layoutPtr,&count);
+ glyph = layoutPtr->glyphID;
+ ::ATSUDirectReleaseLayoutDataArrayPtr(NULL,kATSUDirectDataLayoutRecordATSLayoutRecordCurrent,(void**)&layoutPtr);
+ return glyph;
+}
+
+void SkScalerContext_Mac::generateAdvance(SkGlyph* glyph) {
+ this->generateMetrics(glyph);
+}
+
+void SkScalerContext_Mac::generateMetrics(SkGlyph* glyph)
+{
+ GlyphID glyphID = glyph->fID;
+ ATSGlyphScreenMetrics metrics= { 0 };
+
+ glyph->fRsbDelta = 0;
+ glyph->fLsbDelta = 0;
+
+ OSStatus err = ATSUGlyphGetScreenMetrics(fStyle,1,&glyphID,0,true,true,&metrics);
+ if (err == noErr) {
+ glyph->fAdvanceX = SkFloatToFixed(metrics.deviceAdvance.x);
+ glyph->fAdvanceY = SkFloatToFixed(metrics.deviceAdvance.y);
+ //glyph->fWidth = metrics.width;
+ //glyph->fHeight = metrics.height;
+ glyph->fWidth = metrics.width + ceil(metrics.sideBearing.x - metrics.otherSideBearing.x);
+ glyph->fHeight = metrics.height + ceil(metrics.sideBearing.y - metrics.otherSideBearing.y) + 1;
+
+ glyph->fTop = -metrics.topLeft.y;
+ glyph->fLeft = metrics.topLeft.x;
+ }
+}
+
+void SkScalerContext_Mac::generateFontMetrics(SkPaint::FontMetrics* mx, SkPaint::FontMetrics* my) {
+ //SkASSERT(false);
+ if (mx)
+ memset(mx, 0, sizeof(SkPaint::FontMetrics));
+ if (my)
+ memset(my, 0, sizeof(SkPaint::FontMetrics));
+ return;
+}
+
+void SkScalerContext_Mac::generateImage(const SkGlyph& glyph)
+{
+ SkAutoMutexAcquire ac(gFTMutex);
+
+ GlyphID glyphID = glyph.fID;
+ ATSGlyphScreenMetrics metrics= { 0 };
+
+ SkASSERT(fLayout);
+ OSStatus err = ::ATSUGlyphGetScreenMetrics(fStyle,1,&glyphID,0,true,true,&metrics);
+
+// uint32_t w = metrics.width;
+// uint32_t h = metrics.height;
+// uint32_t pitch = (w + 3) & ~0x3;
+// if (pitch != glyph.rowBytes()) {
+// SkASSERT(false); // it's different from previously cacluated in generateMetrics(), so the size of glyph.fImage buffer is incorrect!
+// }
+
+ CGColorSpaceRef greyColorSpace = ::CGColorSpaceCreateWithName(kCGColorSpaceGenericGray);
+ CGContextRef contextRef = ::CGBitmapContextCreate((uint8_t*)glyph.fImage, glyph.fWidth, glyph.fHeight, 8, glyph.rowBytes(), greyColorSpace, kCGImageAlphaNone);
+ if (!contextRef) {
+ SkASSERT(false);
+ return;
+ }
+
+ ::CGContextSetFillColorSpace(contextRef, greyColorSpace);
+ ::CGContextSetStrokeColorSpace(contextRef, greyColorSpace);
+
+ ::CGContextSetGrayFillColor(contextRef, 0.0, 1.0);
+ ::CGContextFillRect(contextRef, ::CGRectMake(0, 0, glyph.fWidth, glyph.fHeight));
+
+ ::CGContextSetGrayFillColor(contextRef, 1.0, 1.0);
+ ::CGContextSetGrayStrokeColor(contextRef, 1.0, 1.0);
+ ::CGContextSetTextDrawingMode(contextRef, kCGTextFill);
+
+ ATSUAttributeTag tag = kATSUCGContextTag;
+ ByteCount size = sizeof(CGContextRef);
+ ATSUAttributeValuePtr value = &contextRef;
+ err = ::ATSUSetLayoutControls(fLayout,1,&tag,&size,&value);
+ err = ::ATSUDrawText(fLayout,kATSUFromTextBeginning,kATSUToTextEnd,FloatToFixed(-metrics.topLeft.x),FloatToFixed(glyph.fHeight-metrics.topLeft.y));
+ ::CGContextRelease(contextRef);
+}
+
+void SkScalerContext_Mac::generatePath(const SkGlyph& glyph, SkPath* path)
+{
+ SkAutoMutexAcquire ac(gFTMutex);
+ OSStatus err,result;
+
+ err = ::ATSUGlyphGetCubicPaths(
+ fStyle,glyph.fID,
+ &SkScalerContext_Mac::MoveTo,
+ &SkScalerContext_Mac::Line,
+ &SkScalerContext_Mac::Curve,
+ &SkScalerContext_Mac::Close,
+ path,&result);
+ SkASSERT(err == noErr);
+}
+
+void SkScalerContext_Mac::generateLineHeight(SkPoint* ascent, SkPoint* descent)
+{
+ ATSUTextMeasurement textAscent, textDescent;
+ ByteCount actual = 0;
+ OSStatus err = ::ATSUGetAttribute(fStyle,kATSULineAscentTag,sizeof(ATSUTextMeasurement),&textAscent,&actual);
+ ascent->set(0,textAscent);
+ err = ::ATSUGetAttribute(fStyle,kATSULineDescentTag,sizeof(ATSUTextMeasurement),&textDescent,&actual);
+ descent->set(0,textDescent);
+}
+
+OSStatus SkScalerContext_Mac::MoveTo(const Float32Point *pt, void *cb)
+{
+ reinterpret_cast<SkPath*>(cb)->moveTo(F32PtToSkPoint(*pt));
+ return noErr;
+}
+
+OSStatus SkScalerContext_Mac::Line(const Float32Point *pt, void *cb)
+{
+ reinterpret_cast<SkPath*>(cb)->lineTo(F32PtToSkPoint(*pt));
+ return noErr;
+}
+
+OSStatus SkScalerContext_Mac::Curve(const Float32Point *pt1, const Float32Point *pt2, const Float32Point *pt3, void *cb)
+{
+ reinterpret_cast<SkPath*>(cb)->cubicTo(F32PtToSkPoint(*pt1),F32PtToSkPoint(*pt2),F32PtToSkPoint(*pt3));
+ return noErr;
+}
+
+OSStatus SkScalerContext_Mac::Close(void *cb)
+{
+ reinterpret_cast<SkPath*>(cb)->close();
+ return noErr;
+}
+
+#pragma mark -
+
+void SkFontHost::Serialize(const SkTypeface* face, SkWStream* stream) {
+ SkASSERT(!"SkFontHost::Serialize unimplemented");
+}
+
+SkTypeface* SkFontHost::Deserialize(SkStream* stream) {
+ SkASSERT(!"SkFontHost::Deserialize unimplemented");
+ return NULL;
+}
+
+SkTypeface* SkFontHost::CreateTypeface(SkStream* stream) {
+
+ //Should not be used on Mac, keep linker happy
+ SkASSERT(false);
+ return CreateTypeface_(gDefaultfont,SkTypeface::kNormal);
+}
+
+SkScalerContext* SkFontHost::CreateScalerContext(const SkDescriptor* desc)
+{
+ return new SkScalerContext_Mac(desc);
+}
+
+SkScalerContext* SkFontHost::CreateFallbackScalerContext(const SkScalerContext::Rec& rec)
+{
+ SkAutoDescriptor ad(sizeof(rec) + sizeof(gDefaultfont) + SkDescriptor::ComputeOverhead(2));
+ SkDescriptor* desc = ad.getDesc();
+
+ desc->init();
+ SkScalerContext::Rec* newRec =
+ (SkScalerContext::Rec*)desc->addEntry(kRec_SkDescriptorTag, sizeof(rec), &rec);
+
+ CreateTypeface_(gDefaultfont,SkTypeface::kNormal);
+ newRec->fFontID = FontFaceChecksum(gDefaultfont,SkTypeface::kNormal);
+ desc->computeChecksum();
+
+ return SkFontHost::CreateScalerContext(desc);
+}
+
+
+ /** Return the closest matching typeface given either an existing family
+ (specified by a typeface in that family) or by a familyName, and a
+ requested style.
+ 1) If familyFace is null, use famillyName.
+ 2) If famillyName is null, use familyFace.
+ 3) If both are null, return the default font that best matches style
+ This MUST not return NULL.
+ */
+
+SkTypeface* SkFontHost::FindTypeface(const SkTypeface* familyFace, const char familyName[], SkTypeface::Style style) {
+
+ SkAutoMutexAcquire ac(gFTMutex);
+
+ // clip to legal style bits
+ style = (SkTypeface::Style)(style & SkTypeface::kBoldItalic);
+
+ SkTypeface* tf = NULL;
+
+ if (NULL == familyFace && NULL == familyName) {
+ tf = CreateTypeface_(gDefaultfont,style);
+ }
+ else {
+ if (NULL != familyFace) {
+ uint32_t id = familyFace->uniqueID();
+ SkFaceRec* rec = find_ft_face(id);
+ if (!rec) {
+ SkASSERT(false);
+ tf = CreateTypeface_(gDefaultfont,style);
+ }
+ else {
+ tf = CreateTypeface_(rec,style);
+ }
+ }
+ else {
+ tf = CreateTypeface_(familyName,style);
+ }
+ }
+
+ if (NULL == tf) {
+ tf = CreateTypeface_(gDefaultfont,style);
+ }
+ return tf;
+
+}
+
+size_t SkFontHost::ShouldPurgeFontCache(size_t sizeAllocatedSoFar) {
+ if (sizeAllocatedSoFar > FONT_CACHE_MEMORY_BUDGET)
+ return sizeAllocatedSoFar - FONT_CACHE_MEMORY_BUDGET;
+ else
+ return 0; // nothing to do
+}
+
+int SkFontHost::ComputeGammaFlag(const SkPaint& paint) {
+ return 0;
+}
+
+void SkFontHost::GetGammaTables(const uint8_t* tables[2]) {
+ tables[0] = NULL; // black gamma (e.g. exp=1.4)
+ tables[1] = NULL; // white gamma (e.g. exp= 1/1.4)
+}
diff --git a/skia/ports/SkFontHost_none.cpp b/skia/ports/SkFontHost_none.cpp
index 4e75abc..b45cf16 100644
--- a/skia/ports/SkFontHost_none.cpp
+++ b/skia/ports/SkFontHost_none.cpp
@@ -1,4 +1,4 @@
-/* Copyright 2006-2008, Google Inc.
+/* Copyright 2006-2008, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -17,74 +17,66 @@
SkTypeface* SkFontHost::FindTypeface(const SkTypeface* familyFace,
const char famillyName[],
- SkTypeface::Style style)
-{
+ SkTypeface::Style style) {
SkASSERT(!"SkFontHost::FindTypeface unimplemented");
return NULL;
}
-SkTypeface* SkFontHost::ResolveTypeface(uint32_t uniqueID)
-{
+SkTypeface* SkFontHost::ResolveTypeface(uint32_t uniqueID) {
SkASSERT(!"SkFontHost::ResolveTypeface unimplemented");
return NULL;
}
-SkStream* SkFontHost::OpenStream(uint32_t uniqueID)
-{
+SkStream* SkFontHost::OpenStream(uint32_t uniqueID) {
SkASSERT(!"SkFontHost::OpenStream unimplemented");
return NULL;
}
-void SkFontHost::CloseStream(uint32_t uniqueID, SkStream*)
-{
+void SkFontHost::CloseStream(uint32_t uniqueID, SkStream*) {
SkASSERT(!"SkFontHost::CloseStream unimplemented");
}
-SkTypeface* SkFontHost::CreateTypeface(SkStream*)
-{
+SkTypeface* SkFontHost::CreateTypeface(SkStream*) {
SkASSERT(!"SkFontHost::CreateTypeface unimplemented");
return NULL;
}
///////////////////////////////////////////////////////////////////////////////
-SkScalerContext* SkFontHost::CreateScalerContext(const SkDescriptor* desc)
-{
+void SkFontHost::Serialize(const SkTypeface* face, SkWStream* stream) {
+ SkASSERT(!"SkFontHost::Serialize unimplemented");
+}
+
+SkTypeface* SkFontHost::Deserialize(SkStream* stream) {
+ SkASSERT(!"SkFontHost::Deserialize unimplemented");
+ return NULL;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+SkScalerContext* SkFontHost::CreateScalerContext(const SkDescriptor* desc) {
SkASSERT(!"SkFontHost::CreateScalarContext unimplemented");
return NULL;
}
-SkScalerContext* SkFontHost::CreateFallbackScalerContext(const SkScalerContext::Rec&)
-{
+SkScalerContext* SkFontHost::CreateFallbackScalerContext(
+ const SkScalerContext::Rec&) {
SkASSERT(!"SkFontHost::CreateFallbackScalerContext unimplemented");
return NULL;
}
///////////////////////////////////////////////////////////////////////////////
-size_t SkFontHost::ShouldPurgeFontCache(size_t sizeAllocatedSoFar)
-{
+size_t SkFontHost::ShouldPurgeFontCache(size_t sizeAllocatedSoFar) {
return 0; // nothing to do (change me if you want to limit the font cache)
}
-int SkFontHost::ComputeGammaFlag(const SkPaint& paint)
-{
+int SkFontHost::ComputeGammaFlag(const SkPaint& paint) {
return 0;
}
-void SkFontHost::GetGammaTables(const uint8_t* tables[2])
-{
+void SkFontHost::GetGammaTables(const uint8_t* tables[2]) {
tables[0] = NULL; // black gamma (e.g. exp=1.4)
tables[1] = NULL; // white gamma (e.g. exp= 1/1.4)
}
-///////////////////////////////////////////////////////////////////////////////
-
-SkTypeface* SkFontHost::Deserialize(SkStream* stream) {
- SkASSERT(!"SkFontHost::Deserialize unimplemented");
- return NULL;
-}
-
-void SkFontHost::Serialize(const SkTypeface*, SkWStream*) {
- SkASSERT(!"SkFontHost::Serialize unimplemented");
-}
diff --git a/skia/ports/SkFontHost_win.cpp b/skia/ports/SkFontHost_win.cpp
index d66297a..4df55c9 100644
--- a/skia/ports/SkFontHost_win.cpp
+++ b/skia/ports/SkFontHost_win.cpp
@@ -1,12 +1,32 @@
-/* libs/graphics/ports/SkFontHost_win.cpp
+/*
-**
+ ** Copyright 2006, The Android Open Source Project
-** Copyright 2006, Google Inc.
+ **
-**
+ ** Licensed under the Apache License, Version 2.0 (the "License");
-*/
+ ** you may not use this file except in compliance with the License.
+
+ ** You may obtain a copy of the License at
+
+ **
+
+ ** http://www.apache.org/licenses/LICENSE-2.0
+
+ **
+
+ ** Unless required by applicable law or agreed to in writing, software
+
+ ** distributed under the License is distributed on an "AS IS" BASIS,
+
+ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+
+ ** See the License for the specific language governing permissions and
+
+ ** limitations under the License.
+
+ */
@@ -32,11 +52,19 @@
-static SkMutex gFTMutex;
+// client3d has to undefine this for now
+
+#define CAN_USE_LOGFONT_NAME
+
+
+static SkMutex gFTMutex;
-static LOGFONT gDefaultFont;
+
+// these globals are loaded (once) by get_default_font()
+
+static LOGFONT gDefaultFont = {0};
@@ -46,15 +74,13 @@ static uint8_t glyphbuf[BUFFERSIZE];
-#ifndef SK_FONTKEY
+// Give 1MB font cache budget
- #define SK_FONTKEY "Windows Font Key"
-
-#endif
+#define FONT_CACHE_MEMORY_BUDGET (1024 * 1024)
-inline FIXED SkFixedToFIXED(SkFixed x) {
+static inline FIXED SkFixedToFIXED(SkFixed x) {
return *(FIXED*)(&x);
@@ -62,81 +88,257 @@ inline FIXED SkFixedToFIXED(SkFixed x) {
-class FontFaceRec_Typeface : public SkTypeface {
+static inline FIXED SkScalarToFIXED(SkScalar x) {
+
+ return SkFixedToFIXED(SkScalarToFixed(x));
+
+}
-public:
-#if 0
- FontFaceRec_Typeface(const LOGFONT& face) : fFace(face)
+// This will generate a unique ID based on the fontname + fontstyle
- {
+// and also used by upper layer
- int style = 0;
+uint32_t FontFaceChecksum(const TCHAR *q, SkTypeface::Style style)
- if (face.lfWeight == FW_SEMIBOLD || face.lfWeight == FW_DEMIBOLD || face.lfWeight == FW_BOLD)
+{
+
+ if (!q) return style;
- style |= SkTypeface::kBold;
+
- if (face.lfItalic)
+ // From "Performance in Practice of String Hashing Functions"
- style |= SkTypeface::kItalic;
+ // Ramakrishna & Zobel
- this->setStyle((SkTypeface::Style)style);
+ const uint32_t L = 5;
+
+ const uint32_t R = 2;
+
+
+
+ uint32_t h = 0x12345678;
+
+ while (*q) {
+
+ //uint32_t ql = tolower(*q);
+
+ h ^= ((h << L) + (h >> R) + *q);
+
+ q ++;
}
-#endif
+
- ~FontFaceRec_Typeface() {};
+ // add style
+ h = _rotl(h, 3) ^ style;
+
- TCHAR* GetFontName() { return fFace.lfFaceName; }
+ return h;
+}
- SkTypeface::Style GetFontStyle() {
- int style = SkTypeface::kNormal;
+static SkTypeface::Style GetFontStyle(const LOGFONT& lf) {
- if (fFace.lfWeight == FW_SEMIBOLD || fFace.lfWeight == FW_DEMIBOLD || fFace.lfWeight == FW_BOLD)
+ int style = SkTypeface::kNormal;
- style |= SkTypeface::kBold;
+ if (lf.lfWeight == FW_SEMIBOLD || lf.lfWeight == FW_DEMIBOLD || lf.lfWeight == FW_BOLD)
- if (fFace.lfItalic)
+ style |= SkTypeface::kBold;
- style |= SkTypeface::kItalic;
+ if (lf.lfItalic)
+ style |= SkTypeface::kItalic;
+
- return (SkTypeface::Style)style;
+ return (SkTypeface::Style)style;
- }
+}
+
+
+
+struct SkFaceRec {
+
+ SkFaceRec* fNext;
+
+ uint32_t fRefCnt;
+
+ uint32_t fFontID; // checksum of fFace
+
+ LOGFONT fFace;
+
+
+
+ SkFaceRec() : fFontID(-1), fRefCnt(0) {
+ memset(&fFace, 0, sizeof(LOGFONT));
+ }
+
+ ~SkFaceRec() {}
- long GetFontSize() { return fFace.lfHeight; }
+
+ uint32_t ref() {
+ return ++fRefCnt;
- LOGFONT fFace;
+ }
};
+// Font Face list
+static SkFaceRec* gFaceRecHead = NULL;
-static const LOGFONT* get_default_font()
-{
+
+static SkFaceRec* find_ft_face(uint32_t fontID) {
+
+ SkFaceRec* rec = gFaceRecHead;
+
+ while (rec) {
+
+ if (rec->fFontID == fontID) {
+
+ return rec;
+
+ }
+
+ rec = rec->fNext;
+
+ }
+
+
+
+ return NULL;
+
+}
+
+
+
+static SkFaceRec* insert_ft_face(const LOGFONT& lf) {
+
+ // need a const char*
+
+ uint32_t id = FontFaceChecksum(&(lf.lfFaceName[0]), GetFontStyle(lf));
+
+ SkFaceRec* rec = find_ft_face(id);
+
+ if (rec) {
+
+ return rec; // found?
+
+ }
+
+
+
+ rec = SkNEW(SkFaceRec);
+
+ rec->fFontID = id;
+
+ memcpy(&(rec->fFace), &lf, sizeof(LOGFONT));
+
+ rec->fNext = gFaceRecHead;
+
+ gFaceRecHead = rec;
+
+
+
+ return rec;
+
+}
+
+
+
+static void unref_ft_face(uint32_t fontID) {
+
+
+
+ SkFaceRec* rec = gFaceRecHead;
+
+ SkFaceRec* prev = NULL;
+
+ while (rec) {
+
+ SkFaceRec* next = rec->fNext;
+
+ if (rec->fFontID == fontID) {
+
+ if (--rec->fRefCnt == 0) {
+
+ if (prev)
+
+ prev->fNext = next;
+
+ else
+
+ gFaceRecHead = next;
+
+
+
+ SkDELETE(rec);
+
+ }
+
+ return;
+
+ }
+
+ prev = rec;
+
+ rec = next;
+
+ }
+
+ SkASSERT("shouldn't get here, face not in list");
+
+}
+
+
+
+// have to do this because SkTypeface::SkTypeface() is protected
+
+class FontFaceRec_Typeface : public SkTypeface {
+
+public:
+
+
+
+ FontFaceRec_Typeface(Style style, uint32_t id) : SkTypeface(style, id) {};
+
+
+
+ virtual ~FontFaceRec_Typeface() {};
+
+};
+
+
+
+static const LOGFONT* get_default_font() {
// don't hardcode on Windows, Win2000, XP, Vista, and international all have different default
// and the user could change too
+
+
+ if (gDefaultFont.lfFaceName[0] != 0) {
+
+ return &gDefaultFont;
+ }
+
+
NONCLIENTMETRICS ncm;
@@ -144,11 +346,11 @@ static const LOGFONT* get_default_font()
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
-
+
memcpy(&gDefaultFont, &(ncm.lfMessageFont), sizeof(LOGFONT));
-
+
return &gDefaultFont;
@@ -156,33 +358,33 @@ static const LOGFONT* get_default_font()
-static uint32_t FontFaceChecksum(const LOGFONT& face)
-
-{
-
- uint32_t cs = 0;
+static SkTypeface* CreateTypeface_(const LOGFONT& lf) {
- uint32_t bytesize = sizeof(LOGFONT);
+
- bytesize >>= 2;
+ SkTypeface::Style style = GetFontStyle(lf);
- uint32_t *p32 = (uint32_t*)&face;
+ FontFaceRec_Typeface* ptypeface = new FontFaceRec_Typeface(style, FontFaceChecksum(lf.lfFaceName, style));
+
+ if (NULL == ptypeface) {
- while (bytesize) {
+ SkASSERT(false);
- bytesize --;
+ return NULL;
- cs ^= *p32;
+ }
- p32 ++;
+
- }
+ SkFaceRec* rec = insert_ft_face(lf);
+ SkASSERT(rec);
+
- return cs;
+ return ptypeface;
}
@@ -196,7 +398,7 @@ public:
virtual ~SkScalerContext_Windows();
-
+
protected:
@@ -204,6 +406,8 @@ protected:
virtual uint16_t generateCharToGlyph(SkUnichar uni);
+ virtual void generateAdvance(SkGlyph* glyph);
+
virtual void generateMetrics(SkGlyph* glyph);
virtual void generateImage(const SkGlyph& glyph);
@@ -212,43 +416,77 @@ protected:
virtual void generateLineHeight(SkPoint* ascent, SkPoint* descent);
+ virtual void generateFontMetrics(SkPaint::FontMetrics* mX, SkPaint::FontMetrics* mY);
+ //virtual SkDeviceContext getDC() {return ddc;}
private:
- LOGFONT* plf;
+ uint32_t fFontID;
+
+ LOGFONT lf;
MAT2 mat22;
-};
+ HDC ddc;
+ HFONT savefont;
+ HFONT font;
-SkScalerContext_Windows::SkScalerContext_Windows(const SkDescriptor* desc)
+};
- : SkScalerContext(desc), plf(NULL)
-{
+
+SkScalerContext_Windows::SkScalerContext_Windows(const SkDescriptor* desc) : SkScalerContext(desc), ddc(0), font(0), savefont(0) {
SkAutoMutexAcquire ac(gFTMutex);
+
+ fFontID = fRec.fFontID;
- const LOGFONT** face = (const LOGFONT**)desc->findEntry(kTypeface_SkDescriptorTag, NULL);
+ SkFaceRec* rec = find_ft_face(fRec.fFontID);
- plf = (LOGFONT*)*face;
+ if (rec) {
- SkASSERT(plf);
+ rec->ref();
-
+ memcpy(&lf, &(rec->fFace), sizeof(LOGFONT));
- mat22.eM11 = SkFixedToFIXED(fRec.fPost2x2[0][0]);
+ }
+
+ else {
- mat22.eM12 = SkFixedToFIXED(-fRec.fPost2x2[0][1]);
+ SkASSERT(false);
- mat22.eM21 = SkFixedToFIXED(fRec.fPost2x2[1][0]);
+ memcpy(&lf, &gDefaultFont, sizeof(LOGFONT));
- mat22.eM22 = SkFixedToFIXED(-fRec.fPost2x2[1][1]);
+ }
+
+
+
+ mat22.eM11 = SkScalarToFIXED(fRec.fPost2x2[0][0]);
+
+ mat22.eM12 = SkScalarToFIXED(-fRec.fPost2x2[0][1]);
+
+ mat22.eM21 = SkScalarToFIXED(fRec.fPost2x2[1][0]);
+
+ mat22.eM22 = SkScalarToFIXED(-fRec.fPost2x2[1][1]);
+
+
+
+ ddc = ::CreateCompatibleDC(NULL);
+
+ SetBkMode(ddc, TRANSPARENT);
+
+
+
+ lf.lfHeight = SkScalarFloor(fRec.fTextSize);
+
+ font = CreateFontIndirect(&lf);
+
+ savefont = (HFONT)SelectObject(ddc, font);
}
@@ -256,6 +494,26 @@ SkScalerContext_Windows::SkScalerContext_Windows(const SkDescriptor* desc)
SkScalerContext_Windows::~SkScalerContext_Windows() {
+ unref_ft_face(fFontID);
+
+
+
+ if (ddc) {
+
+ ::SelectObject(ddc, savefont);
+
+ ::DeleteDC(ddc);
+
+ ddc = NULL;
+
+ }
+
+ if (font) {
+
+ ::DeleteObject(font);
+
+ }
+
}
@@ -264,7 +522,7 @@ unsigned SkScalerContext_Windows::generateGlyphCount() const {
return 0xFFFF;
-// return fFace->num_glyphs;
+ // return fFace->num_glyphs;
}
@@ -272,35 +530,37 @@ unsigned SkScalerContext_Windows::generateGlyphCount() const {
uint16_t SkScalerContext_Windows::generateCharToGlyph(SkUnichar uni) {
+
+ //uint16_t index = 0;
- // let's just use the uni as index on Windows
-
- return SkToU16(uni);
-
-}
+ //GetGlyphIndicesW(ddc, &(uint16_t&)uni, 1, &index, 0);
+ //return index;
+
-void SkScalerContext_Windows::generateMetrics(SkGlyph* glyph) {
+ // let's just use the uni as index on Windows
+ return SkToU16(uni);
+}
- HDC ddc = ::CreateCompatibleDC(NULL);
- SetBkMode(ddc, TRANSPARENT);
+void SkScalerContext_Windows::generateAdvance(SkGlyph* glyph) {
+ this->generateMetrics(glyph);
- SkASSERT(plf);
+}
- plf->lfHeight = -SkFixedFloor(fRec.fTextSize);
+void SkScalerContext_Windows::generateMetrics(SkGlyph* glyph) {
- HFONT font = CreateFontIndirect(plf);
+
- HFONT oldfont = (HFONT)SelectObject(ddc, font);
+ SkASSERT(ddc);
@@ -308,19 +568,23 @@ void SkScalerContext_Windows::generateMetrics(SkGlyph* glyph) {
memset(&gm, 0, sizeof(gm));
-
+
glyph->fRsbDelta = 0;
glyph->fLsbDelta = 0;
+
+
+ UINT glyphIndexFlag = 0; //glyph->fIsCodePoint ? 0 : GGO_GLYPH_INDEX;
+ // UINT glyphIndexFlag = GGO_GLYPH_INDEX;
// Note: need to use GGO_GRAY8_BITMAP instead of GGO_METRICS because GGO_METRICS returns a smaller
// BlackBlox; we need the bigger one in case we need the image. fAdvance is the same.
- uint32_t ret = GetGlyphOutlineW(ddc, glyph->f_GlyphID, GGO_GRAY8_BITMAP, &gm, 0, NULL, &mat22);
+ uint32_t ret = GetGlyphOutlineW(ddc, glyph->getGlyphID(0), GGO_GRAY8_BITMAP | glyphIndexFlag, &gm, 0, NULL, &mat22);
@@ -338,63 +602,91 @@ void SkScalerContext_Windows::generateMetrics(SkGlyph* glyph) {
glyph->fHeight = gm.gmBlackBoxY;
- glyph->fTop = gm.gmptGlyphOrigin.y - gm.gmBlackBoxY;
+ glyph->fTop = SkToS16(gm.gmptGlyphOrigin.y - gm.gmBlackBoxY);
- glyph->fLeft = gm.gmptGlyphOrigin.x;
+ glyph->fLeft = SkToS16(gm.gmptGlyphOrigin.x);
glyph->fAdvanceX = SkIntToFixed(gm.gmCellIncX);
glyph->fAdvanceY = -SkIntToFixed(gm.gmCellIncY);
+ } else {
+
+ glyph->fWidth = 0;
+
}
+
+#if 0
- ::SelectObject(ddc, oldfont);
+ char buf[1024];
- ::DeleteObject(font);
+ sprintf(buf, "generateMetrics: id:%d, w=%d, h=%d, font:%s, fh:%d\n", glyph->fID, glyph->fWidth, glyph->fHeight, lf.lfFaceName, lf.lfHeight);
- ::DeleteDC(ddc);
+ OutputDebugString(buf);
+
+#endif
}
-void SkScalerContext_Windows::generateImage(const SkGlyph& glyph) {
+void SkScalerContext_Windows::generateFontMetrics(SkPaint::FontMetrics* mx, SkPaint::FontMetrics* my) {
+ //SkASSERT(false);
+ if (mx)
- SkAutoMutexAcquire ac(gFTMutex);
+ memset(mx, 0, sizeof(SkPaint::FontMetrics));
+ if (my)
+ memset(my, 0, sizeof(SkPaint::FontMetrics));
- SkASSERT(plf);
+ return;
+}
- HDC ddc = ::CreateCompatibleDC(NULL);
- SetBkMode(ddc, TRANSPARENT);
+void SkScalerContext_Windows::generateImage(const SkGlyph& glyph) {
+
+ SkAutoMutexAcquire ac(gFTMutex);
- plf->lfHeight = -SkFixedFloor(fRec.fTextSize);
+
+ SkASSERT(ddc);
+
- HFONT font = CreateFontIndirect(plf);
+ GLYPHMETRICS gm;
- HFONT oldfont = (HFONT)SelectObject(ddc, font);
+ memset(&gm, 0, sizeof(gm));
+
+
+#if 0
+ char buf[1024];
- GLYPHMETRICS gm;
+ sprintf(buf, "generateImage: id:%d, w=%d, h=%d, font:%s,fh:%d\n", glyph.fID, glyph.fWidth, glyph.fHeight, lf.lfFaceName, lf.lfHeight);
- memset(&gm, 0, sizeof(gm));
+ OutputDebugString(buf);
+#endif
+
+
+ uint32_t bytecount = 0;
- uint32_t total_size = GetGlyphOutlineW(ddc, glyph.f_GlyphID, GGO_GRAY8_BITMAP, &gm, 0, NULL, &mat22);
+ UINT glyphIndexFlag = 0; //glyph.fIsCodePoint ? 0 : GGO_GLYPH_INDEX;
+
+ // UINT glyphIndexFlag = GGO_GLYPH_INDEX;
+
+ uint32_t total_size = GetGlyphOutlineW(ddc, glyph.fID, GGO_GRAY8_BITMAP | glyphIndexFlag, &gm, 0, NULL, &mat22);
if (GDI_ERROR != total_size && total_size > 0) {
@@ -402,25 +694,37 @@ void SkScalerContext_Windows::generateImage(const SkGlyph& glyph) {
if (NULL != pBuff) {
- total_size = GetGlyphOutlineW(ddc, glyph.f_GlyphID, GGO_GRAY8_BITMAP, &gm, total_size, pBuff, &mat22);
+ total_size = GetGlyphOutlineW(ddc, glyph.fID, GGO_GRAY8_BITMAP | glyphIndexFlag, &gm, total_size, pBuff, &mat22);
-
+
SkASSERT(total_size != GDI_ERROR);
+
+
+ SkASSERT(glyph.fWidth == gm.gmBlackBoxX);
+ SkASSERT(glyph.fHeight == gm.gmBlackBoxY);
+
+
uint8_t* dst = (uint8_t*)glyph.fImage;
uint32_t pitch = (gm.gmBlackBoxX + 3) & ~0x3;
+ if (pitch != glyph.rowBytes()) {
+
+ SkASSERT(false); // glyph.fImage has different rowsize!?
+ }
+
+
for (int32_t y = gm.gmBlackBoxY - 1; y >= 0; y--) {
uint8_t* src = pBuff + pitch * y;
-
+
for (uint32_t x = 0; x < gm.gmBlackBoxX; x++) {
@@ -440,11 +744,17 @@ void SkScalerContext_Windows::generateImage(const SkGlyph& glyph) {
src++;
+ bytecount++;
+
}
- }
+ memset(dst, 0, glyph.rowBytes() - glyph.fWidth);
+
+ dst += glyph.rowBytes() - glyph.fWidth;
+ }
+
delete[] pBuff;
@@ -452,17 +762,11 @@ void SkScalerContext_Windows::generateImage(const SkGlyph& glyph) {
}
-
+
SkASSERT(GDI_ERROR != total_size && total_size >= 0);
-
-
- ::SelectObject(ddc, oldfont);
-
- ::DeleteObject(font);
-
- ::DeleteDC(ddc);
+
}
@@ -470,91 +774,85 @@ void SkScalerContext_Windows::generateImage(const SkGlyph& glyph) {
void SkScalerContext_Windows::generatePath(const SkGlyph& glyph, SkPath* path) {
-
+
SkAutoMutexAcquire ac(gFTMutex);
-
+
SkASSERT(&glyph && path);
+ SkASSERT(ddc);
-
- SkASSERT(plf);
-
-
+
path->reset();
+
+#if 0
- HDC ddc = ::CreateCompatibleDC(NULL);
-
- SetBkMode(ddc, TRANSPARENT);
-
-
-
- plf->lfHeight = -SkFixedFloor(fRec.fTextSize);
-
-
+ char buf[1024];
- HFONT font = CreateFontIndirect(plf);
+ sprintf(buf, "generatePath: id:%d, w=%d, h=%d, font:%s,fh:%d\n", glyph.fID, glyph.fWidth, glyph.fHeight, lf.lfFaceName, lf.lfHeight);
- HFONT oldfont = (HFONT)SelectObject(ddc, font);
+ OutputDebugString(buf);
+#endif
+
GLYPHMETRICS gm;
+ UINT glyphIndexFlag = 0; //glyph.fIsCodePoint ? 0 : GGO_GLYPH_INDEX;
+ uint32_t total_size = GetGlyphOutlineW(ddc, glyph.fID, GGO_NATIVE | glyphIndexFlag, &gm, BUFFERSIZE, glyphbuf, &mat22);
- uint32_t total_size = GetGlyphOutlineW(ddc, glyph.f_GlyphID, GGO_NATIVE, &gm, BUFFERSIZE, glyphbuf, &mat22);
-
-
+
if (GDI_ERROR != total_size) {
-
+
const uint8_t* cur_glyph = glyphbuf;
const uint8_t* end_glyph = glyphbuf + total_size;
-
+
while(cur_glyph < end_glyph) {
const TTPOLYGONHEADER* th = (TTPOLYGONHEADER*)cur_glyph;
-
+
const uint8_t* end_poly = cur_glyph + th->cb;
const uint8_t* cur_poly = cur_glyph + sizeof(TTPOLYGONHEADER);
-
+
- path->moveTo(*(SkFixed*)(&th->pfxStart.x), *(SkFixed*)(&th->pfxStart.y));
+ path->moveTo(SkFixedToScalar(*(SkFixed*)(&th->pfxStart.x)), SkFixedToScalar(*(SkFixed*)(&th->pfxStart.y)));
-
+
while(cur_poly < end_poly) {
const TTPOLYCURVE* pc = (const TTPOLYCURVE*)cur_poly;
-
+
if (pc->wType == TT_PRIM_LINE) {
for (uint16_t i = 0; i < pc->cpfx; i++) {
- path->lineTo(*(SkFixed*)(&pc->apfx[i].x), *(SkFixed*)(&pc->apfx[i].y));
+ path->lineTo(SkFixedToScalar(*(SkFixed*)(&pc->apfx[i].x)), SkFixedToScalar(*(SkFixed*)(&pc->apfx[i].y)));
}
}
-
+
if (pc->wType == TT_PRIM_QSPLINE) {
@@ -564,7 +862,7 @@ void SkScalerContext_Windows::generatePath(const SkGlyph& glyph, SkPath* path) {
POINTFX pnt_c = pc->apfx[u+1];
-
+
if (u < pc->cpfx - 2) { // If not on last spline, compute C
@@ -574,9 +872,9 @@ void SkScalerContext_Windows::generatePath(const SkGlyph& glyph, SkPath* path) {
}
+
-
- path->quadTo(*(SkFixed*)(&pnt_b.x), *(SkFixed*)(&pnt_b.y), *(SkFixed*)(&pnt_c.x), *(SkFixed*)(&pnt_c.y));
+ path->quadTo(SkFixedToScalar(*(SkFixed*)(&pnt_b.x)), SkFixedToScalar(*(SkFixed*)(&pnt_b.y)), SkFixedToScalar(*(SkFixed*)(&pnt_c.x)), SkFixedToScalar(*(SkFixed*)(&pnt_c.y)));
}
@@ -588,6 +886,8 @@ void SkScalerContext_Windows::generatePath(const SkGlyph& glyph, SkPath* path) {
cur_glyph += th->cb;
+ path->close();
+
}
}
@@ -598,17 +898,11 @@ void SkScalerContext_Windows::generatePath(const SkGlyph& glyph, SkPath* path) {
}
+ //char buf[1024];
+ //sprintf(buf, "generatePath: count:%d\n", count);
- path->close();
-
-
-
- ::SelectObject(ddc, oldfont);
-
- ::DeleteObject(font);
-
- ::DeleteDC(ddc);
+ //OutputDebugString(buf);
}
@@ -620,33 +914,19 @@ void SkScalerContext_Windows::generatePath(const SkGlyph& glyph, SkPath* path) {
void SkScalerContext_Windows::generateLineHeight(SkPoint* ascent, SkPoint* descent) {
+
+ SkASSERT(ddc);
- HDC ddc = ::CreateCompatibleDC(NULL);
-
- SetBkMode(ddc, TRANSPARENT);
-
-
-
- SkASSERT(plf);
-
- plf->lfHeight = -SkFixedFloor(fRec.fTextSize);
-
-
-
- HFONT font = CreateFontIndirect(plf);
-
- HFONT oldfont = (HFONT)SelectObject(ddc, font);
-
-
+
OUTLINETEXTMETRIC otm;
-
+
uint32_t ret = GetOutlineTextMetrics(ddc, sizeof(otm), &otm);
-
+
if (sizeof(otm) == ret) {
@@ -660,15 +940,7 @@ void SkScalerContext_Windows::generateLineHeight(SkPoint* ascent, SkPoint* desce
}
-
-
- ::SelectObject(ddc, oldfont);
-
- ::DeleteObject(font);
-
- ::DeleteDC(ddc);
-
-
+
return;
@@ -676,213 +948,237 @@ void SkScalerContext_Windows::generateLineHeight(SkPoint* ascent, SkPoint* desce
-SkTypeface* SkFontHost::CreateTypeface( const SkTypeface* familyFace, const char familyName[], SkTypeface::Style style) {
-
-
-
- FontFaceRec_Typeface* ptypeface = new FontFaceRec_Typeface;
+void SkFontHost::Serialize(const SkTypeface* face, SkWStream* stream) {
+ SkASSERT(!"SkFontHost::Serialize unimplemented");
+}
- if (NULL == ptypeface) {
- SkASSERT(false);
- return NULL;
+SkTypeface* SkFontHost::Deserialize(SkStream* stream) {
- }
+ SkASSERT(!"SkFontHost::Deserialize unimplemented");
+ return NULL;
+}
- memset(&ptypeface->fFace, 0, sizeof(LOGFONT));
+SkTypeface* SkFontHost::CreateTypeface(SkStream* stream) {
- // default
+
- ptypeface->fFace.lfHeight = -11; // default
+ //Should not be used on Windows, keep linker happy
- ptypeface->fFace.lfWeight = (style & SkTypeface::kBold) != 0 ? FW_BOLD : FW_NORMAL ;
+ SkASSERT(false);
- ptypeface->fFace.lfItalic = ((style & SkTypeface::kItalic) != 0);
+ get_default_font();
- ptypeface->fFace.lfQuality = PROOF_QUALITY;
+ return CreateTypeface_(gDefaultFont);
+}
- _tcscpy(ptypeface->fFace.lfFaceName, familyName);
+SkScalerContext* SkFontHost::CreateScalerContext(const SkDescriptor* desc) {
+ return SkNEW_ARGS(SkScalerContext_Windows, (desc));
+}
- return ptypeface;
-}
+SkScalerContext* SkFontHost::CreateFallbackScalerContext(const SkScalerContext::Rec& rec) {
+ get_default_font();
+
-uint32_t SkFontHost::FlattenTypeface(const SkTypeface* tface, void* buffer) {
+ SkAutoDescriptor ad(sizeof(rec) + sizeof(gDefaultFont) + SkDescriptor::ComputeOverhead(2));
- const LOGFONT* face;
+ SkDescriptor* desc = ad.getDesc();
- if (tface)
+ desc->init();
- face = &((const FontFaceRec_Typeface*)tface)->fFace;
+ SkScalerContext::Rec* newRec =
- else
+ (SkScalerContext::Rec*)desc->addEntry(kRec_SkDescriptorTag, sizeof(rec), &rec);
- face = get_default_font();
+
+ get_default_font();
+ CreateTypeface_(gDefaultFont);
- size_t size = sizeof(face);
+ newRec->fFontID = FontFaceChecksum(gDefaultFont.lfFaceName, GetFontStyle(gDefaultFont));
+ desc->computeChecksum();
+
- size += sizeof(uint32_t);
+ return SkFontHost::CreateScalerContext(desc);
+}
- if (buffer) {
- uint8_t* buf = (uint8_t*)buffer;
+/** Return the closest matching typeface given either an existing family
- memcpy(buf, &face, sizeof(face));
+ (specified by a typeface in that family) or by a familyName, and a
- uint32_t cs = FontFaceChecksum(*face);
+ requested style.
+ 1) If familyFace is null, use famillyName.
+ 2) If famillyName is null, use familyFace.
- memcpy(buf+sizeof(face), &cs, sizeof(cs));
+ 3) If both are null, return the default font that best matches style
- }
+ This MUST not return NULL.
+ */
- return size;
-}
+SkTypeface* SkFontHost::FindTypeface(const SkTypeface* familyFace, const char familyName[], SkTypeface::Style style) {
+
+ SkAutoMutexAcquire ac(gFTMutex);
-SkScalerContext* SkFontHost::CreateScalerContext(const SkDescriptor* desc) {
- return SkNEW_ARGS(SkScalerContext_Windows, (desc));
-}
+#ifndef CAN_USE_LOGFONT_NAME
+ familyName = NULL;
+ familyFace = NULL;
-void SkFontHost::GetDescriptorKeyString(const SkDescriptor* desc, SkString* keyString) {
+#endif
- const LOGFONT** face = (const LOGFONT**)desc->findEntry(kTypeface_SkDescriptorTag, NULL);
- LOGFONT*lf = (LOGFONT*)*face;
- keyString->set(SK_FONTKEY);
+ // clip to legal style bits
- if (lf) {
+ style = (SkTypeface::Style)(style & SkTypeface::kBoldItalic);
- keyString->append(lf->lfFaceName);
+
- }
+ SkTypeface* tf = NULL;
-}
+ if (NULL == familyFace && NULL == familyName) {
+ LOGFONT lf;
+ get_default_font();
-SkScalerContext* SkFontHost::CreateFallbackScalerContext(const SkScalerContext::Rec& rec) {
+ memcpy(&lf, &gDefaultFont, sizeof(LOGFONT));
- const LOGFONT* face = get_default_font();
+ lf.lfWeight = (style & SkTypeface::kBold) != 0 ? FW_BOLD : FW_NORMAL ;
+ lf.lfItalic = ((style & SkTypeface::kItalic) != 0);
+ tf = CreateTypeface_(lf);
- SkAutoDescriptor ad(sizeof(rec) + sizeof(face) + SkDescriptor::ComputeOverhead(2));
+ } else {
- SkDescriptor* desc = ad.getDesc();
+#ifdef CAN_USE_LOGFONT_NAME
+ LOGFONT lf;
+ if (NULL != familyFace) {
- desc->init();
+ uint32_t id = familyFace->uniqueID();
- desc->addEntry(kRec_SkDescriptorTag, sizeof(rec), &rec);
+ SkFaceRec* rec = find_ft_face(id);
- desc->addEntry(kTypeface_SkDescriptorTag, sizeof(face), &face);
+ if (!rec) {
- desc->computeChecksum();
+ SkASSERT(false);
+ get_default_font();
+ memcpy(&lf, &gDefaultFont, sizeof(LOGFONT));
- return SkFontHost::CreateScalerContext(desc);
+ }
-}
+ else {
+ memcpy(&lf, &(rec->fFace), sizeof(LOGFONT));
+ }
-SkStream* SkFontHost::OpenDescriptorStream(const SkDescriptor* desc, const char keyString[]) {
+ }
- SkASSERT(!"SkFontHost::OpenDescriptorStream unimplemented");
+ else {
- return NULL;
+ memset(&lf, 0, sizeof(LOGFONT));
-}
+
+ lf.lfHeight = -11; // default
+ lf.lfQuality = PROOF_QUALITY;
-uint32_t SkFontHost::TypefaceHash(const SkTypeface* face) {
+ lf.lfCharSet = DEFAULT_CHARSET;
-
+
-// FontFaceRec_Typeface *ptypeface = dynamic_cast<FontFaceRec_Typeface*>(face);
+ _tcsncpy(lf.lfFaceName, familyName, LF_FACESIZE);
- FontFaceRec_Typeface *ptypeface = (FontFaceRec_Typeface*)(face);
+ lf.lfFaceName[LF_FACESIZE-1] = '\0';
- SkASSERT(ptypeface);
+ }
+
+ // use the style desired
- return FontFaceChecksum(ptypeface->fFace);
+ lf.lfWeight = (style & SkTypeface::kBold) != 0 ? FW_BOLD : FW_NORMAL ;
-}
+ lf.lfItalic = ((style & SkTypeface::kItalic) != 0);
+ tf = CreateTypeface_(lf);
+#endif
-bool SkFontHost::TypefaceEqual(const SkTypeface* facea, const SkTypeface* faceb) {
+ }
-
- FontFaceRec_Typeface *ptypefaceA = (FontFaceRec_Typeface*)facea;
- SkASSERT(ptypefaceA);
+ if (NULL == tf) {
+ get_default_font();
+ tf = CreateTypeface_(gDefaultFont);
- FontFaceRec_Typeface *ptypefaceB = (FontFaceRec_Typeface*)faceb;
+ }
- SkASSERT(ptypefaceB);
+ return tf;
+}
- if (_tcscmp(ptypefaceA->GetFontName(), ptypefaceB->GetFontName())) return false;
- if (ptypefaceA->GetFontStyle() != ptypefaceB->GetFontStyle()) return false;
+size_t SkFontHost::ShouldPurgeFontCache(size_t sizeAllocatedSoFar) {
- if (ptypefaceA->GetFontSize() != ptypefaceB->GetFontSize()) return false;
+ if (sizeAllocatedSoFar > FONT_CACHE_MEMORY_BUDGET)
+ return sizeAllocatedSoFar - FONT_CACHE_MEMORY_BUDGET;
+ else
- return true;
+ return 0; // nothing to do
}
-int SkFontHost::ComputeGammaFlag(const SkPaint& paint)
-
-{
+int SkFontHost::ComputeGammaFlag(const SkPaint& paint) {
return 0;
@@ -890,9 +1186,7 @@ int SkFontHost::ComputeGammaFlag(const SkPaint& paint)
-void SkFontHost::GetGammaTables(const uint8_t* tables[2])
-
-{
+void SkFontHost::GetGammaTables(const uint8_t* tables[2]) {
tables[0] = NULL; // black gamma (e.g. exp=1.4)
diff --git a/skia/ports/SkGlobals_global.cpp b/skia/ports/SkGlobals_global.cpp
index f5f48ef..d87568b 100644
--- a/skia/ports/SkGlobals_global.cpp
+++ b/skia/ports/SkGlobals_global.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/ports/SkGlobals_global.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/ports/SkImageDecoder_Factory.cpp b/skia/ports/SkImageDecoder_Factory.cpp
index 67d4dcb..d5d7b3f 100644
--- a/skia/ports/SkImageDecoder_Factory.cpp
+++ b/skia/ports/SkImageDecoder_Factory.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/ports/SkImageDecoder_Factory.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -19,19 +19,12 @@
#include "SkMovie.h"
#include "SkStream.h"
-//#define USE_PV_FOR_JPEG
-
extern SkImageDecoder* SkImageDecoder_GIF_Factory(SkStream*);
extern SkImageDecoder* SkImageDecoder_BMP_Factory(SkStream*);
extern SkImageDecoder* SkImageDecoder_ICO_Factory(SkStream*);
extern SkImageDecoder* SkImageDecoder_PNG_Factory(SkStream*);
extern SkImageDecoder* SkImageDecoder_WBMP_Factory(SkStream*);
-#ifdef USE_PV_FOR_JPEG
- extern SkImageDecoder* SkImageDecoder_PVJPEG_Factory(SkStream*);
-#else
- extern SkImageDecoder* SkImageDecoder_JPEG_Factory(SkStream*);
-#endif
-
+extern SkImageDecoder* SkImageDecoder_JPEG_Factory(SkStream*);
typedef SkImageDecoder* (*SkImageDecoderFactoryProc)(SkStream*);
@@ -46,12 +39,7 @@ static const CodecFormat gPairs[] = {
{ SkImageDecoder_ICO_Factory, SkImageDecoder::kICO_Format },
{ SkImageDecoder_WBMP_Factory, SkImageDecoder::kWBMP_Format },
{ SkImageDecoder_BMP_Factory, SkImageDecoder::kBMP_Format },
- // jpeg must be last, as it doesn't have a good sniffer yet
-#ifdef USE_PV_FOR_JPEG
- { SkImageDecoder_PVJPEG_Factory, SkImageDecoder::kJPEG_Format }
-#else
{ SkImageDecoder_JPEG_Factory, SkImageDecoder::kJPEG_Format }
-#endif
};
SkImageDecoder* SkImageDecoder::Factory(SkStream* stream) {
diff --git a/skia/ports/SkImageRef_ashmem.cpp b/skia/ports/SkImageRef_ashmem.cpp
index ef5fc58..1bb65c4 100644
--- a/skia/ports/SkImageRef_ashmem.cpp
+++ b/skia/ports/SkImageRef_ashmem.cpp
@@ -37,7 +37,10 @@ SkImageRef_ashmem::SkImageRef_ashmem(SkStream* stream,
SkImageRef_ashmem::~SkImageRef_ashmem() {
fCT->safeUnref();
+ this->closeFD();
+}
+void SkImageRef_ashmem::closeFD() {
if (-1 != fRec.fFD) {
#ifdef DUMP_ASHMEM_LIFECYCLE
SkDebugf("=== ashmem close %d\n", fRec.fFD);
@@ -46,6 +49,7 @@ SkImageRef_ashmem::~SkImageRef_ashmem() {
SkASSERT(fRec.fSize);
munmap(fRec.fAddr, fRec.fSize);
close(fRec.fFD);
+ fRec.fFD = -1;
}
}
@@ -136,6 +140,7 @@ bool SkImageRef_ashmem::onDecode(SkImageDecoder* codec, SkStream* stream,
ashmem_unpin_region(fRec.fFD, 0, 0);
fRec.fPinned = false;
}
+ this->closeFD();
return false;
}
}
@@ -183,13 +188,16 @@ void* SkImageRef_ashmem::onLockPixels(SkColorTable** ct) {
void SkImageRef_ashmem::onUnlockPixels() {
this->INHERITED::onUnlockPixels();
- SkASSERT(-1 != fRec.fFD);
- SkASSERT(fRec.fAddr);
- SkASSERT(fRec.fPinned);
-
- ashmem_unpin_region(fRec.fFD, 0, 0);
- fRec.fPinned = false;
+ if (-1 != fRec.fFD) {
+ SkASSERT(fRec.fAddr);
+ SkASSERT(fRec.fPinned);
+
+ ashmem_unpin_region(fRec.fFD, 0, 0);
+ fRec.fPinned = false;
+ }
+ // we clear this with or without an error, since we've either closed or
+ // unpinned the region
fBitmap.setPixels(NULL, NULL);
}
diff --git a/skia/ports/SkImageRef_ashmem.h b/skia/ports/SkImageRef_ashmem.h
index 909baea..193a01d 100644
--- a/skia/ports/SkImageRef_ashmem.h
+++ b/skia/ports/SkImageRef_ashmem.h
@@ -24,6 +24,8 @@ protected:
virtual void onUnlockPixels();
private:
+ void closeFD();
+
SkColorTable* fCT;
SkAshmemRec fRec;
diff --git a/skia/ports/SkOSEvent_android.cpp b/skia/ports/SkOSEvent_android.cpp
index 8e16440..59d6191 100644
--- a/skia/ports/SkOSEvent_android.cpp
+++ b/skia/ports/SkOSEvent_android.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/ports/SkOSEvent_android.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/ports/SkOSEvent_dummy.cpp b/skia/ports/SkOSEvent_dummy.cpp
index c83995e..f061b6e 100644
--- a/skia/ports/SkOSEvent_dummy.cpp
+++ b/skia/ports/SkOSEvent_dummy.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/ports/SkOSEvent_dummy.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/ports/SkOSFile_stdio.cpp b/skia/ports/SkOSFile_stdio.cpp
index 15ca451..7438f7b 100644
--- a/skia/ports/SkOSFile_stdio.cpp
+++ b/skia/ports/SkOSFile_stdio.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/ports/SkOSFile_stdio.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/ports/SkThread_none.cpp b/skia/ports/SkThread_none.cpp
index 3e66973..37a3834 100644
--- a/skia/ports/SkThread_none.cpp
+++ b/skia/ports/SkThread_none.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/ports/SkThread_none.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/ports/SkThread_win.cpp b/skia/ports/SkThread_win.cpp
index 791e4f4..d3f3e21 100644
--- a/skia/ports/SkThread_win.cpp
+++ b/skia/ports/SkThread_win.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/ports/SkThread_none.cpp
**
-** Copyright 2008, Google Inc.
+** Copyright 2008, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/ports/SkTime_Unix.cpp b/skia/ports/SkTime_Unix.cpp
index 202fcb8..1bf3a76 100644
--- a/skia/ports/SkTime_Unix.cpp
+++ b/skia/ports/SkTime_Unix.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/ports/SkTime_Unix.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/ports/SkXMLParser_empty.cpp b/skia/ports/SkXMLParser_empty.cpp
index a316dba..9a27306 100644
--- a/skia/ports/SkXMLParser_empty.cpp
+++ b/skia/ports/SkXMLParser_empty.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/ports/SkXMLParser_empty.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/ports/SkXMLParser_expat.cpp b/skia/ports/SkXMLParser_expat.cpp
index 82a78db..7694d50 100644
--- a/skia/ports/SkXMLParser_expat.cpp
+++ b/skia/ports/SkXMLParser_expat.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/ports/SkXMLParser_expat.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/ports/SkXMLParser_tinyxml.cpp b/skia/ports/SkXMLParser_tinyxml.cpp
index c53587a..7f57b80 100644
--- a/skia/ports/SkXMLParser_tinyxml.cpp
+++ b/skia/ports/SkXMLParser_tinyxml.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/ports/SkXMLParser_tinyxml.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/ports/SkXMLPullParser_expat.cpp b/skia/ports/SkXMLPullParser_expat.cpp
index cd29a9e..949c7a9 100644
--- a/skia/ports/SkXMLPullParser_expat.cpp
+++ b/skia/ports/SkXMLPullParser_expat.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/ports/SkXMLParser_expat.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/ports/sk_predefined_gamma.h b/skia/ports/sk_predefined_gamma.h
new file mode 100644
index 0000000..0818b30
--- /dev/null
+++ b/skia/ports/sk_predefined_gamma.h
@@ -0,0 +1,44 @@
+#ifndef SK_PREDEFINED_GAMMA_H
+#define SK_PREDEFINED_GAMMA_H
+
+// Gamma table for 1.4
+static const uint8_t gBlackGamma[] = {
+ 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x03, 0x03, 0x04, 0x04, 0x04, 0x05,
+ 0x05, 0x06, 0x06, 0x07, 0x07, 0x08, 0x08, 0x09, 0x09, 0x0A, 0x0A, 0x0B, 0x0C, 0x0C, 0x0D, 0x0D,
+ 0x0E, 0x0F, 0x0F, 0x10, 0x10, 0x11, 0x12, 0x12, 0x13, 0x14, 0x14, 0x15, 0x16, 0x16, 0x17, 0x18,
+ 0x19, 0x19, 0x1A, 0x1B, 0x1C, 0x1C, 0x1D, 0x1E, 0x1F, 0x1F, 0x20, 0x21, 0x22, 0x22, 0x23, 0x24,
+ 0x25, 0x26, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x31,
+ 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40,
+ 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,
+ 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60,
+ 0x61, 0x62, 0x63, 0x64, 0x65, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71,
+ 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7C, 0x7D, 0x7E, 0x7F, 0x80, 0x81, 0x82, 0x84,
+ 0x85, 0x86, 0x87, 0x88, 0x89, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x91, 0x92, 0x93, 0x94, 0x95, 0x97,
+ 0x98, 0x99, 0x9A, 0x9B, 0x9D, 0x9E, 0x9F, 0xA0, 0xA1, 0xA3, 0xA4, 0xA5, 0xA6, 0xA8, 0xA9, 0xAA,
+ 0xAB, 0xAD, 0xAE, 0xAF, 0xB0, 0xB2, 0xB3, 0xB4, 0xB5, 0xB7, 0xB8, 0xB9, 0xBB, 0xBC, 0xBD, 0xBE,
+ 0xC0, 0xC1, 0xC2, 0xC4, 0xC5, 0xC6, 0xC8, 0xC9, 0xCA, 0xCB, 0xCD, 0xCE, 0xCF, 0xD1, 0xD2, 0xD3,
+ 0xD5, 0xD6, 0xD7, 0xD9, 0xDA, 0xDB, 0xDD, 0xDE, 0xDF, 0xE1, 0xE2, 0xE3, 0xE5, 0xE6, 0xE8, 0xE9,
+ 0xEA, 0xEC, 0xED, 0xEE, 0xF0, 0xF1, 0xF2, 0xF4, 0xF5, 0xF7, 0xF8, 0xF9, 0xFB, 0xFC, 0xFE, 0xFF,
+};
+
+// Gamma table for 0.714286
+static const uint8_t gWhiteGamma[] = {
+ 0x00, 0x05, 0x08, 0x0B, 0x0D, 0x0F, 0x12, 0x14, 0x16, 0x17, 0x19, 0x1B, 0x1D, 0x1E, 0x20, 0x22,
+ 0x23, 0x25, 0x26, 0x28, 0x29, 0x2B, 0x2C, 0x2E, 0x2F, 0x31, 0x32, 0x33, 0x35, 0x36, 0x37, 0x39,
+ 0x3A, 0x3B, 0x3C, 0x3E, 0x3F, 0x40, 0x41, 0x43, 0x44, 0x45, 0x46, 0x48, 0x49, 0x4A, 0x4B, 0x4C,
+ 0x4D, 0x4E, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E,
+ 0x5F, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E,
+ 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E,
+ 0x7F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D,
+ 0x8E, 0x8F, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x97, 0x98, 0x99, 0x9A, 0x9B,
+ 0x9C, 0x9D, 0x9E, 0x9E, 0x9F, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9,
+ 0xAA, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB4, 0xB5, 0xB6,
+ 0xB7, 0xB8, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBC, 0xBD, 0xBE, 0xBF, 0xC0, 0xC0, 0xC1, 0xC2, 0xC3,
+ 0xC4, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCC, 0xCD, 0xCE, 0xCF, 0xCF,
+ 0xD0, 0xD1, 0xD2, 0xD3, 0xD3, 0xD4, 0xD5, 0xD6, 0xD6, 0xD7, 0xD8, 0xD9, 0xD9, 0xDA, 0xDB, 0xDC,
+ 0xDC, 0xDD, 0xDE, 0xDF, 0xDF, 0xE0, 0xE1, 0xE2, 0xE2, 0xE3, 0xE4, 0xE5, 0xE5, 0xE6, 0xE7, 0xE8,
+ 0xE8, 0xE9, 0xEA, 0xEB, 0xEB, 0xEC, 0xED, 0xEE, 0xEE, 0xEF, 0xF0, 0xF1, 0xF1, 0xF2, 0xF3, 0xF3,
+ 0xF4, 0xF5, 0xF6, 0xF6, 0xF7, 0xF8, 0xF9, 0xF9, 0xFA, 0xFB, 0xFB, 0xFC, 0xFD, 0xFE, 0xFE, 0xFF,
+};
+
+#endif
diff --git a/skia/sgl/SkAlphaRuns.cpp b/skia/sgl/SkAlphaRuns.cpp
index 35fcfd6..46b0206 100644
--- a/skia/sgl/SkAlphaRuns.cpp
+++ b/skia/sgl/SkAlphaRuns.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkAlphaRuns.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkAntiRun.h b/skia/sgl/SkAntiRun.h
index 32814f1..12930e66 100644
--- a/skia/sgl/SkAntiRun.h
+++ b/skia/sgl/SkAntiRun.h
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkAntiRun.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkAutoKern.h b/skia/sgl/SkAutoKern.h
index 644ad85..023cb6b 100644
--- a/skia/sgl/SkAutoKern.h
+++ b/skia/sgl/SkAutoKern.h
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkAutoKern.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkBitmap.cpp b/skia/sgl/SkBitmap.cpp
index 914fc77..5ca3601 100644
--- a/skia/sgl/SkBitmap.cpp
+++ b/skia/sgl/SkBitmap.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2008 Google Inc.
+ * Copyright (C) 2006-2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
#include "SkColorPriv.h"
#include "SkDither.h"
#include "SkFlattenable.h"
+#include "SkMallocPixelRef.h"
#include "SkMask.h"
#include "SkPixelRef.h"
#include "SkThread.h"
@@ -33,8 +34,8 @@ struct MipLevel {
};
struct SkBitmap::MipMap : SkNoncopyable {
- int fRefCnt;
- int fLevelCount;
+ int32_t fRefCnt;
+ int fLevelCount;
// MipLevel fLevel[fLevelCount];
// Pixels[]
@@ -203,6 +204,20 @@ int SkBitmap::ComputeRowBytes(Config c, int width) {
return rowBytes;
}
+Sk64 SkBitmap::ComputeSize64(Config c, int width, int height) {
+ Sk64 size;
+ size.setMul(SkBitmap::ComputeRowBytes(c, width), height);
+ return size;
+}
+
+size_t SkBitmap::ComputeSize(Config c, int width, int height) {
+ Sk64 size = SkBitmap::ComputeSize64(c, width, height);
+ if (size.isNeg() || !size.is32()) {
+ return 0;
+ }
+ return size.get32();
+}
+
void SkBitmap::setConfig(Config c, int width, int height, int rowBytes) {
this->freePixels();
@@ -334,40 +349,6 @@ void SkBitmap::notifyPixelsChanged() const {
///////////////////////////////////////////////////////////////////////////////
-/** We explicitly use the same allocator for our pixels that SkMask does,
- so that we can freely assign memory allocated by one class to the other.
- */
-class SkMallocPixelRef : public SkPixelRef {
-public:
- /** Allocate the specified buffer for pixels. The memory is freed when the
- last owner of this pixelref is gone.
- */
- SkMallocPixelRef(void* addr, size_t size, SkColorTable* ctable);
- virtual ~SkMallocPixelRef();
-
- virtual void flatten(SkFlattenableWriteBuffer&) const;
- virtual Factory getFactory() const {
- return Create;
- }
- static SkPixelRef* Create(SkFlattenableReadBuffer& buffer) {
- return SkNEW_ARGS(SkMallocPixelRef, (buffer));
- }
-
-protected:
- // overrides from SkPixelRef
- virtual void* onLockPixels(SkColorTable**);
- virtual void onUnlockPixels();
-
- SkMallocPixelRef(SkFlattenableReadBuffer& buffer);
-
-private:
- void* fStorage;
- size_t fSize;
- SkColorTable* fCTable;
-
- typedef SkPixelRef INHERITED;
-};
-
SkMallocPixelRef::SkMallocPixelRef(void* storage, size_t size,
SkColorTable* ctable) {
SkASSERT(storage);
@@ -416,7 +397,7 @@ SkMallocPixelRef::SkMallocPixelRef(SkFlattenableReadBuffer& buffer) : INHERITED(
}
static SkPixelRef::Registrar reg("SkMallocPixelRef",
- SkMallocPixelRef::Create);
+ SkMallocPixelRef::Create);
/** We explicitly use the same allocator for our pixels that SkMask does,
so that we can freely assign memory allocated by one class to the other.
@@ -534,7 +515,7 @@ void SkBitmap::eraseARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b) const {
SkAutoLockPixels alp(*this);
// perform this check after the lock call
- if (NULL == fPixels) {
+ if (!this->readyToDraw()) {
return;
}
@@ -648,6 +629,8 @@ bool SkBitmap::extractSubset(SkBitmap* result, const SkIRect& subset) const {
if (kRLE_Index8_Config == fConfig) {
SkAutoLockPixels alp(*this);
+ // don't call readyToDraw(), since we can operate w/o a colortable
+ // at this stage
if (this->getPixels() == NULL) {
return false;
}
@@ -725,7 +708,7 @@ bool SkBitmap::copyTo(SkBitmap* dst, Config dstConfig, Allocator* alloc) const {
SkAutoLockPixels srclock(*this);
SkAutoLockPixels dstlock(tmp);
- if (NULL == this->getPixels() || NULL == tmp.getPixels()) {
+ if (!this->readyToDraw() || !tmp.readyToDraw()) {
// allocator/lock failed
return false;
}
@@ -1257,6 +1240,7 @@ void SkBitmap::validate() const {
SkASSERT(NULL == fColorTable || (unsigned)fColorTable->getRefCnt() < 10000);
SkASSERT((uint8_t)ComputeBytesPerPixel((Config)fConfig) == fBytesPerPixel);
+#if 0 // these asserts are not thread-correct, so disable for now
if (fPixelRef) {
if (fPixelLockCount > 0) {
SkASSERT(fPixelRef->getLockCount() > 0);
@@ -1265,6 +1249,7 @@ void SkBitmap::validate() const {
SkASSERT(NULL == fColorTable);
}
}
+#endif
}
#endif
diff --git a/skia/sgl/SkBitmapProcShader.h b/skia/sgl/SkBitmapProcShader.h
index 6d7d0d9..ed790c8 100644
--- a/skia/sgl/SkBitmapProcShader.h
+++ b/skia/sgl/SkBitmapProcShader.h
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkBitmapShader.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkBitmapProcState.cpp b/skia/sgl/SkBitmapProcState.cpp
index aff7e9d..428921d 100644
--- a/skia/sgl/SkBitmapProcState.cpp
+++ b/skia/sgl/SkBitmapProcState.cpp
@@ -296,9 +296,8 @@ bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) {
}
const SkMatrix* m;
- if (inv.getType() <= SkMatrix::kTranslate_Mask ||
- (SkShader::kClamp_TileMode == fTileModeX &&
- SkShader::kClamp_TileMode == fTileModeY)) {
+ if (SkShader::kClamp_TileMode == fTileModeX &&
+ SkShader::kClamp_TileMode == fTileModeY) {
m = &inv;
} else {
fUnitInvMatrix = inv;
@@ -331,16 +330,6 @@ bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) {
fInvMatrix = m;
fInvProc = m->getMapXYProc();
fInvType = m->getType();
- if (fInvType <= SkMatrix::kTranslate_Mask &&
- inv.getType() > SkMatrix::kTranslate_Mask) {
- SkASSERT(inv.getType() <=
- (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask));
- // It is possible that by the calculation of fUnitInvMatrix, we have
- // eliminated the scale transformation of the matrix (e.g., if inv^(-1)
- // scales fOrigBitmap into an 1X1 rect). We add the scale flag back so
- // that we don't make wrong choice in chooseMatrixProc().
- fInvType |= SkMatrix::kScale_Mask;
- }
fInvSx = SkScalarToFixed(m->getScaleX());
fInvSy = SkScalarToFixed(m->getScaleY());
fInvKy = SkScalarToFixed(m->getSkewY());
diff --git a/skia/sgl/SkBitmapProcState.h b/skia/sgl/SkBitmapProcState.h
index e48a8c3..1366d3b 100644
--- a/skia/sgl/SkBitmapProcState.h
+++ b/skia/sgl/SkBitmapProcState.h
@@ -1,5 +1,5 @@
/*
-** Copyright 2007, Google Inc.
+** Copyright 2007, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -39,9 +39,8 @@ struct SkBitmapProcState {
int count,
uint16_t colors[]);
- typedef SkFixed (*FixedTileProc)(SkFixed, int);
- typedef int (*IntTileProc)(int, int);
-
+ typedef U16CPU (*FixedTileProc)(SkFixed); // returns 0..0xFFFF
+
MatrixProc fMatrixProc; // chooseProcs
SampleProc32 fSampleProc32; // chooseProcs
SampleProc16 fSampleProc16; // chooseProcs
@@ -49,8 +48,6 @@ struct SkBitmapProcState {
SkMatrix fUnitInvMatrix; // chooseProcs
FixedTileProc fTileProcX; // chooseProcs
FixedTileProc fTileProcY; // chooseProcs
- IntTileProc iTileProcX; // chooseProcs
- IntTileProc iTileProcY; // chooseProcs
SkFixed fFilterOneX;
SkFixed fFilterOneY;
diff --git a/skia/sgl/SkBitmapProcState_matrix.h b/skia/sgl/SkBitmapProcState_matrix.h
index fe551c2..1212a41 100644
--- a/skia/sgl/SkBitmapProcState_matrix.h
+++ b/skia/sgl/SkBitmapProcState_matrix.h
@@ -1,5 +1,4 @@
-#define TRANSLATE_NOFILTER_NAME MAKENAME(_nofilter_translate)
#define SCALE_NOFILTER_NAME MAKENAME(_nofilter_scale)
#define SCALE_FILTER_NAME MAKENAME(_filter_scale)
#define AFFINE_NOFILTER_NAME MAKENAME(_nofilter_affine)
@@ -18,38 +17,6 @@
#define PREAMBLE_ARG_Y
#endif
-#ifndef PREAMBLE_TRANS
- #define PREAMBLE_TRANS(state)
-#endif
-
-static void TRANSLATE_NOFILTER_NAME(const SkBitmapProcState& s,
- uint32_t xy[], int count, int x, int y)
-{
- SkASSERT((s.fInvType & ~SkMatrix::kTranslate_Mask) == 0);
-
- PREAMBLE_TRANS(s);
-
- x += SkScalarFloor(s.fInvMatrix->getTranslateX());
- y += SkScalarFloor(s.fInvMatrix->getTranslateY());
-
- *xy++ = (uint32_t)TILEY_TRANS(y, (s.fBitmap->height() - 1));
-
- int maxX = s.fBitmap->width() - 1;
- int i;
- uint16_t* xx = (uint16_t*)xy;
- for (i = (count >> 2); i > 0; --i)
- {
- *xx++ = (uint16_t)TILEX_TRANS(x, maxX); x++;
- *xx++ = (uint16_t)TILEX_TRANS(x, maxX); x++;
- *xx++ = (uint16_t)TILEX_TRANS(x, maxX); x++;
- *xx++ = (uint16_t)TILEX_TRANS(x, maxX); x++;
- }
- for (i = (count & 3); i > 0; --i)
- {
- *xx++ = (uint16_t)TILEX_TRANS(x, maxX); x++;
- }
-}
-
static void SCALE_NOFILTER_NAME(const SkBitmapProcState& s,
uint32_t xy[], int count, int x, int y) {
SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask |
@@ -274,9 +241,6 @@ static void PERSP_FILTER_NAME(const SkBitmapProcState& s,
}
static SkBitmapProcState::MatrixProc MAKENAME(_Procs)[] = {
- TRANSLATE_NOFILTER_NAME,
- TRANSLATE_NOFILTER_NAME, // No need to do filtering if the matrix is no
- // more complex than identity/translate.
SCALE_NOFILTER_NAME,
SCALE_FILTER_NAME,
AFFINE_NOFILTER_NAME,
@@ -291,10 +255,7 @@ static SkBitmapProcState::MatrixProc MAKENAME(_Procs)[] = {
#ifdef CHECK_FOR_DECAL
#undef CHECK_FOR_DECAL
#endif
-#undef TILEX_TRANS
-#undef TILEY_TRANS
-
-#undef TRANSLATE_NOFILTER_NAME
+
#undef SCALE_NOFILTER_NAME
#undef SCALE_FILTER_NAME
#undef AFFINE_NOFILTER_NAME
@@ -307,7 +268,6 @@ static SkBitmapProcState::MatrixProc MAKENAME(_Procs)[] = {
#undef PREAMBLE_PARAM_Y
#undef PREAMBLE_ARG_X
#undef PREAMBLE_ARG_Y
-#undef PREAMBLE_TRANS
#undef TILEX_LOW_BITS
#undef TILEY_LOW_BITS
diff --git a/skia/sgl/SkBitmapProcState_matrixProcs.cpp b/skia/sgl/SkBitmapProcState_matrixProcs.cpp
index 369f9ff..beb21c8 100644
--- a/skia/sgl/SkBitmapProcState_matrixProcs.cpp
+++ b/skia/sgl/SkBitmapProcState_matrixProcs.cpp
@@ -28,8 +28,6 @@ void decal_filter_scale(uint32_t dst[], SkFixed fx, SkFixed dx, int count);
#define TILEX_LOW_BITS(fx, max) (((fx) >> 12) & 0xF)
#define TILEY_LOW_BITS(fy, max) (((fy) >> 12) & 0xF)
#define CHECK_FOR_DECAL
-#define TILEX_TRANS(x, max) SkClampMax(x, max)
-#define TILEY_TRANS(y, max) SkClampMax(y, max)
#include "SkBitmapProcState_matrix.h"
#define MAKENAME(suffix) RepeatX_RepeatY ## suffix
@@ -37,9 +35,6 @@ void decal_filter_scale(uint32_t dst[], SkFixed fx, SkFixed dx, int count);
#define TILEY_PROCF(fy, max) (((fy) & 0xFFFF) * ((max) + 1) >> 16)
#define TILEX_LOW_BITS(fx, max) ((((fx) & 0xFFFF) * ((max) + 1) >> 12) & 0xF)
#define TILEY_LOW_BITS(fy, max) ((((fy) & 0xFFFF) * ((max) + 1) >> 12) & 0xF)
-#define REAL_MOD(val, modulus) (((val)%(modulus)) + (modulus)*( (val)<0 ))
-#define TILEX_TRANS(x, max) (REAL_MOD((x), ((max) + 1)))
-#define TILEY_TRANS(y, max) (REAL_MOD((y), ((max) + 1)))
#include "SkBitmapProcState_matrix.h"
#define MAKENAME(suffix) GeneralXY ## suffix
@@ -49,17 +44,13 @@ void decal_filter_scale(uint32_t dst[], SkFixed fx, SkFixed dx, int count);
#define PREAMBLE_PARAM_Y , SkBitmapProcState::FixedTileProc tileProcY
#define PREAMBLE_ARG_X , tileProcX
#define PREAMBLE_ARG_Y , tileProcY
-#define TILEX_PROCF(fx, max) (tileProcX(fx, max) >> 16)
-#define TILEY_PROCF(fy, max) (tileProcY(fy, max) >> 16)
-#define TILEX_LOW_BITS(fx, max) ((tileProcX(fx, max) >> 14) & 0x3)
-#define TILEY_LOW_BITS(fy, max) ((tileProcY(fy, max) >> 14) & 0x3)
-#define PREAMBLE_TRANS(state) SkBitmapProcState::IntTileProc tileProcX = (state).iTileProcX; \
- SkBitmapProcState::IntTileProc tileProcY = (state).iTileProcY
-#define TILEX_TRANS(x, max) tileProcX(x, max)
-#define TILEY_TRANS(y, max) tileProcY(y, max)
+#define TILEX_PROCF(fx, max) (tileProcX(fx) * ((max) + 1) >> 16)
+#define TILEY_PROCF(fy, max) (tileProcY(fy) * ((max) + 1) >> 16)
+#define TILEX_LOW_BITS(fx, max) ((tileProcX(fx) * ((max) + 1) >> 12) & 0xF)
+#define TILEY_LOW_BITS(fy, max) ((tileProcY(fy) * ((max) + 1) >> 12) & 0xF)
#include "SkBitmapProcState_matrix.h"
-static inline SkFixed fixed_clamp(SkFixed x, int max)
+static inline U16CPU fixed_clamp(SkFixed x)
{
#ifdef SK_CPU_HAS_CONDITIONAL_INSTR
if (x >> 16)
@@ -75,20 +66,19 @@ static inline SkFixed fixed_clamp(SkFixed x, int max)
x = 0xFFFF;
}
#endif
- return x * (max + 1);
+ return x;
}
-static inline SkFixed fixed_repeat(SkFixed x, int max)
+static inline U16CPU fixed_repeat(SkFixed x)
{
- return (x & 0xFFFF) * (max + 1);
+ return x & 0xFFFF;
}
-static inline SkFixed fixed_mirror(SkFixed x, int max)
+static inline U16CPU fixed_mirror(SkFixed x)
{
SkFixed s = x << 15 >> 31;
// s is FFFFFFFF if we're on an odd interval, or 0 if an even interval
- x = ((x ^ s) & 0xFFFF) * (max + 1);
- return s ? (x ^ 0xFFFF) : x;
+ return (x ^ s) & 0xFFFF;
}
static SkBitmapProcState::FixedTileProc choose_tile_proc(unsigned m)
@@ -100,41 +90,6 @@ static SkBitmapProcState::FixedTileProc choose_tile_proc(unsigned m)
SkASSERT(SkShader::kMirror_TileMode == m);
return fixed_mirror;
}
-
-static inline int int_clamp(int x, int max)
-{
- SkASSERT(max >= 0);
-
- return SkClampMax(x, max);
-}
-
-static inline int int_repeat(int x, int max)
-{
- SkASSERT(max >= 0);
-
- return x % (max + 1);
-}
-
-static inline int int_mirror(int x, int max)
-{
- SkASSERT(max >= 0);
-
- int dx = x % (max + 1);
- if (dx < 0)
- dx = -dx - 1;
-
- return (x / (max + 1) % 2) ? max - dx : dx;
-}
-
-static SkBitmapProcState::IntTileProc choose_int_tile_proc(unsigned m)
-{
- if (SkShader::kClamp_TileMode == m)
- return int_clamp;
- if (SkShader::kRepeat_TileMode == m)
- return int_repeat;
- SkASSERT(SkShader::kMirror_TileMode == m);
- return int_mirror;
-}
SkBitmapProcState::MatrixProc SkBitmapProcState::chooseMatrixProc()
{
@@ -142,10 +97,8 @@ SkBitmapProcState::MatrixProc SkBitmapProcState::chooseMatrixProc()
if (fDoFilter)
index = 1;
if (fInvType & SkMatrix::kPerspective_Mask)
- index |= 6;
- else if (fInvType & SkMatrix::kAffine_Mask)
index |= 4;
- else if (fInvType & SkMatrix::kScale_Mask)
+ else if (fInvType & SkMatrix::kAffine_Mask)
index |= 2;
if (SkShader::kClamp_TileMode == fTileModeX &&
@@ -170,8 +123,6 @@ SkBitmapProcState::MatrixProc SkBitmapProcState::chooseMatrixProc()
// only general needs these procs
fTileProcX = choose_tile_proc(fTileModeX);
fTileProcY = choose_tile_proc(fTileModeY);
- iTileProcX = choose_int_tile_proc(fTileModeX);
- iTileProcY = choose_int_tile_proc(fTileModeY);
return GeneralXY_Procs[index];
}
diff --git a/skia/sgl/SkBitmapSampler.cpp b/skia/sgl/SkBitmapSampler.cpp
index 924aeaa..045efd1 100644
--- a/skia/sgl/SkBitmapSampler.cpp
+++ b/skia/sgl/SkBitmapSampler.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkBitmapSampler.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkBitmapSampler.h b/skia/sgl/SkBitmapSampler.h
index b31bb9f..eeef3b3 100644
--- a/skia/sgl/SkBitmapSampler.h
+++ b/skia/sgl/SkBitmapSampler.h
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkBitmapSampler.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkBitmapSamplerTemplate.h b/skia/sgl/SkBitmapSamplerTemplate.h
index d9680d6..00df10c 100644
--- a/skia/sgl/SkBitmapSamplerTemplate.h
+++ b/skia/sgl/SkBitmapSamplerTemplate.h
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkBitmapSamplerTemplate.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkBitmapShader.cpp b/skia/sgl/SkBitmapShader.cpp
index 939080d..5d70dd3 100644
--- a/skia/sgl/SkBitmapShader.cpp
+++ b/skia/sgl/SkBitmapShader.cpp
@@ -1,4 +1,4 @@
-/* Copyright 2006, Google Inc.
+/* Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkBitmapShader.h b/skia/sgl/SkBitmapShader.h
index d64274c..8d40a4b 100644
--- a/skia/sgl/SkBitmapShader.h
+++ b/skia/sgl/SkBitmapShader.h
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkBitmapShader.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkBitmapShader16BilerpTemplate.h b/skia/sgl/SkBitmapShader16BilerpTemplate.h
index 555d587..b70801e 100644
--- a/skia/sgl/SkBitmapShader16BilerpTemplate.h
+++ b/skia/sgl/SkBitmapShader16BilerpTemplate.h
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkBitmapShader16BilerpTemplate.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkBitmapShaderTemplate.h b/skia/sgl/SkBitmapShaderTemplate.h
index b24168c..0174138 100644
--- a/skia/sgl/SkBitmapShaderTemplate.h
+++ b/skia/sgl/SkBitmapShaderTemplate.h
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkBitmapShaderTemplate.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkBitmap_scroll.cpp b/skia/sgl/SkBitmap_scroll.cpp
index eb2abc8..f9f197d 100644
--- a/skia/sgl/SkBitmap_scroll.cpp
+++ b/skia/sgl/SkBitmap_scroll.cpp
@@ -64,6 +64,7 @@ bool SkBitmap::scrollRect(const SkIRect* subset, int dx, int dy,
SkAutoLockPixels alp(*this);
// if we have no pixels, just return (inval is already updated)
+ // don't call readyToDraw(), since we don't require a colortable per se
if (this->getPixels() == NULL) {
return true;
}
diff --git a/skia/sgl/SkBlitBWMaskTemplate.h b/skia/sgl/SkBlitBWMaskTemplate.h
index f7767fb..e433d36 100644
--- a/skia/sgl/SkBlitBWMaskTemplate.h
+++ b/skia/sgl/SkBlitBWMaskTemplate.h
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkBlitBWMaskTemplate.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkBlitter.cpp b/skia/sgl/SkBlitter.cpp
index 95a67c7..9208429 100644
--- a/skia/sgl/SkBlitter.cpp
+++ b/skia/sgl/SkBlitter.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkBlitter.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkBlitter.h b/skia/sgl/SkBlitter.h
index 56d69c9..11b84fd 100644
--- a/skia/sgl/SkBlitter.h
+++ b/skia/sgl/SkBlitter.h
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkBlitter.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkBlitter_4444.cpp b/skia/sgl/SkBlitter_4444.cpp
index de42312..cce94c5 100644
--- a/skia/sgl/SkBlitter_4444.cpp
+++ b/skia/sgl/SkBlitter_4444.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkBlitter_ARGB32.cpp
**
- ** Copyright 2006, Google Inc.
+ ** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -379,11 +379,14 @@ class SkARGB4444_Shader_Blitter : public SkShaderBlitter {
SkBlitRow::Proc fOpaqueProc;
SkBlitRow::Proc fAlphaProc;
SkPMColor* fBuffer;
+ uint8_t* fAAExpand;
public:
SkARGB4444_Shader_Blitter(const SkBitmap& device, const SkPaint& paint)
: INHERITED(device, paint)
{
- fBuffer = (SkPMColor*)sk_malloc_throw(device.width() * (sizeof(SkPMColor)));
+ const int width = device.width();
+ fBuffer = (SkPMColor*)sk_malloc_throw(width * sizeof(SkPMColor) + width);
+ fAAExpand = (uint8_t*)(fBuffer + width);
(fXfermode = paint.getXfermode())->safeRef();
@@ -423,7 +426,8 @@ virtual void blitH(int x, int y, int width)
virtual void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[])
{
- SkPMColor* span = fBuffer;
+ SkPMColor* SK_RESTRICT span = fBuffer;
+ uint8_t* SK_RESTRICT aaExpand = fAAExpand;
SkPMColor16* device = fDevice.getAddr16(x, y);
SkShader* shader = fShader;
SkXfermode* xfer = fXfermode;
@@ -439,10 +443,12 @@ virtual void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t ru
if (255 == aa) {
xfer->xfer4444(device, span, count, NULL);
} else {
- // count is almost always 1
- for (int i = count - 1; i >= 0; --i) {
- xfer->xfer4444(&device[i], &span[i], count, antialias);
+ const uint8_t* aaBuffer = antialias;
+ if (count > 1) {
+ memset(aaExpand, aa, count);
+ aaBuffer = aaExpand;
}
+ xfer->xfer4444(device, span, count, aaBuffer);
}
}
device += count;
diff --git a/skia/sgl/SkBlitter_A1.cpp b/skia/sgl/SkBlitter_A1.cpp
index 61d9cf6..1a91a26 100644
--- a/skia/sgl/SkBlitter_A1.cpp
+++ b/skia/sgl/SkBlitter_A1.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkBlitter_A1.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkBlitter_A8.cpp b/skia/sgl/SkBlitter_A8.cpp
index 23f7f01..18b0881 100644
--- a/skia/sgl/SkBlitter_A8.cpp
+++ b/skia/sgl/SkBlitter_A8.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkBlitter_A8.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkBlitter_ARGB32.cpp b/skia/sgl/SkBlitter_ARGB32.cpp
index 0fa0e0b..ed2fc0e 100644
--- a/skia/sgl/SkBlitter_ARGB32.cpp
+++ b/skia/sgl/SkBlitter_ARGB32.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkBlitter_ARGB32.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkBlitter_RGB16.cpp b/skia/sgl/SkBlitter_RGB16.cpp
index aca515d..b253662 100644
--- a/skia/sgl/SkBlitter_RGB16.cpp
+++ b/skia/sgl/SkBlitter_RGB16.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkBlitter_RGB16.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -161,6 +161,7 @@ SkRGB16_Blitter::SkRGB16_Blitter(const SkBitmap& device, const SkPaint& paint)
: INHERITED(device) {
SkColor color = paint.getColor();
+ fSrcColor32 = SkPreMultiplyColor(color);
fScale = SkAlpha255To256(SkColorGetA(color));
int r = SkColorGetR(color);
@@ -210,9 +211,9 @@ void SkRGB16_Blitter::blitH(int x, int y, int width) SK_RESTRICT {
}
} else {
// TODO: respect fDoDither
- unsigned scale = 256 - fScale;
+ SkPMColor src32 = fSrcColor32;
do {
- *device = srcColor + SkAlphaMulRGB16(*device, scale);
+ *device = SkSrcOver32To16(src32, *device);
device += 1;
} while (--width != 0);
}
@@ -467,11 +468,10 @@ void SkRGB16_Blitter::blitRect(int x, int y, int width, int height) {
}
}
} else {
- unsigned dst_scale = 256 - fScale; // apply it to the dst
-
+ SkPMColor src32 = fSrcColor32;
while (--height >= 0) {
for (int i = width - 1; i >= 0; --i) {
- device[i] = color16 + SkAlphaMulRGB16(device[i], dst_scale);
+ device[i] = SkSrcOver32To16(src32, device[i]);
}
device = (uint16_t*)((char*)device + deviceRB);
}
diff --git a/skia/sgl/SkBlitter_Sprite.cpp b/skia/sgl/SkBlitter_Sprite.cpp
index 6ce8f13..f0da166 100644
--- a/skia/sgl/SkBlitter_Sprite.cpp
+++ b/skia/sgl/SkBlitter_Sprite.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkBlitter_Sprite.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkCanvas.cpp b/skia/sgl/SkCanvas.cpp
index a657023..4088416 100644
--- a/skia/sgl/SkCanvas.cpp
+++ b/skia/sgl/SkCanvas.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2008 Google Inc.
+ * Copyright (C) 2006-2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@
#include "SkDrawFilter.h"
#include "SkDrawLooper.h"
#include "SkPicture.h"
+#include "SkScalarCompare.h"
#include "SkTemplates.h"
#include "SkUtils.h"
#include <new>
@@ -49,6 +50,14 @@
#endif
///////////////////////////////////////////////////////////////////////////////
+// Helpers for computing fast bounds for quickReject tests
+
+static SkCanvas::EdgeType paint2EdgeType(const SkPaint* paint) {
+ return paint != NULL && paint->isAntiAlias() ?
+ SkCanvas::kAA_EdgeType : SkCanvas::kBW_EdgeType;
+}
+
+///////////////////////////////////////////////////////////////////////////////
/* This is the record we keep for each SkDevice that the user installs.
The clip/matrix/proc are fields that reflect the top of the save/restore
@@ -229,6 +238,7 @@ public:
fBitmap = &fDevice->accessBitmap(true);
fLayerX = rec->fX;
fLayerY = rec->fY;
+ fPaint = rec->fPaint;
SkDEBUGCODE(this->validate();)
fCurrLayer = rec->fNext;
@@ -249,10 +259,11 @@ public:
SkDevice* getDevice() const { return fDevice; }
const SkMatrix& getMatrix() const { return *fMatrix; }
const SkRegion& getClip() const { return *fClip; }
-
+ const SkPaint* getPaint() const { return fPaint; }
private:
SkCanvas* fCanvas;
const DeviceCM* fCurrLayer;
+ const SkPaint* fPaint; // May be null.
int fLayerX;
int fLayerY;
SkBool8 fSkipEmptyClips;
@@ -377,7 +388,8 @@ private:
SkDevice* SkCanvas::init(SkDevice* device) {
fBounder = NULL;
-
+ fLocalBoundsCompareTypeDirty = true;
+
fMCRec = (MCRec*)fMCStack.push_back();
new (fMCRec) MCRec(NULL, 0);
@@ -668,6 +680,7 @@ void SkCanvas::internalRestore() {
SkASSERT(fMCStack.count() != 0);
fDeviceCMDirty = true;
+ fLocalBoundsCompareTypeDirty = true;
// reserve our layer (if any)
DeviceCM* layer = fMCRec->fLayer; // may be null
@@ -750,31 +763,37 @@ void SkCanvas::drawDevice(SkDevice* device, int x, int y,
bool SkCanvas::translate(SkScalar dx, SkScalar dy) {
fDeviceCMDirty = true;
+ fLocalBoundsCompareTypeDirty = true;
return fMCRec->fMatrix->preTranslate(dx, dy);
}
bool SkCanvas::scale(SkScalar sx, SkScalar sy) {
fDeviceCMDirty = true;
+ fLocalBoundsCompareTypeDirty = true;
return fMCRec->fMatrix->preScale(sx, sy);
}
bool SkCanvas::rotate(SkScalar degrees) {
fDeviceCMDirty = true;
+ fLocalBoundsCompareTypeDirty = true;
return fMCRec->fMatrix->preRotate(degrees);
}
bool SkCanvas::skew(SkScalar sx, SkScalar sy) {
fDeviceCMDirty = true;
+ fLocalBoundsCompareTypeDirty = true;
return fMCRec->fMatrix->preSkew(sx, sy);
}
bool SkCanvas::concat(const SkMatrix& matrix) {
fDeviceCMDirty = true;
+ fLocalBoundsCompareTypeDirty = true;
return fMCRec->fMatrix->preConcat(matrix);
}
void SkCanvas::setMatrix(const SkMatrix& matrix) {
fDeviceCMDirty = true;
+ fLocalBoundsCompareTypeDirty = true;
*fMCRec->fMatrix = matrix;
}
@@ -791,6 +810,8 @@ void SkCanvas::resetMatrix() {
bool SkCanvas::clipRect(const SkRect& rect, SkRegion::Op op) {
fDeviceCMDirty = true;
+ fLocalBoundsCompareTypeDirty = true;
+
if (fMCRec->fMatrix->rectStaysRect()) {
SkRect r;
SkIRect ir;
@@ -808,6 +829,7 @@ bool SkCanvas::clipRect(const SkRect& rect, SkRegion::Op op) {
bool SkCanvas::clipPath(const SkPath& path, SkRegion::Op op) {
fDeviceCMDirty = true;
+ fLocalBoundsCompareTypeDirty = true;
SkPath devPath;
path.transform(*fMCRec->fMatrix, &devPath);
@@ -831,24 +853,52 @@ bool SkCanvas::clipPath(const SkPath& path, SkRegion::Op op) {
bool SkCanvas::clipRegion(const SkRegion& rgn, SkRegion::Op op) {
fDeviceCMDirty = true;
+ fLocalBoundsCompareTypeDirty = true;
+
return fMCRec->fRegion->op(rgn, op);
}
-bool SkCanvas::quickReject(const SkRect& rect, EdgeType et) const {
- if (fMCRec->fRegion->isEmpty() || rect.isEmpty()) {
- return true;
+void SkCanvas::computeLocalClipBoundsCompareType() const {
+ SkRect r;
+
+ if (!this->getClipBounds(&r, kAA_EdgeType)) {
+ fLocalBoundsCompareType.setEmpty();
+ } else {
+ fLocalBoundsCompareType.set(SkScalarToCompareType(r.fLeft),
+ SkScalarToCompareType(r.fTop),
+ SkScalarToCompareType(r.fRight),
+ SkScalarToCompareType(r.fBottom));
}
+}
- SkRect r;
- SkIRect ir;
+bool SkCanvas::quickReject(const SkRect& rect, EdgeType) const {
+ /* current impl ignores edgetype, and relies on
+ getLocalClipBoundsCompareType(), which always returns a value assuming
+ antialiasing (worst case)
+ */
- fMCRec->fMatrix->mapRect(&r, rect);
- if (kAA_EdgeType == et) {
- r.roundOut(&ir);
- } else {
- r.round(&ir);
+ if (fMCRec->fRegion->isEmpty()) {
+ return true;
}
- return fMCRec->fRegion->quickReject(ir);
+
+ // check for empty user rect (horizontal)
+ SkScalarCompareType userL = SkScalarToCompareType(rect.fLeft);
+ SkScalarCompareType userR = SkScalarToCompareType(rect.fRight);
+ if (userL >= userR) {
+ return true;
+ }
+
+ // check for empty user rect (vertical)
+ SkScalarCompareType userT = SkScalarToCompareType(rect.fTop);
+ SkScalarCompareType userB = SkScalarToCompareType(rect.fBottom);
+ if (userT >= userB) {
+ return true;
+ }
+
+ // check if we are completely outside of the local clip bounds
+ const SkRectCompareType& clipR = this->getLocalClipBoundsCompareType();
+ return userL >= clipR.fRight || userT >= clipR.fBottom ||
+ userR <= clipR.fLeft || userB <= clipR.fTop;
}
bool SkCanvas::quickReject(const SkPath& path, EdgeType et) const {
@@ -858,7 +908,7 @@ bool SkCanvas::quickReject(const SkPath& path, EdgeType et) const {
if (fMCRec->fMatrix->rectStaysRect()) {
SkRect r;
- path.computeBounds(&r, SkPath::kExact_BoundsType);
+ path.computeBounds(&r, SkPath::kFast_BoundsType);
return this->quickReject(r, et);
}
@@ -867,55 +917,38 @@ bool SkCanvas::quickReject(const SkPath& path, EdgeType et) const {
SkIRect ir;
path.transform(*fMCRec->fMatrix, &dstPath);
- dstPath.computeBounds(&r, SkPath::kExact_BoundsType);
+ dstPath.computeBounds(&r, SkPath::kFast_BoundsType);
+ r.round(&ir);
if (kAA_EdgeType == et) {
- r.roundOut(&ir);
- } else {
- r.round(&ir);
+ ir.inset(-1, -1);
}
return fMCRec->fRegion->quickReject(ir);
}
bool SkCanvas::quickRejectY(SkScalar top, SkScalar bottom, EdgeType et) const {
- if (fMCRec->fRegion->isEmpty() || top >= bottom) {
+ /* current impl ignores edgetype, and relies on
+ getLocalClipBoundsCompareType(), which always returns a value assuming
+ antialiasing (worst case)
+ */
+
+ if (fMCRec->fRegion->isEmpty()) {
return true;
}
- const SkMatrix& matrix = *fMCRec->fMatrix;
-
- // if we're rotated/skewed/perspective, give up (for now)
- // TODO: cache this attribute of the matrix? or specialized query method?
- // TODO: if rotate=90 or 270 is common, we can handle those too...
- if (matrix.getType() & ~(SkMatrix::kTranslate_Mask |
- SkMatrix::kScale_Mask)) {
- return false;
- }
- // transform top/botttom into device coordinates
- const SkScalar sy = matrix[SkMatrix::kMScaleY];
- const SkScalar ty = matrix[SkMatrix::kMTransY];
- top = SkScalarMulAdd(top, sy, ty);
- bottom = SkScalarMulAdd(bottom, sy, ty);
-
- // if the scale flipped us, flip back
- if (top > bottom) {
- SkTSwap<SkScalar>(top, bottom);
- }
- // now round based on the edge type
- int ymin, ymax;
- if (kAA_EdgeType == et) {
- ymin = SkScalarFloor(top);
- ymax = SkScalarCeil(bottom);
- } else {
- ymin = SkScalarRound(top);
- ymax = SkScalarRound(bottom);
+ SkScalarCompareType userT = SkScalarAs2sCompliment(top);
+ SkScalarCompareType userB = SkScalarAs2sCompliment(bottom);
+
+ // check for invalid user Y coordinates (i.e. empty)
+ if (userT >= userB) {
+ return true;
}
- // now compare against the bounds of the clip
- const SkIRect& bounds = fMCRec->fRegion->getBounds();
- return ymin >= bounds.fBottom || ymax <= bounds.fTop;
+ // check if we are above or below the local clip bounds
+ const SkRectCompareType& clipR = this->getLocalClipBoundsCompareType();
+ return userT >= clipR.fBottom || userB <= clipR.fTop;
}
-bool SkCanvas::getClipBounds(SkRect* bounds) const {
+bool SkCanvas::getClipBounds(SkRect* bounds, EdgeType et) const {
const SkRegion& clip = *fMCRec->fRegion;
if (clip.isEmpty()) {
if (bounds) {
@@ -928,9 +961,16 @@ bool SkCanvas::getClipBounds(SkRect* bounds) const {
SkMatrix inverse;
SkRect r;
- // TODO: should we cache the inverse (with a dirty bit)?
fMCRec->fMatrix->invert(&inverse);
- r.set(clip.getBounds());
+
+ // get the clip's bounds
+ const SkIRect& ibounds = clip.getBounds();
+ // adjust it outwards if we are antialiasing
+ int inset = (kAA_EdgeType == et);
+ r.iset(ibounds.fLeft - inset, ibounds.fTop - inset,
+ ibounds.fRight + inset, ibounds.fBottom + inset);
+
+ // invert into local coordinates
inverse.mapRect(bounds, r);
}
return true;
@@ -994,6 +1034,14 @@ void SkCanvas::drawPoints(PointMode mode, size_t count, const SkPoint pts[],
}
void SkCanvas::drawRect(const SkRect& r, const SkPaint& paint) {
+ if (paint.canComputeFastBounds()) {
+ SkRect storage;
+ if (this->quickReject(paint.computeFastBounds(r, &storage),
+ paint2EdgeType(&paint))) {
+ return;
+ }
+ }
+
ITER_BEGIN(paint, SkDrawFilter::kRect_Type)
while (iter.next()) {
@@ -1004,6 +1052,15 @@ void SkCanvas::drawRect(const SkRect& r, const SkPaint& paint) {
}
void SkCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
+ if (paint.canComputeFastBounds()) {
+ SkRect r;
+ path.computeBounds(&r, SkPath::kFast_BoundsType);
+ if (this->quickReject(paint.computeFastBounds(r, &r),
+ paint2EdgeType(&paint))) {
+ return;
+ }
+ }
+
ITER_BEGIN(paint, SkDrawFilter::kPath_Type)
while (iter.next()) {
@@ -1016,7 +1073,17 @@ void SkCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
void SkCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y,
const SkPaint* paint) {
SkDEBUGCODE(bitmap.validate();)
-
+
+ if (NULL == paint || (paint->getMaskFilter() == NULL)) {
+ SkRect fastBounds;
+ fastBounds.set(x, y,
+ x + SkIntToScalar(bitmap.width()),
+ y + SkIntToScalar(bitmap.height()));
+ if (this->quickReject(fastBounds, paint2EdgeType(paint))) {
+ return;
+ }
+ }
+
SkMatrix matrix;
matrix.setTranslate(x, y);
this->internalDrawBitmap(bitmap, matrix, paint);
@@ -1029,8 +1096,7 @@ void SkCanvas::drawBitmapRect(const SkBitmap& bitmap, const SkIRect* src,
}
// do this now, to avoid the cost of calling extract for RLE bitmaps
- if (this->quickReject(dst, paint != NULL && paint->isAntiAlias() ?
- kAA_EdgeType : kBW_EdgeType)) {
+ if (this->quickReject(dst, paint2EdgeType(paint))) {
return;
}
@@ -1229,10 +1295,18 @@ void SkCanvas::drawCircle(SkScalar cx, SkScalar cy, SkScalar radius,
radius = 0;
}
- SkPath path;
SkRect r;
-
r.set(cx - radius, cy - radius, cx + radius, cy + radius);
+
+ if (paint.canComputeFastBounds()) {
+ SkRect storage;
+ if (this->quickReject(paint.computeFastBounds(r, &storage),
+ paint2EdgeType(&paint))) {
+ return;
+ }
+ }
+
+ SkPath path;
path.addOval(r);
this->drawPath(path, paint);
}
@@ -1240,6 +1314,14 @@ void SkCanvas::drawCircle(SkScalar cx, SkScalar cy, SkScalar radius,
void SkCanvas::drawRoundRect(const SkRect& r, SkScalar rx, SkScalar ry,
const SkPaint& paint) {
if (rx > 0 && ry > 0) {
+ if (paint.canComputeFastBounds()) {
+ SkRect storage;
+ if (this->quickReject(paint.computeFastBounds(r, &storage),
+ paint2EdgeType(&paint))) {
+ return;
+ }
+ }
+
SkPath path;
path.addRoundRect(r, rx, ry, SkPath::kCW_Direction);
this->drawPath(path, paint);
@@ -1249,6 +1331,14 @@ void SkCanvas::drawRoundRect(const SkRect& r, SkScalar rx, SkScalar ry,
}
void SkCanvas::drawOval(const SkRect& oval, const SkPaint& paint) {
+ if (paint.canComputeFastBounds()) {
+ SkRect storage;
+ if (this->quickReject(paint.computeFastBounds(oval, &storage),
+ paint2EdgeType(&paint))) {
+ return;
+ }
+ }
+
SkPath path;
path.addOval(oval);
this->drawPath(path, paint);
@@ -1316,8 +1406,15 @@ const SkMatrix& SkCanvas::LayerIter::matrix() const {
return fImpl->getMatrix();
}
+const SkPaint& SkCanvas::LayerIter::paint() const {
+ const SkPaint* paint = fImpl->getPaint();
+ if (NULL == paint) {
+ paint = &fDefaultPaint;
+ }
+ return *paint;
+}
+
const SkRegion& SkCanvas::LayerIter::clip() const { return fImpl->getClip(); }
int SkCanvas::LayerIter::x() const { return fImpl->getX(); }
int SkCanvas::LayerIter::y() const { return fImpl->getY(); }
-
diff --git a/skia/sgl/SkColor.cpp b/skia/sgl/SkColor.cpp
index 1e7aa70..4256179 100644
--- a/skia/sgl/SkColor.cpp
+++ b/skia/sgl/SkColor.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkColor.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -66,7 +66,9 @@ void SkRGBToHSV(U8CPU r, U8CPU g, U8CPU b, SkScalar hsv[3]) {
SkASSERT(v >= 0 && v <= SK_Scalar1);
if (0 == delta) { // we're a shade of gray
- hsv[0] = hsv[1] = hsv[2] = v;
+ hsv[0] = 0;
+ hsv[1] = 0;
+ hsv[2] = v;
return;
}
diff --git a/skia/sgl/SkColorFilter.cpp b/skia/sgl/SkColorFilter.cpp
index d9034c6..bb4be48 100644
--- a/skia/sgl/SkColorFilter.cpp
+++ b/skia/sgl/SkColorFilter.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkColorFilter.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkColorTable.cpp b/skia/sgl/SkColorTable.cpp
index b8edf18..f991da3 100644
--- a/skia/sgl/SkColorTable.cpp
+++ b/skia/sgl/SkColorTable.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkColorTable.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkCoreBlitters.h b/skia/sgl/SkCoreBlitters.h
index e1692f0..5b3497e 100644
--- a/skia/sgl/SkCoreBlitters.h
+++ b/skia/sgl/SkCoreBlitters.h
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkCoreBlitters.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -162,6 +162,7 @@ public:
virtual const SkBitmap* justAnOpaqueColor(uint32_t*);
private:
+ SkPMColor fSrcColor32;
unsigned fScale;
uint16_t fColor16; // already scaled by fScale
uint16_t fRawColor16; // unscaled
diff --git a/skia/sgl/SkDeque.cpp b/skia/sgl/SkDeque.cpp
index e424817..4f15051 100644
--- a/skia/sgl/SkDeque.cpp
+++ b/skia/sgl/SkDeque.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkDeque.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkDraw.cpp b/skia/sgl/SkDraw.cpp
index 106543a..2f0ddff 100644
--- a/skia/sgl/SkDraw.cpp
+++ b/skia/sgl/SkDraw.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkDraw.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -37,6 +37,27 @@
//#define TRACE_BITMAP_DRAWS
+class SkAutoRestoreBounder : SkNoncopyable {
+public:
+ // note: initializing fBounder is done only to fix a warning
+ SkAutoRestoreBounder() : fDraw(NULL), fBounder(NULL) {}
+ ~SkAutoRestoreBounder() {
+ if (fDraw) {
+ fDraw->fBounder = fBounder;
+ }
+ }
+
+ void clearBounder(const SkDraw* draw) {
+ fDraw = const_cast<SkDraw*>(draw);
+ fBounder = draw->fBounder;
+ fDraw->fBounder = NULL;
+ }
+
+private:
+ SkDraw* fDraw;
+ SkBounder* fBounder;
+};
+
static SkPoint* rect_points(SkRect& r, int index) {
SkASSERT((unsigned)index < 2);
return &((SkPoint*)(void*)&r)[index];
@@ -182,7 +203,7 @@ static BitmapXferProc ChooseBitmapXferProc(const SkBitmap& bitmap,
return D_Dst_BitmapXferProc; // ignore data
case SkPorterDuff::kSrc_Mode: {
/*
- should I worry about dithering for the lower depths? <reed>
+ should I worry about dithering for the lower depths?
*/
SkPMColor pmc = SkPreMultiplyColor(color);
switch (bitmap.config()) {
@@ -496,6 +517,21 @@ PtProcRec::Proc PtProcRec::chooseProc(SkBlitter* blitter) {
return proc;
}
+static bool bounder_points(SkBounder* bounder, SkCanvas::PointMode mode,
+ size_t count, const SkPoint pts[],
+ const SkPaint& paint, const SkMatrix& matrix) {
+ SkIRect ibounds;
+ SkRect bounds;
+ SkScalar inset = paint.getStrokeWidth();
+
+ bounds.set(pts, count);
+ bounds.inset(-inset, -inset);
+ matrix.mapRect(&bounds);
+
+ bounds.roundOut(&ibounds);
+ return bounder->doIRect(ibounds);
+}
+
// each of these costs 8-bytes of stack space, so don't make it too large
// must be even for lines/polygon to work
#define MAX_DEV_PTS 32
@@ -510,6 +546,18 @@ void SkDraw::drawPoints(SkCanvas::PointMode mode, size_t count,
if ((long)count <= 0) {
return;
}
+
+ SkAutoRestoreBounder arb;
+
+ if (fBounder) {
+ if (!bounder_points(fBounder, mode, count, pts, paint, *fMatrix)) {
+ return;
+ }
+ // clear the bounder for the rest of this function, so we don't call it
+ // again later if we happen to call ourselves for drawRect, drawPath,
+ // etc.
+ arb.clearBounder(this);
+ }
SkASSERT(pts != NULL);
SkDEBUGCODE(this->validate();)
@@ -749,7 +797,7 @@ void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& paint,
SkDEBUGCODE(prePathMatrix = (const SkMatrix*)0x50FF8001;)
/*
- If the device thickness <= 1.0, then make it a hairline, and
+ If the device thickness < 1.0, then make it a hairline, and
modulate alpha if the thickness is even smaller (e.g. thickness == 0.5
should modulate the alpha by 1/2)
*/
@@ -762,7 +810,7 @@ void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& paint,
SkScalar width = paint.getStrokeWidth();
if (width > 0) {
width = matrix->mapRadius(paint.getStrokeWidth());
- if (width <= SK_Scalar1) {
+ if (width < SK_Scalar1) {
int scale = (int)SkScalarMul(width, 256);
int alpha = paint.getAlpha() * scale >> 8;
@@ -931,15 +979,15 @@ void SkDraw::drawBitmap(const SkBitmap& bitmap, const SkMatrix& prematrix,
return;
}
- // do I need to call the bounder first??? <reed>
+ // do I need to call the bounder first???
if (clipped_out(matrix, *fClip, bitmap.width(), bitmap.height())) {
return;
}
// only lock the pixels if we passed the clip test
SkAutoLockPixels alp(bitmap);
- // after the lock, check if we have valid pixels
- if (bitmap.getPixels() == NULL) {
+ // after the lock, check if we are valid
+ if (!bitmap.readyToDraw()) {
return;
}
@@ -988,7 +1036,7 @@ void SkDraw::drawBitmap(const SkBitmap& bitmap, const SkMatrix& prematrix,
SkRect r;
r.set(0, 0, SkIntToScalar(bitmap.width()),
SkIntToScalar(bitmap.height()));
- // is this ok if paint has a rasterizer? <reed>
+ // is this ok if paint has a rasterizer?
draw.drawRect(r, paint);
}
}
@@ -1053,7 +1101,7 @@ void SkDraw::drawSprite(const SkBitmap& bitmap, int x, int y,
matrix.reset();
draw.fMatrix = &matrix;
// call ourself with a rect
- // is this OK if paint has a rasterizer? <reed>
+ // is this OK if paint has a rasterizer?
draw.drawRect(r, paint);
}
@@ -2298,4 +2346,3 @@ bool SkDraw::DrawToMask(const SkPath& devPath, const SkIRect* clipBounds,
return true;
}
-
diff --git a/skia/sgl/SkEdge.cpp b/skia/sgl/SkEdge.cpp
index 3a9474c..b079bef 100644
--- a/skia/sgl/SkEdge.cpp
+++ b/skia/sgl/SkEdge.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkEdge.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -77,7 +77,12 @@ int SkEdge::setLine(const SkPoint& p0, const SkPoint& p1, const SkIRect* clip,
fX = SkFDot6ToFixed(x0 + SkFixedMul(slope, (32 - y0) & 63)); // + SK_Fixed1/2
fDX = slope;
- fFirstY = (int16_t)(top); // inlined skToS16()
+#if 0
+ // CHANGED FOR CHROME
+ fFirstY = top;
+ fLastY = bot - 1;
+#else
+ fFirstY = top;
if (top != (long)fFirstY) {
if (fFirstY < top) {
fFirstY = std::numeric_limits<int16_t>::max();
@@ -86,7 +91,7 @@ int SkEdge::setLine(const SkPoint& p0, const SkPoint& p1, const SkIRect* clip,
}
fX -= fDX * (top - (long)fFirstY);
}
- fLastY = (int16_t)(bot - 1); // inlined SkToS16()
+ fLastY = bot - 1;
if (bot-1 != (long)fLastY) {
if (fLastY < bot-1) {
fLastY = std::numeric_limits<int16_t>::max();
@@ -94,6 +99,7 @@ int SkEdge::setLine(const SkPoint& p0, const SkPoint& p1, const SkIRect* clip,
fLastY = std::numeric_limits<int16_t>::min();
}
}
+#endif
fCurveCount = 0;
fWinding = SkToS8(winding);
fCurveShift = 0;
@@ -109,7 +115,7 @@ int SkEdge::updateLine(SkFixed x0, SkFixed y0, SkFixed x1, SkFixed y1)
{
SkASSERT(fWinding == 1 || fWinding == -1);
SkASSERT(fCurveCount != 0);
- SkASSERT(fCurveShift != 0);
+// SkASSERT(fCurveShift != 0);
y0 >>= 10;
y1 >>= 10;
@@ -132,8 +138,8 @@ int SkEdge::updateLine(SkFixed x0, SkFixed y0, SkFixed x1, SkFixed y1)
fX = SkFDot6ToFixed(x0 + SkFixedMul(slope, (32 - y0) & 63)); // + SK_Fixed1/2
fDX = slope;
- fFirstY = SkToS16(top);
- fLastY = SkToS16(bot - 1);
+ fFirstY = top;
+ fLastY = bot - 1;
return 1;
}
@@ -153,7 +159,14 @@ void SkEdge::chopLineWithClip(const SkIRect& clip)
}
}
-/////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+
+/* We store 1<<shift in a (signed) byte, so its maximum value is 1<<6 == 64.
+ Note that this limits the number of lines we use to approximate a curve.
+ If we need to increase this, we need to store fCurveCount in something
+ larger than int8_t.
+*/
+#define MAX_COEFF_SHIFT 6
static inline SkFDot6 cheap_distance(SkFDot6 dx, SkFDot6 dy)
{
@@ -176,7 +189,7 @@ static inline int diff_to_shift(SkFDot6 dx, SkFDot6 dy)
// down by 5 should give us 1/2 pixel accuracy (assuming our dist is accurate...)
// this is chosen by heuristic: make it as big as possible (to minimize segments)
// ... but small enough so that our curves still look smooth
- dist >>= 5;
+ dist = (dist + (1 << 4)) >> 5;
// each subdivision (shift value) cuts this dist (error) by 1/4
return (32 - SkCLZ(dist)) >> 1;
@@ -230,14 +243,19 @@ int SkQuadraticEdge::setQuadratic(const SkPoint pts[3], const SkIRect* clip, int
SkFDot6 dx = ((x1 << 1) - x0 - x2) >> 2;
SkFDot6 dy = ((y1 << 1) - y0 - y2) >> 2;
shift = diff_to_shift(dx, dy);
+ SkASSERT(shift >= 0);
}
// need at least 1 subdivision for our bias trick
- if (shift == 0)
+ if (shift == 0) {
shift = 1;
-
+ } else if (shift > MAX_COEFF_SHIFT) {
+ shift = MAX_COEFF_SHIFT;
+ }
+
fWinding = SkToS8(winding);
fCurveShift = SkToU8(shift);
- fCurveCount = SkToS16(1 << shift);
+ //fCubicDShift only set for cubics
+ fCurveCount = SkToS8(1 << shift);
SkFixed A = SkFDot6ToFixed(x0 - x1 - x1 + x2);
SkFixed B = SkFDot6ToFixed(x1 - x0 + x1 - x0);
@@ -309,6 +327,11 @@ int SkQuadraticEdge::updateQuadratic()
/////////////////////////////////////////////////////////////////////////
+static inline int SkFDot6UpShift(SkFDot6 x, int upShift) {
+ SkASSERT((x << upShift >> upShift) == x);
+ return x << upShift;
+}
+
/* f(1/3) = (8a + 12b + 6c + d) / 27
f(2/3) = (a + 6b + 12c + 8d) / 27
@@ -386,23 +409,38 @@ int SkCubicEdge::setCubic(const SkPoint pts[4], const SkIRect* clip, int shift)
}
// need at least 1 subdivision for our bias trick
SkASSERT(shift > 0);
+ if (shift > MAX_COEFF_SHIFT) {
+ shift = MAX_COEFF_SHIFT;
+ }
+
+ /* Since our in coming data is initially shifted down by 10 (or 8 in
+ antialias). That means the most we can shift up is 8. However, we
+ compute coefficients with a 3*, so the safest upshift is really 6
+ */
+ int upShift = 6; // largest safe value
+ int downShift = shift + upShift - 10;
+ if (downShift < 0) {
+ downShift = 0;
+ upShift = 10 - shift;
+ }
fWinding = SkToS8(winding);
+ fCurveCount = SkToS8(-1 << shift);
fCurveShift = SkToU8(shift);
- fCurveCount = SkToS16(-1 << shift);
+ fCubicDShift = SkToU8(downShift);
- SkFixed B = SkFDot6ToFixed(3 * (x1 - x0));
- SkFixed C = SkFDot6ToFixed(3 * (x0 - x1 - x1 + x2));
- SkFixed D = SkFDot6ToFixed(x3 + 3 * (x1 - x2) - x0);
+ SkFixed B = SkFDot6UpShift(3 * (x1 - x0), upShift);
+ SkFixed C = SkFDot6UpShift(3 * (x0 - x1 - x1 + x2), upShift);
+ SkFixed D = SkFDot6UpShift(x3 + 3 * (x1 - x2) - x0, upShift);
fCx = SkFDot6ToFixed(x0);
fCDx = B + (C >> shift) + (D >> 2*shift); // biased by shift
fCDDx = 2*C + (3*D >> (shift - 1)); // biased by 2*shift
fCDDDx = 3*D >> (shift - 1); // biased by 2*shift
- B = SkFDot6ToFixed(3 * (y1 - y0));
- C = SkFDot6ToFixed(3 * (y0 - y1 - y1 + y2));
- D = SkFDot6ToFixed(y3 + 3 * (y1 - y2) - y0);
+ B = SkFDot6UpShift(3 * (y1 - y0), upShift);
+ C = SkFDot6UpShift(3 * (y0 - y1 - y1 + y2), upShift);
+ D = SkFDot6UpShift(y3 + 3 * (y1 - y2) - y0, upShift);
fCy = SkFDot6ToFixed(y0);
fCDy = B + (C >> shift) + (D >> 2*shift); // biased by shift
@@ -431,19 +469,20 @@ int SkCubicEdge::updateCubic()
SkFixed oldx = fCx;
SkFixed oldy = fCy;
SkFixed newx, newy;
- int shift = fCurveShift;
+ const int ddshift = fCurveShift;
+ const int dshift = fCubicDShift;
SkASSERT(count < 0);
do {
if (++count < 0)
{
- newx = oldx + (fCDx >> shift);
- fCDx += fCDDx >> shift;
+ newx = oldx + (fCDx >> dshift);
+ fCDx += fCDDx >> ddshift;
fCDDx += fCDDDx;
- newy = oldy + (fCDy >> shift);
- fCDy += fCDDy >> shift;
+ newy = oldy + (fCDy >> dshift);
+ fCDy += fCDDy >> ddshift;
fCDDy += fCDDDy;
}
else // last segment
diff --git a/skia/sgl/SkEdge.h b/skia/sgl/SkEdge.h
index 086e5a6..5b0cc75 100644
--- a/skia/sgl/SkEdge.h
+++ b/skia/sgl/SkEdge.h
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkEdge.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -32,10 +32,11 @@ struct SkEdge {
SkFixed fX;
SkFixed fDX;
- int16_t fFirstY;
- int16_t fLastY;
- int16_t fCurveCount; // only used by kQuad(+) and kCubic(-)
- uint8_t fCurveShift;
+ int32_t fFirstY;
+ int32_t fLastY;
+ int8_t fCurveCount; // only used by kQuad(+) and kCubic(-)
+ uint8_t fCurveShift; // appled to all Dx/DDx/DDDx except for fCubicDShift exception
+ uint8_t fCubicDShift; // applied to fCDx and fCDy only in cubic
int8_t fWinding; // 1 or -1
int setLine(const SkPoint& p0, const SkPoint& p1, const SkIRect* clip,
diff --git a/skia/sgl/SkFP.h b/skia/sgl/SkFP.h
index b95cba2..6c0c526 100644
--- a/skia/sgl/SkFP.h
+++ b/skia/sgl/SkFP.h
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkFP.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkFilterProc.cpp b/skia/sgl/SkFilterProc.cpp
index 8082a34..814bafe 100644
--- a/skia/sgl/SkFilterProc.cpp
+++ b/skia/sgl/SkFilterProc.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkFilterProc.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkFilterProc.h b/skia/sgl/SkFilterProc.h
index 5aa59ab..9af4ed5 100644
--- a/skia/sgl/SkFilterProc.h
+++ b/skia/sgl/SkFilterProc.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2008 Google Inc.
+ * Copyright (C) 2006-2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -70,7 +70,7 @@ typedef unsigned (*SkFilter32Proc)(uint32_t x00, uint32_t x01,
const SkFilter32Proc* SkGetFilter32ProcTable();
-inline SkFilter32Proc SkGetFilter32Proc22(const SkFilterProc* table,
+inline SkFilter32Proc SkGetFilter32Proc22(const SkFilter32Proc* table,
unsigned x, unsigned y)
{
SkASSERT(table);
@@ -81,7 +81,7 @@ inline SkFilter32Proc SkGetFilter32Proc22(const SkFilterProc* table,
return table[(y << 2) | x];
}
-inline const SkFilter32Proc* SkGetFilter32Proc22Row(const SkFilterProc* table,
+inline const SkFilter32Proc* SkGetFilter32Proc22Row(const SkFilter32Proc* table,
unsigned y)
{
SkASSERT(table);
@@ -89,7 +89,7 @@ inline const SkFilter32Proc* SkGetFilter32Proc22Row(const SkFilterProc* table,
return &table[y << 30 >> 28];
}
-inline SkFilter32Proc SkGetFilter32Proc22RowProc(const SkFilterProc* row,
+inline SkFilter32Proc SkGetFilter32Proc22RowProc(const SkFilter32Proc* row,
unsigned x)
{
SkASSERT(row);
diff --git a/skia/sgl/SkGeometry.cpp b/skia/sgl/SkGeometry.cpp
index 3c72f4b..4f22e92 100644
--- a/skia/sgl/SkGeometry.cpp
+++ b/skia/sgl/SkGeometry.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkGeometry.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -260,6 +260,14 @@ static void flatten_double_quad_extrema(SkScalar coords[14])
coords[2] = coords[6] = coords[4];
}
+static void force_quad_monotonic_in_y(SkPoint pts[3])
+{
+ // zap pts[1].fY to the nearest value
+ SkScalar ab = SkScalarAbs(pts[0].fY - pts[1].fY);
+ SkScalar bc = SkScalarAbs(pts[1].fY - pts[2].fY);
+ pts[1].fY = ab < bc ? pts[0].fY : pts[2].fY;
+}
+
/* Returns 0 for 1 quad, and 1 for two quads, either way the answer is
stored in dst[]. Guarantees that the 1/2 quads will be monotonic.
*/
diff --git a/skia/sgl/SkGeometry.h b/skia/sgl/SkGeometry.h
index d4547a5..571159f 100644
--- a/skia/sgl/SkGeometry.h
+++ b/skia/sgl/SkGeometry.h
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkGeometry.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkGlobals.cpp b/skia/sgl/SkGlobals.cpp
index fb1c948..bc72b97 100644
--- a/skia/sgl/SkGlobals.cpp
+++ b/skia/sgl/SkGlobals.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkGlobals.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkGlyphCache.cpp b/skia/sgl/SkGlyphCache.cpp
index f67223d..6b214df 100644
--- a/skia/sgl/SkGlyphCache.cpp
+++ b/skia/sgl/SkGlyphCache.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkGlyphCache.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -21,7 +21,33 @@
#include "SkTemplates.h"
#define SPEW_PURGE_STATUS
-#define USE_CACHE_HASHxxxxx
+//#define USE_CACHE_HASH
+//#define RECORD_HASH_EFFICIENCY
+
+///////////////////////////////////////////////////////////////////////////////
+
+#ifdef RECORD_HASH_EFFICIENCY
+ static uint32_t gHashSuccess;
+ static uint32_t gHashCollision;
+
+ static void RecordHashSuccess() {
+ gHashSuccess += 1;
+ }
+
+ static void RecordHashCollisionIf(bool pred) {
+ if (pred) {
+ gHashCollision += 1;
+
+ uint32_t total = gHashSuccess + gHashCollision;
+ SkDebugf("Font Cache Hash success rate: %d%%\n",
+ 100 * gHashSuccess / total);
+ }
+ }
+#else
+ #define RecordHashSuccess() (void)0
+ #define RecordHashCollisionIf(pred) (void)0
+#endif
+#define RecordHashCollision() RecordHashCollisionIf(true)
///////////////////////////////////////////////////////////////////////////////
@@ -70,26 +96,40 @@ SkGlyphCache::~SkGlyphCache() {
///////////////////////////////////////////////////////////////////////////////
#ifdef SK_DEBUG
- class AutoCheckForNull {
- public:
- AutoCheckForNull(const SkTDArray<SkGlyph*>& array) : fArray(array) {
- for (int i = 0; i < array.count(); i++)
- SkASSERT(array[i]);
- }
- ~AutoCheckForNull() {
- const SkTDArray<SkGlyph*>& array = fArray;
- for (int i = 0; i < array.count(); i++) {
- SkASSERT(array[i]);
- }
+class AutoCheckForNull {
+public:
+ AutoCheckForNull(const SkTDArray<SkGlyph*>& array) : fArray(array) {
+ for (int i = 0; i < array.count(); i++)
+ SkASSERT(array[i]);
+ }
+ ~AutoCheckForNull() {
+ const SkTDArray<SkGlyph*>& array = fArray;
+ for (int i = 0; i < array.count(); i++) {
+ SkASSERT(array[i]);
}
- private:
- const SkTDArray<SkGlyph*>& fArray;
- };
- #define VALIDATE() AutoCheckForNull acfn(fGlyphArray)
+ }
+private:
+ const SkTDArray<SkGlyph*>& fArray;
+};
+#define VALIDATE() AutoCheckForNull acfn(fGlyphArray)
#else
- #define VALIDATE()
+#define VALIDATE()
#endif
+uint16_t SkGlyphCache::unicharToGlyph(SkUnichar charCode) {
+ VALIDATE();
+ uint32_t id = SkGlyph::MakeID(charCode);
+ const CharGlyphRec& rec = fCharToGlyphHash[ID2HashIndex(id)];
+
+ if (rec.fID == id) {
+ return rec.fGlyph->getGlyphID();
+ } else {
+ return fScalerContext->charToGlyphID(charCode);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
const SkGlyph& SkGlyphCache::getUnicharAdvance(SkUnichar charCode) {
VALIDATE();
uint32_t id = SkGlyph::MakeID(charCode);
@@ -126,12 +166,14 @@ const SkGlyph& SkGlyphCache::getUnicharMetrics(SkUnichar charCode) {
CharGlyphRec* rec = &fCharToGlyphHash[ID2HashIndex(id)];
if (rec->fID != id) {
+ RecordHashCollisionIf(rec->fGlyph != NULL);
// this ID is based on the UniChar
rec->fID = id;
// this ID is based on the glyph index
id = SkGlyph::MakeID(fScalerContext->charToGlyphID(charCode));
rec->fGlyph = this->lookupMetrics(id, kFull_MetricsType);
} else {
+ RecordHashSuccess();
if (rec->fGlyph->isJustAdvance()) {
fScalerContext->getMetrics(rec->fGlyph);
}
@@ -147,12 +189,14 @@ const SkGlyph& SkGlyphCache::getUnicharMetrics(SkUnichar charCode,
CharGlyphRec* rec = &fCharToGlyphHash[ID2HashIndex(id)];
if (rec->fID != id) {
+ RecordHashCollisionIf(rec->fGlyph != NULL);
// this ID is based on the UniChar
rec->fID = id;
// this ID is based on the glyph index
id = SkGlyph::MakeID(fScalerContext->charToGlyphID(charCode), x, y);
rec->fGlyph = this->lookupMetrics(id, kFull_MetricsType);
} else {
+ RecordHashSuccess();
if (rec->fGlyph->isJustAdvance()) {
fScalerContext->getMetrics(rec->fGlyph);
}
@@ -168,9 +212,11 @@ const SkGlyph& SkGlyphCache::getGlyphIDMetrics(uint16_t glyphID) {
SkGlyph* glyph = fGlyphHash[index];
if (NULL == glyph || glyph->fID != id) {
+ RecordHashCollisionIf(glyph != NULL);
glyph = this->lookupMetrics(glyphID, kFull_MetricsType);
fGlyphHash[index] = glyph;
} else {
+ RecordHashSuccess();
if (glyph->isJustAdvance()) {
fScalerContext->getMetrics(glyph);
}
@@ -185,11 +231,13 @@ const SkGlyph& SkGlyphCache::getGlyphIDMetrics(uint16_t glyphID,
uint32_t id = SkGlyph::MakeID(glyphID, x, y);
unsigned index = ID2HashIndex(id);
SkGlyph* glyph = fGlyphHash[index];
-
+
if (NULL == glyph || glyph->fID != id) {
+ RecordHashCollisionIf(glyph != NULL);
glyph = this->lookupMetrics(id, kFull_MetricsType);
fGlyphHash[index] = glyph;
} else {
+ RecordHashSuccess();
if (glyph->isJustAdvance()) {
fScalerContext->getMetrics(glyph);
}
@@ -406,6 +454,23 @@ public:
#define GET_GC_GLOBALS() gGCGlobals
#endif
+void SkGlyphCache::VisitAllCaches(bool (*proc)(SkGlyphCache*, void*),
+ void* context) {
+ SkGlyphCache_Globals& globals = FIND_GC_GLOBALS();
+ SkAutoMutexAcquire ac(globals.fMutex);
+ SkGlyphCache* cache;
+
+ globals.validate();
+
+ for (cache = globals.fHead; cache != NULL; cache = cache->fNext) {
+ if (proc(cache, context)) {
+ break;
+ }
+ }
+
+ globals.validate();
+}
+
/* This guy calls the visitor from within the mutext lock, so the visitor
cannot:
- take too much time
@@ -434,7 +499,6 @@ SkGlyphCache* SkGlyphCache::VisitCache(const SkDescriptor* desc,
}
#endif
- cache = globals.fHead;
for (cache = globals.fHead; cache != NULL; cache = cache->fNext) {
if (cache->fDesc->equals(*desc)) {
cache->detach(&globals.fHead);
diff --git a/skia/sgl/SkGlyphCache.h b/skia/sgl/SkGlyphCache.h
index 6aef173..2462ea5 100644
--- a/skia/sgl/SkGlyphCache.h
+++ b/skia/sgl/SkGlyphCache.h
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkGlyphCache.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -66,6 +66,12 @@ public:
const SkGlyph& getUnicharMetrics(SkUnichar, SkFixed x, SkFixed y);
const SkGlyph& getGlyphIDMetrics(uint16_t, SkFixed x, SkFixed y);
+ /** Return the glyphID for the specified Unichar. If the char has already
+ been seen, use the existing cache entry. If not, ask the scalercontext
+ to compute it for us.
+ */
+ uint16_t unicharToGlyph(SkUnichar);
+
/** Return the image associated with the glyph. If it has not been generated
this will trigger that.
*/
@@ -98,6 +104,12 @@ public:
// call the proc)
void removeAuxProc(void (*auxProc)(void*));
+ /** Call proc on all cache entries, stopping early if proc returns true.
+ The proc should not create or delete caches, since it could produce
+ deadlock.
+ */
+ static void VisitAllCaches(bool (*proc)(SkGlyphCache*, void*), void* ctx);
+
/** Find a matching cache entry, and call proc() with it. If none is found
create a new one. If the proc() returns true, detach the cache and
return it, otherwise leave it and return NULL.
@@ -176,7 +188,7 @@ private:
SkPaint::FontMetrics fFontMetricsY;
enum {
- kHashBits = 6,
+ kHashBits = 8,
kHashCount = 1 << kHashBits,
kHashMask = kHashCount - 1
};
diff --git a/skia/sgl/SkGraphics.cpp b/skia/sgl/SkGraphics.cpp
index 1bb3cb3..ed9ab02 100644
--- a/skia/sgl/SkGraphics.cpp
+++ b/skia/sgl/SkGraphics.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkGraphics.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -149,10 +149,132 @@ static void test_drawText(SkBitmap::Config config, SkColor color)
#endif
+#include "SkFloatBits.h"
+
+static inline float fast_inc(float x) {
+ SkFloatIntUnion data;
+ data.fFloat = x;
+ data.fSignBitInt += 1;
+ return data.fFloat;
+}
+
+extern float dummy();
+int time_math() {
+ SkMSec now;
+ int i;
+ int sum = 0;
+ const int repeat = 1000000;
+ float f;
+
+ f = dummy();
+ now = SkTime::GetMSecs();
+ for (i = repeat - 1; i >= 0; --i) {
+ sum += (int)f; f = fast_inc(f);
+ sum += (int)f; f = fast_inc(f);
+ sum += (int)f; f = fast_inc(f);
+ sum += (int)f; f = fast_inc(f);
+ }
+ SkDebugf("---- native cast %d\n", SkTime::GetMSecs() - now);
+
+ f = dummy();
+ now = SkTime::GetMSecs();
+ for (i = repeat - 1; i >= 0; --i) {
+ sum += SkFloatToIntCast(f); f = fast_inc(f);
+ sum += SkFloatToIntCast(f); f = fast_inc(f);
+ sum += SkFloatToIntCast(f); f = fast_inc(f);
+ sum += SkFloatToIntCast(f); f = fast_inc(f);
+ }
+ SkDebugf("---- hack cast %d\n", SkTime::GetMSecs() - now);
+
+ f = dummy();
+ now = SkTime::GetMSecs();
+ for (i = repeat - 1; i >= 0; --i) {
+ sum += (int)floorf(f + 0.5f); f = fast_inc(f);
+ sum += (int)floorf(f + 0.5f); f = fast_inc(f);
+ sum += (int)floorf(f + 0.5f); f = fast_inc(f);
+ sum += (int)floorf(f + 0.5f); f = fast_inc(f);
+ }
+ SkDebugf("---- native round %d\n", SkTime::GetMSecs() - now);
+
+ f = dummy();
+ now = SkTime::GetMSecs();
+ for (i = repeat - 1; i >= 0; --i) {
+ sum += SkFloatToIntRound(f); f = fast_inc(f);
+ sum += SkFloatToIntRound(f); f = fast_inc(f);
+ sum += SkFloatToIntRound(f); f = fast_inc(f);
+ sum += SkFloatToIntRound(f); f = fast_inc(f);
+ }
+ SkDebugf("---- hack round %d\n", SkTime::GetMSecs() - now);
+
+ f = dummy();
+ now = SkTime::GetMSecs();
+ for (i = repeat - 1; i >= 0; --i) {
+ sum += SkFloat2Bits(floorf(f)); f = fast_inc(f);
+ sum += SkFloat2Bits(floorf(f)); f = fast_inc(f);
+ sum += SkFloat2Bits(floorf(f)); f = fast_inc(f);
+ sum += SkFloat2Bits(floorf(f)); f = fast_inc(f);
+ }
+ SkDebugf("---- native floor %d\n", SkTime::GetMSecs() - now);
+
+ f = dummy();
+ now = SkTime::GetMSecs();
+ for (i = repeat - 1; i >= 0; --i) {
+ sum += SkFloatToIntFloor(f); f = fast_inc(f);
+ sum += SkFloatToIntFloor(f); f = fast_inc(f);
+ sum += SkFloatToIntFloor(f); f = fast_inc(f);
+ sum += SkFloatToIntFloor(f); f = fast_inc(f);
+ }
+ SkDebugf("---- hack floor %d\n", SkTime::GetMSecs() - now);
+
+ return sum;
+}
+
+static float time_intToFloat() {
+ const int repeat = 1000000;
+ int i, n;
+ SkMSec now;
+ float sum = 0;
+
+ n = (int)dummy();
+ now = SkTime::GetMSecs();
+ for (i = repeat - 1; i >= 0; --i) {
+ sum += (float)n; n += 1;
+ sum += (float)n; n += 1;
+ sum += (float)n; n += 1;
+ sum += (float)n; n += 1;
+ }
+ SkDebugf("---- native i2f %d\n", SkTime::GetMSecs() - now);
+
+ n = (int)dummy();
+ now = SkTime::GetMSecs();
+ for (i = repeat - 1; i >= 0; --i) {
+ sum += SkIntToFloatCast(n); n += 1;
+ sum += SkIntToFloatCast(n); n += 1;
+ sum += SkIntToFloatCast(n); n += 1;
+ sum += SkIntToFloatCast(n); n += 1;
+ }
+ SkDebugf("---- check i2f %d\n", SkTime::GetMSecs() - now);
+
+ n = (int)dummy();
+ now = SkTime::GetMSecs();
+ for (i = repeat - 1; i >= 0; --i) {
+ sum += SkIntToFloatCast_NoOverflowCheck(n); n += 1;
+ sum += SkIntToFloatCast_NoOverflowCheck(n); n += 1;
+ sum += SkIntToFloatCast_NoOverflowCheck(n); n += 1;
+ sum += SkIntToFloatCast_NoOverflowCheck(n); n += 1;
+ }
+ SkDebugf("---- nocheck i2f %d\n", SkTime::GetMSecs() - now);
+
+ return sum;
+}
+
void SkGraphics::Init(bool runUnitTests)
{
SkGlobals::Init();
+// time_math();
+// time_intToFloat();
+
#ifdef BUILD_EMBOSS_TABLE
SkEmbossMask_BuildTable();
#endif
@@ -221,11 +343,12 @@ void SkGraphics::Init(bool runUnitTests)
unittestline(SkMath),
unittestline(SkUtils),
unittestline(SkString),
- unittestline(SkFloat),
unittestline(SkMatrix),
unittestline(SkGeometry),
unittestline(SkPath),
- unittestline(SkPathMeasure)
+ unittestline(SkPathMeasure),
+ unittestline(SkStream),
+ unittestline(SkWStream),
};
for (i = 0; i < (int)SK_ARRAY_COUNT(gUnitTests); i++)
@@ -402,3 +525,4 @@ bool SkGraphics::SetFontCacheUsed(size_t usageInBytes) {
return SkGlyphCache::SetCacheUsed(usageInBytes);
}
+float dummy() { return 1.25f; }
diff --git a/skia/sgl/SkMask.cpp b/skia/sgl/SkMask.cpp
index edc3b0a..b237639 100644
--- a/skia/sgl/SkMask.cpp
+++ b/skia/sgl/SkMask.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkMask.cpp
**
-** Copyright 2007, Google Inc.
+** Copyright 2007, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkMaskFilter.cpp b/skia/sgl/SkMaskFilter.cpp
index 9040cfd..56fff97 100644
--- a/skia/sgl/SkMaskFilter.cpp
+++ b/skia/sgl/SkMaskFilter.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkMaskFilter.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkPaint.cpp b/skia/sgl/SkPaint.cpp
index ef23f09..bb6b31e 100644
--- a/skia/sgl/SkPaint.cpp
+++ b/skia/sgl/SkPaint.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkPaint.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -301,40 +301,26 @@ SkDrawLooper* SkPaint::setLooper(SkDrawLooper* looper)
return looper;
}
-///////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
#include "SkGlyphCache.h"
#include "SkUtils.h"
-class SkAutoRestoreFlags {
-public:
- SkAutoRestoreFlags(SkPaint* paint) : fPaint(paint)
- {
- fFlags = paint->getFlags();
- }
- ~SkAutoRestoreFlags()
- {
- fPaint->setFlags(fFlags);
- }
-private:
- SkPaint* fPaint;
- uint32_t fFlags;
-};
-
-int SkPaint::textToGlyphs(const void* textData, size_t byteLength, uint16_t glyphs[]) const
-{
- if (byteLength == 0)
+int SkPaint::textToGlyphs(const void* textData, size_t byteLength,
+ uint16_t glyphs[]) const {
+ if (byteLength == 0) {
return 0;
+ }
SkASSERT(textData != NULL);
- if (NULL == glyphs)
- {
+ if (NULL == glyphs) {
switch (this->getTextEncoding()) {
case kUTF8_TextEncoding:
return SkUTF8_CountUnichars((const char*)textData, byteLength);
case kUTF16_TextEncoding:
- return SkUTF16_CountUnichars((const uint16_t*)textData, byteLength >> 1);
+ return SkUTF16_CountUnichars((const uint16_t*)textData,
+ byteLength >> 1);
case kGlyphID_TextEncoding:
return byteLength >> 1;
default:
@@ -345,33 +331,60 @@ int SkPaint::textToGlyphs(const void* textData, size_t byteLength, uint16_t glyp
// if we get here, we have a valid glyphs[] array, so time to fill it in
- if (this->getTextEncoding() == kGlyphID_TextEncoding)
- {
+ // handle this encoding before the setup for the glyphcache
+ if (this->getTextEncoding() == kGlyphID_TextEncoding) {
// we want to ignore the low bit of byteLength
memcpy(glyphs, textData, byteLength >> 1 << 1);
return byteLength >> 1;
}
- SkAutoRestoreFlags autoRestore((SkPaint*)this);
- ((SkPaint*)this)->fFlags &= ~kSubpixelText_Flag;
-
- SkAutoGlyphCache autoCache(*this, NULL);
- SkGlyphCache* cache = autoCache.getCache();
- SkMeasureCacheProc proc;
- proc = this->getMeasureCacheProc(kForward_TextBufferDirection, false);
+ SkAutoGlyphCache autoCache(*this, NULL);
+ SkGlyphCache* cache = autoCache.getCache();
- const char* text = (const char*)textData;
- const char* stop = text + byteLength;
- uint16_t* gptr = glyphs;
+ const char* text = (const char*)textData;
+ const char* stop = text + byteLength;
+ uint16_t* gptr = glyphs;
- while (text < stop)
- {
- // no need to provide x, y
- *gptr++ = proc(cache, &text).getGlyphID();
+ switch (this->getTextEncoding()) {
+ case SkPaint::kUTF8_TextEncoding:
+ while (text < stop) {
+ *gptr++ = cache->unicharToGlyph(SkUTF8_NextUnichar(&text));
+ }
+ break;
+ case SkPaint::kUTF16_TextEncoding: {
+ const uint16_t* text16 = (const uint16_t*)text;
+ const uint16_t* stop16 = (const uint16_t*)stop;
+ while (text16 < stop16) {
+ *gptr++ = cache->unicharToGlyph(SkUTF16_NextUnichar(&text16));
+ }
+ break;
+ }
+ default:
+ SkASSERT(!"unknown text encoding");
}
return gptr - glyphs;
}
+///////////////////////////////////////////////////////////////////////////////
+
+static uint32_t sk_glyphID_next(const char** text)
+{
+ const uint16_t* glyph = (const uint16_t*)text;
+ int32_t value = *glyph;
+ glyph += 1;
+ *text = (const char*)glyph;
+ return value;
+}
+
+static uint32_t sk_glyphID_prev(const char** text)
+{
+ const uint16_t* glyph = (const uint16_t*)text;
+ glyph -= 1;
+ int32_t value = *glyph;
+ *text = (const char*)glyph;
+ return value;
+}
+
//////////////////////////////////////////////////////////////////////////////
static const SkGlyph& sk_getMetrics_utf8_next(SkGlyphCache* cache, const char** text)
@@ -1231,7 +1244,7 @@ void SkPaint::descriptorProc(const SkMatrix* deviceMatrix,
descSize += peBuffer.size();
entryCount += 1;
rec.fMaskFormat = SkMask::kA8_Format; // force antialiasing when we do the scan conversion
- // seems like we could support kLCD as well at this point <reed>...
+ // seems like we could support kLCD as well at this point...
}
if (mf) {
mfBuffer.writeFlattenable(mf);
@@ -1431,6 +1444,38 @@ bool SkPaint::getFillPath(const SkPath& src, SkPath* dst) const
return width != 0; // return true if we're filled, or false if we're hairline (width == 0)
}
+bool SkPaint::canComputeFastBounds() const {
+ // use bit-or since no need for early exit
+ return (reinterpret_cast<uintptr_t>(this->getMaskFilter()) |
+ reinterpret_cast<uintptr_t>(this->getLooper()) |
+ reinterpret_cast<uintptr_t>(this->getRasterizer()) |
+ reinterpret_cast<uintptr_t>(this->getPathEffect())) == 0;
+}
+
+const SkRect& SkPaint::computeFastBounds(const SkRect& src,
+ SkRect* storage) const {
+ SkASSERT(storage);
+
+ if (this->getStyle() != SkPaint::kFill_Style) {
+ // if we're stroked, outset the rect by the radius (and join type)
+ SkScalar radius = SkScalarHalf(this->getStrokeWidth());
+
+ if (0 == radius) { // hairline
+ radius = SK_Scalar1;
+ } else if (this->getStrokeJoin() == SkPaint::kMiter_Join) {
+ SkScalar scale = this->getStrokeMiter();
+ if (scale > SK_Scalar1) {
+ radius = SkScalarMul(radius, scale);
+ }
+ }
+ storage->set(src.fLeft - radius, src.fTop - radius,
+ src.fRight + radius, src.fBottom + radius);
+ return *storage;
+ }
+ // no adjustments needed, just return the original rect
+ return src;
+}
+
////////////////////////////////////////////////////////////////////////////////////////
static bool has_thick_frame(const SkPaint& paint)
@@ -1524,4 +1569,3 @@ const SkPath* SkTextToPathIter::next(SkScalar* xpos)
}
return NULL;
}
-
diff --git a/skia/sgl/SkPath.cpp b/skia/sgl/SkPath.cpp
index afe8662..5d6882e 100644
--- a/skia/sgl/SkPath.cpp
+++ b/skia/sgl/SkPath.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkPath.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -19,6 +19,63 @@
#include "SkFlattenable.h"
#include "SkMath.h"
+////////////////////////////////////////////////////////////////////////////
+
+/* This guy's constructor/destructor bracket a path editing operation. It is
+ used when we know the bounds of the amount we are going to add to the path
+ (usually a new contour, but not required).
+
+ It captures some state about the path up front (i.e. if it already has a
+ cached bounds), and the if it can, it updates the cache bounds explicitly,
+ avoiding the need to revisit all of the points in computeBounds().
+ */
+class SkAutoPathBoundsUpdate {
+public:
+ SkAutoPathBoundsUpdate(SkPath* path, const SkRect& r) : fRect(r) {
+ this->init(path);
+ }
+
+ SkAutoPathBoundsUpdate(SkPath* path, SkScalar left, SkScalar top,
+ SkScalar right, SkScalar bottom) {
+ fRect.set(left, top, right, bottom);
+ this->init(path);
+ }
+
+ ~SkAutoPathBoundsUpdate() {
+ if (fEmpty) {
+ fPath->fFastBounds = fRect;
+ fPath->fFastBoundsIsDirty = false;
+ } else if (!fDirty) {
+ fPath->fFastBounds.join(fRect);
+ fPath->fFastBoundsIsDirty = false;
+ }
+ }
+
+private:
+ const SkPath* fPath;
+ SkRect fRect;
+ bool fDirty;
+ bool fEmpty;
+
+ // returns true if we should proceed
+ void init(const SkPath* path) {
+ fPath = path;
+ fDirty = path->fFastBoundsIsDirty;
+ fEmpty = path->isEmpty();
+ }
+};
+
+static void compute_fast_bounds(SkRect* bounds, const SkTDArray<SkPoint>& pts) {
+ if (pts.count() <= 1) { // we ignore just 1 point (moveto)
+ bounds->set(0, 0, 0, 0);
+ } else {
+ bounds->set(pts.begin(), pts.count());
+// SkDebugf("------- compute bounds %p %d", &pts, pts.count());
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////
+
/*
Stores the verbs and points as they are given to us, with exceptions:
- we only record "Close" if it was immediately preceeded by Line | Quad | Cubic
@@ -145,24 +202,8 @@ void SkPath::computeBounds(SkRect* bounds, BoundsType bt) const {
if (fFastBoundsIsDirty) {
fFastBoundsIsDirty = false;
- if (fPts.count() <= 1) { // we ignore just 1 point (moveto)
- fFastBounds.set(0, 0, 0, 0);
- } else {
- fFastBounds.set(fPts.begin(), fPts.count());
- }
+ compute_fast_bounds(&fFastBounds, fPts);
}
-#ifdef SK_DEBUG
- else { // check that our cache is correct
- SkRect r;
- if (fPts.count() <= 1) { // we ignore just 1 point (moveto)
- r.set(0, 0, 0, 0);
- } else {
- r.set(fPts.begin(), fPts.count());
- }
- SkASSERT(r == fFastBounds);
- }
-#endif
-
*bounds = fFastBounds;
}
@@ -286,13 +327,15 @@ void SkPath::close() {
}
///////////////////////////////////////////////////////////////////////////////
-
+
void SkPath::addRect(const SkRect& rect, Direction dir) {
this->addRect(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, dir);
}
void SkPath::addRect(SkScalar left, SkScalar top, SkScalar right,
SkScalar bottom, Direction dir) {
+ SkAutoPathBoundsUpdate apbu(this, left, top, right, bottom);
+
this->incReserve(5);
this->moveTo(left, top);
@@ -312,6 +355,8 @@ void SkPath::addRect(SkScalar left, SkScalar top, SkScalar right,
void SkPath::addRoundRect(const SkRect& rect, SkScalar rx, SkScalar ry,
Direction dir) {
+ SkAutoPathBoundsUpdate apbu(this, rect);
+
SkScalar w = rect.width();
SkScalar halfW = SkScalarHalf(w);
SkScalar h = rect.height();
@@ -395,7 +440,7 @@ void SkPath::addRoundRect(const SkRect& rect, SkScalar rx, SkScalar ry,
static void add_corner_arc(SkPath* path, const SkRect& rect,
SkScalar rx, SkScalar ry, int startAngle,
- bool ccw, bool forceMoveTo = false) {
+ SkPath::Direction dir, bool forceMoveTo) {
rx = SkMinScalar(SkScalarHalf(rect.width()), rx);
ry = SkMinScalar(SkScalarHalf(rect.height()), ry);
@@ -416,7 +461,7 @@ static void add_corner_arc(SkPath* path, const SkRect& rect,
SkScalar start = SkIntToScalar(startAngle);
SkScalar sweep = SkIntToScalar(90);
- if (ccw) {
+ if (SkPath::kCCW_Direction == dir) {
start += sweep;
sweep = -sweep;
}
@@ -426,26 +471,30 @@ static void add_corner_arc(SkPath* path, const SkRect& rect,
void SkPath::addRoundRect(const SkRect& rect, const SkScalar rad[],
Direction dir) {
+ SkAutoPathBoundsUpdate apbu(this, rect);
if (kCW_Direction == dir) {
- add_corner_arc(this, rect, rad[0], rad[1], 180, false, true);
- add_corner_arc(this, rect, rad[2], rad[3], 270, false);
- add_corner_arc(this, rect, rad[4], rad[5], 0, false);
- add_corner_arc(this, rect, rad[6], rad[7], 90, false);
+ add_corner_arc(this, rect, rad[0], rad[1], 180, dir, true);
+ add_corner_arc(this, rect, rad[2], rad[3], 270, dir, false);
+ add_corner_arc(this, rect, rad[4], rad[5], 0, dir, false);
+ add_corner_arc(this, rect, rad[6], rad[7], 90, dir, false);
} else {
- add_corner_arc(this, rect, rad[0], rad[1], 180, true, true);
- add_corner_arc(this, rect, rad[6], rad[7], 90, true);
- add_corner_arc(this, rect, rad[4], rad[5], 0, true);
- add_corner_arc(this, rect, rad[2], rad[3], 270, true);
+ add_corner_arc(this, rect, rad[0], rad[1], 180, dir, true);
+ add_corner_arc(this, rect, rad[6], rad[7], 90, dir, false);
+ add_corner_arc(this, rect, rad[4], rad[5], 0, dir, false);
+ add_corner_arc(this, rect, rad[2], rad[3], 270, dir, false);
}
+ this->close();
}
void SkPath::addOval(const SkRect& oval, Direction dir) {
+ SkAutoPathBoundsUpdate apbu(this, oval);
+
SkScalar cx = oval.centerX();
SkScalar cy = oval.centerY();
SkScalar rx = SkScalarHalf(oval.width());
SkScalar ry = SkScalarHalf(oval.height());
-#if 1 // these seem faster than using quads (1/2 the number of edges)
+#if 0 // these seem faster than using quads (1/2 the number of edges)
SkScalar sx = SkScalarMul(rx, CUBIC_ARC_FACTOR);
SkScalar sy = SkScalarMul(ry, CUBIC_ARC_FACTOR);
@@ -468,7 +517,7 @@ void SkPath::addOval(const SkRect& oval, Direction dir) {
SkScalar mx = SkScalarMul(rx, SK_ScalarRoot2Over2);
SkScalar my = SkScalarMul(ry, SK_ScalarRoot2Over2);
- this->incReserve(16);
+ this->incReserve(17); // 8 quads + close
this->moveTo(cx + rx, cy);
if (dir == kCCW_Direction) {
this->quadTo(cx + rx, cy - sy, cx + mx, cy - my);
@@ -547,7 +596,7 @@ void SkPath::addArc(const SkRect& oval, SkScalar startAngle,
if (oval.isEmpty() || 0 == sweepAngle) {
return;
}
-
+
const SkScalar kFullCircleAngle = SkIntToScalar(360);
if (sweepAngle >= kFullCircleAngle || sweepAngle <= -kFullCircleAngle) {
@@ -792,6 +841,7 @@ static void subdivide_cubic_to(SkPath* path, const SkPoint pts[4],
}
void SkPath::transform(const SkMatrix& matrix, SkPath* dst) const {
+ SkDEBUGCODE(this->validate();)
if (dst == NULL) {
dst = (SkPath*)this;
}
@@ -846,6 +896,7 @@ void SkPath::transform(const SkMatrix& matrix, SkPath* dst) const {
dst->fFillType = fFillType;
}
matrix.mapPoints(dst->fPts.begin(), fPts.begin(), fPts.count());
+ SkDEBUGCODE(dst->validate();)
}
}
@@ -1211,11 +1262,18 @@ void SkPath::toString(SkString* str) const {
void SkPath::validate() const {
SkASSERT(this != NULL);
SkASSERT((fFillType & ~3) == 0);
- if (!fFastBoundsIsDirty) {
- SkASSERT(fFastBounds.width() >= 0 && fFastBounds.height() >= 0);
- }
fPts.validate();
fVerbs.validate();
+
+ if (!fFastBoundsIsDirty) {
+ SkRect bounds;
+ compute_fast_bounds(&bounds, fPts);
+ // can't call contains(), since it returns false if the rect is empty
+ SkASSERT(fFastBounds.fLeft <= bounds.fLeft);
+ SkASSERT(fFastBounds.fTop <= bounds.fTop);
+ SkASSERT(fFastBounds.fRight >= bounds.fRight);
+ SkASSERT(fFastBounds.fBottom >= bounds.fBottom);
+ }
}
#if 0 // test to ensure that the iterator returns the same data as the path
diff --git a/skia/sgl/SkPathEffect.cpp b/skia/sgl/SkPathEffect.cpp
index 8321fca..2905895 100644
--- a/skia/sgl/SkPathEffect.cpp
+++ b/skia/sgl/SkPathEffect.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkPathEffect.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkPathMeasure.cpp b/skia/sgl/SkPathMeasure.cpp
index e877d0f..ec1510d 100644
--- a/skia/sgl/SkPathMeasure.cpp
+++ b/skia/sgl/SkPathMeasure.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2008 Google Inc.
+ * Copyright (C) 2006-2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkProcSpriteBlitter.cpp b/skia/sgl/SkProcSpriteBlitter.cpp
index 822c218..f727581e 100644
--- a/skia/sgl/SkProcSpriteBlitter.cpp
+++ b/skia/sgl/SkProcSpriteBlitter.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkProcSpriteBlitter.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkRasterizer.cpp b/skia/sgl/SkRasterizer.cpp
index 8a46bad..f1d087d 100644
--- a/skia/sgl/SkRasterizer.cpp
+++ b/skia/sgl/SkRasterizer.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkRasterizer.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkRefCnt.cpp b/skia/sgl/SkRefCnt.cpp
index 2f0babc..fea1005 100644
--- a/skia/sgl/SkRefCnt.cpp
+++ b/skia/sgl/SkRefCnt.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkRefCnt.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkRegion_path.cpp b/skia/sgl/SkRegion_path.cpp
index 11e19b9..d00baf9 100644
--- a/skia/sgl/SkRegion_path.cpp
+++ b/skia/sgl/SkRegion_path.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkRegion_path.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -25,7 +25,8 @@ class SkRgnBuilder : public SkBlitter {
public:
virtual ~SkRgnBuilder();
- void init(int maxHeight, int maxTransitions);
+ // returns true if it could allocate the working storage needed
+ bool init(int maxHeight, int maxTransitions);
void done() {
if (fCurrScanline != NULL) {
@@ -96,15 +97,33 @@ SkRgnBuilder::~SkRgnBuilder() {
sk_free(fStorage);
}
-void SkRgnBuilder::init(int maxHeight, int maxTransitions) {
- int count = maxHeight * (3 + maxTransitions);
+bool SkRgnBuilder::init(int maxHeight, int maxTransitions) {
+ if ((maxHeight | maxTransitions) < 0) {
+ return false;
+ }
+
+ Sk64 count, size;
+
+ // compute the count with +1 and +3 slop for the working buffer
+ count.setMul(maxHeight + 1, 3 + maxTransitions);
+ if (!count.is32() || count.isNeg()) {
+ return false;
+ }
+ fStorageCount = count.get32();
- // add maxTransitions to have slop for working buffer
- fStorageCount = count + 3 + maxTransitions;
- fStorage = (SkRegion::RunType*)sk_malloc_throw(fStorageCount * sizeof(SkRegion::RunType));
+ size.setMul(fStorageCount, sizeof(SkRegion::RunType));
+ if (!size.is32() || size.isNeg()) {
+ return false;
+ }
+
+ fStorage = (SkRegion::RunType*)sk_malloc_flags(size.get32(), 0);
+ if (NULL == fStorage) {
+ return false;
+ }
fCurrScanline = NULL; // signal empty collection
fPrevScanline = NULL; // signal first scanline
+ return true;
}
void SkRgnBuilder::blitH(int x, int y, int width) {
@@ -275,7 +294,11 @@ bool SkRegion::setPath(const SkPath& path, const SkRegion& clip) {
SkRgnBuilder builder;
- builder.init(bot - top, SkMax32(pathTransitions, clipTransitions));
+ if (!builder.init(bot - top, SkMax32(pathTransitions, clipTransitions))) {
+ // can't allocate working space, so return false
+ return this->setEmpty();
+ }
+
SkScan::FillPath(path, clip, &builder);
builder.done();
diff --git a/skia/sgl/SkScalerContext.cpp b/skia/sgl/SkScalerContext.cpp
index 0289312..854c4de 100644
--- a/skia/sgl/SkScalerContext.cpp
+++ b/skia/sgl/SkScalerContext.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkScalerContext.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -182,6 +182,17 @@ SkScalerContext* SkScalerContext::getGlyphContext(const SkGlyph& glyph) const {
return ctx;
}
+static int plus_minus_pin(int value, int max) {
+ SkASSERT(max >= 0);
+
+ if (value > max) {
+ value = max;
+ } else if (value < -max) {
+ value = -max;
+ }
+ return value;
+}
+
void SkScalerContext::getAdvance(SkGlyph* glyph) {
// mark us as just having a valid advance
glyph->fMaskFormat = MASK_FORMAT_JUST_ADVANCE;
@@ -384,18 +395,19 @@ void SkScalerContext::getImage(const SkGlyph& origGlyph) {
// check to see if we should filter the alpha channel
- if (fRec.fMaskFormat != SkMask::kBW_Format &&
+ if (NULL == fMaskFilter &&
+ fRec.fMaskFormat != SkMask::kBW_Format &&
(fRec.fFlags & (kGammaForBlack_Flag | kGammaForWhite_Flag)) != 0)
{
const uint8_t* table = (fRec.fFlags & kGammaForBlack_Flag) ? gBlackGammaTable : gWhiteGammaTable;
if (NULL != table)
{
- uint8_t* dst = (uint8_t*)glyph->fImage;
- unsigned rowBytes = glyph->rowBytes();
+ uint8_t* dst = (uint8_t*)origGlyph.fImage;
+ unsigned rowBytes = origGlyph.rowBytes();
- for (int y = glyph->fHeight - 1; y >= 0; --y)
+ for (int y = origGlyph.fHeight - 1; y >= 0; --y)
{
- for (int x = glyph->fWidth - 1; x >= 0; --x)
+ for (int x = origGlyph.fWidth - 1; x >= 0; --x)
dst[x] = table[dst[x]];
dst += rowBytes;
}
diff --git a/skia/sgl/SkScan.cpp b/skia/sgl/SkScan.cpp
index 1d80bb1..013b0ea 100644
--- a/skia/sgl/SkScan.cpp
+++ b/skia/sgl/SkScan.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkScan.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -65,10 +65,10 @@ void SkScan::FillXRect(const SkXRect& xr, const SkRegion* clip,
void SkScan::FillRect(const SkRect& r, const SkRegion* clip,
SkBlitter* blitter) {
- SkXRect xr;
+ SkIRect ir;
- XRect_set(&xr, r);
- SkScan::FillXRect(xr, clip, blitter);
+ r.round(&ir);
+ SkScan::FillIRect(ir, clip, blitter);
}
#endif
diff --git a/skia/sgl/SkScan.h b/skia/sgl/SkScan.h
index f5b12fb..379c016 100644
--- a/skia/sgl/SkScan.h
+++ b/skia/sgl/SkScan.h
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkScan.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -83,7 +83,7 @@ public:
from int to SkFixed. Does not check for overflow if the src coordinates
exceed 32K
*/
-static inline void XRect_set(SkXRect* xr, const SkIRect& src) {
+static void XRect_set(SkXRect* xr, const SkIRect& src) {
xr->fLeft = SkIntToFixed(src.fLeft);
xr->fTop = SkIntToFixed(src.fTop);
xr->fRight = SkIntToFixed(src.fRight);
@@ -94,7 +94,7 @@ static inline void XRect_set(SkXRect* xr, const SkIRect& src) {
from SkScalar to SkFixed. Does not check for overflow if the src coordinates
exceed 32K
*/
-static inline void XRect_set(SkXRect* xr, const SkRect& src) {
+static void XRect_set(SkXRect* xr, const SkRect& src) {
xr->fLeft = SkScalarToFixed(src.fLeft);
xr->fTop = SkScalarToFixed(src.fTop);
xr->fRight = SkScalarToFixed(src.fRight);
@@ -103,7 +103,7 @@ static inline void XRect_set(SkXRect* xr, const SkRect& src) {
/** Round the SkXRect coordinates, and store the result in the SkIRect.
*/
-static inline void XRect_round(const SkXRect& xr, SkIRect* dst) {
+static void XRect_round(const SkXRect& xr, SkIRect* dst) {
dst->fLeft = SkFixedRound(xr.fLeft);
dst->fTop = SkFixedRound(xr.fTop);
dst->fRight = SkFixedRound(xr.fRight);
@@ -113,7 +113,7 @@ static inline void XRect_round(const SkXRect& xr, SkIRect* dst) {
/** Round the SkXRect coordinates out (i.e. use floor for left/top, and ceiling
for right/bottom), and store the result in the SkIRect.
*/
-static inline void XRect_roundOut(const SkXRect& xr, SkIRect* dst) {
+static void XRect_roundOut(const SkXRect& xr, SkIRect* dst) {
dst->fLeft = SkFixedFloor(xr.fLeft);
dst->fTop = SkFixedFloor(xr.fTop);
dst->fRight = SkFixedCeil(xr.fRight);
diff --git a/skia/sgl/SkScanPriv.h b/skia/sgl/SkScanPriv.h
index de7e3e7..43dfdef 100644
--- a/skia/sgl/SkScanPriv.h
+++ b/skia/sgl/SkScanPriv.h
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkScanPriv.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkScan_AntiPath.cpp b/skia/sgl/SkScan_AntiPath.cpp
index b603f15..9cdeeaa 100644
--- a/skia/sgl/SkScan_AntiPath.cpp
+++ b/skia/sgl/SkScan_AntiPath.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkScan_AntiPath.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkScan_Antihair.cpp b/skia/sgl/SkScan_Antihair.cpp
index ca36739..04e4690 100644
--- a/skia/sgl/SkScan_Antihair.cpp
+++ b/skia/sgl/SkScan_Antihair.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkScan_Antihair.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -23,6 +23,12 @@
#define HLINE_STACK_BUFFER 100
+static inline int SmallDot6Scale(int value, int dot6) {
+ SkASSERT((int16_t)value == value);
+ SkASSERT((unsigned)dot6 <= 64);
+ return SkMulS16(value, dot6) >> 6;
+}
+
//#define TEST_GAMMA
#ifdef TEST_GAMMA
@@ -52,8 +58,9 @@
#define ApplyGamma(table, alpha) SkToU8(alpha)
#endif
+///////////////////////////////////////////////////////////////////////////////
-static void call_hline_blitter(SkBlitter* blitter, int x, int y, int count, uint8_t alpha)
+static void call_hline_blitter(SkBlitter* blitter, int x, int y, int count, U8CPU alpha)
{
SkASSERT(count > 0);
@@ -74,7 +81,7 @@ static void call_hline_blitter(SkBlitter* blitter, int x, int y, int count, uint
} while (count > 0);
}
-static void hline(int x, int stopx, SkFixed fy, SkFixed /*slope*/, SkBlitter* blitter)
+static SkFixed hline(int x, int stopx, SkFixed fy, SkFixed /*slope*/, SkBlitter* blitter, int mod64)
{
SkASSERT(x < stopx);
int count = stopx - x;
@@ -84,16 +91,21 @@ static void hline(int x, int stopx, SkFixed fy, SkFixed /*slope*/, SkBlitter* bl
uint8_t a = (uint8_t)(fy >> 8);
// lower line
- if (a)
- call_hline_blitter(blitter, x, y, count, a);
+ unsigned ma = SmallDot6Scale(a, mod64);
+ if (ma) {
+ call_hline_blitter(blitter, x, y, count, ma);
+ }
// upper line
- a = (uint8_t)(255 - a);
- if (a)
- call_hline_blitter(blitter, x, y - 1, count, a);
+ ma = SmallDot6Scale(255 - a, mod64);
+ if (ma) {
+ call_hline_blitter(blitter, x, y - 1, count, ma);
+ }
+
+ return fy - SK_Fixed1/2;
}
-static void horish(int x, int stopx, SkFixed fy, SkFixed dy, SkBlitter* blitter)
+static SkFixed horish(int x, int stopx, SkFixed fy, SkFixed dy, SkBlitter* blitter, int mod64)
{
SkASSERT(x < stopx);
@@ -110,19 +122,19 @@ static void horish(int x, int stopx, SkFixed fy, SkFixed dy, SkBlitter* blitter)
do {
int lower_y = fy >> 16;
uint8_t a = (uint8_t)(fy >> 8);
-
- if (a)
+ unsigned ma = SmallDot6Scale(a, mod64);
+ if (ma)
{
- aa[0] = ApplyGamma(gamma, a);
+ aa[0] = ApplyGamma(gamma, ma);
blitter->blitAntiH(x, lower_y, aa, runs);
// the clipping blitters might edit runs, but should not affect us
SkASSERT(runs[0] == 1);
SkASSERT(runs[1] == 0);
}
- a = (uint8_t)(255 - a);
- if (a)
+ ma = SmallDot6Scale(255 - a, mod64);
+ if (ma)
{
- aa[0] = ApplyGamma(gamma, a);
+ aa[0] = ApplyGamma(gamma, ma);
blitter->blitAntiH(x, lower_y - 1, aa, runs);
// the clipping blitters might edit runs, but should not affect us
SkASSERT(runs[0] == 1);
@@ -130,9 +142,11 @@ static void horish(int x, int stopx, SkFixed fy, SkFixed dy, SkBlitter* blitter)
}
fy += dy;
} while (++x < stopx);
+
+ return fy - SK_Fixed1/2;
}
-static void vline(int y, int stopy, SkFixed fx, SkFixed /*slope*/, SkBlitter* blitter)
+static SkFixed vline(int y, int stopy, SkFixed fx, SkFixed /*slope*/, SkBlitter* blitter, int mod64)
{
SkASSERT(y < stopy);
fx += SK_Fixed1/2;
@@ -140,14 +154,17 @@ static void vline(int y, int stopy, SkFixed fx, SkFixed /*slope*/, SkBlitter* bl
int x = fx >> 16;
int a = (uint8_t)(fx >> 8);
- if (a)
- blitter->blitV(x, y, stopy - y, ApplyGamma(gGammaTable, a));
- a = 255 - a;
- if (a)
- blitter->blitV(x - 1, y, stopy - y, ApplyGamma(gGammaTable, a));
+ unsigned ma = SmallDot6Scale(a, mod64);
+ if (ma)
+ blitter->blitV(x, y, stopy - y, ApplyGamma(gGammaTable, ma));
+ ma = SmallDot6Scale(255 - a, mod64);
+ if (ma)
+ blitter->blitV(x - 1, y, stopy - y, ApplyGamma(gGammaTable, ma));
+
+ return fx - SK_Fixed1/2;
}
-static void vertish(int y, int stopy, SkFixed fx, SkFixed dx, SkBlitter* blitter)
+static SkFixed vertish(int y, int stopy, SkFixed fx, SkFixed dx, SkBlitter* blitter, int mod64)
{
SkASSERT(y < stopy);
#ifdef TEST_GAMMA
@@ -164,8 +181,8 @@ static void vertish(int y, int stopy, SkFixed fx, SkFixed dx, SkBlitter* blitter
int x = fx >> 16;
uint8_t a = (uint8_t)(fx >> 8);
- aa[0] = ApplyGamma(gamma, 255 - a);
- aa[1] = ApplyGamma(gamma, a);
+ aa[0] = ApplyGamma(gamma, SmallDot6Scale(255 - a, mod64));
+ aa[1] = ApplyGamma(gamma, SmallDot6Scale(a, mod64));
// the clippng blitters might overwrite this guy, so we have to reset it each time
runs[1] = 1;
blitter->blitAntiH(x - 1, y, aa, runs);
@@ -174,9 +191,11 @@ static void vertish(int y, int stopy, SkFixed fx, SkFixed dx, SkBlitter* blitter
SkASSERT(runs[2] == 0);
fx += dx;
} while (++y < stopy);
+
+ return fx - SK_Fixed1/2;
}
-typedef void (*LineProc)(int istart, int istop, SkFixed fstart, SkFixed slope, SkBlitter*);
+typedef SkFixed (*LineProc)(int istart, int istop, SkFixed fstart, SkFixed slope, SkBlitter*, int);
static inline SkFixed fastfixdiv(SkFDot6 a, SkFDot6 b)
{
@@ -184,11 +203,6 @@ static inline SkFixed fastfixdiv(SkFDot6 a, SkFDot6 b)
SkASSERT(b != 0);
return (a << 16) / b;
}
-static inline SkFDot6 fastfixmul(SkFixed fixed, SkFDot6 b)
-{
- SkASSERT(SkAbs32(fixed) <= SK_Fixed1 && SkAbs32(b) <= SkIntToFDot6(511));
- return (fixed * b + 0x8000) >> 16;
-}
static void do_anti_hairline(SkFDot6 x0, SkFDot6 y0, SkFDot6 x1, SkFDot6 y1,
const SkIRect* clip, SkBlitter* blitter)
@@ -205,35 +219,40 @@ static void do_anti_hairline(SkFDot6 x0, SkFDot6 y0, SkFDot6 x1, SkFDot6 y1,
return;
}
+ int scaleStart, scaleStop;
int istart, istop;
SkFixed fstart, slope;
LineProc proc;
if (SkAbs32(x1 - x0) > SkAbs32(y1 - y0)) // mostly horizontal
{
- if (x0 > x1) // we want to go left-to-right
- {
+ if (x0 > x1) { // we want to go left-to-right
SkTSwap<SkFDot6>(x0, x1);
SkTSwap<SkFDot6>(y0, y1);
}
- istart = SkFDot6Round(x0);
- istop = SkFDot6Round(x1);
- if (istart == istop) // too short to draw
- return;
- if (y0 == y1) // completely horizontal, take fast case
- {
+ istart = SkFDot6Floor(x0);
+ istop = SkFDot6Ceil(x1);
+ fstart = SkFDot6ToFixed(y0);
+ if (y0 == y1) { // completely horizontal, take fast case
slope = 0;
- fstart = SkFDot6ToFixed(y0);
proc = hline;
- }
- else
- {
+ } else {
slope = fastfixdiv(y1 - y0, x1 - x0);
SkASSERT(slope >= -SK_Fixed1 && slope <= SK_Fixed1);
- fstart = SkFDot6ToFixed(y0 + fastfixmul(slope, (32 - x0) & 63));
+ fstart += (slope * (32 - (x0 & 63)) + 32) >> 6;
proc = horish;
}
+
+ SkASSERT(istop > istart);
+ if (istop - istart == 1) {
+ scaleStart = x1 - x0;
+ SkASSERT(scaleStart >= 0 && scaleStart <= 64);
+ scaleStop = 0;
+ } else {
+ scaleStart = 64 - (x0 & 63);
+ scaleStop = x1 & 63;
+ }
if (clip)
{
@@ -243,12 +262,16 @@ static void do_anti_hairline(SkFDot6 x0, SkFDot6 y0, SkFDot6 x1, SkFDot6 y1,
{
fstart += slope * (clip->fLeft - istart);
istart = clip->fLeft;
+ scaleStart = 64;
}
- if (istop > clip->fRight)
+ if (istop > clip->fRight) {
istop = clip->fRight;
+ scaleStop = 64;
+ }
SkASSERT(istart <= istop);
if (istart == istop)
return;
+
// now test if our Y values are completely inside the clip
int top, bottom;
if (slope >= 0) // T2B
@@ -274,25 +297,36 @@ static void do_anti_hairline(SkFDot6 x0, SkFDot6 y0, SkFDot6 x1, SkFDot6 y1,
SkTSwap<SkFDot6>(x0, x1);
SkTSwap<SkFDot6>(y0, y1);
}
- istart = SkFDot6Round(y0);
- istop = SkFDot6Round(y1);
- if (istart == istop) // too short to draw
- return;
+ istart = SkFDot6Floor(y0);
+ istop = SkFDot6Ceil(y1);
+ fstart = SkFDot6ToFixed(x0);
if (x0 == x1)
{
+ if (y0 == y1) { // are we zero length?
+ return; // nothing to do
+ }
slope = 0;
- fstart = SkFDot6ToFixed(x0);
proc = vline;
}
else
{
slope = fastfixdiv(x1 - x0, y1 - y0);
SkASSERT(slope <= SK_Fixed1 && slope >= -SK_Fixed1);
- fstart = SkFDot6ToFixed(x0 + fastfixmul(slope, (32 - y0) & 63));
+ fstart += (slope * (32 - (y0 & 63)) + 32) >> 6;
proc = vertish;
}
+ SkASSERT(istop > istart);
+ if (istop - istart == 1) {
+ scaleStart = y1 - y0;
+ SkASSERT(scaleStart >= 0 && scaleStart <= 64);
+ scaleStop = 0;
+ } else {
+ scaleStart = 64 - (y0 & 63);
+ scaleStop = y1 & 63;
+ }
+
if (clip)
{
if (istart >= clip->fBottom || istop <= clip->fTop)
@@ -301,12 +335,16 @@ static void do_anti_hairline(SkFDot6 x0, SkFDot6 y0, SkFDot6 x1, SkFDot6 y1,
{
fstart += slope * (clip->fTop - istart);
istart = clip->fTop;
+ scaleStart = 64;
}
- if (istop > clip->fBottom)
+ if (istop > clip->fBottom) {
istop = clip->fBottom;
+ scaleStop = 64;
+ }
SkASSERT(istart <= istop);
if (istart == istop)
return;
+
// now test if our X values are completely inside the clip
int left, right;
if (slope >= 0) // L2R
@@ -332,7 +370,16 @@ static void do_anti_hairline(SkFDot6 x0, SkFDot6 y0, SkFDot6 x1, SkFDot6 y1,
rectClipper.init(blitter, *clip);
blitter = &rectClipper;
}
- proc(istart, istop, fstart, slope, blitter);
+
+ fstart = proc(istart, istart + 1, fstart, slope, blitter, scaleStart);
+ istart += 1;
+ int fullSpans = istop - istart - 1;
+ if (fullSpans > 0) {
+ fstart = proc(istart, istart + fullSpans, fstart, slope, blitter, 64);
+ }
+ if (scaleStop > 0) {
+ proc(istop - 1, istop, fstart, slope, blitter, scaleStop);
+ }
}
void SkScan::AntiHairLine(const SkPoint& pt0, const SkPoint& pt1,
@@ -360,10 +407,10 @@ void SkScan::AntiHairLine(const SkPoint& pt0, const SkPoint& pt1,
SkFDot6 bottom = SkMax32(y0, y1);
SkIRect ir;
- ir.set( SkFDot6Round(left) - 1,
- SkFDot6Round(top) - 1,
- SkFDot6Round(right) + 1,
- SkFDot6Round(bottom) + 1);
+ ir.set( SkFDot6Floor(left) - 1,
+ SkFDot6Floor(top) - 1,
+ SkFDot6Ceil(right) + 1,
+ SkFDot6Ceil(bottom) + 1);
if (clip->quickReject(ir))
return;
@@ -536,12 +583,61 @@ void SkScan::AntiFillXRect(const SkXRect& xr, const SkRegion* clip,
#ifdef SK_SCALAR_IS_FLOAT
-void SkScan::AntiFillRect(const SkRect& r, const SkRegion* clip,
- SkBlitter* blitter) {
+/* This guy takes a float-rect, but with the key improvement that it has
+ already been clipped, so we know that it is safe to convert it into a
+ XRect (fixedpoint), as it won't overflow.
+*/
+static void antifillrect(const SkRect& r, SkBlitter* blitter) {
SkXRect xr;
XRect_set(&xr, r);
- SkScan::AntiFillXRect(xr, clip, blitter);
+ antifillrect(xr, blitter);
+}
+
+/* We repeat the clipping logic of AntiFillXRect because the float rect might
+ overflow if we blindly converted it to an XRect. This sucks that we have to
+ repeat the clipping logic, but I don't see how to share the code/logic.
+
+ We clip r (as needed) into one or more (smaller) float rects, and then pass
+ those to our version of antifillrect, which converts it into an XRect and
+ then calls the blit.
+*/
+void SkScan::AntiFillRect(const SkRect& r, const SkRegion* clip,
+ SkBlitter* blitter) {
+ if (clip) {
+ SkIRect outerBounds;
+ r.roundOut(&outerBounds);
+
+ if (clip->isRect()) {
+ const SkIRect& clipBounds = clip->getBounds();
+
+ if (clipBounds.contains(outerBounds)) {
+ antifillrect(r, blitter);
+ } else {
+ SkRect tmpR;
+ // this keeps our original edges fractional
+ tmpR.set(clipBounds);
+ if (tmpR.intersect(r)) {
+ antifillrect(tmpR, blitter);
+ }
+ }
+ } else {
+ SkRegion::Cliperator clipper(*clip, outerBounds);
+ const SkIRect& rr = clipper.rect();
+
+ while (!clipper.done()) {
+ SkRect tmpR;
+ // this keeps our original edges fractional
+ tmpR.set(rr);
+ if (tmpR.intersect(r)) {
+ antifillrect(tmpR, blitter);
+ }
+ clipper.next();
+ }
+ }
+ } else {
+ antifillrect(r, blitter);
+ }
}
#endif
diff --git a/skia/sgl/SkScan_Hairline.cpp b/skia/sgl/SkScan_Hairline.cpp
index 5312f25..6a66754 100644
--- a/skia/sgl/SkScan_Hairline.cpp
+++ b/skia/sgl/SkScan_Hairline.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkScan_Hairline.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -95,7 +95,7 @@ void SkScan::HairLine(const SkPoint& pt0, const SkPoint& pt1, const SkRegion* cl
return;
SkFixed slope = SkFixedDiv(dy, dx);
- SkFixed startY = SkFDot6ToFixed(y0 + SkFixedMul(slope, (32 - x0) & 63));
+ SkFixed startY = SkFDot6ToFixed(y0) + (slope * ((32 - x0) & 63) >> 6);
horiline(ix0, ix1, startY, slope, blitter);
}
@@ -112,7 +112,7 @@ void SkScan::HairLine(const SkPoint& pt0, const SkPoint& pt1, const SkRegion* cl
return;
SkFixed slope = SkFixedDiv(dx, dy);
- SkFixed startX = SkFDot6ToFixed(x0 + SkFixedMul(slope, (32 - y0) & 63));
+ SkFixed startX = SkFDot6ToFixed(x0) + (slope * ((32 - y0) & 63) >> 6);
vertline(iy0, iy1, startX, slope, blitter);
}
@@ -165,6 +165,25 @@ static bool quad_too_curvy(const SkPoint pts[3])
return true;
}
+static int compute_int_quad_dist(const SkPoint pts[3]) {
+ // compute the vector between the control point ([1]) and the middle of the
+ // line connecting the start and end ([0] and [2])
+ SkScalar dx = SkScalarHalf(pts[0].fX + pts[2].fX) - pts[1].fX;
+ SkScalar dy = SkScalarHalf(pts[0].fY + pts[2].fY) - pts[1].fY;
+ // we want everyone to be positive
+ dx = SkScalarAbs(dx);
+ dy = SkScalarAbs(dy);
+ // convert to whole pixel values (use ceiling to be conservative)
+ int idx = SkScalarCeil(dx);
+ int idy = SkScalarCeil(dy);
+ // use the cheap approx for distance
+ if (idx > idy) {
+ return idx + (idy >> 1);
+ } else {
+ return idy + (idx >> 1);
+ }
+}
+
static void hairquad(const SkPoint pts[3], const SkRegion* clip, SkBlitter* blitter, int level,
void (*lineproc)(const SkPoint&, const SkPoint&, const SkRegion* clip, SkBlitter*))
{
@@ -180,8 +199,19 @@ static void hairquad(const SkPoint pts[3], const SkRegion* clip, SkBlitter* blit
else
lineproc(pts[0], pts[2], clip, blitter);
#else
- lineproc(pts[0], pts[1], clip, blitter);
- lineproc(pts[1], pts[2], clip, blitter);
+ int count = 1 << level;
+ const SkScalar dt = SkFixedToScalar(SK_Fixed1 >> level);
+ SkScalar t = dt;
+ SkPoint prevPt = pts[0];
+ for (int i = 1; i < count; i++) {
+ SkPoint nextPt;
+ SkEvalQuadAt(pts, t, &nextPt);
+ lineproc(prevPt, nextPt, clip, blitter);
+ t += dt;
+ prevPt = nextPt;
+ }
+ // draw the last line explicitly to 1.0, in case t didn't match that exactly
+ lineproc(prevPt, pts[2], clip, blitter);
#endif
}
@@ -244,9 +274,22 @@ static void hair_path(const SkPath& path, const SkRegion* clip, SkBlitter* blitt
case SkPath::kLine_Verb:
lineproc(pts[0], pts[1], clip, blitter);
break;
- case SkPath::kQuad_Verb:
- hairquad(pts, clip, blitter, kMaxQuadSubdivideLevel, lineproc);
+ case SkPath::kQuad_Verb: {
+ int d = compute_int_quad_dist(pts);
+ /* quadratics approach the line connecting their start and end points
+ 4x closer with each subdivision, so we compute the number of
+ subdivisions to be the minimum need to get that distance to be less
+ than a pixel.
+ */
+ int level = (33 - SkCLZ(d)) >> 1;
+// SkDebugf("----- distance %d computedLevel %d\n", d, computedLevel);
+ // sanity check on level (from the previous version)
+ if (level > kMaxQuadSubdivideLevel) {
+ level = kMaxQuadSubdivideLevel;
+ }
+ hairquad(pts, clip, blitter, level, lineproc);
break;
+ }
case SkPath::kCubic_Verb:
haircubic(pts, clip, blitter, kMaxCubicSubdivideLevel, lineproc);
break;
diff --git a/skia/sgl/SkScan_Path.cpp b/skia/sgl/SkScan_Path.cpp
index 43a61bd..8b58991 100644
--- a/skia/sgl/SkScan_Path.cpp
+++ b/skia/sgl/SkScan_Path.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkScan_Path.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -23,15 +23,15 @@
#include "SkRegion.h"
#include "SkTemplates.h"
-#define kEDGE_HEAD_Y SK_MinS16
-#define kEDGE_TAIL_Y SK_MaxS16
+#define kEDGE_HEAD_Y SK_MinS32
+#define kEDGE_TAIL_Y SK_MaxS32
#ifdef SK_DEBUG
static void validate_sort(const SkEdge* edge)
{
int y = kEDGE_HEAD_Y;
- while (edge->fFirstY != SK_MaxS16)
+ while (edge->fFirstY != SK_MaxS32)
{
edge->validate();
SkASSERT(y <= edge->fFirstY);
@@ -368,7 +368,7 @@ extern "C" {
valuea = edgea->fX;
valueb = edgeb->fX;
}
- return valuea > valueb ? 1 : valuea < valueb ? -1 : 0;
+ return valuea - valueb;
}
}
@@ -387,7 +387,6 @@ static SkEdge* sort_edges(SkEdge* list[], int count, SkEdge** last)
return list[0];
}
-#ifdef SK_DEBUG
/* 'quick' computation of the max sized needed to allocated for
our edgelist.
*/
@@ -423,7 +422,6 @@ static int worst_case_edge_count(const SkPath& path, size_t* storage)
*storage = size;
return edgeCount;
}
-#endif
/* Much faster than worst_case_edge_count, but over estimates even more
*/
diff --git a/skia/sgl/SkShader.cpp b/skia/sgl/SkShader.cpp
index 9a90959..dd9c859 100644
--- a/skia/sgl/SkShader.cpp
+++ b/skia/sgl/SkShader.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkShader.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkSpriteBlitter.h b/skia/sgl/SkSpriteBlitter.h
index 7447389..9f7764d 100644
--- a/skia/sgl/SkSpriteBlitter.h
+++ b/skia/sgl/SkSpriteBlitter.h
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkSpriteBlitter.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkSpriteBlitterTemplate.h b/skia/sgl/SkSpriteBlitterTemplate.h
index 267931e..2ab2b3a 100644
--- a/skia/sgl/SkSpriteBlitterTemplate.h
+++ b/skia/sgl/SkSpriteBlitterTemplate.h
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkSpriteBlitterTemplate.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkSpriteBlitter_ARGB32.cpp b/skia/sgl/SkSpriteBlitter_ARGB32.cpp
index ede7450..6addde7 100644
--- a/skia/sgl/SkSpriteBlitter_ARGB32.cpp
+++ b/skia/sgl/SkSpriteBlitter_ARGB32.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkSpriteBlitter_ARGB32.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkSpriteBlitter_RGB16.cpp b/skia/sgl/SkSpriteBlitter_RGB16.cpp
index 3ffea44..a158637 100644
--- a/skia/sgl/SkSpriteBlitter_RGB16.cpp
+++ b/skia/sgl/SkSpriteBlitter_RGB16.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkSpriteBlitter_RGB16.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -24,12 +24,7 @@
#define D16_S32A_Opaque_Pixel(dst, sc) \
do { \
if (sc) { \
- unsigned sa = SkGetPackedA32(sc); \
- unsigned result = SkPixel32ToPixel16(sc); \
- if (sa != 0xFF) { \
- result += SkAlphaMulRGB16_ToU16(*dst, SkAlpha255To256(255 - sa)); \
- } \
- *dst = SkToU16(result); \
+ *dst = SkSrcOver32To16(sc, *dst); \
} \
} while (0)
diff --git a/skia/sgl/SkString.cpp b/skia/sgl/SkString.cpp
index 839f5c4..c683e35 100644
--- a/skia/sgl/SkString.cpp
+++ b/skia/sgl/SkString.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkString.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -107,7 +107,10 @@ char* SkStrAppendScalar(char string[], SkScalar value)
const uint16_t* tens = gTens;
x = SkFixedRound(frac * 10000);
- SkASSERT(x < 10000);
+ SkASSERT(x <= 10000);
+ if (x == 10000) {
+ x -= 1;
+ }
*string++ = '.';
do {
unsigned powerOfTen = *tens++;
diff --git a/skia/sgl/SkStroke.cpp b/skia/sgl/SkStroke.cpp
index 530f0fa..86dff48 100644
--- a/skia/sgl/SkStroke.cpp
+++ b/skia/sgl/SkStroke.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2008 Google Inc.
+ * Copyright (C) 2006-2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -528,15 +528,61 @@ void SkStroke::setJoin(SkPaint::Join join) {
fJoin = SkToU8(join);
}
+///////////////////////////////////////////////////////////////////////////////
+
+#ifdef SK_SCALAR_IS_FIXED
+ /* return non-zero if the path is too big, and should be shrunk to avoid
+ overflows during intermediate calculations. Note that we compute the
+ bounds for this. If we had a custom callback/walker for paths, we could
+ perhaps go faster by using that, and just perform the abs | in that
+ routine
+ */
+ static int needs_to_shrink(const SkPath& path) {
+ SkRect r;
+ path.computeBounds(&r, SkPath::kFast_BoundsType);
+ SkFixed mask = SkAbs32(r.fLeft);
+ mask |= SkAbs32(r.fTop);
+ mask |= SkAbs32(r.fRight);
+ mask |= SkAbs32(r.fBottom);
+ // we need the top 3 bits clear (after abs) to avoid overflow
+ return mask >> 29;
+ }
+
+ static void identity_proc(SkPoint pts[], int count) {}
+ static void shift_down_2_proc(SkPoint pts[], int count) {
+ for (int i = 0; i < count; i++) {
+ pts->fX >>= 2;
+ pts->fY >>= 2;
+ pts += 1;
+ }
+ }
+ #define APPLY_PROC(proc, pts, count) proc(pts, count)
+#else // float does need any of this
+ #define APPLY_PROC(proc, pts, count)
+#endif
+
void SkStroke::strokePath(const SkPath& src, SkPath* dst) const {
SkASSERT(&src != NULL && dst != NULL);
+ SkScalar radius = SkScalarHalf(fWidth);
+
dst->reset();
- if (SkScalarHalf(fWidth) <= 0) {
+ if (radius <= 0) {
return;
}
+
+#ifdef SK_SCALAR_IS_FIXED
+ void (*proc)(SkPoint pts[], int count) = identity_proc;
+ if (needs_to_shrink(src)) {
+ proc = shift_down_2_proc;
+ radius >>= 2;
+ if (radius == 0) {
+ return;
+ }
+ }
+#endif
- SkPathStroker stroker(SkScalarHalf(fWidth), fMiterLimit, this->getCap(),
+ SkPathStroker stroker(radius, fMiterLimit, this->getCap(),
this->getJoin());
SkPath::Iter iter(src, false);
@@ -546,17 +592,21 @@ void SkStroke::strokePath(const SkPath& src, SkPath* dst) const {
while ((verb = iter.next(pts)) != SkPath::kDone_Verb) {
switch (verb) {
case SkPath::kMove_Verb:
+ APPLY_PROC(proc, &pts[0], 1);
stroker.moveTo(pts[0]);
break;
case SkPath::kLine_Verb:
+ APPLY_PROC(proc, &pts[1], 1);
stroker.lineTo(pts[1]);
lastSegment = verb;
break;
case SkPath::kQuad_Verb:
+ APPLY_PROC(proc, &pts[1], 2);
stroker.quadTo(pts[1], pts[2]);
lastSegment = verb;
break;
case SkPath::kCubic_Verb:
+ APPLY_PROC(proc, &pts[1], 3);
stroker.cubicTo(pts[1], pts[2], pts[3]);
lastSegment = verb;
break;
@@ -569,6 +619,16 @@ void SkStroke::strokePath(const SkPath& src, SkPath* dst) const {
}
stroker.done(dst, lastSegment == SkPath::kLine_Verb);
+#ifdef SK_SCALAR_IS_FIXED
+ // undo our previous down_shift
+ if (shift_down_2_proc == proc) {
+ // need a real shift methid on path. antialias paths could use this too
+ SkMatrix matrix;
+ matrix.setScale(SkIntToScalar(4), SkIntToScalar(4));
+ dst->transform(matrix);
+ }
+#endif
+
if (fDoFill) {
dst->addPath(src);
}
diff --git a/skia/sgl/SkStrokerPriv.cpp b/skia/sgl/SkStrokerPriv.cpp
index 28276cb..07833ca 100644
--- a/skia/sgl/SkStrokerPriv.cpp
+++ b/skia/sgl/SkStrokerPriv.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkStrokerPriv.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkStrokerPriv.h b/skia/sgl/SkStrokerPriv.h
index 1d1eb89..ecb9bde 100644
--- a/skia/sgl/SkStrokerPriv.h
+++ b/skia/sgl/SkStrokerPriv.h
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkStrokerPriv.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkTSearch.cpp b/skia/sgl/SkTSearch.cpp
index 3a1a7d4..bab348f 100644
--- a/skia/sgl/SkTSearch.cpp
+++ b/skia/sgl/SkTSearch.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkTSearch.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkTSort.h b/skia/sgl/SkTSort.h
index 660b689..fba49e2 100644
--- a/skia/sgl/SkTSort.h
+++ b/skia/sgl/SkTSort.h
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkTSort.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkTemplatesPriv.h b/skia/sgl/SkTemplatesPriv.h
index 91ecd51..b0a95a0 100644
--- a/skia/sgl/SkTemplatesPriv.h
+++ b/skia/sgl/SkTemplatesPriv.h
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkTemplatesPriv.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/sgl/SkUtils.cpp b/skia/sgl/SkUtils.cpp
index 94834fd..4f5ba6ea 100644
--- a/skia/sgl/SkUtils.cpp
+++ b/skia/sgl/SkUtils.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/sgl/SkUtils.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -427,12 +427,10 @@ size_t SkUTF16_ToUTF8(const uint16_t utf16[], int numberOf16BitValues, char utf8
#include <stdlib.h>
-#if 0
static int round_to_K(size_t bytes)
{
return (bytes + 512) >> 10;
}
-#endif
SkAutoMemoryUsageProbe::SkAutoMemoryUsageProbe(const char label[])
: fLabel(label)
diff --git a/skia/sgl/SkWriter32.cpp b/skia/sgl/SkWriter32.cpp
index 819803f..61d0051 100644
--- a/skia/sgl/SkWriter32.cpp
+++ b/skia/sgl/SkWriter32.cpp
@@ -37,6 +37,15 @@ struct SkWriter32::Block {
}
};
+static size_t compute_block_size(size_t currSize, size_t minSize)
+{
+ if (currSize < minSize)
+ currSize = minSize;
+
+ currSize += (currSize >> 1);
+ return SkAlign4(currSize);
+}
+
///////////////////////////////////////////////////////////////////////////////
SkWriter32::~SkWriter32()
diff --git a/skia/sgl/SkXfermode.cpp b/skia/sgl/SkXfermode.cpp
index 6225e6e..e8a202d 100644
--- a/skia/sgl/SkXfermode.cpp
+++ b/skia/sgl/SkXfermode.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Google Inc.
+ * Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,6 +30,19 @@ static SkPMColor SkFourByteInterp(SkPMColor src, SkPMColor dst, U8CPU alpha) {
return SkPackARGB32(a, r, g, b);
}
+// idea for higher precision blends in xfer procs (and slightly faster)
+// see DstATop as a probable caller
+static U8CPU mulmuldiv255round(U8CPU a, U8CPU b, U8CPU c, U8CPU d) {
+ SkASSERT(a <= 255);
+ SkASSERT(b <= 255);
+ SkASSERT(c <= 255);
+ SkASSERT(d <= 255);
+ unsigned prod = SkMulS16(a, b) + SkMulS16(c, d) + 128;
+ unsigned result = (prod + (prod >> 8)) >> 8;
+ SkASSERT(result <= 255);
+ return result;
+}
+
///////////////////////////////////////////////////////////////////////////////
bool SkXfermode::asCoeff(Coeff* src, Coeff* dst) {
diff --git a/skia/skia.vcproj b/skia/skia.vcproj
index 374e395..a1c9ab8 100644
--- a/skia/skia.vcproj
+++ b/skia/skia.vcproj
@@ -301,6 +301,14 @@
>
</File>
<File
+ RelativePath=".\include\SkFlipPixelRef.h"
+ >
+ </File>
+ <File
+ RelativePath=".\include\corecg\SkFloatBits.h"
+ >
+ </File>
+ <File
RelativePath=".\include\corecg\SkFloatingPoint.h"
>
</File>
@@ -353,10 +361,18 @@
>
</File>
<File
+ RelativePath=".\include\SkLayerDrawLooper.h"
+ >
+ </File>
+ <File
RelativePath=".\include\SkLayerRasterizer.h"
>
</File>
<File
+ RelativePath=".\include\SkMallocPixelRef.h"
+ >
+ </File>
+ <File
RelativePath=".\include\SkMask.h"
>
</File>
@@ -421,6 +437,10 @@
>
</File>
<File
+ RelativePath=".\include\corecg\SkPageFlipper.h"
+ >
+ </File>
+ <File
RelativePath=".\include\SkPaint.h"
>
</File>
@@ -517,6 +537,10 @@
>
</File>
<File
+ RelativePath=".\include\corecg\SkScalarCompare.h"
+ >
+ </File>
+ <File
RelativePath=".\include\SkScalerContext.h"
>
</File>
@@ -721,6 +745,10 @@
>
</File>
<File
+ RelativePath=".\corecg\SkFloatBits.cpp"
+ >
+ </File>
+ <File
RelativePath=".\corecg\SkInterpolator.cpp"
>
</File>
@@ -737,6 +765,10 @@
>
</File>
<File
+ RelativePath=".\corecg\SkPageFlipper.cpp"
+ >
+ </File>
+ <File
RelativePath=".\corecg\SkPoint.cpp"
>
</File>
@@ -997,10 +1029,6 @@
>
</File>
<File
- RelativePath=".\sgl\SkPicture.cpp"
- >
- </File>
- <File
RelativePath=".\sgl\SkPixelRef.cpp"
>
</File>
@@ -1125,6 +1153,10 @@
Name="ports"
>
<File
+ RelativePath=".\ports\sk_predefined_gamma.h"
+ >
+ </File>
+ <File
RelativePath=".\ports\SkFontHost_none.cpp"
>
</File>
@@ -1281,6 +1313,18 @@
Name="picture"
>
<File
+ RelativePath=".\picture\SkPathHeap.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\picture\SkPathHeap.h"
+ >
+ </File>
+ <File
+ RelativePath=".\picture\SkPicture.cpp"
+ >
+ </File>
+ <File
RelativePath=".\picture\SkPictureFlat.cpp"
>
</File>
diff --git a/skia/skia.xcodeproj/project.pbxproj b/skia/skia.xcodeproj/project.pbxproj
index 5e97c52..83bad3f 100644
--- a/skia/skia.xcodeproj/project.pbxproj
+++ b/skia/skia.xcodeproj/project.pbxproj
@@ -7,14 +7,11 @@
objects = {
/* Begin PBXBuildFile section */
- 7B4DF47E0E5B5FE0004D7619 /* SkNinePatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7B4DF47D0E5B5FE0004D7619 /* SkNinePatch.cpp */; };
- 7B4DF4800E5B6005004D7619 /* SkScaledBitmapSampler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7B4DF47F0E5B6005004D7619 /* SkScaledBitmapSampler.cpp */; };
- 7B4DF48A0E5B609B004D7619 /* SkTypeface_fake.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7B4DF4820E5B6087004D7619 /* SkTypeface_fake.cpp */; };
A70A3BAE0ED7385F00C31871 /* bitmap_platform_device_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = A70A3BA80ED7385F00C31871 /* bitmap_platform_device_mac.cc */; };
- A70A3BAF0ED7385F00C31871 /* platform_canvas_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = A70A3BAA0ED7385F00C31871 /* platform_canvas_mac.cc */; };
- A70A3BB00ED7385F00C31871 /* platform_device_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = A70A3BAC0ED7385F00C31871 /* platform_device_mac.cc */; };
A74368B90EE61BBF003562CC /* convolver.cc in Sources */ = {isa = PBXBuildFile; fileRef = A74368B70EE61BBF003562CC /* convolver.cc */; };
A74368BA0EE61BBF003562CC /* image_operations.cc in Sources */ = {isa = PBXBuildFile; fileRef = A74368B80EE61BBF003562CC /* image_operations.cc */; };
+ A70A3BAF0ED7385F00C31871 /* platform_canvas_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = A70A3BAA0ED7385F00C31871 /* platform_canvas_mac.cc */; };
+ A70A3BB00ED7385F00C31871 /* platform_device_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = A70A3BAC0ED7385F00C31871 /* platform_device_mac.cc */; };
A77479340EE732890049F2F5 /* skia_utils.cc in Sources */ = {isa = PBXBuildFile; fileRef = A77479320EE732890049F2F5 /* skia_utils.cc */; };
E48EE4D20E34E873009DE966 /* Sk1DPathEffect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C46860DAE9C4F00FC0DB7 /* Sk1DPathEffect.cpp */; };
E48EE4D30E34E873009DE966 /* Sk2DPathEffect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C46870DAE9C4F00FC0DB7 /* Sk2DPathEffect.cpp */; };
@@ -64,6 +61,7 @@
E48EE4FF0E34E873009DE966 /* SkFilterProc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C48460DAE9C9C00FC0DB7 /* SkFilterProc.cpp */; };
E48EE5000E34E873009DE966 /* SkFlattenable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C48480DAE9C9C00FC0DB7 /* SkFlattenable.cpp */; };
E48EE5010E34E873009DE966 /* SkFloat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C46630DAE9C4A00FC0DB7 /* SkFloat.cpp */; };
+ A74366C60EE5B7B9003562CC /* SkFloatBits.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A74366C40EE5B7B9003562CC /* SkFloatBits.cpp */; };
E48EE5020E34E873009DE966 /* SkFontHost_none.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C47F90DAE9C9700FC0DB7 /* SkFontHost_none.cpp */; };
E48EE5030E34E873009DE966 /* SkGeometry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C484A0DAE9C9C00FC0DB7 /* SkGeometry.cpp */; };
E48EE5040E34E873009DE966 /* SkGlobals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C484C0DAE9C9C00FC0DB7 /* SkGlobals.cpp */; };
@@ -83,13 +81,17 @@
E48EE5110E34E873009DE966 /* SkMath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C46660DAE9C4A00FC0DB7 /* SkMath.cpp */; };
E48EE5120E34E873009DE966 /* SkMatrix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C46670DAE9C4A00FC0DB7 /* SkMatrix.cpp */; };
E48EE5130E34E873009DE966 /* SkMemory_stdlib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C46680DAE9C4A00FC0DB7 /* SkMemory_stdlib.cpp */; };
+ 7B4DF47E0E5B5FE0004D7619 /* SkNinePatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7B4DF47D0E5B5FE0004D7619 /* SkNinePatch.cpp */; };
E48EE5140E34E873009DE966 /* SkOSFile_stdio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C47FF0DAE9C9700FC0DB7 /* SkOSFile_stdio.cpp */; };
E48EE5150E34E873009DE966 /* SkPackBits.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C48520DAE9C9C00FC0DB7 /* SkPackBits.cpp */; };
+ A74366C70EE5B7B9003562CC /* SkPageFlipper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A74366C50EE5B7B9003562CC /* SkPageFlipper.cpp */; };
E48EE5160E34E873009DE966 /* SkPaint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C48530DAE9C9C00FC0DB7 /* SkPaint.cpp */; };
E48EE5170E34E873009DE966 /* SkPaintFlagsDrawFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C469D0DAE9C4F00FC0DB7 /* SkPaintFlagsDrawFilter.cpp */; };
E48EE5180E34E873009DE966 /* SkPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C48540DAE9C9C00FC0DB7 /* SkPath.cpp */; };
E48EE5190E34E873009DE966 /* SkPathEffect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C48550DAE9C9C00FC0DB7 /* SkPathEffect.cpp */; };
+ A74366CC0EE5B80D003562CC /* SkPathHeap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A74366C90EE5B80D003562CC /* SkPathHeap.cpp */; };
E48EE51A0E34E873009DE966 /* SkPathMeasure.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C48560DAE9C9C00FC0DB7 /* SkPathMeasure.cpp */; };
+ A74366CD0EE5B80D003562CC /* SkPicture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A74366CB0EE5B80D003562CC /* SkPicture.cpp */; };
E48EE51C0E34E873009DE966 /* SkPixelXorXfermode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C469E0DAE9C4F00FC0DB7 /* SkPixelXorXfermode.cpp */; };
E48EE51D0E34E873009DE966 /* SkPoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C46690DAE9C4A00FC0DB7 /* SkPoint.cpp */; };
E48EE51E0E34E873009DE966 /* SkProcSpriteBlitter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C48580DAE9C9C00FC0DB7 /* SkProcSpriteBlitter.cpp */; };
@@ -98,6 +100,7 @@
E48EE5210E34E873009DE966 /* SkRefCnt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C485B0DAE9C9C00FC0DB7 /* SkRefCnt.cpp */; };
E48EE5220E34E873009DE966 /* SkRegion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C466B0DAE9C4A00FC0DB7 /* SkRegion.cpp */; };
E48EE5230E34E873009DE966 /* SkRegion_path.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C485C0DAE9C9C00FC0DB7 /* SkRegion_path.cpp */; };
+ 7B4DF4800E5B6005004D7619 /* SkScaledBitmapSampler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7B4DF47F0E5B6005004D7619 /* SkScaledBitmapSampler.cpp */; };
E48EE5240E34E873009DE966 /* SkScalerContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C485D0DAE9C9C00FC0DB7 /* SkScalerContext.cpp */; };
E48EE5250E34E873009DE966 /* SkScan.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C485E0DAE9C9C00FC0DB7 /* SkScan.cpp */; };
E48EE5260E34E873009DE966 /* SkScan_Antihair.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C48600DAE9C9C00FC0DB7 /* SkScan_Antihair.cpp */; };
@@ -117,6 +120,7 @@
E48EE5340E34E873009DE966 /* SkTime_Unix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C48030DAE9C9700FC0DB7 /* SkTime_Unix.cpp */; };
E48EE5350E34E873009DE966 /* SkTransparentShader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C46A10DAE9C4F00FC0DB7 /* SkTransparentShader.cpp */; };
E48EE5360E34E873009DE966 /* SkTSearch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C486F0DAE9C9C00FC0DB7 /* SkTSearch.cpp */; };
+ 7B4DF48A0E5B609B004D7619 /* SkTypeface_fake.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7B4DF4820E5B6087004D7619 /* SkTypeface_fake.cpp */; };
E48EE5370E34E873009DE966 /* SkUnitMappers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C46A20DAE9C4F00FC0DB7 /* SkUnitMappers.cpp */; };
E48EE5380E34E873009DE966 /* SkUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C48710DAE9C9C00FC0DB7 /* SkUtils.cpp */; };
E48EE5390E34E873009DE966 /* SkWriter32.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C48720DAE9C9C00FC0DB7 /* SkWriter32.cpp */; };
@@ -128,7 +132,6 @@
E4A1332A0E37A22700110AA2 /* SkPictureFlat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4A133290E37A22700110AA2 /* SkPictureFlat.cpp */; };
E4A133390E37A33200110AA2 /* SkMMapStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4A133380E37A33200110AA2 /* SkMMapStream.cpp */; };
E4A1333D0E37A35900110AA2 /* SkBlitter_4444.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4A1333C0E37A35900110AA2 /* SkBlitter_4444.cpp */; };
- E4A133790E37AF2900110AA2 /* SkPicture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C48570DAE9C9C00FC0DB7 /* SkPicture.cpp */; };
E4A1337B0E37B11300110AA2 /* SkPicturePlayback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4A133340E37A30B00110AA2 /* SkPicturePlayback.cpp */; };
E4A133840E37B12E00110AA2 /* SkTypeface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4A1332C0E37A24F00110AA2 /* SkTypeface.cpp */; };
/* End PBXBuildFile section */
@@ -157,6 +160,18 @@
A70A3BAB0ED7385F00C31871 /* platform_canvas_mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = platform_canvas_mac.h; path = ext/platform_canvas_mac.h; sourceTree = "<group>"; };
A70A3BAC0ED7385F00C31871 /* platform_device_mac.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = platform_device_mac.cc; path = ext/platform_device_mac.cc; sourceTree = "<group>"; };
A70A3BAD0ED7385F00C31871 /* platform_device_mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = platform_device_mac.h; path = ext/platform_device_mac.h; sourceTree = "<group>"; };
+ A74366BE0EE5B74E003562CC /* SkFlipPixelRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SkFlipPixelRef.h; sourceTree = "<group>"; };
+ A74366BF0EE5B74E003562CC /* SkLayerDrawLooper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SkLayerDrawLooper.h; sourceTree = "<group>"; };
+ A74366C00EE5B74E003562CC /* SkMallocPixelRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SkMallocPixelRef.h; sourceTree = "<group>"; };
+ A74366C10EE5B795003562CC /* SkFloatBits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SkFloatBits.h; sourceTree = "<group>"; };
+ A74366C20EE5B795003562CC /* SkPageFlipper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SkPageFlipper.h; sourceTree = "<group>"; };
+ A74366C30EE5B795003562CC /* SkScalarCompare.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SkScalarCompare.h; sourceTree = "<group>"; };
+ A74366C40EE5B7B9003562CC /* SkFloatBits.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkFloatBits.cpp; sourceTree = "<group>"; };
+ A74366C50EE5B7B9003562CC /* SkPageFlipper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkPageFlipper.cpp; sourceTree = "<group>"; };
+ A74366C80EE5B7FA003562CC /* sk_predefined_gamma.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sk_predefined_gamma.h; sourceTree = "<group>"; };
+ A74366C90EE5B80D003562CC /* SkPathHeap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkPathHeap.cpp; path = picture/SkPathHeap.cpp; sourceTree = "<group>"; };
+ A74366CA0EE5B80D003562CC /* SkPathHeap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkPathHeap.h; path = picture/SkPathHeap.h; sourceTree = "<group>"; };
+ A74366CB0EE5B80D003562CC /* SkPicture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkPicture.cpp; path = picture/SkPicture.cpp; sourceTree = "<group>"; };
A74368B70EE61BBF003562CC /* convolver.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = convolver.cc; path = ext/convolver.cc; sourceTree = "<group>"; };
A74368B80EE61BBF003562CC /* image_operations.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = image_operations.cc; path = ext/image_operations.cc; sourceTree = "<group>"; };
A77479320EE732890049F2F5 /* skia_utils.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = skia_utils.cc; path = ext/skia_utils.cc; sourceTree = "<group>"; };
@@ -398,7 +413,6 @@
AB4C48540DAE9C9C00FC0DB7 /* SkPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkPath.cpp; sourceTree = "<group>"; };
AB4C48550DAE9C9C00FC0DB7 /* SkPathEffect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkPathEffect.cpp; sourceTree = "<group>"; };
AB4C48560DAE9C9C00FC0DB7 /* SkPathMeasure.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkPathMeasure.cpp; sourceTree = "<group>"; };
- AB4C48570DAE9C9C00FC0DB7 /* SkPicture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkPicture.cpp; sourceTree = "<group>"; };
AB4C48580DAE9C9C00FC0DB7 /* SkProcSpriteBlitter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkProcSpriteBlitter.cpp; sourceTree = "<group>"; };
AB4C48590DAE9C9C00FC0DB7 /* SkRasterizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkRasterizer.cpp; sourceTree = "<group>"; };
AB4C485B0DAE9C9C00FC0DB7 /* SkRefCnt.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkRefCnt.cpp; sourceTree = "<group>"; };
@@ -553,10 +567,12 @@
AB4C46630DAE9C4A00FC0DB7 /* SkFloat.cpp */,
AB4C46640DAE9C4A00FC0DB7 /* SkFloat.h */,
7B4DF47A0E5B5FB3004D7619 /* SkFloatBits.h */,
+ A74366C40EE5B7B9003562CC /* SkFloatBits.cpp */,
AB4C46650DAE9C4A00FC0DB7 /* SkInterpolator.cpp */,
AB4C46660DAE9C4A00FC0DB7 /* SkMath.cpp */,
AB4C46670DAE9C4A00FC0DB7 /* SkMatrix.cpp */,
AB4C46680DAE9C4A00FC0DB7 /* SkMemory_stdlib.cpp */,
+ A74366C50EE5B7B9003562CC /* SkPageFlipper.cpp */,
AB4C46690DAE9C4A00FC0DB7 /* SkPoint.cpp */,
AB4C466A0DAE9C4A00FC0DB7 /* SkRect.cpp */,
AB4C466B0DAE9C4A00FC0DB7 /* SkRegion.cpp */,
@@ -658,6 +674,7 @@
AB4C471E0DAE9C7A00FC0DB7 /* SkEvent.h */,
AB4C471F0DAE9C7A00FC0DB7 /* SkEventSink.h */,
AB4C47200DAE9C7A00FC0DB7 /* SkFlattenable.h */,
+ A74366BE0EE5B74E003562CC /* SkFlipPixelRef.h */,
AB4C47210DAE9C7A00FC0DB7 /* SkFontCodec.h */,
AB4C47220DAE9C7A00FC0DB7 /* SkFontHost.h */,
7B4DF45D0E5B5F3A004D7619 /* SkGLCanvas.h */,
@@ -671,7 +688,9 @@
AB4C47290DAE9C7A00FC0DB7 /* SkJS.h */,
AB4C472A0DAE9C7A00FC0DB7 /* SkKernel33MaskFilter.h */,
AB4C472B0DAE9C7A00FC0DB7 /* SkKey.h */,
+ A74366BF0EE5B74E003562CC /* SkLayerDrawLooper.h */,
AB4C472C0DAE9C7A00FC0DB7 /* SkLayerRasterizer.h */,
+ A74366C00EE5B74E003562CC /* SkMallocPixelRef.h */,
AB4C472D0DAE9C7A00FC0DB7 /* SkMask.h */,
AB4C472E0DAE9C7A00FC0DB7 /* SkMaskFilter.h */,
AB4C472F0DAE9C7A00FC0DB7 /* SkMetaData.h */,
@@ -741,6 +760,9 @@
AB4C46E00DAE9C7900FC0DB7 /* corecg */ = {
isa = PBXGroup;
children = (
+ A74366C10EE5B795003562CC /* SkFloatBits.h */,
+ A74366C20EE5B795003562CC /* SkPageFlipper.h */,
+ A74366C30EE5B795003562CC /* SkScalarCompare.h */,
AB4C46E10DAE9C7900FC0DB7 /* Sk64.h */,
AB4C46E20DAE9C7900FC0DB7 /* SkBuffer.h */,
AB4C46E30DAE9C7900FC0DB7 /* SkChunkAlloc.h */,
@@ -772,6 +794,7 @@
AB4C47F30DAE9C9700FC0DB7 /* ports */ = {
isa = PBXGroup;
children = (
+ A74366C80EE5B7FA003562CC /* sk_predefined_gamma.h */,
AB4C47F90DAE9C9700FC0DB7 /* SkFontHost_none.cpp */,
AB4C47FB0DAE9C9700FC0DB7 /* SkGlobals_global.cpp */,
AB4C4A290DAECE3600FC0DB7 /* SkImageDecoder_Factory.cpp */,
@@ -844,7 +867,6 @@
AB4C48540DAE9C9C00FC0DB7 /* SkPath.cpp */,
AB4C48550DAE9C9C00FC0DB7 /* SkPathEffect.cpp */,
AB4C48560DAE9C9C00FC0DB7 /* SkPathMeasure.cpp */,
- AB4C48570DAE9C9C00FC0DB7 /* SkPicture.cpp */,
E4A1330E0E37A16400110AA2 /* SkPixelRef.cpp */,
AB4C48580DAE9C9C00FC0DB7 /* SkProcSpriteBlitter.cpp */,
E4A133120E37A19300110AA2 /* SkPtrRecorder.cpp */,
@@ -883,6 +905,9 @@
E48EE5A20E34F13C009DE966 /* picture */ = {
isa = PBXGroup;
children = (
+ A74366CA0EE5B80D003562CC /* SkPathHeap.h */,
+ A74366C90EE5B80D003562CC /* SkPathHeap.cpp */,
+ A74366CB0EE5B80D003562CC /* SkPicture.cpp */,
E48EE5A60E34F14C009DE966 /* SkPictureFlat.h */,
E4A133290E37A22700110AA2 /* SkPictureFlat.cpp */,
E48EE5A70E34F14C009DE966 /* SkPicturePlayback.h */,
@@ -990,6 +1015,7 @@
E48EE4FF0E34E873009DE966 /* SkFilterProc.cpp in Sources */,
E48EE5000E34E873009DE966 /* SkFlattenable.cpp in Sources */,
E48EE5010E34E873009DE966 /* SkFloat.cpp in Sources */,
+ A74366C60EE5B7B9003562CC /* SkFloatBits.cpp in Sources */,
E48EE5020E34E873009DE966 /* SkFontHost_none.cpp in Sources */,
E48EE5030E34E873009DE966 /* SkGeometry.cpp in Sources */,
E48EE5040E34E873009DE966 /* SkGlobals.cpp in Sources */,
@@ -1014,12 +1040,14 @@
7B4DF47E0E5B5FE0004D7619 /* SkNinePatch.cpp in Sources */,
E48EE5140E34E873009DE966 /* SkOSFile_stdio.cpp in Sources */,
E48EE5150E34E873009DE966 /* SkPackBits.cpp in Sources */,
+ A74366C70EE5B7B9003562CC /* SkPageFlipper.cpp in Sources */,
E48EE5160E34E873009DE966 /* SkPaint.cpp in Sources */,
E48EE5170E34E873009DE966 /* SkPaintFlagsDrawFilter.cpp in Sources */,
E48EE5180E34E873009DE966 /* SkPath.cpp in Sources */,
+ A74366CC0EE5B80D003562CC /* SkPathHeap.cpp in Sources */,
E48EE5190E34E873009DE966 /* SkPathEffect.cpp in Sources */,
E48EE51A0E34E873009DE966 /* SkPathMeasure.cpp in Sources */,
- E4A133790E37AF2900110AA2 /* SkPicture.cpp in Sources */,
+ A74366CD0EE5B80D003562CC /* SkPicture.cpp in Sources */,
E4A1332A0E37A22700110AA2 /* SkPictureFlat.cpp in Sources */,
E4A1337B0E37B11300110AA2 /* SkPicturePlayback.cpp in Sources */,
E4A133270E37A1FE00110AA2 /* SkPictureRecord.cpp in Sources */,
diff --git a/skia/svg/SkSVG.cpp b/skia/svg/SkSVG.cpp
index 7c39044..bcd62bf 100644
--- a/skia/svg/SkSVG.cpp
+++ b/skia/svg/SkSVG.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVG.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGCircle.cpp b/skia/svg/SkSVGCircle.cpp
index b72d46c..d27521d 100644
--- a/skia/svg/SkSVGCircle.cpp
+++ b/skia/svg/SkSVGCircle.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGCircle.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGCircle.h b/skia/svg/SkSVGCircle.h
index 9124c1c..343a367 100644
--- a/skia/svg/SkSVGCircle.h
+++ b/skia/svg/SkSVGCircle.h
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGCircle.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGClipPath.cpp b/skia/svg/SkSVGClipPath.cpp
index 586571a..bd71429 100644
--- a/skia/svg/SkSVGClipPath.cpp
+++ b/skia/svg/SkSVGClipPath.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGClipPath.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGClipPath.h b/skia/svg/SkSVGClipPath.h
index 4fc7da6..6fa17b8 100644
--- a/skia/svg/SkSVGClipPath.h
+++ b/skia/svg/SkSVGClipPath.h
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGClipPath.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGDefs.cpp b/skia/svg/SkSVGDefs.cpp
index ae1da54..0499075 100644
--- a/skia/svg/SkSVGDefs.cpp
+++ b/skia/svg/SkSVGDefs.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGDefs.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGDefs.h b/skia/svg/SkSVGDefs.h
index b4f024c..45f0106 100644
--- a/skia/svg/SkSVGDefs.h
+++ b/skia/svg/SkSVGDefs.h
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGDefs.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGElements.cpp b/skia/svg/SkSVGElements.cpp
index 52a2dc1..8e195c7 100644
--- a/skia/svg/SkSVGElements.cpp
+++ b/skia/svg/SkSVGElements.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGElements.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGElements.h b/skia/svg/SkSVGElements.h
index 743d07f..ed3f921 100644
--- a/skia/svg/SkSVGElements.h
+++ b/skia/svg/SkSVGElements.h
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGElements.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGEllipse.cpp b/skia/svg/SkSVGEllipse.cpp
index f795d21..3752b83 100644
--- a/skia/svg/SkSVGEllipse.cpp
+++ b/skia/svg/SkSVGEllipse.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGEllipse.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGEllipse.h b/skia/svg/SkSVGEllipse.h
index ea5d291..566f16c 100644
--- a/skia/svg/SkSVGEllipse.h
+++ b/skia/svg/SkSVGEllipse.h
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGEllipse.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGFeColorMatrix.cpp b/skia/svg/SkSVGFeColorMatrix.cpp
index f55985a..a758704 100644
--- a/skia/svg/SkSVGFeColorMatrix.cpp
+++ b/skia/svg/SkSVGFeColorMatrix.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGFeColorMatrix.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGFeColorMatrix.h b/skia/svg/SkSVGFeColorMatrix.h
index bb79ed9..431d532 100644
--- a/skia/svg/SkSVGFeColorMatrix.h
+++ b/skia/svg/SkSVGFeColorMatrix.h
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGFeColorMatrix.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGFilter.cpp b/skia/svg/SkSVGFilter.cpp
index 9d97f69..1d32e56 100644
--- a/skia/svg/SkSVGFilter.cpp
+++ b/skia/svg/SkSVGFilter.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGFilter.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGFilter.h b/skia/svg/SkSVGFilter.h
index 5323e1b..6ec9bd5 100644
--- a/skia/svg/SkSVGFilter.h
+++ b/skia/svg/SkSVGFilter.h
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGFilter.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGG.cpp b/skia/svg/SkSVGG.cpp
index 2e2c876..f73b8b8 100644
--- a/skia/svg/SkSVGG.cpp
+++ b/skia/svg/SkSVGG.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGG.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGG.h b/skia/svg/SkSVGG.h
index 4200c2c..4c5c68a 100644
--- a/skia/svg/SkSVGG.h
+++ b/skia/svg/SkSVGG.h
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGG.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGGradient.cpp b/skia/svg/SkSVGGradient.cpp
index d1fdc22..c89bdc9 100644
--- a/skia/svg/SkSVGGradient.cpp
+++ b/skia/svg/SkSVGGradient.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGGradient.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGGradient.h b/skia/svg/SkSVGGradient.h
index 1f91b1c..873b258 100644
--- a/skia/svg/SkSVGGradient.h
+++ b/skia/svg/SkSVGGradient.h
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGGradient.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGGroup.cpp b/skia/svg/SkSVGGroup.cpp
index 6d7e438..069aa56 100644
--- a/skia/svg/SkSVGGroup.cpp
+++ b/skia/svg/SkSVGGroup.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGGroup.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGGroup.h b/skia/svg/SkSVGGroup.h
index 31fff46..2e34cbb 100644
--- a/skia/svg/SkSVGGroup.h
+++ b/skia/svg/SkSVGGroup.h
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGGroup.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGImage.cpp b/skia/svg/SkSVGImage.cpp
index 17df84d..b641c9f 100644
--- a/skia/svg/SkSVGImage.cpp
+++ b/skia/svg/SkSVGImage.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGImage.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGImage.h b/skia/svg/SkSVGImage.h
index 9b21f69..2f73b0d 100644
--- a/skia/svg/SkSVGImage.h
+++ b/skia/svg/SkSVGImage.h
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGImage.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGLine.cpp b/skia/svg/SkSVGLine.cpp
index 23cc46f..105822a 100644
--- a/skia/svg/SkSVGLine.cpp
+++ b/skia/svg/SkSVGLine.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGLine.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGLine.h b/skia/svg/SkSVGLine.h
index 6d8b733..f2cfce9 100644
--- a/skia/svg/SkSVGLine.h
+++ b/skia/svg/SkSVGLine.h
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGLine.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGLinearGradient.cpp b/skia/svg/SkSVGLinearGradient.cpp
index d950cae..a474d15 100644
--- a/skia/svg/SkSVGLinearGradient.cpp
+++ b/skia/svg/SkSVGLinearGradient.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGLinearGradient.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGLinearGradient.h b/skia/svg/SkSVGLinearGradient.h
index 96301d2..85e28e7 100644
--- a/skia/svg/SkSVGLinearGradient.h
+++ b/skia/svg/SkSVGLinearGradient.h
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGLinearGradient.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGMask.cpp b/skia/svg/SkSVGMask.cpp
index dfc9ebf..eb93118 100644
--- a/skia/svg/SkSVGMask.cpp
+++ b/skia/svg/SkSVGMask.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGMask.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGMask.h b/skia/svg/SkSVGMask.h
index 6a2f3c3..6e349b4 100644
--- a/skia/svg/SkSVGMask.h
+++ b/skia/svg/SkSVGMask.h
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGMask.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGMetadata.cpp b/skia/svg/SkSVGMetadata.cpp
index 9c305e4..7c9e6ba 100644
--- a/skia/svg/SkSVGMetadata.cpp
+++ b/skia/svg/SkSVGMetadata.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGMetadata.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGMetadata.h b/skia/svg/SkSVGMetadata.h
index 8fb42a8..f3b5b6c 100644
--- a/skia/svg/SkSVGMetadata.h
+++ b/skia/svg/SkSVGMetadata.h
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGMetadata.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGPaintState.cpp b/skia/svg/SkSVGPaintState.cpp
index 20fb5db..7fc90c7 100644
--- a/skia/svg/SkSVGPaintState.cpp
+++ b/skia/svg/SkSVGPaintState.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGPaintState.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGParser.cpp b/skia/svg/SkSVGParser.cpp
index 869a55a..b55c5ed 100644
--- a/skia/svg/SkSVGParser.cpp
+++ b/skia/svg/SkSVGParser.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGParser.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGPath.cpp b/skia/svg/SkSVGPath.cpp
index bff8f24..a916c30 100644
--- a/skia/svg/SkSVGPath.cpp
+++ b/skia/svg/SkSVGPath.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGPath.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGPath.h b/skia/svg/SkSVGPath.h
index f3be03b..8a0c210 100644
--- a/skia/svg/SkSVGPath.h
+++ b/skia/svg/SkSVGPath.h
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGPath.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGPolygon.cpp b/skia/svg/SkSVGPolygon.cpp
index f1ed9ce..283422c 100644
--- a/skia/svg/SkSVGPolygon.cpp
+++ b/skia/svg/SkSVGPolygon.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGPolygon.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGPolygon.h b/skia/svg/SkSVGPolygon.h
index a01d389..1f27c5c 100644
--- a/skia/svg/SkSVGPolygon.h
+++ b/skia/svg/SkSVGPolygon.h
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGPolygon.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGPolyline.cpp b/skia/svg/SkSVGPolyline.cpp
index 7e7b575..8432c95 100644
--- a/skia/svg/SkSVGPolyline.cpp
+++ b/skia/svg/SkSVGPolyline.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGPolyline.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGPolyline.h b/skia/svg/SkSVGPolyline.h
index 68527e7..7f25129 100644
--- a/skia/svg/SkSVGPolyline.h
+++ b/skia/svg/SkSVGPolyline.h
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGPolyline.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGRadialGradient.cpp b/skia/svg/SkSVGRadialGradient.cpp
index 31bfde6..bba8b941 100644
--- a/skia/svg/SkSVGRadialGradient.cpp
+++ b/skia/svg/SkSVGRadialGradient.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGRadialGradient.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGRadialGradient.h b/skia/svg/SkSVGRadialGradient.h
index cdf2c10..5b04186 100644
--- a/skia/svg/SkSVGRadialGradient.h
+++ b/skia/svg/SkSVGRadialGradient.h
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGRadialGradient.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGRect.cpp b/skia/svg/SkSVGRect.cpp
index 9f1da07..03fdfdc 100644
--- a/skia/svg/SkSVGRect.cpp
+++ b/skia/svg/SkSVGRect.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGRect.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGRect.h b/skia/svg/SkSVGRect.h
index ac48d8e..d06372b 100644
--- a/skia/svg/SkSVGRect.h
+++ b/skia/svg/SkSVGRect.h
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGRect.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGSVG.cpp b/skia/svg/SkSVGSVG.cpp
index 6b0aed3..1678fc1 100644
--- a/skia/svg/SkSVGSVG.cpp
+++ b/skia/svg/SkSVGSVG.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGSVG.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGSVG.h b/skia/svg/SkSVGSVG.h
index c8eec08..f331ccd 100644
--- a/skia/svg/SkSVGSVG.h
+++ b/skia/svg/SkSVGSVG.h
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGSVG.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGStop.cpp b/skia/svg/SkSVGStop.cpp
index 10472d2..0d1d76c 100644
--- a/skia/svg/SkSVGStop.cpp
+++ b/skia/svg/SkSVGStop.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGStop.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGStop.h b/skia/svg/SkSVGStop.h
index 50be491..dd11d18 100644
--- a/skia/svg/SkSVGStop.h
+++ b/skia/svg/SkSVGStop.h
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGStop.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGSymbol.cpp b/skia/svg/SkSVGSymbol.cpp
index a559397..f8729d7 100644
--- a/skia/svg/SkSVGSymbol.cpp
+++ b/skia/svg/SkSVGSymbol.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGSymbol.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGSymbol.h b/skia/svg/SkSVGSymbol.h
index 08285eb..c1439dc 100644
--- a/skia/svg/SkSVGSymbol.h
+++ b/skia/svg/SkSVGSymbol.h
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGSymbol.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGText.cpp b/skia/svg/SkSVGText.cpp
index 930055c..1c18a74 100644
--- a/skia/svg/SkSVGText.cpp
+++ b/skia/svg/SkSVGText.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGText.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGText.h b/skia/svg/SkSVGText.h
index 82f0242..98b0155 100644
--- a/skia/svg/SkSVGText.h
+++ b/skia/svg/SkSVGText.h
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGText.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGUse.cpp b/skia/svg/SkSVGUse.cpp
index 9c419e0..ba7b256 100644
--- a/skia/svg/SkSVGUse.cpp
+++ b/skia/svg/SkSVGUse.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGUse.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/svg/SkSVGUse.h b/skia/svg/SkSVGUse.h
index 1c024d5..ff85ce6 100644
--- a/skia/svg/SkSVGUse.h
+++ b/skia/svg/SkSVGUse.h
@@ -1,6 +1,6 @@
/* libs/graphics/svg/SkSVGUse.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/text/ATextEntry.h b/skia/text/ATextEntry.h
index 8d7b60d..225236d 100644
--- a/skia/text/ATextEntry.h
+++ b/skia/text/ATextEntry.h
@@ -1,6 +1,6 @@
/* libs/graphics/text/ATextEntry.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/views/SkEvent.cpp b/skia/views/SkEvent.cpp
index 7d00862..67549b4 100644
--- a/skia/views/SkEvent.cpp
+++ b/skia/views/SkEvent.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/views/SkEvent.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/views/SkEventSink.cpp b/skia/views/SkEventSink.cpp
index 8c9d73c..c8fe35c 100644
--- a/skia/views/SkEventSink.cpp
+++ b/skia/views/SkEventSink.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/views/SkEventSink.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/views/SkMetaData.cpp b/skia/views/SkMetaData.cpp
index 1d423a4..c366bd3 100644
--- a/skia/views/SkMetaData.cpp
+++ b/skia/views/SkMetaData.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/views/SkMetaData.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/views/SkTagList.cpp b/skia/views/SkTagList.cpp
index 4d73000..4576ce6 100644
--- a/skia/views/SkTagList.cpp
+++ b/skia/views/SkTagList.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/views/SkTagList.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/views/SkTagList.h b/skia/views/SkTagList.h
index c093fa0..5f428e4 100644
--- a/skia/views/SkTagList.h
+++ b/skia/views/SkTagList.h
@@ -1,6 +1,6 @@
/* libs/graphics/views/SkTagList.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/views/SkTextBox.cpp b/skia/views/SkTextBox.cpp
index 08ec4fd..657f648 100644
--- a/skia/views/SkTextBox.cpp
+++ b/skia/views/SkTextBox.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/views/SkTextBox.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/xml/SkBML_Verbs.h b/skia/xml/SkBML_Verbs.h
index 2d17d87..86bfede 100644
--- a/skia/xml/SkBML_Verbs.h
+++ b/skia/xml/SkBML_Verbs.h
@@ -1,6 +1,6 @@
/* libs/graphics/xml/SkBML_Verbs.h
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/xml/SkBML_XMLParser.cpp b/skia/xml/SkBML_XMLParser.cpp
index 34b86a1..53b7f61 100644
--- a/skia/xml/SkBML_XMLParser.cpp
+++ b/skia/xml/SkBML_XMLParser.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/xml/SkBML_XMLParser.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/xml/SkDOM.cpp b/skia/xml/SkDOM.cpp
index c738be6..a9fc31e 100644
--- a/skia/xml/SkDOM.cpp
+++ b/skia/xml/SkDOM.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/xml/SkDOM.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/xml/SkJS.cpp b/skia/xml/SkJS.cpp
index 626bd6f..03ccba6 100644
--- a/skia/xml/SkJS.cpp
+++ b/skia/xml/SkJS.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/xml/SkJS.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/xml/SkJSDisplayable.cpp b/skia/xml/SkJSDisplayable.cpp
index 87269f3..d52a7c9 100644
--- a/skia/xml/SkJSDisplayable.cpp
+++ b/skia/xml/SkJSDisplayable.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/xml/SkJSDisplayable.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/xml/SkParse.cpp b/skia/xml/SkParse.cpp
index b2cf296..e740280 100644
--- a/skia/xml/SkParse.cpp
+++ b/skia/xml/SkParse.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/xml/SkParse.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/xml/SkParseColor.cpp b/skia/xml/SkParseColor.cpp
index 43bd09e..eca2e38 100644
--- a/skia/xml/SkParseColor.cpp
+++ b/skia/xml/SkParseColor.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/xml/SkParseColor.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/xml/SkXMLParser.cpp b/skia/xml/SkXMLParser.cpp
index 0a88bfb..da33307 100644
--- a/skia/xml/SkXMLParser.cpp
+++ b/skia/xml/SkXMLParser.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/xml/SkXMLParser.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/skia/xml/SkXMLWriter.cpp b/skia/xml/SkXMLWriter.cpp
index e8df912..4685d81 100644
--- a/skia/xml/SkXMLWriter.cpp
+++ b/skia/xml/SkXMLWriter.cpp
@@ -1,6 +1,6 @@
/* libs/graphics/xml/SkXMLWriter.cpp
**
-** Copyright 2006, Google Inc.
+** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.