aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-23 18:14:13 +0000
committerGravatar rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-23 18:14:13 +0000
commitd6176b0dcacb124539e0cfd051e6d93a9782f020 (patch)
tree9e6f4b465e54c9b26e1ba70cd8890b55abb08464
parentfbfcd5602128ec010c82cb733c9cdc0a3254f9f3 (diff)
Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/)
This CL is part II of IV (I broke down the 1280 files into 4 CLs). Review URL: https://codereview.appspot.com/6474054 git-svn-id: http://skia.googlecode.com/svn/trunk@5263 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--experimental/Debugger/DebuggerCommandsView.cpp18
-rw-r--r--experimental/Debugger/DebuggerContentView.cpp66
-rw-r--r--experimental/Debugger/DebuggerStateView.cpp6
-rw-r--r--experimental/Debugger/DebuggerViews.h8
-rw-r--r--experimental/Debugger/SkDebugDumper.cpp32
-rw-r--r--experimental/Debugger/SkDebugDumper.h4
-rw-r--r--experimental/DrawingBoard/SampleDrawingClient.cpp74
-rw-r--r--experimental/DrawingBoard/SampleDrawingServer.cpp54
-rw-r--r--experimental/DrawingBoard/SkColorPalette.cpp58
-rw-r--r--experimental/DrawingBoard/SkNetPipeController.cpp10
-rw-r--r--experimental/DrawingBoard/SkNetPipeController.h8
-rw-r--r--experimental/FileReaderApp/ReaderView.cpp22
-rw-r--r--experimental/FileReaderApp/ReaderView.h6
-rwxr-xr-xexperimental/Intersection/ActiveEdge_Test.cpp4
-rw-r--r--experimental/Intersection/ConvexHull.cpp12
-rw-r--r--experimental/Intersection/ConvexHull_Test.cpp28
-rw-r--r--experimental/Intersection/CubeRoot.cpp400
-rw-r--r--experimental/Intersection/CubicBezierClip.cpp10
-rw-r--r--experimental/Intersection/CubicIntersection.cpp18
-rw-r--r--experimental/Intersection/CubicIntersection_TestData.cpp8
-rw-r--r--experimental/Intersection/CubicParameterization.cpp182
-rw-r--r--experimental/Intersection/CubicParameterizationCode.cpp126
-rw-r--r--experimental/Intersection/CubicParameterization_Test.cpp2
-rw-r--r--experimental/Intersection/CubicReduceOrder.cpp6
-rw-r--r--experimental/Intersection/CubicReduceOrder_Test.cpp8
-rw-r--r--experimental/Intersection/CubicSubDivide.cpp18
-rw-r--r--experimental/Intersection/DataTypes.cpp12
-rw-r--r--experimental/Intersection/DataTypes.h12
-rw-r--r--experimental/Intersection/EdgeDemo.cpp2
-rw-r--r--experimental/Intersection/EdgeWalker.cpp74
-rwxr-xr-xexperimental/Intersection/EdgeWalkerPolygon4x4_Test.cpp2
-rw-r--r--experimental/Intersection/EdgeWalkerPolygons_Test.cpp12
-rw-r--r--experimental/Intersection/EdgeWalkerQuadratic4x4_Test.cpp2
-rw-r--r--experimental/Intersection/EdgeWalkerRectangles_Test.cpp26
-rw-r--r--experimental/Intersection/EdgeWalker_Test.h2
-rw-r--r--experimental/Intersection/IntersectionUtilities.cpp4
-rw-r--r--experimental/Intersection/IntersectionUtilities.h2
-rw-r--r--experimental/Intersection/Intersection_Tests.cpp2
-rw-r--r--experimental/Intersection/Intersections.h2
-rw-r--r--experimental/Intersection/LineCubicIntersection.cpp22
-rw-r--r--experimental/Intersection/LineIntersection.cpp6
-rw-r--r--experimental/Intersection/LineIntersection_Test.cpp2
-rw-r--r--experimental/Intersection/LineParameterization.cpp4
-rw-r--r--experimental/Intersection/LineParameters.h14
-rw-r--r--experimental/Intersection/LineParameteters_Test.cpp4
-rw-r--r--experimental/Intersection/LineQuadraticIntersection.cpp30
-rw-r--r--experimental/Intersection/LineQuadraticIntersection_Test.cpp6
-rw-r--r--experimental/Intersection/LineUtilities.cpp8
-rw-r--r--experimental/Intersection/QuadraticBezierClip.cpp10
-rw-r--r--experimental/Intersection/QuadraticIntersection.cpp24
-rw-r--r--experimental/Intersection/QuadraticParameterization.cpp2
-rw-r--r--experimental/Intersection/QuadraticParameterization_Test.cpp2
-rw-r--r--experimental/Intersection/QuadraticReduceOrder.cpp2
-rw-r--r--experimental/Intersection/QuadraticSubDivide.cpp2
-rw-r--r--experimental/Intersection/QuadraticUtilities.cpp2
-rw-r--r--experimental/Intersection/Simplify.cpp126
-rw-r--r--experimental/Intersection/SimplifyAddIntersectingTs_Test.cpp6
-rw-r--r--experimental/Intersection/SimplifyFindNext_Test.cpp4
-rw-r--r--experimental/Intersection/SimplifyNew_Test.cpp2
-rw-r--r--experimental/Intersection/SimplifyRect4x4_Test.cpp30
-rw-r--r--experimental/Intersection/SkAntiEdge.cpp10
-rw-r--r--experimental/Networking/SampleNetPipeReader.cpp24
-rw-r--r--experimental/Networking/SkSockets.cpp22
-rw-r--r--experimental/Networking/SkSockets.h36
-rw-r--r--experimental/SkSetPoly3To3.cpp10
-rw-r--r--experimental/SkSetPoly3To3_A.cpp10
-rw-r--r--experimental/SkSetPoly3To3_D.cpp6
-rw-r--r--experimental/iOSSampleApp/Shared/SkOptionListController.h2
-rw-r--r--experimental/iOSSampleApp/SkSampleUIView.h6
-rw-r--r--gm/aaclip.cpp2
-rw-r--r--gm/aarectmodes.cpp16
-rw-r--r--gm/bitmapfilters.cpp4
-rw-r--r--gm/colormatrix.cpp6
-rw-r--r--gm/complexclip.cpp6
-rw-r--r--gm/convexpaths.cpp12
-rw-r--r--gm/cubicpaths.cpp28
-rw-r--r--gm/degeneratesegments.cpp10
-rw-r--r--gm/drawlooper.cpp10
-rw-r--r--gm/filltypes.cpp12
-rw-r--r--gm/filltypespersp.cpp6
-rw-r--r--gm/gammatext.cpp16
-rw-r--r--gm/getpostextpath.cpp8
-rw-r--r--gm/gm.h10
-rw-r--r--gm/gradients.cpp60
-rw-r--r--gm/hittestpath.cpp22
-rw-r--r--gm/imageblur.cpp4
-rw-r--r--gm/imagefiltersbase.cpp18
-rw-r--r--gm/lcdtext.cpp2
-rw-r--r--gm/linepaths.cpp28
-rw-r--r--gm/ninepatchstretch.cpp32
-rw-r--r--gm/pathfill.cpp32
-rw-r--r--gm/pathreverse.cpp12
-rw-r--r--gm/poly2poly.cpp32
-rw-r--r--gm/quadpaths.cpp28
-rw-r--r--gm/simpleaaclip.cpp20
-rw-r--r--gm/strokerects.cpp6
-rw-r--r--gm/tablecolorfilter.cpp20
-rw-r--r--gm/testimagefilters.cpp14
-rw-r--r--gm/texdata.cpp4
-rw-r--r--gyp/FileReaderApp.gyp2
-rw-r--r--gyp/SampleApp.gyp8
-rw-r--r--gyp/SimpleCocoaApp.gyp4
-rw-r--r--gyp/android_deps.gyp10
-rw-r--r--gyp/android_system.gyp10
-rw-r--r--gyp/bench.gypi2
-rw-r--r--gyp/common_variables.gypi2
-rw-r--r--gyp/gm.gyp2
-rw-r--r--gyp/gpu.gyp2
-rw-r--r--gyp/iOSSampleApp.gyp12
-rw-r--r--gyp/ports.gyp2
-rw-r--r--gyp/shapeops_demo.gyp2
-rw-r--r--gyp/utils.gyp2
-rw-r--r--src/animator/SkAnimateActive.cpp32
-rw-r--r--src/animator/SkAnimateBase.cpp22
-rw-r--r--src/animator/SkAnimateField.cpp8
-rw-r--r--src/animator/SkAnimateMaker.cpp10
-rw-r--r--src/animator/SkAnimateMaker.h8
-rw-r--r--src/animator/SkAnimateSet.cpp4
-rw-r--r--src/animator/SkAnimator.cpp30
-rw-r--r--src/animator/SkAnimatorScript.cpp40
-rw-r--r--src/animator/SkAnimatorScript.h20
-rw-r--r--src/animator/SkAnimatorScript2.cpp1020
-rw-r--r--src/animator/SkAnimatorScript2.h38
-rw-r--r--src/animator/SkBoundable.cpp2
-rw-r--r--src/animator/SkBuildCondensedInfo.cpp6
-rw-r--r--src/animator/SkCondensedDebug.cpp164
-rw-r--r--src/animator/SkCondensedRelease.cpp162
-rw-r--r--src/animator/SkDisplayAdd.cpp4
-rw-r--r--src/animator/SkDisplayAdd.h4
-rw-r--r--src/animator/SkDisplayApply.cpp32
-rw-r--r--src/animator/SkDisplayApply.h4
-rw-r--r--src/animator/SkDisplayBounds.cpp2
-rw-r--r--src/animator/SkDisplayEvent.cpp10
-rw-r--r--src/animator/SkDisplayEvents.cpp2
-rw-r--r--src/animator/SkDisplayInput.cpp2
-rw-r--r--src/animator/SkDisplayList.cpp12
-rw-r--r--src/animator/SkDisplayList.h8
-rw-r--r--src/animator/SkDisplayMath.cpp14
-rw-r--r--src/animator/SkDisplayMath.h4
-rw-r--r--src/animator/SkDisplayMovie.cpp2
-rw-r--r--src/animator/SkDisplayNumber.h2
-rw-r--r--src/animator/SkDisplayPost.cpp20
-rw-r--r--src/animator/SkDisplayRandom.cpp2
-rw-r--r--src/animator/SkDisplayType.cpp12
-rw-r--r--src/animator/SkDisplayType.h2
-rw-r--r--src/animator/SkDisplayTypes.cpp8
-rw-r--r--src/animator/SkDisplayTypes.h2
-rw-r--r--src/animator/SkDisplayXMLParser.cpp18
-rw-r--r--src/animator/SkDisplayable.cpp90
-rw-r--r--src/animator/SkDisplayable.h18
-rw-r--r--src/animator/SkDraw3D.cpp6
-rw-r--r--src/animator/SkDraw3D.h2
-rw-r--r--src/animator/SkDrawBitmap.cpp12
-rw-r--r--src/animator/SkDrawBitmap.h2
-rw-r--r--src/animator/SkDrawBlur.cpp2
-rw-r--r--src/animator/SkDrawColor.cpp24
-rw-r--r--src/animator/SkDrawEmboss.cpp2
-rw-r--r--src/animator/SkDrawGradient.cpp20
-rw-r--r--src/animator/SkDrawGradient.h4
-rw-r--r--src/animator/SkDrawGroup.cpp2
-rw-r--r--src/animator/SkDrawLine.cpp2
-rw-r--r--src/animator/SkDrawMatrix.cpp16
-rw-r--r--src/animator/SkDrawPaint.h2
-rw-r--r--src/animator/SkDrawPath.cpp18
-rw-r--r--src/animator/SkDrawPoint.cpp4
-rw-r--r--src/animator/SkDrawRectangle.cpp4
-rw-r--r--src/animator/SkDrawRectangle.h2
-rw-r--r--src/animator/SkDrawSaveLayer.cpp2
-rw-r--r--src/animator/SkDrawShader.cpp10
-rw-r--r--src/animator/SkDrawText.h2
-rw-r--r--src/animator/SkDrawTextBox.cpp2
-rw-r--r--src/animator/SkDrawable.cpp4
-rw-r--r--src/animator/SkDrawable.h2
-rw-r--r--src/animator/SkDump.cpp2
-rw-r--r--src/animator/SkGetCondensedInfo.cpp2
-rw-r--r--src/animator/SkIntArray.h28
-rw-r--r--src/animator/SkMatrixParts.cpp30
-rw-r--r--src/animator/SkMatrixParts.h2
-rw-r--r--src/animator/SkMemberInfo.cpp44
-rw-r--r--src/animator/SkMemberInfo.h16
-rw-r--r--src/animator/SkOpArray.cpp12
-rw-r--r--src/animator/SkOpArray.h18
-rw-r--r--src/animator/SkOperand2.h62
-rw-r--r--src/animator/SkOperandIterpolator.cpp2
-rw-r--r--src/animator/SkParseSVGPath.cpp8
-rw-r--r--src/animator/SkPathParts.cpp14
-rw-r--r--src/animator/SkPostParts.cpp2
-rw-r--r--src/animator/SkScript.cpp106
-rw-r--r--src/animator/SkScript.h6
-rw-r--r--src/animator/SkScript2.h476
-rw-r--r--src/animator/SkScriptCallBack.h52
-rw-r--r--src/animator/SkScriptDecompile.cpp4
-rw-r--r--src/animator/SkScriptRuntime.cpp584
-rw-r--r--src/animator/SkScriptRuntime.h52
-rw-r--r--src/animator/SkScriptTokenizer.cpp98
-rw-r--r--src/animator/SkTDArray_Experimental.h10
-rw-r--r--src/animator/SkTextOnPath.cpp2
-rw-r--r--src/animator/SkTextToPath.cpp2
-rw-r--r--src/animator/SkTime.cpp2
-rw-r--r--src/animator/SkTypedArray.h2
-rw-r--r--src/gpu/GrAAHairLinePathRenderer.h2
-rw-r--r--src/gpu/GrAARectRenderer.cpp2
-rwxr-xr-xsrc/gpu/GrAllocator.h36
-rw-r--r--src/gpu/GrClipMaskManager.h20
-rw-r--r--src/gpu/GrDrawState.h36
-rw-r--r--src/gpu/GrDrawTarget.cpp32
-rw-r--r--src/gpu/GrDrawTarget.h56
-rw-r--r--src/gpu/GrGpu.cpp18
-rw-r--r--src/gpu/GrGpu.h28
-rw-r--r--src/gpu/GrGpuVertex.h8
-rw-r--r--src/gpu/GrPathRenderer.h6
-rw-r--r--src/gpu/GrPathUtils.cpp10
-rw-r--r--src/gpu/GrPlotMgr.h2
-rw-r--r--src/gpu/GrRectanizer.cpp2
-rw-r--r--src/gpu/GrSWMaskHelper.h18
-rw-r--r--src/gpu/GrSoftwarePathRenderer.cpp18
-rw-r--r--src/gpu/GrSoftwarePathRenderer.h4
-rw-r--r--src/gpu/GrStencil.h18
-rw-r--r--src/gpu/GrStencilBuffer.cpp6
-rw-r--r--src/gpu/GrTBSearch.h6
-rw-r--r--src/gpu/GrTDArray.h2
-rw-r--r--src/gpu/GrTLList.h2
-rw-r--r--src/gpu/GrTemplates.h6
-rw-r--r--src/gpu/GrTextContext.cpp8
-rw-r--r--src/gpu/GrTextStrike_impl.h14
-rw-r--r--src/gpu/GrTexture.cpp6
-rw-r--r--src/gpu/SkGpuDevice.cpp32
-rw-r--r--src/gpu/gl/GrGLPath.h2
-rw-r--r--src/gpu/gl/GrGLProgram.h12
-rw-r--r--src/gpu/gl/GrGLTexture.h2
-rw-r--r--src/gpu/gl/GrGpuGL.h6
-rw-r--r--src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp6
-rw-r--r--src/gpu/gl/win/SkNativeGLContext_win.cpp8
-rw-r--r--src/gpu/gr_unittests.cpp2
-rw-r--r--src/gpu/ios/GrGLDefaultInterface_iOS.cpp6
-rw-r--r--src/images/SkFlipPixelRef.cpp6
-rw-r--r--src/images/SkImageDecoder_libbmp.cpp24
-rw-r--r--src/images/SkImageDecoder_libgif.cpp34
-rw-r--r--src/images/SkImageDecoder_libico.cpp94
-rw-r--r--src/images/SkImageDecoder_libjpeg.cpp8
-rw-r--r--src/images/SkImageDecoder_libpng.cpp60
-rw-r--r--src/images/SkImageDecoder_wbmp.cpp26
-rw-r--r--src/images/SkImageRefPool.cpp38
-rw-r--r--src/images/SkImageRefPool.h16
-rw-r--r--src/images/SkImageRef_GlobalPool.cpp6
-rw-r--r--src/images/SkMovie.cpp2
-rw-r--r--src/images/SkMovie_gif.cpp2
-rw-r--r--src/images/SkPageFlipper.cpp2
-rw-r--r--src/images/SkScaledBitmapSampler.cpp18
-rw-r--r--src/images/SkScaledBitmapSampler.h6
-rw-r--r--src/images/bmpdecoderhelper.h10
-rw-r--r--src/pdf/SkPDFFont.cpp2
-rw-r--r--src/pdf/SkPDFShader.cpp6
-rw-r--r--src/pdf/SkPDFTypes.h14
-rw-r--r--src/pipe/SkGPipePriv.h10
-rw-r--r--src/pipe/SkGPipeRead.cpp10
-rw-r--r--src/pipe/SkGPipeWrite.cpp18
-rw-r--r--src/ports/SkFontDescriptor.cpp2
-rw-r--r--src/ports/SkFontDescriptor.h2
-rw-r--r--src/ports/SkFontHost_FONTPATH.cpp10
-rw-r--r--src/ports/SkFontHost_FreeType.cpp2
-rw-r--r--src/ports/SkFontHost_FreeType_common.cpp8
-rw-r--r--src/ports/SkFontHost_ascender.cpp32
-rw-r--r--src/ports/SkFontHost_freetype_mac.cpp4
-rw-r--r--src/ports/SkFontHost_mac_coretext.cpp56
-rwxr-xr-xsrc/ports/SkFontHost_win.cpp4
-rw-r--r--src/ports/SkFontHost_win_dw.cpp18
-rw-r--r--src/ports/SkGlobalInitialization_default.cpp2
-rw-r--r--src/ports/SkImageDecoder_CG.cpp16
-rw-r--r--src/ports/SkImageDecoder_WIC.cpp58
-rw-r--r--src/ports/SkImageRef_ashmem.cpp28
-rw-r--r--src/ports/SkImageRef_ashmem.h6
-rw-r--r--src/ports/SkThread_pthread.cpp6
-rw-r--r--src/ports/SkXMLParser_expat.cpp2
-rw-r--r--src/ports/SkXMLParser_tinyxml.cpp18
-rw-r--r--src/ports/SkXMLPullParser_expat.cpp18
-rw-r--r--src/sfnt/SkOTUtils.cpp2
-rw-r--r--src/sfnt/SkTypedEnum.h2
-rw-r--r--src/svg/SkSVGClipPath.cpp2
-rw-r--r--src/svg/SkSVGElements.cpp4
-rw-r--r--src/svg/SkSVGGradient.cpp2
-rw-r--r--src/svg/SkSVGPaintState.cpp12
-rw-r--r--src/svg/SkSVGParser.cpp20
-rw-r--r--src/svg/SkSVGPath.cpp2
-rw-r--r--src/svg/SkSVGPolygon.cpp4
-rw-r--r--src/svg/SkSVGPolygon.h2
-rw-r--r--src/svg/SkSVGPolyline.cpp4
-rw-r--r--src/svg/SkSVGPolyline.h2
-rw-r--r--src/svg/SkSVGSVG.cpp6
-rw-r--r--src/svg/SkSVGSVG.h4
-rw-r--r--src/svg/SkSVGSymbol.cpp2
-rw-r--r--src/utils/SkBase64.cpp10
-rw-r--r--src/utils/SkBoundaryPatch.cpp2
-rw-r--r--src/utils/SkCamera.cpp4
-rw-r--r--src/utils/SkCubicInterval.cpp2
-rw-r--r--src/utils/SkCullPoints.cpp14
-rw-r--r--src/utils/SkDeferredCanvas.cpp54
-rw-r--r--src/utils/SkInterpolator.cpp10
-rw-r--r--src/utils/SkJSON.cpp16
-rw-r--r--src/utils/SkMeshUtils.cpp6
-rw-r--r--src/utils/SkNinePatch.cpp42
-rw-r--r--src/utils/SkParse.cpp8
-rw-r--r--src/utils/SkParsePath.cpp10
-rw-r--r--src/utils/SkThreadUtils.h12
-rw-r--r--src/utils/mac/SkBitmap_Mac.cpp18
-rw-r--r--src/utils/mac/SkCreateCGImageRef.cpp22
-rw-r--r--src/utils/win/SkDWriteFontFileStream.h2
-rw-r--r--src/utils/win/SkDWriteGeometrySink.cpp2
-rw-r--r--src/utils/win/SkHRESULT.cpp4
-rw-r--r--src/utils/win/SkIStream.cpp6
-rw-r--r--src/views/SkBGViewArtist.cpp8
-rw-r--r--src/views/SkEvent.cpp30
-rw-r--r--src/views/SkEventSink.cpp4
-rw-r--r--src/views/SkOSMenu.cpp20
-rw-r--r--src/views/SkParsePaint.cpp178
-rw-r--r--src/views/SkProgressView.cpp170
-rw-r--r--src/views/SkStackViewLayout.cpp340
-rw-r--r--src/views/SkTextBox.cpp2
-rw-r--r--src/views/SkTouchGesture.cpp4
-rw-r--r--src/views/SkView.cpp74
-rw-r--r--src/views/SkViewInflate.cpp184
-rw-r--r--src/views/SkViewPriv.cpp98
-rw-r--r--src/views/SkViewPriv.h48
-rw-r--r--src/views/SkWidget.cpp386
-rw-r--r--src/views/SkWidgets.cpp550
-rw-r--r--src/views/SkWindow.cpp270
-rw-r--r--src/views/animated/SkBorderView.cpp104
-rw-r--r--src/views/animated/SkImageView.cpp424
-rw-r--r--src/views/animated/SkListView.cpp1296
-rw-r--r--src/views/animated/SkListWidget.cpp972
-rw-r--r--src/views/animated/SkProgressBarView.cpp124
-rw-r--r--src/views/animated/SkScrollBarView.cpp184
-rw-r--r--src/views/animated/SkStaticTextView.cpp184
-rw-r--r--src/views/animated/SkWidgetViews.cpp70
-rw-r--r--src/views/mac/SkNSView.h2
-rw-r--r--src/views/mac/SkOSWindow_Mac.cpp290
-rw-r--r--src/views/sdl/SkOSWindow_SDL.cpp10
-rw-r--r--src/views/unix/SkOSWindow_Unix.cpp2
-rw-r--r--src/views/unix/keysym2ucs.c20
-rw-r--r--src/views/win/SkOSWindow_win.cpp48
-rw-r--r--src/xml/SkDOM.cpp10
-rw-r--r--src/xml/SkJSDisplayable.cpp6
-rw-r--r--src/xml/SkXMLParser.cpp2
-rw-r--r--src/xml/SkXMLPullParser.cpp10
-rw-r--r--src/xml/SkXMLWriter.cpp2
-rw-r--r--tests/AAClipTest.cpp12
-rw-r--r--tests/BlitRowTest.cpp12
-rw-r--r--tests/CanvasTest.cpp98
-rw-r--r--tests/ClampRangeTest.cpp6
-rw-r--r--tests/ClipCacheTest.cpp8
-rw-r--r--tests/ClipCubicTest.cpp2
-rw-r--r--tests/ClipStackTest.cpp2
-rw-r--r--tests/ClipperTest.cpp12
-rw-r--r--tests/ColorFilterTest.cpp4
-rw-r--r--tests/DataRefTest.cpp14
-rw-r--r--tests/DeferredCanvasTest.cpp18
-rw-r--r--tests/DequeTest.cpp8
-rw-r--r--tests/DrawBitmapRectTest.cpp36
-rw-r--r--tests/DrawPathTest.cpp20
-rw-r--r--tests/DrawTextTest.cpp2
-rw-r--r--tests/FillPathTest.cpp2
-rw-r--r--tests/FlateTest.cpp4
-rw-r--r--tests/FontHostStreamTest.cpp2
-rw-r--r--tests/FontHostTest.cpp2
-rw-r--r--tests/GLProgramsTest.cpp4
-rw-r--r--tests/GeometryTest.cpp4
-rw-r--r--tests/GradientTest.cpp12
-rw-r--r--tests/MathTest.cpp8
-rw-r--r--tests/Matrix44Test.cpp2
-rw-r--r--tests/MatrixTest.cpp6
-rw-r--r--tests/MemsetTest.cpp18
-rw-r--r--tests/MetaDataTest.cpp20
-rw-r--r--tests/PaintTest.cpp2
-rw-r--r--tests/ParsePathTest.cpp2
-rw-r--r--tests/PathCoverageTest.cpp2
-rw-r--r--tests/PathMeasureTest.cpp20
-rw-r--r--tests/PathTest.cpp94
-rw-r--r--tests/ReadPixelsTest.cpp16
-rw-r--r--tests/ReadWriteAlphaTest.cpp6
-rw-r--r--tests/RefCntTest.cpp2
-rw-r--r--tests/RegionTest.cpp4
-rw-r--r--tests/ScalarTest.cpp8
-rw-r--r--tests/ShaderOpacityTest.cpp12
-rw-r--r--tests/SortTest.cpp2
-rw-r--r--tests/StreamTest.cpp8
-rw-r--r--tests/StringTest.cpp4
-rw-r--r--tests/TLSTest.cpp2
-rw-r--r--tests/Test.h4
-rw-r--r--tests/TestSize.cpp12
-rw-r--r--tests/UnicodeTest.cpp2
-rw-r--r--tests/WritePixelsTest.cpp4
-rw-r--r--tests/Writer32Test.cpp18
-rw-r--r--tests/XfermodeTest.cpp4
-rw-r--r--tests/skia_test.cpp2
-rw-r--r--tools/skhello.cpp2
-rw-r--r--tools/skimage_main.cpp2
396 files changed, 7049 insertions, 7049 deletions
diff --git a/experimental/Debugger/DebuggerCommandsView.cpp b/experimental/Debugger/DebuggerCommandsView.cpp
index bd1fe03b61..735c808a59 100644
--- a/experimental/Debugger/DebuggerCommandsView.cpp
+++ b/experimental/Debugger/DebuggerCommandsView.cpp
@@ -12,7 +12,7 @@ DebuggerCommandsView::DebuggerCommandsView() {
fTopIndex = 0;
fHighlight = 0;
fResizing = false;
-
+
SkPaint p;
p.setTextSize(SkIntToScalar(SKDEBUGGER_TEXTSIZE));
fSpacing = p.getFontSpacing();
@@ -42,7 +42,7 @@ void DebuggerCommandsView::alignCenter() {
if (!fCentered || fHighlight < fRange/2 || fHighlight > (fList.count() - fRange/2)) {
return;
} else {
- if (fHighlight > (fTopIndex + fRange/2))
+ if (fHighlight > (fTopIndex + fRange/2))
fTopIndex += fHighlight - (fTopIndex + fRange/2);
if (fHighlight < (fTopIndex + fRange/2))
fTopIndex -= (fTopIndex + fRange/2) - fHighlight;
@@ -115,30 +115,30 @@ void DebuggerCommandsView::toggleCentered() {
void DebuggerCommandsView::onDraw(SkCanvas* canvas) {
canvas->drawColor(fBGColor);
-
+
SkPaint p;
p.setTextSize(SkIntToScalar(SKDEBUGGER_TEXTSIZE));
p.setAntiAlias(true);
-
+
//draw highlight
int selected = fHighlight - fTopIndex;
SkRect r = {0, fSpacing * selected, this->width(), fSpacing * (selected+1)};
p.setColor(SKDEBUGGER_HIGHLIGHTCOLOR);
canvas->drawRect(r, p);
-
- int endIndex = fTopIndex + fRange;
+
+ int endIndex = fTopIndex + fRange;
if (endIndex > fList.count())
endIndex = fList.count();
-
+
p.setColor(SKDEBUGGER_TEXTCOLOR);
int pos;
for (int i = fTopIndex; i < endIndex; ++i) {
pos = i - fTopIndex;
- canvas->drawText(fList[i]->c_str(), fList[i]->size(),
+ canvas->drawText(fList[i]->c_str(), fList[i]->size(),
0, fSpacing - 2 + fSpacing * pos, p);
}
p.setColor(SKDEBUGGER_RESIZEBARCOLOR);
- r = SkRect::MakeXYWH(this->width() - SKDEBUGGER_RESIZEBARSIZE, 0,
+ r = SkRect::MakeXYWH(this->width() - SKDEBUGGER_RESIZEBARSIZE, 0,
SKDEBUGGER_RESIZEBARSIZE, this->height());
canvas->drawRect(r, p);
}
diff --git a/experimental/Debugger/DebuggerContentView.cpp b/experimental/Debugger/DebuggerContentView.cpp
index 27fc8c6a2a..02ea404c0b 100644
--- a/experimental/Debugger/DebuggerContentView.cpp
+++ b/experimental/Debugger/DebuggerContentView.cpp
@@ -11,44 +11,44 @@ public:
fCommandsResizing = false;
fStateVisible = true;
fStateResizing = false;
-
+
fCommands = new DebuggerCommandsView;
fCommands->setVisibleP(fCommandsVisible);
this->attachChildToFront(fCommands)->unref();
-
+
fState = new DebuggerStateView;
fState->setVisibleP(fStateVisible);
this->attachChildToFront(fState)->unref();
-
+
fAtomsToRead = 0;
fDisplayClip = false;
-
- fDumper = new SkDebugDumper(this->getSinkID(), fCommands->getSinkID(),
+
+ fDumper = new SkDebugDumper(this->getSinkID(), fCommands->getSinkID(),
fState->getSinkID());
-
+
fDumper->unload();
fAtomBounds.reset();
fFrameBounds.reset();
-
+
SkDumpCanvas* dumpCanvas = new SkDumpCanvas(fDumper);
SkGPipeReader* dumpReader = new SkGPipeReader(dumpCanvas);
-
+
if (size > 0) {
int offset = 0;
int frameBound = 0;
size_t bytesRead;
while (static_cast<unsigned>(offset) < size) {
- SkGPipeReader::Status s = dumpReader->playback(data + offset,
- size - offset,
- &bytesRead,
+ SkGPipeReader::Status s = dumpReader->playback(data + offset,
+ size - offset,
+ &bytesRead,
true);
SkASSERT(SkGPipeReader::kError_Status != s);
offset += bytesRead;
-
+
if (SkGPipeReader::kDone_Status == s) {
- fDumper->dump(dumpCanvas, SkDumpCanvas::kNULL_Verb,
+ fDumper->dump(dumpCanvas, SkDumpCanvas::kNULL_Verb,
"End of Frame", NULL);
delete dumpReader;
delete dumpCanvas;
@@ -60,34 +60,34 @@ public:
fFrameBounds.append(1, &frameBound);
}
}
-
+
delete dumpReader;
delete dumpCanvas;
-
+
fDumper->load();
}
-
+
~DebuggerView() {
fAtomBounds.reset();
fFrameBounds.reset();
delete fDumper;
}
-
+
virtual void requestMenu(SkOSMenu* menu) {
menu->setTitle("Debugger");
menu->appendSwitch("Show Commands", "Commands", this->getSinkID(), fCommandsVisible);
menu->appendSwitch("Show State", "State", this->getSinkID(), fStateVisible);
menu->appendSwitch("Display Clip", "Clip", this->getSinkID(), fDisplayClip);
}
-
-
+
+
void goToAtom(int atom) {
if (atom != fAtomsToRead) {
fAtomsToRead = atom;
this->inval(NULL);
}
}
-
+
protected:
virtual bool onQuery(SkEvent* evt) {
if (SampleCode::TitleQ(*evt)) {
@@ -99,7 +99,7 @@ protected:
}
return this->INHERITED::onQuery(evt);
}
-
+
virtual bool onEvent(const SkEvent& evt) {
if (SkOSMenu::FindSwitchState(evt, "Commands", &fCommandsVisible) ||
SkOSMenu::FindSwitchState(evt, "State", &fStateVisible)) {
@@ -117,13 +117,13 @@ protected:
}
return this->INHERITED::onEvent(evt);
}
-
+
virtual void onDrawContent(SkCanvas* canvas) {
if (fData.count() <= 0)
return;
SkAutoCanvasRestore acr(canvas, true);
canvas->translate(fStateOffset, 0);
-
+
int lastFrameBound = fFrameBounds[fAtomsToRead];
int toBeRead = fAtomBounds[fAtomsToRead] - lastFrameBound;
int firstChunk = (fAtomsToRead > 0) ? fAtomBounds[fAtomsToRead - 1] - lastFrameBound: 0;
@@ -132,7 +132,7 @@ protected:
SkGPipeReader* dumpReader = new SkGPipeReader(dumpCanvas);
SkGPipeReader* reader = new SkGPipeReader(canvas);
fDumper->disable();
-
+
int offset = 0;
size_t bytesRead;
SkGPipeReader::Status s;
@@ -163,7 +163,7 @@ protected:
delete reader;
delete dumpReader;
delete dumpCanvas;
-
+
if (fDisplayClip) {
SkPaint p;
p.setColor(0x440000AA);
@@ -173,11 +173,11 @@ protected:
}
}
}
-
+
virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y) {
return new Click(this);
}
-
+
virtual bool onClick(SkView::Click* click) {
SkPoint prev = click->fPrev;
SkPoint curr = click->fCurr;
@@ -195,7 +195,7 @@ protected:
fAtomsToRead = fCommands->selectHighlight(
SkScalarFloorToInt(curr.fY));
}
- else
+ else
handled = false;
break;
case SkView::Click::kMoved_State:
@@ -220,7 +220,7 @@ protected:
default:
break;
}
-
+
fStateOffset = fCommands->width();
fState->setSize(this->width() - fStateOffset, fState->height());
fState->setLoc(fStateOffset, this->height() - fState->height());
@@ -228,7 +228,7 @@ protected:
this->inval(NULL);
return handled;
}
-
+
virtual void onSizeChange() {
this->INHERITED::onSizeChange();
fCommands->setSize(CMD_WIDTH, this->height());
@@ -236,7 +236,7 @@ protected:
fState->setSize(this->width() - CMD_WIDTH, SkFloatToScalar(INFO_HEIGHT));
fState->setLoc(CMD_WIDTH, this->height() - SkFloatToScalar(INFO_HEIGHT));
}
-
+
private:
DebuggerCommandsView* fCommands;
DebuggerStateView* fState;
@@ -251,7 +251,7 @@ private:
SkTDArray<int> fFrameBounds;
SkTDArray<char> fData;
SkDebugDumper* fDumper;
-
+
typedef SampleView INHERITED;
};
@@ -264,5 +264,5 @@ SkView* create_debugger(const char* data, size_t size) {
bool is_debugger(SkView* view) {
SkEvent isDebugger(gIsDebuggerQuery);
- return view->doQuery(&isDebugger);
+ return view->doQuery(&isDebugger);
}
diff --git a/experimental/Debugger/DebuggerStateView.cpp b/experimental/Debugger/DebuggerStateView.cpp
index aaf6fb5dcf..27befcbaa0 100644
--- a/experimental/Debugger/DebuggerStateView.cpp
+++ b/experimental/Debugger/DebuggerStateView.cpp
@@ -18,7 +18,7 @@ bool DebuggerStateView::onEvent(const SkEvent& evt) {
if (evt.isType(SKDEBUGGER_STATETYPE)) {
fMatrix = evt.findString(SKDEBUGGER_MATRIX);
fClip = evt.findString(SKDEBUGGER_CLIP);
-
+
SkPaint* ptr;
if (evt.getMetaData().findPtr(SKDEBUGGER_PAINT, (void**)&ptr)) {
fPaint = *ptr;
@@ -32,7 +32,7 @@ bool DebuggerStateView::onEvent(const SkEvent& evt) {
void DebuggerStateView::onDraw(SkCanvas* canvas) {
canvas->drawColor(fBGColor);
-
+
//Display Current Paint
SkRect r = {10, 20, 40, 50};
canvas->drawRect(r, fPaint);
@@ -44,7 +44,7 @@ void DebuggerStateView::onDraw(SkCanvas* canvas) {
canvas->drawText(fPaintInfo.c_str(), fPaintInfo.size(), x, 30, p);
canvas->drawText(fMatrix.c_str(), fMatrix.size(), x, 60, p);
canvas->drawText(fClip.c_str(), fClip.size(), x, 90, p);
-
+
p.setColor(SKDEBUGGER_RESIZEBARCOLOR);
r = SkRect::MakeXYWH(0, 0, this->width(), SKDEBUGGER_RESIZEBARSIZE);
canvas->drawRect(r, p);
diff --git a/experimental/Debugger/DebuggerViews.h b/experimental/Debugger/DebuggerViews.h
index f025c79755..c63283f895 100644
--- a/experimental/Debugger/DebuggerViews.h
+++ b/experimental/Debugger/DebuggerViews.h
@@ -37,7 +37,7 @@
class DebuggerStateView : public SkView {
public:
DebuggerStateView();
-
+
protected:
virtual bool onEvent(const SkEvent& evt);
virtual void onDraw(SkCanvas* canvas);
@@ -65,7 +65,7 @@ public:
void highlight(int index);
int selectHighlight(int ypos);
void toggleCentered();
-
+
protected:
virtual bool onEvent(const SkEvent& evt);
virtual void onSizeChange();
@@ -87,7 +87,7 @@ private:
static void* PaintProc(void* ptr, bool doRef) {
SkPaint* p = (SkPaint*) ptr;
-
+
if (doRef) {
return new SkPaint(*p);
}
@@ -95,6 +95,6 @@ static void* PaintProc(void* ptr, bool doRef) {
delete p;
return NULL;
}
-
+
}
diff --git a/experimental/Debugger/SkDebugDumper.cpp b/experimental/Debugger/SkDebugDumper.cpp
index 69b1896626..cfda184ebe 100644
--- a/experimental/Debugger/SkDebugDumper.cpp
+++ b/experimental/Debugger/SkDebugDumper.cpp
@@ -16,7 +16,7 @@
#include "SkMaskFilter.h"
#include "DebuggerViews.h"
-SkDebugDumper::SkDebugDumper(SkEventSinkID cID, SkEventSinkID clID,
+SkDebugDumper::SkDebugDumper(SkEventSinkID cID, SkEventSinkID clID,
SkEventSinkID ipID) {
fContentID = cID;
fCommandsID = clID;
@@ -43,17 +43,17 @@ static SkString dumpMatrix(SkDumpCanvas* canvas) {
SkString str;
SkMatrix m = canvas->getTotalMatrix();
str.append("Matrix:");
- str.appendf("Translate (%0.4g, %0.4g) ",
- SkScalarToFloat(m.get(SkMatrix::kMTransX)),
+ str.appendf("Translate (%0.4g, %0.4g) ",
+ SkScalarToFloat(m.get(SkMatrix::kMTransX)),
SkScalarToFloat(m.get(SkMatrix::kMTransY)));
- str.appendf("Scale (%0.4g, %0.4g) ",
- SkScalarToFloat(m.get(SkMatrix::kMScaleX)),
+ str.appendf("Scale (%0.4g, %0.4g) ",
+ SkScalarToFloat(m.get(SkMatrix::kMScaleX)),
SkScalarToFloat(m.get(SkMatrix::kMScaleY)));
- str.appendf("Skew (%0.4g, %0.4g) ",
- SkScalarToFloat(m.get(SkMatrix::kMSkewX)),
+ str.appendf("Skew (%0.4g, %0.4g) ",
+ SkScalarToFloat(m.get(SkMatrix::kMSkewX)),
SkScalarToFloat(m.get(SkMatrix::kMSkewY)));
- str.appendf("Perspective (%0.4g, %0.4g, %0.4g) ",
- SkScalarToFloat(SkPerspToScalar(m.get(SkMatrix::kMPersp0))),
+ str.appendf("Perspective (%0.4g, %0.4g, %0.4g) ",
+ SkScalarToFloat(SkPerspToScalar(m.get(SkMatrix::kMPersp0))),
SkScalarToFloat(SkPerspToScalar(m.get(SkMatrix::kMPersp1))),
SkScalarToFloat(SkPerspToScalar(m.get(SkMatrix::kMPersp2))));
return str;
@@ -67,7 +67,7 @@ static SkString dumpClip(SkDumpCanvas* canvas) {
if (canvas->getTotalClip().getBoundaryPath(&p)) {
SkPoint pts[maxPts];
int numPts = p.getPoints(pts, maxPts);
-
+
str.append("Clip: [ ");
for (int i = 0; i < numPts; ++i) {
str.appendf("(%0.4g, %0.4g)", pts[i].x(), pts[i].y());
@@ -99,7 +99,7 @@ static const char* gPaintFlags[] = {
static SkString dumpPaint(SkDumpCanvas* canvas, const SkPaint* p,
SkDumpCanvas::Verb verb) {
SkString str;
- str.appendf("Color: #%08X\n", p->getColor());
+ str.appendf("Color: #%08X\n", p->getColor());
str.appendf("Flags: %s\n", gPaintFlags[p->getFlags()]);
appendFlattenable(&str, p->getShader(), "shader");
appendFlattenable(&str, p->getXfermode(), "xfermode");
@@ -107,26 +107,26 @@ static SkString dumpPaint(SkDumpCanvas* canvas, const SkPaint* p,
appendFlattenable(&str, p->getMaskFilter(), "maskFilter");
appendFlattenable(&str, p->getPathEffect(), "pathEffect");
appendFlattenable(&str, p->getColorFilter(), "filter");
-
+
if (SkDumpCanvas::kDrawText_Verb == verb) {
str.appendf("Text Size:%0.4g\n", SkScalarToFloat(p->getTextSize()));
appendPtr(&str, p->getTypeface(), "typeface");
}
-
+
return str;
}
void SkDebugDumper::dump(SkDumpCanvas* canvas, SkDumpCanvas::Verb verb,
- const char str[], const SkPaint* p) {
+ const char str[], const SkPaint* p) {
if (!fDisabled) {
SkString msg, tab;
-
+
const int level = canvas->getNestLevel() + canvas->getSaveCount() - 1;
SkASSERT(level >= 0);
for (int i = 0; i < level; i++) {
tab.append("| ");
}
-
+
msg.appendf("%03d: %s%s\n", fCount, tab.c_str(), str);
++fCount;
if (!fInit) {
diff --git a/experimental/Debugger/SkDebugDumper.h b/experimental/Debugger/SkDebugDumper.h
index fdc7e0fc64..e7d69562d5 100644
--- a/experimental/Debugger/SkDebugDumper.h
+++ b/experimental/Debugger/SkDebugDumper.h
@@ -20,7 +20,7 @@ public:
// the function pointer that was passed to the constructor
virtual void dump(SkDumpCanvas*, SkDumpCanvas::Verb, const char str[],
const SkPaint*);
-
+
void load() { fInit = true; };
void unload() { fInit = false; fCount = 0;};
void disable() { fDisabled = true; };
@@ -32,7 +32,7 @@ private:
SkEventSinkID fContentID;
SkEventSinkID fCommandsID;
SkEventSinkID fStateID;
-
+
typedef SkDumpCanvas::Dumper INHERITED;
};
#endif
diff --git a/experimental/DrawingBoard/SampleDrawingClient.cpp b/experimental/DrawingBoard/SampleDrawingClient.cpp
index 02b7a3b4f7..fbefbc8f12 100644
--- a/experimental/DrawingBoard/SampleDrawingClient.cpp
+++ b/experimental/DrawingBoard/SampleDrawingClient.cpp
@@ -12,22 +12,22 @@
/**
* Drawing Client
*
- * A drawing client that allows a user to perform simple brush stokes with
- * a selected color and brush size. The drawing client communicates with a
+ * A drawing client that allows a user to perform simple brush stokes with
+ * a selected color and brush size. The drawing client communicates with a
* drawing server to send/receive data to/from other clients connected to the
* same server. The drawing client stores data in fData and fBuffer depending on
* the data type. Append type means that the drawing data is a completed stroke
- * and Replace type means that the drawing data is in progress and will be
- * replaced by subsequent data. fData and fBuffer are read by a pipe reader and
+ * and Replace type means that the drawing data is in progress and will be
+ * replaced by subsequent data. fData and fBuffer are read by a pipe reader and
* reproduce the drawing. When the client is in a normal state, the data stored
* on the client and the server should be identical.
* The drawing client is also able to switch between vector and bitmap drawing.
* The drawing client also renders the latest drawing stroke locally in order to
- * produce better reponses. This can be disabled by calling
- * controller.disablePlayBack(), which will introduce a lag between the input
+ * produce better reponses. This can be disabled by calling
+ * controller.disablePlayBack(), which will introduce a lag between the input
* and the drawing.
* Note: in order to keep up with the drawing data, the client will try to read
- * a few times each frame in case more than one frame worth of data has been
+ * a few times each frame in case more than one frame worth of data has been
* received and render them together. This behavior can be adjusted by tweaking
* MAX_READ_PER_FRAME or disabled by turning fSync to false
*/
@@ -36,7 +36,7 @@
class DrawingClientView : public SampleView {
public:
- DrawingClientView() {
+ DrawingClientView() {
fSocket = NULL;
fTotalBytesRead = 0;
fPalette = new SkColorPalette;
@@ -57,29 +57,29 @@ public:
fData.reset();
fBuffer.reset();
}
-
+
virtual void requestMenu(SkOSMenu* menu) {
menu->setTitle("Drawing Client");
- menu->appendTextField("Server IP", "Server IP", this->getSinkID(),
+ menu->appendTextField("Server IP", "Server IP", this->getSinkID(),
"IP address or hostname");
menu->appendSwitch("Vector", "Vector", this->getSinkID(), fVector);
- menu->appendSlider("Brush Size", "Brush Size", this->getSinkID(), 1.0,
+ menu->appendSlider("Brush Size", "Brush Size", this->getSinkID(), 1.0,
100.0, fBrushSize);
menu->appendSwitch("Anti-Aliasing", "AA", this->getSinkID(), fAA);
- menu->appendSwitch("Show Color Palette", "Palette", this->getSinkID(),
+ menu->appendSwitch("Show Color Palette", "Palette", this->getSinkID(),
fPaletteVisible);
menu->appendSwitch("Sync", "Sync", this->getSinkID(), fSync);
menu->appendAction("Clear", this->getSinkID());
}
-
+
protected:
-
+
static void readData(int cid, const void* data, size_t size,
SkSocket::DataType type, void* context) {
DrawingClientView* view = (DrawingClientView*)context;
view->onRead(cid, data, size, type);
}
-
+
void onRead(int cid, const void* data, size_t size, SkSocket::DataType type) {
if (size > 0) {
fBuffer.reset();
@@ -92,20 +92,20 @@ protected:
}
}
}
-
+
bool onQuery(SkEvent* evt) {
if (SampleCode::TitleQ(*evt)) {
SampleCode::TitleR(evt, "Drawing Client");
return true;
}
-
+
return this->INHERITED::onQuery(evt);
}
-
+
bool onEvent(const SkEvent& evt) {;
if (SkOSMenu::FindSliderValue(evt, "Brush Size", &fBrushSize))
return true;
-
+
SkString s;
if (SkOSMenu::FindText(evt, "Server IP", &s)) {
if (NULL != fSocket) {
@@ -137,11 +137,11 @@ protected:
}
return this->INHERITED::onEvent(evt);
}
-
+
virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y) {
return new Click(this);
}
-
+
virtual bool onClick(SkView::Click* click) {
switch (click->fState) {
case SkView::Click::kDown_State:
@@ -161,20 +161,20 @@ protected:
}
return true;
}
-
+
virtual void onDrawContent(SkCanvas* canvas) {
if (fSocket) {
if (fSocket->isConnected()) {
if (fSync) {
int count = 0;
while (fSocket->readPacket(readData, this) > 0 &&
- count < MAX_READ_PER_FRAME)
+ count < MAX_READ_PER_FRAME)
++count;
}
- else
+ else
fSocket->readPacket(readData, this);
}
- else
+ else
fSocket->connectToServer();
}
size_t bytesRead = 0;
@@ -186,7 +186,7 @@ protected:
tempCanvas = canvas;
else
tempCanvas = &bufferCanvas;
- SkGPipeReader reader(tempCanvas);
+ SkGPipeReader reader(tempCanvas);
status = reader.playback(fData.begin() + fTotalBytesRead,
fData.count() - fTotalBytesRead,
&bytesRead);
@@ -197,22 +197,22 @@ protected:
fTotalBytesRead = 0;
else
canvas->drawBitmap(fBase, 0, 0, NULL);
-
+
size_t totalBytesRead = 0;
while (totalBytesRead < fBuffer.count()) {
SkGPipeReader reader(canvas);
- status = reader.playback(fBuffer.begin() + totalBytesRead,
- fBuffer.count() - totalBytesRead,
+ status = reader.playback(fBuffer.begin() + totalBytesRead,
+ fBuffer.count() - totalBytesRead,
&bytesRead);
SkASSERT(SkGPipeReader::kError_Status != status);
totalBytesRead += bytesRead;
}
-
+
SkNetPipeController controller(canvas);
SkGPipeWriter writer;
- SkCanvas* writerCanvas = writer.startRecording(&controller,
+ SkCanvas* writerCanvas = writer.startRecording(&controller,
SkGPipeWriter::kCrossProcess_Flag);
-
+
//controller.disablePlayback();
SkPaint p;
p.setColor(fPalette->getColor());
@@ -224,16 +224,16 @@ protected:
p.setPathEffect(new SkCornerPathEffect(55))->unref();
writerCanvas->drawPath(fCurrLine, p);
writer.endRecording();
-
+
controller.writeToSocket(fSocket, fType);
if (fType == SkSocket::kPipeAppend_type && fSocket) {
fSocket->suspendWrite();
fCurrLine.reset();
}
-
+
this->inval(NULL);
}
-
+
virtual void onSizeChange() {
this->INHERITED::onSizeChange();
fPalette->setLoc(this->width()-100, 0);
@@ -241,7 +241,7 @@ protected:
fBase.allocPixels(NULL);
this->clearBitmap();
}
-
+
private:
void clear() {
fData.reset();
@@ -267,7 +267,7 @@ private:
bool fAA;
bool fSync;
bool fVector;
-
+
typedef SampleView INHERITED;
};
diff --git a/experimental/DrawingBoard/SampleDrawingServer.cpp b/experimental/DrawingBoard/SampleDrawingServer.cpp
index c79f8d3470..fa059fa70a 100644
--- a/experimental/DrawingBoard/SampleDrawingServer.cpp
+++ b/experimental/DrawingBoard/SampleDrawingServer.cpp
@@ -11,14 +11,14 @@
/**
* Drawing Server
*
- * This simple drawing server can accept connections from multiple drawing
- * clients simultaneously. It accumulates drawing data from each client each
+ * This simple drawing server can accept connections from multiple drawing
+ * clients simultaneously. It accumulates drawing data from each client each
* frame, stores it in the appropriate place, and then broadcasts incremental
* changes back to all the clients. Each logical packet, meaning one brush
* stoke in this case can be of two types, append and replace. Append types are
* completed strokes ready to be stored in the fData queue and will no longer be
- * modified. Replace types are drawing operations that are still in progress on
- * the client side, so they are appended to fBuffer. The location and size of
+ * modified. Replace types are drawing operations that are still in progress on
+ * the client side, so they are appended to fBuffer. The location and size of
* the buffered data for each client is stored in a map and updated properly.
* Each time a new replace drawing call is received from a client, its previous
* buffered data is discarded.
@@ -28,7 +28,7 @@
class DrawingServerView : public SampleView {
public:
- DrawingServerView(){
+ DrawingServerView(){
fServer = new SkTCPServer(40000);
fServer->suspendWrite();
fTotalBytesRead = fTotalBytesWritten = 0;
@@ -40,24 +40,24 @@ public:
fBuffer.reset();
fClientMap.clear();
}
-
+
virtual void requestMenu(SkOSMenu* menu) {
menu->setTitle("Drawing Server");
menu->appendAction("Clear", this->getSinkID());
menu->appendSwitch("Vector", "Vector", this->getSinkID(), fVector);
}
-
+
protected:
- static void readData(int cid, const void* data, size_t size,
+ static void readData(int cid, const void* data, size_t size,
SkSocket::DataType type, void* context) {
DrawingServerView* view = (DrawingServerView*)context;
view->onRead(cid, data, size, type);
}
-
+
void onRead(int cid, const void* data, size_t size, SkSocket::DataType type) {
if (NULL == data && size <= 0)
return;
-
+
ClientState* cs;
std::map<int, ClientState*>::iterator it = fClientMap.find(cid);
if (it == fClientMap.end()) { //New client
@@ -69,10 +69,10 @@ protected:
else {
cs = it->second;
}
-
+
if (type == SkSocket::kPipeReplace_type) {
fBuffer.remove(cs->bufferBase, cs->bufferSize);
-
+
for (it = fClientMap.begin(); it != fClientMap.end(); ++it) {
if (cid == it->first)
continue;
@@ -83,7 +83,7 @@ protected:
}
}
}
-
+
cs->bufferBase = fBuffer.count();
cs->bufferSize = size;
fBuffer.append(size, (const char*)data);
@@ -101,7 +101,7 @@ protected:
//other types of data
}
}
-
+
bool onQuery(SkEvent* evt) {
if (SampleCode::TitleQ(*evt)) {
SampleCode::TitleR(evt, "Drawing Server");
@@ -109,7 +109,7 @@ protected:
}
return this->INHERITED::onQuery(evt);
}
-
+
bool onEvent(const SkEvent& evt) {
if (SkOSMenu::FindAction(evt, "Clear")) {
this->clear();
@@ -121,8 +121,8 @@ protected:
}
return this->INHERITED::onEvent(evt);
}
-
-
+
+
virtual void onDrawContent(SkCanvas* canvas) {
if (fCurrMatrix != canvas->getTotalMatrix()) {
fTotalBytesRead = 0;
@@ -136,7 +136,7 @@ protected:
else {
fServer->suspendWrite();
}
-
+
size_t bytesRead;
SkGPipeReader::Status stat;
SkCanvas bufferCanvas(fBase);
@@ -159,7 +159,7 @@ protected:
} else {
canvas->drawBitmap(fBase, 0, 0, NULL);
}
-
+
size_t totalBytesRead = 0;
while (totalBytesRead < fBuffer.count()) {
SkGPipeReader reader(canvas);
@@ -169,22 +169,22 @@ protected:
SkASSERT(SkGPipeReader::kError_Status != stat);
totalBytesRead += bytesRead;
}
-
- fServer->writePacket(fBuffer.begin(), fBuffer.count(),
+
+ fServer->writePacket(fBuffer.begin(), fBuffer.count(),
SkSocket::kPipeReplace_type);
this->inval(NULL);
}
-
+
virtual void onSizeChange() {
this->INHERITED::onSizeChange();
- fBase.setConfig(SkBitmap::kARGB_8888_Config,
- this->width(),
+ fBase.setConfig(SkBitmap::kARGB_8888_Config,
+ this->width(),
this->height());
fBase.allocPixels(NULL);
this->clearBitmap();
}
-
+
private:
void clear() {
fData.reset();
@@ -197,12 +197,12 @@ private:
fTotalBytesRead = 0;
fBase.eraseColor(fBGColor);
}
-
+
struct ClientState {
int bufferBase;
int bufferSize;
};
-
+
std::map<int, ClientState*> fClientMap;
SkTDArray<char> fData;
SkTDArray<char> fBuffer;
diff --git a/experimental/DrawingBoard/SkColorPalette.cpp b/experimental/DrawingBoard/SkColorPalette.cpp
index a7ceb2e703..566c134c0f 100644
--- a/experimental/DrawingBoard/SkColorPalette.cpp
+++ b/experimental/DrawingBoard/SkColorPalette.cpp
@@ -16,7 +16,7 @@ SkColorPalette::SkColorPalette() {
fGradientRect = SkRect::MakeWH(SkIntToScalar(100), SkIntToScalar(100));
fSelected = 0;
fCurrColor = 0xFF000000;
-
+
fColors[0] = SK_ColorWHITE;
fColors[1] = SK_ColorBLACK;
fColors[2] = SK_ColorRED;
@@ -27,15 +27,15 @@ SkColorPalette::SkColorPalette() {
bool SkColorPalette::onEvent(const SkEvent& evt) {
return this->INHERITED::onEvent(evt);
}
-
+
void SkColorPalette::onDraw(SkCanvas* canvas) {
canvas->drawColor(SK_ColorWHITE);
-
+
SkPaint paint;
paint.setAntiAlias(true);
-
+
canvas->translate(PalettePadding, PalettePadding);
-
+
for (int i = 0; i < PaletteSlots; ++i) {
if (fSelected == i) {
paint.setStrokeWidth(SkIntToScalar(3));
@@ -43,7 +43,7 @@ void SkColorPalette::onDraw(SkCanvas* canvas) {
else {
paint.setStrokeWidth(1);
}
-
+
paint.setStyle(SkPaint::kStroke_Style);
paint.setColor(SK_ColorBLACK);
canvas->drawRect(fSlotRect, paint);
@@ -57,16 +57,16 @@ void SkColorPalette::onDraw(SkCanvas* canvas) {
SkPoint p = SkPoint::Make(0,0);
SkPoint q = SkPoint::Make(this->width(), 0);
SkPoint pts[] = {p, q};
-
- SkColor colors[] = { SK_ColorRED, SK_ColorYELLOW, SK_ColorGREEN,
+
+ SkColor colors[] = { SK_ColorRED, SK_ColorYELLOW, SK_ColorGREEN,
SK_ColorCYAN, SK_ColorBLUE, SK_ColorMAGENTA,SK_ColorRED};
SkScalar colorPositions[] = { 0, 0.2, 0.4, 0.5, 0.6, 0.8, 1.0};
-
-
- SkShader* shader1 = SkGradientShader::CreateLinear(pts, colors, colorPositions,7,
+
+
+ SkShader* shader1 = SkGradientShader::CreateLinear(pts, colors, colorPositions,7,
SkShader::kMirror_TileMode);
paint.setShader(shader1)->unref();
-
+
canvas->drawRect(fGradientRect, paint);
//this->INHERITED::onDraw(canvas);
@@ -127,7 +127,7 @@ int SkColorPalette::selectSlot(SkPoint& cursorPosition) {
//account for padding
cursorPosition.fX -= PalettePadding;
cursorPosition.fY -= PalettePadding;
-
+
if (cursorPosition.fX < 0 || cursorPosition.fX > fSlotRect.width() ||
cursorPosition.fY < 0 || cursorPosition.fY > (fSlotRect.height() + PalettePadding) * PaletteSlots) {
return -1;
@@ -143,8 +143,8 @@ int SkColorPalette::selectSlot(SkPoint& cursorPosition) {
}
SkColor SkColorPalette::selectColorFromGradient(SkPoint& cursorPosition) {
- float h = cursorPosition.fX/fGradientRect.width();
- float s = 1.0 - cursorPosition.fY/fGradientRect.height();
+ float h = cursorPosition.fX/fGradientRect.width();
+ float s = 1.0 - cursorPosition.fY/fGradientRect.height();
float v = 1.0;
float _h,r,g,b;
float _1, _2, _3;
@@ -155,38 +155,38 @@ SkColor SkColorPalette::selectColorFromGradient(SkPoint& cursorPosition) {
_1 = v * (1 - s);
_2 = v * (1 - s * (_h - _i));
_3 = v * (1 - s * (1 - (_h - _i)));
-
+
if (_i == 0) {
- r = v;
- g = _3;
+ r = v;
+ g = _3;
b = _1;
}
else if (_i == 1) {
- r = _2;
- g = v;
+ r = _2;
+ g = v;
b = _1;
}
else if (_i == 2) {
- r = _1;
- g = v;
+ r = _1;
+ g = v;
b = _3;
}
else if (_i == 3) {
- r = _1;
- g = _2;
+ r = _1;
+ g = _2;
b = v;
}
else if (_i == 4) {
- r = _3;
- g = _1;
+ r = _3;
+ g = _1;
b = v;
}
else {
- r = v;
- g = _1;
+ r = v;
+ g = _1;
b = _2;
};
-
+
SkColor retval = 0xFF000000;
retval += ((int)(r * 255) << 16);
retval += ((int)(g * 255) << 8);
diff --git a/experimental/DrawingBoard/SkNetPipeController.cpp b/experimental/DrawingBoard/SkNetPipeController.cpp
index 71db86ae78..a61ca64478 100644
--- a/experimental/DrawingBoard/SkNetPipeController.cpp
+++ b/experimental/DrawingBoard/SkNetPipeController.cpp
@@ -21,13 +21,13 @@ SkNetPipeController::~SkNetPipeController() {
int SkNetPipeController::writeToSocket(SkSocket* sockfd, SkSocket::DataType type) {
if (NULL != sockfd && fTotalWritten > 4)
return sockfd->writePacket(fBlock, fBytesWritten, type);
- else
+ else
return -1;
}
void* SkNetPipeController::requestBlock(size_t minRequest, size_t* actual) {
sk_free(fBlock);
-
+
fBlockSize = minRequest * 4;
fBlock = sk_malloc_throw(fBlockSize);
fBytesWritten = 0;
@@ -37,15 +37,15 @@ void* SkNetPipeController::requestBlock(size_t minRequest, size_t* actual) {
void SkNetPipeController::notifyWritten(size_t bytes) {
SkASSERT(fBytesWritten + bytes <= fBlockSize);
-
+
if (fPlayback) {
fStatus = fReader.playback((const char*)fBlock + fBytesWritten, bytes);
}
-
+
SkASSERT(SkGPipeReader::kError_Status != fStatus);
fBytesWritten += bytes;
fTotalWritten += bytes;
-
+
fAtomsWritten += 1;
}
diff --git a/experimental/DrawingBoard/SkNetPipeController.h b/experimental/DrawingBoard/SkNetPipeController.h
index 334fd8cccb..081239bad5 100644
--- a/experimental/DrawingBoard/SkNetPipeController.h
+++ b/experimental/DrawingBoard/SkNetPipeController.h
@@ -14,14 +14,14 @@ class SkNetPipeController : public SkGPipeController {
public:
SkNetPipeController(SkCanvas* target);
~SkNetPipeController();
-
+
virtual void* requestBlock(size_t minRequest, size_t* actual);
virtual void notifyWritten(size_t bytes);
-
+
int writeToSocket(SkSocket* sockfd, SkSocket::DataType type);
void enablePlayback() { fPlayback = true; }
void disablePlayback() { fPlayback = false; }
-
+
private:
SkGPipeReader fReader;
bool fPlayback;
@@ -30,7 +30,7 @@ private:
size_t fBytesWritten;
int fAtomsWritten;
size_t fTotalWritten;
-
+
SkGPipeReader::Status fStatus;
};
#endif
diff --git a/experimental/FileReaderApp/ReaderView.cpp b/experimental/FileReaderApp/ReaderView.cpp
index f6876adeac..78a7a21e28 100644
--- a/experimental/FileReaderApp/ReaderView.cpp
+++ b/experimental/FileReaderApp/ReaderView.cpp
@@ -25,38 +25,38 @@ ReaderView::ReaderView() {
void ReaderView::draw(SkCanvas* canvas) {
canvas->drawColor(fBGColor);
-
+
SkAutoCanvasRestore acr(canvas, true);
-
- //Create a temporary canvas and reader object that draws into the back
+
+ //Create a temporary canvas and reader object that draws into the back
//bitmap so that the incremental changes or incomplete reads are not shown
//on screen
SkCanvas bufferCanvas(fBufferBitmaps[fBack]);
SkGPipeReader reader(&bufferCanvas);
-
+
//The file specified by FILE_PATH MUST exist
FILE* f = fopen(FILE_PATH, "rb");
SkASSERT(f != NULL);
-
+
fseek(f, 0, SEEK_END);
int size = ftell(f) * sizeof(char);
if (size <= fFilePos) {
fFilePos = 0;
}
-
+
//Resume from the last read location
fseek(f, fFilePos, SEEK_SET);
int toBeRead = size - fFilePos;
if (size > 0 && toBeRead > 0) {
void* block = sk_malloc_throw(toBeRead);
fread(block, 1, toBeRead, f);
-
+
size_t bytesRead;
SkGPipeReader::Status fStatus = reader.playback(block, toBeRead, &bytesRead);
SkASSERT(SkGPipeReader::kError_Status != fStatus);
SkASSERT(toBeRead >= bytesRead);
-
- //if the reader reaches a done verb, a frame is complete.
+
+ //if the reader reaches a done verb, a frame is complete.
//Update the file location and swap the front and back bitmaps to show
//the new frame
if (SkGPipeReader::kDone_Status == fStatus) {
@@ -66,9 +66,9 @@ void ReaderView::draw(SkCanvas* canvas) {
}
sk_free(block);
}
-
+
fclose(f);
-
+
//the front bitmap is always drawn
canvas->drawBitmap(fBufferBitmaps[fFront], 0, 0, NULL);
this->inval(NULL);
diff --git a/experimental/FileReaderApp/ReaderView.h b/experimental/FileReaderApp/ReaderView.h
index 5d06777d48..e3032d3a68 100644
--- a/experimental/FileReaderApp/ReaderView.h
+++ b/experimental/FileReaderApp/ReaderView.h
@@ -10,15 +10,15 @@
#include "SkBitmap.h"
/*
- * Pipe Reader with File IO. This view reads from the data file produced by the
- * Pipe Writer.
+ * Pipe Reader with File IO. This view reads from the data file produced by the
+ * Pipe Writer.
*/
class ReaderView : public SkView {
public:
ReaderView();
virtual void draw(SkCanvas* canvas);
-
+
private:
int fFilePos;
int fFront;
diff --git a/experimental/Intersection/ActiveEdge_Test.cpp b/experimental/Intersection/ActiveEdge_Test.cpp
index 5456155abc..d460ba0644 100755
--- a/experimental/Intersection/ActiveEdge_Test.cpp
+++ b/experimental/Intersection/ActiveEdge_Test.cpp
@@ -52,7 +52,7 @@ static bool operator_less_than(const UnitTest::ActiveEdge& lh,
return (check.fY - lh.fAbove.fY) * (lh.fBelow.fX - lh.fAbove.fX)
< (lh.fBelow.fY - lh.fAbove.fY) * (check.fX - lh.fAbove.fX);
}
- const SkPoint& check = lh.fBelow.fY <= rh.fBelow.fY
+ const SkPoint& check = lh.fBelow.fY <= rh.fBelow.fY
&& lh.fBelow != rh.fBelow ? lh.fBelow : lh.fAbove;
return (rh.fBelow.fY - rh.fAbove.fY) * (check.fX - rh.fAbove.fX)
< (check.fY - rh.fAbove.fY) * (rh.fBelow.fX - rh.fAbove.fX);
@@ -66,7 +66,7 @@ void ActiveEdge_Test() {
right.fWorkEdge.fEdge = &rightIn;
for (size_t x = 0; x < leftRightCount; ++x) {
left.fAbove = leftRight[x][0];
- left.fTangent = left.fBelow = leftRight[x][1];
+ left.fTangent = left.fBelow = leftRight[x][1];
right.fAbove = leftRight[x][2];
right.fTangent = right.fBelow = leftRight[x][3];
SkASSERT(left < right);
diff --git a/experimental/Intersection/ConvexHull.cpp b/experimental/Intersection/ConvexHull.cpp
index 1551720eef..f291e7491e 100644
--- a/experimental/Intersection/ConvexHull.cpp
+++ b/experimental/Intersection/ConvexHull.cpp
@@ -5,12 +5,12 @@
/* Given a cubic, find the convex hull described by the end and control points.
The hull may have 3 or 4 points. Cubics that degenerate into a point or line
are not considered.
-
+
The hull is computed by assuming that three points, if unique and non-linear,
form a triangle. The fourth point may replace one of the first three, may be
discarded if in the triangle or on an edge, or may be inserted between any of
the three to form a convex quadralateral.
-
+
The indices returned in order describe the convex hull.
*/
int convex_hull(const Cubic& cubic, char order[4]) {
@@ -71,7 +71,7 @@ int convex_hull(const Cubic& cubic, char order[4]) {
int most = midX ^ mask;
order[0] = yMin;
order[1] = least;
-
+
// see if mid value is on same side of line (least, most) as yMin
Cubic midPath;
if (!rotate(cubic, least, most, midPath)) { // ! if cbc[least]==cbc[most]
@@ -80,7 +80,7 @@ int convex_hull(const Cubic& cubic, char order[4]) {
}
int midSides = side(midPath[yMin].y - midPath[least].y);
midSides ^= side(midPath[midX].y - midPath[least].y);
- if (midSides != 2) { // if mid point is not between
+ if (midSides != 2) { // if mid point is not between
order[2] = most;
return 3; // result is a triangle
}
@@ -91,10 +91,10 @@ int convex_hull(const Cubic& cubic, char order[4]) {
/* Find the convex hull for cubics with the x-axis interval regularly spaced.
Cubics computed as distance functions are formed this way.
-
+
connectTo0[0], connectTo0[1] are the point indices that cubic[0] connects to.
connectTo3[0], connectTo3[1] are the point indices that cubic[3] connects to.
-
+
Returns true if cubic[1] to cubic[2] also forms part of the hull.
*/
bool convex_x_hull(const Cubic& cubic, char connectTo0[2], char connectTo3[2]) {
diff --git a/experimental/Intersection/ConvexHull_Test.cpp b/experimental/Intersection/ConvexHull_Test.cpp
index 4eb524b3bd..a350391eaa 100644
--- a/experimental/Intersection/ConvexHull_Test.cpp
+++ b/experimental/Intersection/ConvexHull_Test.cpp
@@ -46,17 +46,17 @@ const Cubic triangle[] = {
{{1, 0}, {2, 0}, {0, 1}, {0, 0}},
{{2, 0}, {0, 1}, {0, 0}, {1, 0}},
{{0, 1}, {0, 0}, {1, 0}, {2, 0}},
-
+
{{0, 0}, {0, 1}, {0, 2}, {1, 1}}, // extra point on vert
{{0, 1}, {0, 2}, {1, 1}, {0, 0}},
{{0, 2}, {1, 1}, {0, 0}, {0, 1}},
{{1, 1}, {0, 0}, {0, 1}, {0, 2}},
-
+
{{0, 0}, {1, 1}, {2, 2}, {2, 0}}, // extra point on diag
{{1, 1}, {2, 2}, {2, 0}, {0, 0}},
{{2, 2}, {2, 0}, {0, 0}, {1, 1}},
{{2, 0}, {0, 0}, {1, 1}, {2, 2}},
-
+
{{0, 0}, {2, 0}, {2, 2}, {1, 1}}, // extra point on diag
{{2, 0}, {2, 2}, {1, 1}, {0, 0}},
{{2, 2}, {1, 1}, {0, 0}, {2, 0}},
@@ -99,9 +99,9 @@ static bool rotateToAxis(const _Point& a, const _Point& b, Matrix3x2& matrix) {
static void transform(const Cubic& cubic, const Matrix3x2& matrix, Cubic& rotPath) {
for (int index = 0; index < 4; ++index) {
- rotPath[index].x = cubic[index].x * matrix[0][0]
+ rotPath[index].x = cubic[index].x * matrix[0][0]
+ cubic[index].y * matrix[1][0] + matrix[2][0];
- rotPath[index].y = cubic[index].x * matrix[0][1]
+ rotPath[index].y = cubic[index].x * matrix[0][1]
+ cubic[index].y * matrix[1][1] + matrix[2][1];
}
}
@@ -146,7 +146,7 @@ static int rotate_to_hull(const Cubic& cubic, char order[4], size_t idx, size_t
for (int index = 0; index < 4; ++index) {
if (debug_rotate_to_hull) printf("(%g,%g) ", rotPath[index].x, rotPath[index].y);
sides[side(rotPath[index].y - rotPath[inner].y)]++;
- if (index != outer && index != inner
+ if (index != outer && index != inner
&& side(rotPath[index].y - rotPath[inner].y) == 1)
zeroes = index;
}
@@ -169,13 +169,13 @@ static int rotate_to_hull(const Cubic& cubic, char order[4], size_t idx, size_t
__FUNCTION__, (int)idx, (int)inr, (int)outer, (int)inner);
continue;
}
- if (rotPath[zeroes].x < rotPath[inner].x
+ if (rotPath[zeroes].x < rotPath[inner].x
&& rotPath[zeroes].x < rotPath[outer].x) {
if (debug_rotate_to_hull) printf("%s [%d,%d] [o=%d,i=%d] zeroes < inner && outer\n",
__FUNCTION__, (int)idx, (int)inr, (int)outer, (int)inner);
continue;
}
- if (rotPath[zeroes].x > rotPath[inner].x
+ if (rotPath[zeroes].x > rotPath[inner].x
&& rotPath[zeroes].x > rotPath[outer].x) {
if (debug_rotate_to_hull) printf("%s [%d,%d] [o=%d,i=%d] zeroes > inner && outer\n",
__FUNCTION__, (int)idx, (int)inr, (int)outer, (int)inner);
@@ -242,7 +242,7 @@ void ConvexHull_Test() {
for (pt = 0; pt < cmp; ++pt) {
if (pts & 1 << order[pt]) {
printf("%s [%d,%d] duplicate index in order: %d,%d,%d",
- __FUNCTION__, (int)index, (int)inner,
+ __FUNCTION__, (int)index, (int)inner,
order[0], order[1], order[2]);
if (cmp == 4) {
printf(",%d", order[3]);
@@ -252,7 +252,7 @@ void ConvexHull_Test() {
}
if (cmpPts & 1 << cmpOrder[pt]) {
printf("%s [%d,%d] duplicate index in order: %d,%d,%d",
- __FUNCTION__, (int)index, (int)inner,
+ __FUNCTION__, (int)index, (int)inner,
cmpOrder[0], cmpOrder[1], cmpOrder[2]);
if (cmp == 4) {
printf(",%d", cmpOrder[3]);
@@ -291,7 +291,7 @@ void ConvexHull_Test() {
}
if (pts != cmpPts) {
printf("%s [%d,%d] mismatch indices: order=%d,%d,%d",
- __FUNCTION__, (int)index, (int)inner,
+ __FUNCTION__, (int)index, (int)inner,
order[0], order[1], order[2]);
if (cmp == 4) {
printf(",%d", order[3]);
@@ -311,7 +311,7 @@ void ConvexHull_Test() {
if (cmpOrder[match ^ 2] != order[2]) {
printf("%s [%d,%d] bowtie mismatch: order=%d,%d,%d,%d"
" cmpOrder=%d,%d,%d,%d\n",
- __FUNCTION__, (int)index, (int)inner,
+ __FUNCTION__, (int)index, (int)inner,
order[0], order[1], order[2], order[3],
cmpOrder[0], cmpOrder[1], cmpOrder[2], cmpOrder[3]);
}
@@ -383,10 +383,10 @@ void ConvexHull_X_Test() {
}
for (idx = 0; idx < cmp; ++idx) {
if (cmpOrder[idx] == 0) {
- rOrder[0] = cmpOrder[(idx + 1) % cmp];
+ rOrder[0] = cmpOrder[(idx + 1) % cmp];
rOrder[1] = cmpOrder[(idx + cmp - 1) % cmp];
} else if (cmpOrder[idx] == 3) {
- rOrder[2] = cmpOrder[(idx + 1) % cmp];
+ rOrder[2] = cmpOrder[(idx + 1) % cmp];
rOrder[3] = cmpOrder[(idx + cmp - 1) % cmp];
}
}
diff --git a/experimental/Intersection/CubeRoot.cpp b/experimental/Intersection/CubeRoot.cpp
index 37c8844bb2..4f602f7c17 100644
--- a/experimental/Intersection/CubeRoot.cpp
+++ b/experimental/Intersection/CubeRoot.cpp
@@ -1,4 +1,4 @@
-// http://metamerist.com/cbrt/CubeRoot.cpp
+// http://metamerist.com/cbrt/CubeRoot.cpp
//
#include <math.h>
@@ -12,102 +12,102 @@ typedef double (*cuberootfnd) (double);
// estimate bits of precision (32-bit float case)
inline int bits_of_precision(float a, float b)
{
- const double kd = 1.0 / log(2.0);
+ const double kd = 1.0 / log(2.0);
- if (a==b)
- return 23;
+ if (a==b)
+ return 23;
- const double kdmin = pow(2.0, -23.0);
+ const double kdmin = pow(2.0, -23.0);
- double d = fabs(a-b);
- if (d < kdmin)
- return 23;
+ double d = fabs(a-b);
+ if (d < kdmin)
+ return 23;
- return int(-log(d)*kd);
+ return int(-log(d)*kd);
}
// estiamte bits of precision (64-bit double case)
inline int bits_of_precision(double a, double b)
{
- const double kd = 1.0 / log(2.0);
+ const double kd = 1.0 / log(2.0);
- if (a==b)
- return 52;
+ if (a==b)
+ return 52;
- const double kdmin = pow(2.0, -52.0);
+ const double kdmin = pow(2.0, -52.0);
- double d = fabs(a-b);
- if (d < kdmin)
- return 52;
+ double d = fabs(a-b);
+ if (d < kdmin)
+ return 52;
- return int(-log(d)*kd);
+ return int(-log(d)*kd);
}
// cube root via x^(1/3)
static float pow_cbrtf(float x)
{
- return (float) pow(x, 1.0f/3.0f);
+ return (float) pow(x, 1.0f/3.0f);
}
// cube root via x^(1/3)
static double pow_cbrtd(double x)
{
- return pow(x, 1.0/3.0);
+ return pow(x, 1.0/3.0);
}
// cube root approximation using bit hack for 32-bit float
static float cbrt_5f(float f)
{
- unsigned int* p = (unsigned int *) &f;
- *p = *p/3 + 709921077;
- return f;
+ unsigned int* p = (unsigned int *) &f;
+ *p = *p/3 + 709921077;
+ return f;
}
#endif
-// cube root approximation using bit hack for 64-bit float
+// cube root approximation using bit hack for 64-bit float
// adapted from Kahan's cbrt
static double cbrt_5d(double d)
{
- const unsigned int B1 = 715094163;
- double t = 0.0;
- unsigned int* pt = (unsigned int*) &t;
- unsigned int* px = (unsigned int*) &d;
- pt[1]=px[1]/3+B1;
- return t;
+ const unsigned int B1 = 715094163;
+ double t = 0.0;
+ unsigned int* pt = (unsigned int*) &t;
+ unsigned int* px = (unsigned int*) &d;
+ pt[1]=px[1]/3+B1;
+ return t;
}
#if TEST_ALTERNATIVES
-// cube root approximation using bit hack for 64-bit float
+// cube root approximation using bit hack for 64-bit float
// adapted from Kahan's cbrt
#if 0
static double quint_5d(double d)
{
- return sqrt(sqrt(d));
-
- const unsigned int B1 = 71509416*5/3;
- double t = 0.0;
- unsigned int* pt = (unsigned int*) &t;
- unsigned int* px = (unsigned int*) &d;
- pt[1]=px[1]/5+B1;
- return t;
+ return sqrt(sqrt(d));
+
+ const unsigned int B1 = 71509416*5/3;
+ double t = 0.0;
+ unsigned int* pt = (unsigned int*) &t;
+ unsigned int* px = (unsigned int*) &d;
+ pt[1]=px[1]/5+B1;
+ return t;
}
#endif
// iterative cube root approximation using Halley's method (float)
static float cbrta_halleyf(const float a, const float R)
{
- const float a3 = a*a*a;
+ const float a3 = a*a*a;
const float b= a * (a3 + R + R) / (a3 + a3 + R);
- return b;
+ return b;
}
#endif
// iterative cube root approximation using Halley's method (double)
static double cbrta_halleyd(const double a, const double R)
{
- const double a3 = a*a*a;
+ const double a3 = a*a*a;
const double b= a * (a3 + R + R) / (a3 + a3 + R);
- return b;
+ return b;
}
#if TEST_ALTERNATIVES
@@ -115,255 +115,255 @@ static double cbrta_halleyd(const double a, const double R)
static float cbrta_newtonf(const float a, const float x)
{
// return (1.0 / 3.0) * ((a + a) + x / (a * a));
- return a - (1.0f / 3.0f) * (a - x / (a*a));
+ return a - (1.0f / 3.0f) * (a - x / (a*a));
}
// iterative cube root approximation using Newton's method (double)
static double cbrta_newtond(const double a, const double x)
{
- return (1.0/3.0) * (x / (a*a) + 2*a);
+ return (1.0/3.0) * (x / (a*a) + 2*a);
}
// cube root approximation using 1 iteration of Halley's method (double)
static double halley_cbrt1d(double d)
{
- double a = cbrt_5d(d);
- return cbrta_halleyd(a, d);
+ double a = cbrt_5d(d);
+ return cbrta_halleyd(a, d);
}
// cube root approximation using 1 iteration of Halley's method (float)
static float halley_cbrt1f(float d)
{
- float a = cbrt_5f(d);
- return cbrta_halleyf(a, d);
+ float a = cbrt_5f(d);
+ return cbrta_halleyf(a, d);
}
// cube root approximation using 2 iterations of Halley's method (double)
static double halley_cbrt2d(double d)
{
- double a = cbrt_5d(d);
- a = cbrta_halleyd(a, d);
- return cbrta_halleyd(a, d);
+ double a = cbrt_5d(d);
+ a = cbrta_halleyd(a, d);
+ return cbrta_halleyd(a, d);
}
#endif
// cube root approximation using 3 iterations of Halley's method (double)
static double halley_cbrt3d(double d)
{
- double a = cbrt_5d(d);
- a = cbrta_halleyd(a, d);
- a = cbrta_halleyd(a, d);
- return cbrta_halleyd(a, d);
+ double a = cbrt_5d(d);
+ a = cbrta_halleyd(a, d);
+ a = cbrta_halleyd(a, d);
+ return cbrta_halleyd(a, d);
}
#if TEST_ALTERNATIVES
// cube root approximation using 2 iterations of Halley's method (float)
static float halley_cbrt2f(float d)
{
- float a = cbrt_5f(d);
- a = cbrta_halleyf(a, d);
- return cbrta_halleyf(a, d);
+ float a = cbrt_5f(d);
+ a = cbrta_halleyf(a, d);
+ return cbrta_halleyf(a, d);
}
// cube root approximation using 1 iteration of Newton's method (double)
static double newton_cbrt1d(double d)
{
- double a = cbrt_5d(d);
- return cbrta_newtond(a, d);
+ double a = cbrt_5d(d);
+ return cbrta_newtond(a, d);
}
// cube root approximation using 2 iterations of Newton's method (double)
static double newton_cbrt2d(double d)
{
- double a = cbrt_5d(d);
- a = cbrta_newtond(a, d);
- return cbrta_newtond(a, d);
+ double a = cbrt_5d(d);
+ a = cbrta_newtond(a, d);
+ return cbrta_newtond(a, d);
}
// cube root approximation using 3 iterations of Newton's method (double)
static double newton_cbrt3d(double d)
{
- double a = cbrt_5d(d);
- a = cbrta_newtond(a, d);
- a = cbrta_newtond(a, d);
- return cbrta_newtond(a, d);
+ double a = cbrt_5d(d);
+ a = cbrta_newtond(a, d);
+ a = cbrta_newtond(a, d);
+ return cbrta_newtond(a, d);
}
// cube root approximation using 4 iterations of Newton's method (double)
static double newton_cbrt4d(double d)
{
- double a = cbrt_5d(d);
- a = cbrta_newtond(a, d);
- a = cbrta_newtond(a, d);
- a = cbrta_newtond(a, d);
- return cbrta_newtond(a, d);
+ double a = cbrt_5d(d);
+ a = cbrta_newtond(a, d);
+ a = cbrta_newtond(a, d);
+ a = cbrta_newtond(a, d);
+ return cbrta_newtond(a, d);
}
// cube root approximation using 2 iterations of Newton's method (float)
static float newton_cbrt1f(float d)
{
- float a = cbrt_5f(d);
- return cbrta_newtonf(a, d);
+ float a = cbrt_5f(d);
+ return cbrta_newtonf(a, d);
}
// cube root approximation using 2 iterations of Newton's method (float)
static float newton_cbrt2f(float d)
{
- float a = cbrt_5f(d);
- a = cbrta_newtonf(a, d);
- return cbrta_newtonf(a, d);
+ float a = cbrt_5f(d);
+ a = cbrta_newtonf(a, d);
+ return cbrta_newtonf(a, d);
}
// cube root approximation using 3 iterations of Newton's method (float)
static float newton_cbrt3f(float d)
{
- float a = cbrt_5f(d);
- a = cbrta_newtonf(a, d);
- a = cbrta_newtonf(a, d);
- return cbrta_newtonf(a, d);
+ float a = cbrt_5f(d);
+ a = cbrta_newtonf(a, d);
+ a = cbrta_newtonf(a, d);
+ return cbrta_newtonf(a, d);
}
// cube root approximation using 4 iterations of Newton's method (float)
static float newton_cbrt4f(float d)
{
- float a = cbrt_5f(d);
- a = cbrta_newtonf(a, d);
- a = cbrta_newtonf(a, d);
- a = cbrta_newtonf(a, d);
- return cbrta_newtonf(a, d);
+ float a = cbrt_5f(d);
+ a = cbrta_newtonf(a, d);
+ a = cbrta_newtonf(a, d);
+ a = cbrta_newtonf(a, d);
+ return cbrta_newtonf(a, d);
}
static double TestCubeRootf(const char* szName, cuberootfnf cbrt, double rA, double rB, int rN)
{
- const int N = rN;
-
- float dd = float((rB-rA) / N);
-
- // calculate 1M numbers
- int i=0;
- float d = (float) rA;
-
- double s = 0.0;
-
- for(d=(float) rA, i=0; i<N; i++, d += dd)
- {
- s += cbrt(d);
- }
-
- double bits = 0.0;
- double worstx=0.0;
- double worsty=0.0;
- int minbits=64;
-
- for(d=(float) rA, i=0; i<N; i++, d += dd)
- {
- float a = cbrt((float) d);
- float b = (float) pow((double) d, 1.0/3.0);
-
- int bc = bits_of_precision(a, b);
- bits += bc;
-
- if (b > 1.0e-6)
- {
- if (bc < minbits)
- {
- minbits = bc;
- worstx = d;
- worsty = a;
- }
- }
- }
-
- bits /= N;
+ const int N = rN;
+
+ float dd = float((rB-rA) / N);
+
+ // calculate 1M numbers
+ int i=0;
+ float d = (float) rA;
+
+ double s = 0.0;
+
+ for(d=(float) rA, i=0; i<N; i++, d += dd)
+ {
+ s += cbrt(d);
+ }
+
+ double bits = 0.0;
+ double worstx=0.0;
+ double worsty=0.0;
+ int minbits=64;
+
+ for(d=(float) rA, i=0; i<N; i++, d += dd)
+ {
+ float a = cbrt((float) d);
+ float b = (float) pow((double) d, 1.0/3.0);
+
+ int bc = bits_of_precision(a, b);
+ bits += bc;
+
+ if (b > 1.0e-6)
+ {
+ if (bc < minbits)
+ {
+ minbits = bc;
+ worstx = d;
+ worsty = a;
+ }
+ }
+ }
+
+ bits /= N;
printf(" %3d mbp %6.3f abp\n", minbits, bits);
- return s;
+ return s;
}
static double TestCubeRootd(const char* szName, cuberootfnd cbrt, double rA, double rB, int rN)
{
- const int N = rN;
-
- double dd = (rB-rA) / N;
-
- int i=0;
-
- double s = 0.0;
- double d = 0.0;
-
- for(d=rA, i=0; i<N; i++, d += dd)
- {
- s += cbrt(d);
- }
-
-
- double bits = 0.0;
- double worstx = 0.0;
- double worsty = 0.0;
- int minbits = 64;
- for(d=rA, i=0; i<N; i++, d += dd)
- {
- double a = cbrt(d);
- double b = pow(d, 1.0/3.0);
-
- int bc = bits_of_precision(a, b); // min(53, count_matching_bitsd(a, b) - 12);
- bits += bc;
-
- if (b > 1.0e-6)
- {
- if (bc < minbits)
- {
- bits_of_precision(a, b);
- minbits = bc;
- worstx = d;
- worsty = a;
- }
- }
- }
-
- bits /= N;
+ const int N = rN;
+
+ double dd = (rB-rA) / N;
+
+ int i=0;
+
+ double s = 0.0;
+ double d = 0.0;
+
+ for(d=rA, i=0; i<N; i++, d += dd)
+ {
+ s += cbrt(d);
+ }
+
+
+ double bits = 0.0;
+ double worstx = 0.0;
+ double worsty = 0.0;
+ int minbits = 64;
+ for(d=rA, i=0; i<N; i++, d += dd)
+ {
+ double a = cbrt(d);
+ double b = pow(d, 1.0/3.0);
+
+ int bc = bits_of_precision(a, b); // min(53, count_matching_bitsd(a, b) - 12);
+ bits += bc;
+
+ if (b > 1.0e-6)
+ {
+ if (bc < minbits)
+ {
+ bits_of_precision(a, b);
+ minbits = bc;
+ worstx = d;
+ worsty = a;
+ }
+ }
+ }
+
+ bits /= N;
printf(" %3d mbp %6.3f abp\n", minbits, bits);
- return s;
+ return s;
}
static int _tmain()
{
- // a million uniform steps through the range from 0.0 to 1.0
- // (doing uniform steps in the log scale would be better)
- double a = 0.0;
- double b = 1.0;
- int n = 1000000;
-
- printf("32-bit float tests\n");
- printf("----------------------------------------\n");
- TestCubeRootf("cbrt_5f", cbrt_5f, a, b, n);
- TestCubeRootf("pow", pow_cbrtf, a, b, n);
- TestCubeRootf("halley x 1", halley_cbrt1f, a, b, n);
- TestCubeRootf("halley x 2", halley_cbrt2f, a, b, n);
- TestCubeRootf("newton x 1", newton_cbrt1f, a, b, n);
- TestCubeRootf("newton x 2", newton_cbrt2f, a, b, n);
- TestCubeRootf("newton x 3", newton_cbrt3f, a, b, n);
- TestCubeRootf("newton x 4", newton_cbrt4f, a, b, n);
- printf("\n\n");
-
- printf("64-bit double tests\n");
- printf("----------------------------------------\n");
- TestCubeRootd("cbrt_5d", cbrt_5d, a, b, n);
- TestCubeRootd("pow", pow_cbrtd, a, b, n);
- TestCubeRootd("halley x 1", halley_cbrt1d, a, b, n);
- TestCubeRootd("halley x 2", halley_cbrt2d, a, b, n);
- TestCubeRootd("halley x 3", halley_cbrt3d, a, b, n);
- TestCubeRootd("newton x 1", newton_cbrt1d, a, b, n);
- TestCubeRootd("newton x 2", newton_cbrt2d, a, b, n);
- TestCubeRootd("newton x 3", newton_cbrt3d, a, b, n);
- TestCubeRootd("newton x 4", newton_cbrt4d, a, b, n);
- printf("\n\n");
-
- return 0;
+ // a million uniform steps through the range from 0.0 to 1.0
+ // (doing uniform steps in the log scale would be better)
+ double a = 0.0;
+ double b = 1.0;
+ int n = 1000000;
+
+ printf("32-bit float tests\n");
+ printf("----------------------------------------\n");
+ TestCubeRootf("cbrt_5f", cbrt_5f, a, b, n);
+ TestCubeRootf("pow", pow_cbrtf, a, b, n);
+ TestCubeRootf("halley x 1", halley_cbrt1f, a, b, n);
+ TestCubeRootf("halley x 2", halley_cbrt2f, a, b, n);
+ TestCubeRootf("newton x 1", newton_cbrt1f, a, b, n);
+ TestCubeRootf("newton x 2", newton_cbrt2f, a, b, n);
+ TestCubeRootf("newton x 3", newton_cbrt3f, a, b, n);
+ TestCubeRootf("newton x 4", newton_cbrt4f, a, b, n);
+ printf("\n\n");
+
+ printf("64-bit double tests\n");
+ printf("----------------------------------------\n");
+ TestCubeRootd("cbrt_5d", cbrt_5d, a, b, n);
+ TestCubeRootd("pow", pow_cbrtd, a, b, n);
+ TestCubeRootd("halley x 1", halley_cbrt1d, a, b, n);
+ TestCubeRootd("halley x 2", halley_cbrt2d, a, b, n);
+ TestCubeRootd("halley x 3", halley_cbrt3d, a, b, n);
+ TestCubeRootd("newton x 1", newton_cbrt1d, a, b, n);
+ TestCubeRootd("newton x 2", newton_cbrt2d, a, b, n);
+ TestCubeRootd("newton x 3", newton_cbrt3d, a, b, n);
+ TestCubeRootd("newton x 4", newton_cbrt4d, a, b, n);
+ printf("\n\n");
+
+ return 0;
}
#endif
diff --git a/experimental/Intersection/CubicBezierClip.cpp b/experimental/Intersection/CubicBezierClip.cpp
index 4eddc70a42..f3c78a247c 100644
--- a/experimental/Intersection/CubicBezierClip.cpp
+++ b/experimental/Intersection/CubicBezierClip.cpp
@@ -10,7 +10,7 @@ bool bezier_clip(const Cubic& cubic1, const Cubic& cubic2, double& minT, double&
maxT = 0;
// determine normalized implicit line equation for pt[0] to pt[3]
// of the form ax + by + c = 0, where a*a + b*b == 1
-
+
// find the implicit line equation parameters
LineParameters endLine;
endLine.cubicEndPoints(cubic1);
@@ -21,7 +21,7 @@ bool bezier_clip(const Cubic& cubic1, const Cubic& cubic2, double& minT, double&
double distance[2];
endLine.controlPtDistance(cubic1, distance);
-
+
// find fat line
double top = distance[0];
double bottom = distance[1];
@@ -42,11 +42,11 @@ bool bezier_clip(const Cubic& cubic1, const Cubic& cubic2, double& minT, double&
top *= scale;
bottom *= scale;
}
-
+
// compute intersecting candidate distance
Cubic distance2y; // points with X of (0, 1/3, 2/3, 1)
endLine.cubicDistanceY(cubic2, distance2y);
-
+
int flags = 0;
if (approximately_lesser(distance2y[0].y, top)) {
flags |= kFindTopMin;
@@ -78,7 +78,7 @@ bool bezier_clip(const Cubic& cubic1, const Cubic& cubic2, double& minT, double&
if (do_1_2_edge) {
x_at(distance2y[1], distance2y[2], top, bottom, flags, minT, maxT);
}
-
+
return minT < maxT; // returns false if distance shows no intersection
}
diff --git a/experimental/Intersection/CubicIntersection.cpp b/experimental/Intersection/CubicIntersection.cpp
index 13c472672d..594e12c9f2 100644
--- a/experimental/Intersection/CubicIntersection.cpp
+++ b/experimental/Intersection/CubicIntersection.cpp
@@ -6,11 +6,11 @@
class CubicIntersections : public Intersections {
public:
-CubicIntersections(const Cubic& c1, const Cubic& c2, Intersections& i)
+CubicIntersections(const Cubic& c1, const Cubic& c2, Intersections& i)
: cubic1(c1)
, cubic2(c2)
, intersections(i)
- , depth(0)
+ , depth(0)
, splits(0) {
}
@@ -37,10 +37,10 @@ bool intersect() {
}
protected:
-
+
bool intersect(double minT1, double maxT1, double minT2, double maxT2) {
Cubic smaller, larger;
- // FIXME: carry last subdivide and reduceOrder result with cubic
+ // FIXME: carry last subdivide and reduceOrder result with cubic
sub_divide(cubic1, minT1, maxT1, intersections.swapped() ? larger : smaller);
sub_divide(cubic2, minT2, maxT2, intersections.swapped() ? smaller : larger);
Cubic smallResult;
@@ -58,11 +58,11 @@ bool intersect(double minT1, double maxT1, double minT2, double maxT2) {
return false;
}
if (intersections.swapped()) {
- smallT[0] = interp(minT2, maxT2, smallT[0]);
- largeT[0] = interp(minT1, maxT1, largeT[0]);
+ smallT[0] = interp(minT2, maxT2, smallT[0]);
+ largeT[0] = interp(minT1, maxT1, largeT[0]);
} else {
- smallT[0] = interp(minT1, maxT1, smallT[0]);
- largeT[0] = interp(minT2, maxT2, largeT[0]);
+ smallT[0] = interp(minT1, maxT1, smallT[0]);
+ largeT[0] = interp(minT2, maxT2, largeT[0]);
}
intersections.add(smallT[0], largeT[0]);
return true;
@@ -83,7 +83,7 @@ bool intersect(double minT1, double maxT1, double minT2, double maxT2) {
}
return false;
}
-
+
int split;
if (intersections.swapped()) {
double newMinT1 = interp(minT1, maxT1, minT);
diff --git a/experimental/Intersection/CubicIntersection_TestData.cpp b/experimental/Intersection/CubicIntersection_TestData.cpp
index 066d9b5b97..e1da4c577e 100644
--- a/experimental/Intersection/CubicIntersection_TestData.cpp
+++ b/experimental/Intersection/CubicIntersection_TestData.cpp
@@ -12,7 +12,7 @@ const Cubic pointDegenerates[] = {
};
const size_t pointDegenerates_count = sizeof(pointDegenerates) / sizeof(pointDegenerates[0]);
-
+
const Cubic notPointDegenerates[] = {
{{1 + PointEpsilon + std::numeric_limits<double>::epsilon(), 1}, {1, 1 + PointEpsilon}, {1, 1}, {1, 1}},
{{1 + PointEpsilon/2 + std::numeric_limits<double>::epsilon(), 1}, {1 - PointEpsilon/2, 1}, {1, 1}, {1, 1}}
@@ -69,7 +69,7 @@ const Cubic tests[][2] = {
{{317.122, 309.05}, {316.112, 315.102}, {310.385, 319.19}, {304.332, 318.179}}
},
{
- {{1046.604051, 172.937967}, {1046.604051, 178.9763059}, {1041.76745, 183.9279165}, {1035.703842, 184.0432409}},
+ {{1046.604051, 172.937967}, {1046.604051, 178.9763059}, {1041.76745, 183.9279165}, {1035.703842, 184.0432409}},
{{1046.452235, 174.7640504}, {1045.544872, 180.1973817}, {1040.837966, 184.0469882}, {1035.505925, 184.0469882}}
},
{
@@ -81,7 +81,7 @@ const Cubic tests[][2] = {
const size_t tests_count = sizeof(tests) / sizeof(tests[0]);
Cubic hexTests[][2] = {
- {
+ {
{{0}} // placeholder for hex converted below
}
};
@@ -95,7 +95,7 @@ static const uint64_t testx[2][8] = {
},
{
0x92c56ed7b6145d40LLU, 0xede4f1255edb7740LLU, 0x1138c1101af75940LLU, 0x42e4f1255edb7740LLU,
- 0x408e51603ad95640LLU, 0x1e2e8fe9dd927740LLU, 0x1cb4777cd3a75440LLU, 0x212e1390de017740LLU
+ 0x408e51603ad95640LLU, 0x1e2e8fe9dd927740LLU, 0x1cb4777cd3a75440LLU, 0x212e1390de017740LLU
}
};
diff --git a/experimental/Intersection/CubicParameterization.cpp b/experimental/Intersection/CubicParameterization.cpp
index bb75771115..7656c663cd 100644
--- a/experimental/Intersection/CubicParameterization.cpp
+++ b/experimental/Intersection/CubicParameterization.cpp
@@ -3,7 +3,7 @@
/* from http://tom.cs.byu.edu/~tom/papers/cvgip84.pdf 4.1
*
- * This paper proves that Syvester's method can compute the implicit form of
+ * This paper proves that Syvester's method can compute the implicit form of
* the quadratic from the parameterzied form.
*
* Given x = a*t*t*t + b*t*t + c*t + d (the parameterized form)
@@ -28,30 +28,30 @@
*
* Resultant[a*t^3 + b*t^2 + c*t + d - x, e*t^3 + f*t^2 + g*t + h - y, t]
*
- * -d^3 e^3 + c d^2 e^2 f - b d^2 e f^2 + a d^2 f^3 - c^2 d e^2 g +
- * 2 b d^2 e^2 g + b c d e f g - 3 a d^2 e f g - a c d f^2 g -
- * b^2 d e g^2 + 2 a c d e g^2 + a b d f g^2 - a^2 d g^3 + c^3 e^2 h -
- * 3 b c d e^2 h + 3 a d^2 e^2 h - b c^2 e f h + 2 b^2 d e f h +
- * a c d e f h + a c^2 f^2 h - 2 a b d f^2 h + b^2 c e g h -
- * 2 a c^2 e g h - a b d e g h - a b c f g h + 3 a^2 d f g h +
- * a^2 c g^2 h - b^3 e h^2 + 3 a b c e h^2 - 3 a^2 d e h^2 +
- * a b^2 f h^2 - 2 a^2 c f h^2 - a^2 b g h^2 + a^3 h^3 + 3 d^2 e^3 x -
- * 2 c d e^2 f x + 2 b d e f^2 x - 2 a d f^3 x + c^2 e^2 g x -
- * 4 b d e^2 g x - b c e f g x + 6 a d e f g x + a c f^2 g x +
- * b^2 e g^2 x - 2 a c e g^2 x - a b f g^2 x + a^2 g^3 x +
- * 3 b c e^2 h x - 6 a d e^2 h x - 2 b^2 e f h x - a c e f h x +
- * 2 a b f^2 h x + a b e g h x - 3 a^2 f g h x + 3 a^2 e h^2 x -
- * 3 d e^3 x^2 + c e^2 f x^2 - b e f^2 x^2 + a f^3 x^2 +
- * 2 b e^2 g x^2 - 3 a e f g x^2 + 3 a e^2 h x^2 + e^3 x^3 -
- * c^3 e^2 y + 3 b c d e^2 y - 3 a d^2 e^2 y + b c^2 e f y -
- * 2 b^2 d e f y - a c d e f y - a c^2 f^2 y + 2 a b d f^2 y -
- * b^2 c e g y + 2 a c^2 e g y + a b d e g y + a b c f g y -
- * 3 a^2 d f g y - a^2 c g^2 y + 2 b^3 e h y - 6 a b c e h y +
- * 6 a^2 d e h y - 2 a b^2 f h y + 4 a^2 c f h y + 2 a^2 b g h y -
- * 3 a^3 h^2 y - 3 b c e^2 x y + 6 a d e^2 x y + 2 b^2 e f x y +
- * a c e f x y - 2 a b f^2 x y - a b e g x y + 3 a^2 f g x y -
- * 6 a^2 e h x y - 3 a e^2 x^2 y - b^3 e y^2 + 3 a b c e y^2 -
- * 3 a^2 d e y^2 + a b^2 f y^2 - 2 a^2 c f y^2 - a^2 b g y^2 +
+ * -d^3 e^3 + c d^2 e^2 f - b d^2 e f^2 + a d^2 f^3 - c^2 d e^2 g +
+ * 2 b d^2 e^2 g + b c d e f g - 3 a d^2 e f g - a c d f^2 g -
+ * b^2 d e g^2 + 2 a c d e g^2 + a b d f g^2 - a^2 d g^3 + c^3 e^2 h -
+ * 3 b c d e^2 h + 3 a d^2 e^2 h - b c^2 e f h + 2 b^2 d e f h +
+ * a c d e f h + a c^2 f^2 h - 2 a b d f^2 h + b^2 c e g h -
+ * 2 a c^2 e g h - a b d e g h - a b c f g h + 3 a^2 d f g h +
+ * a^2 c g^2 h - b^3 e h^2 + 3 a b c e h^2 - 3 a^2 d e h^2 +
+ * a b^2 f h^2 - 2 a^2 c f h^2 - a^2 b g h^2 + a^3 h^3 + 3 d^2 e^3 x -
+ * 2 c d e^2 f x + 2 b d e f^2 x - 2 a d f^3 x + c^2 e^2 g x -
+ * 4 b d e^2 g x - b c e f g x + 6 a d e f g x + a c f^2 g x +
+ * b^2 e g^2 x - 2 a c e g^2 x - a b f g^2 x + a^2 g^3 x +
+ * 3 b c e^2 h x - 6 a d e^2 h x - 2 b^2 e f h x - a c e f h x +
+ * 2 a b f^2 h x + a b e g h x - 3 a^2 f g h x + 3 a^2 e h^2 x -
+ * 3 d e^3 x^2 + c e^2 f x^2 - b e f^2 x^2 + a f^3 x^2 +
+ * 2 b e^2 g x^2 - 3 a e f g x^2 + 3 a e^2 h x^2 + e^3 x^3 -
+ * c^3 e^2 y + 3 b c d e^2 y - 3 a d^2 e^2 y + b c^2 e f y -
+ * 2 b^2 d e f y - a c d e f y - a c^2 f^2 y + 2 a b d f^2 y -
+ * b^2 c e g y + 2 a c^2 e g y + a b d e g y + a b c f g y -
+ * 3 a^2 d f g y - a^2 c g^2 y + 2 b^3 e h y - 6 a b c e h y +
+ * 6 a^2 d e h y - 2 a b^2 f h y + 4 a^2 c f h y + 2 a^2 b g h y -
+ * 3 a^3 h^2 y - 3 b c e^2 x y + 6 a d e^2 x y + 2 b^2 e f x y +
+ * a c e f x y - 2 a b f^2 x y - a b e g x y + 3 a^2 f g x y -
+ * 6 a^2 e h x y - 3 a e^2 x^2 y - b^3 e y^2 + 3 a b c e y^2 -
+ * 3 a^2 d e y^2 + a b^2 f y^2 - 2 a^2 c f y^2 - a^2 b g y^2 +
* 3 a^3 h y^2 + 3 a^2 e x y^2 - a^3 y^3
*/
@@ -75,7 +75,7 @@ enum {
// FIXME: factoring version unwritten
// static bool straight_forward = true;
-/* from CubicParameterizationCode.cpp output:
+/* from CubicParameterizationCode.cpp output:
* double A = e * e * e;
* double B = -3 * a * e * e;
* double C = 3 * a * a * e;
@@ -96,7 +96,7 @@ static void calc_ABCD(double a, double e, double p[coeff_count]) {
// start of generated code
static double calc_xx(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
+ return
-3 * d * e * e * e
+ c * e * e * f
- b * e * f * f
@@ -108,7 +108,7 @@ static double calc_xx(double a, double b, double c, double d,
static double calc_xy(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
+ return
-3 * b * c * e * e
+ 6 * a * d * e * e
+ 2 * b * b * e * f
@@ -121,7 +121,7 @@ static double calc_xy(double a, double b, double c, double d,
static double calc_yy(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
+ return
-b * b * b * e
+ 3 * a * b * c * e
- 3 * a * a * d * e
@@ -133,7 +133,7 @@ static double calc_yy(double a, double b, double c, double d,
static double calc_x(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
+ return
3 * d * d * e * e * e
- 2 * c * d * e * e * f
+ 2 * b * d * e * f * f
@@ -159,7 +159,7 @@ static double calc_x(double a, double b, double c, double d,
static double calc_y(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
+ return
-c * c * c * e * e
+ 3 * b * c * d * e * e
- 3 * a * d * d * e * e
@@ -185,7 +185,7 @@ static double calc_y(double a, double b, double c, double d,
static double calc_c(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
+ return
-d * d * d * e * e * e
+ c * d * d * e * e * f
- b * d * d * e * f * f
@@ -231,65 +231,65 @@ static double calc_c(double a, double b, double c, double d,
*/
static double calc_c(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
-d*d*d*e*e*e - 3*d*d*(3*c*e*e*f + 3*b*e*(-3*f*f + 2*e*g) + a*(9*f*f*f - 9*e*f*g + e*e*h)) -
- h*(27*c*c*c*e*e - 27*c*c*(3*b*e*f - 3*a*f*f + 2*a*e*g) +
- h*(-27*b*b*b*e + 27*a*b*b*f - 9*a*a*b*g + a*a*a*h) +
- 9*c*(9*b*b*e*g + a*b*(-9*f*g + 3*e*h) + a*a*(3*g*g - 2*f*h))) +
- 3*d*(9*c*c*e*e*g + 9*b*b*e*(3*g*g - 2*f*h) + 3*a*b*(-9*f*g*g + 6*f*f*h + e*g*h) +
+ return
+d*d*d*e*e*e - 3*d*d*(3*c*e*e*f + 3*b*e*(-3*f*f + 2*e*g) + a*(9*f*f*f - 9*e*f*g + e*e*h)) -
+ h*(27*c*c*c*e*e - 27*c*c*(3*b*e*f - 3*a*f*f + 2*a*e*g) +
+ h*(-27*b*b*b*e + 27*a*b*b*f - 9*a*a*b*g + a*a*a*h) +
+ 9*c*(9*b*b*e*g + a*b*(-9*f*g + 3*e*h) + a*a*(3*g*g - 2*f*h))) +
+ 3*d*(9*c*c*e*e*g + 9*b*b*e*(3*g*g - 2*f*h) + 3*a*b*(-9*f*g*g + 6*f*f*h + e*g*h) +
a*a*(9*g*g*g - 9*f*g*h + e*h*h) + 3*c*(3*b*e*(-3*f*g + e*h) + a*(9*f*f*g - 6*e*g*g - e*f*h)))
;
}
-// - Power(e - 3*f + 3*g - h,3)*Power(x,3)
+// - Power(e - 3*f + 3*g - h,3)*Power(x,3)
static double calc_xxx(double e3f3gh) {
return -e3f3gh * e3f3gh * e3f3gh;
}
static double calc_y(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
-+ 3*(6*b*d*d*e*e - d*d*d*e*e + 18*b*b*d*e*f - 18*b*d*d*e*f -
- 9*b*d*d*f*f - 54*b*b*d*e*g + 12*b*d*d*e*g - 27*b*b*d*g*g - 18*b*b*b*e*h + 18*b*b*d*e*h +
- 18*b*b*d*f*h + a*a*a*h*h - 9*b*b*b*h*h + 9*c*c*c*e*(e + 2*h) +
- a*a*(-3*b*h*(2*g + h) + d*(-27*g*g + 9*g*h - h*(2*e + h) + 9*f*(g + h))) +
- a*(9*b*b*h*(2*f + h) - 3*b*d*(6*f*f - 6*f*(3*g - 2*h) + g*(-9*g + h) + e*(g + h)) +
- d*d*(e*e + 9*f*(3*f - g) + e*(-9*f - 9*g + 2*h))) -
- 9*c*c*(d*e*(e + 2*g) + 3*b*(f*h + e*(f + h)) + a*(-3*f*f - 6*f*h + 2*(g*h + e*(g + h)))) +
- 3*c*(d*d*e*(e + 2*f) + a*a*(3*g*g + 6*g*h - 2*h*(2*f + h)) + 9*b*b*(g*h + e*(g + h)) +
- a*d*(-9*f*f - 18*f*g + 6*g*g + f*h + e*(f + 12*g + h)) +
- b*(d*(-3*e*e + 9*f*g + e*(9*f + 9*g - 6*h)) + 3*a*(h*(2*e - 3*g + h) - 3*f*(g + h))))) // *y
+ return
++ 3*(6*b*d*d*e*e - d*d*d*e*e + 18*b*b*d*e*f - 18*b*d*d*e*f -
+ 9*b*d*d*f*f - 54*b*b*d*e*g + 12*b*d*d*e*g - 27*b*b*d*g*g - 18*b*b*b*e*h + 18*b*b*d*e*h +
+ 18*b*b*d*f*h + a*a*a*h*h - 9*b*b*b*h*h + 9*c*c*c*e*(e + 2*h) +
+ a*a*(-3*b*h*(2*g + h) + d*(-27*g*g + 9*g*h - h*(2*e + h) + 9*f*(g + h))) +
+ a*(9*b*b*h*(2*f + h) - 3*b*d*(6*f*f - 6*f*(3*g - 2*h) + g*(-9*g + h) + e*(g + h)) +
+ d*d*(e*e + 9*f*(3*f - g) + e*(-9*f - 9*g + 2*h))) -
+ 9*c*c*(d*e*(e + 2*g) + 3*b*(f*h + e*(f + h)) + a*(-3*f*f - 6*f*h + 2*(g*h + e*(g + h)))) +
+ 3*c*(d*d*e*(e + 2*f) + a*a*(3*g*g + 6*g*h - 2*h*(2*f + h)) + 9*b*b*(g*h + e*(g + h)) +
+ a*d*(-9*f*f - 18*f*g + 6*g*g + f*h + e*(f + 12*g + h)) +
+ b*(d*(-3*e*e + 9*f*g + e*(9*f + 9*g - 6*h)) + 3*a*(h*(2*e - 3*g + h) - 3*f*(g + h))))) // *y
;
}
static double calc_yy(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
-- 3*(18*c*c*c*e - 18*c*c*d*e + 6*c*d*d*e - d*d*d*e + 3*c*d*d*f - 9*c*c*d*g + a*a*a*h + 9*c*c*c*h -
- 9*b*b*b*(e + 2*h) - a*a*(d*(e - 9*f + 18*g - 7*h) + 3*c*(2*f - 6*g + h)) +
- a*(-9*c*c*(2*e - 6*f + 2*g - h) + d*d*(-7*e + 18*f - 9*g + h) + 3*c*d*(7*e - 17*f + 3*g + h)) +
- 9*b*b*(3*c*(e + g + h) + a*(f + 2*h) - d*(e - 2*(f - 3*g + h))) -
- 3*b*(-(d*d*(e - 6*f + 2*g)) - 3*c*d*(e + 3*f + 3*g - h) + 9*c*c*(e + f + h) + a*a*(g + 2*h) +
- a*(c*(-3*e + 9*f + 9*g + 3*h) + d*(e + 3*f - 17*g + 7*h)))) // *Power(y,2)
+ return
+- 3*(18*c*c*c*e - 18*c*c*d*e + 6*c*d*d*e - d*d*d*e + 3*c*d*d*f - 9*c*c*d*g + a*a*a*h + 9*c*c*c*h -
+ 9*b*b*b*(e + 2*h) - a*a*(d*(e - 9*f + 18*g - 7*h) + 3*c*(2*f - 6*g + h)) +
+ a*(-9*c*c*(2*e - 6*f + 2*g - h) + d*d*(-7*e + 18*f - 9*g + h) + 3*c*d*(7*e - 17*f + 3*g + h)) +
+ 9*b*b*(3*c*(e + g + h) + a*(f + 2*h) - d*(e - 2*(f - 3*g + h))) -
+ 3*b*(-(d*d*(e - 6*f + 2*g)) - 3*c*d*(e + 3*f + 3*g - h) + 9*c*c*(e + f + h) + a*a*(g + 2*h) +
+ a*(c*(-3*e + 9*f + 9*g + 3*h) + d*(e + 3*f - 17*g + 7*h)))) // *Power(y,2)
;
}
-// + Power(a - 3*b + 3*c - d,3)*Power(y,3)
+// + Power(a - 3*b + 3*c - d,3)*Power(y,3)
static double calc_yyy(double a3b3cd) {
return a3b3cd * a3b3cd * a3b3cd;
}
static double calc_xx(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
+ return
// + Power(x,2)*
-(-3*(-9*b*e*f*f + 9*a*f*f*f + 6*b*e*e*g - 9*a*e*f*g + 27*b*e*f*g - 27*a*f*f*g + 18*a*e*g*g - 54*b*e*g*g +
- 27*a*f*g*g + 27*b*f*g*g - 18*a*g*g*g + a*e*e*h - 9*b*e*e*h + 3*a*e*f*h + 9*b*e*f*h + 9*a*f*f*h -
- 18*b*f*f*h - 21*a*e*g*h + 51*b*e*g*h - 9*a*f*g*h - 27*b*f*g*h + 18*a*g*g*h + 7*a*e*h*h - 18*b*e*h*h - 3*a*f*h*h +
- 18*b*f*h*h - 6*a*g*h*h - 3*b*g*h*h + a*h*h*h +
- 3*c*(-9*f*f*(g - 2*h) + 3*g*g*h - f*h*(9*g + 2*h) + e*e*(f - 6*g + 6*h) +
- e*(9*f*g + 6*g*g - 17*f*h - 3*g*h + 3*h*h)) -
- d*(e*e*e + e*e*(-6*f - 3*g + 7*h) - 9*(2*f - g)*(f*f + g*g - f*(g + h)) +
+(-3*(-9*b*e*f*f + 9*a*f*f*f + 6*b*e*e*g - 9*a*e*f*g + 27*b*e*f*g - 27*a*f*f*g + 18*a*e*g*g - 54*b*e*g*g +
+ 27*a*f*g*g + 27*b*f*g*g - 18*a*g*g*g + a*e*e*h - 9*b*e*e*h + 3*a*e*f*h + 9*b*e*f*h + 9*a*f*f*h -
+ 18*b*f*f*h - 21*a*e*g*h + 51*b*e*g*h - 9*a*f*g*h - 27*b*f*g*h + 18*a*g*g*h + 7*a*e*h*h - 18*b*e*h*h - 3*a*f*h*h +
+ 18*b*f*h*h - 6*a*g*h*h - 3*b*g*h*h + a*h*h*h +
+ 3*c*(-9*f*f*(g - 2*h) + 3*g*g*h - f*h*(9*g + 2*h) + e*e*(f - 6*g + 6*h) +
+ e*(9*f*g + 6*g*g - 17*f*h - 3*g*h + 3*h*h)) -
+ d*(e*e*e + e*e*(-6*f - 3*g + 7*h) - 9*(2*f - g)*(f*f + g*g - f*(g + h)) +
e*(18*f*f + 9*g*g + 3*g*h + h*h - 3*f*(3*g + 7*h)))) )
;
}
@@ -301,35 +301,35 @@ static double calc_xxy(double a3b3cd, double e3f3gh) {
static double calc_x(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
+ return
// + x*
-(-3*(27*b*b*e*g*g - 27*a*b*f*g*g + 9*a*a*g*g*g - 18*b*b*e*f*h + 18*a*b*f*f*h + 3*a*b*e*g*h -
- 27*b*b*e*g*h - 9*a*a*f*g*h + 27*a*b*f*g*h - 9*a*a*g*g*h + a*a*e*h*h - 9*a*b*e*h*h +
- 27*b*b*e*h*h + 6*a*a*f*h*h - 18*a*b*f*h*h - 9*b*b*f*h*h + 3*a*a*g*h*h +
- 6*a*b*g*h*h - a*a*h*h*h + 9*c*c*(e*e*(g - 3*h) - 3*f*f*h + e*(3*f + 2*g)*h) +
- d*d*(e*e*e - 9*f*f*f + 9*e*f*(f + g) - e*e*(3*f + 6*g + h)) +
- d*(-3*c*(-9*f*f*g + e*e*(2*f - 6*g - 3*h) + e*(9*f*g + 6*g*g + f*h)) +
- a*(-18*f*f*f - 18*e*g*g + 18*g*g*g - 2*e*e*h + 3*e*g*h + 2*e*h*h + 9*f*f*(3*g + 2*h) +
- 3*f*(6*e*g - 9*g*g - e*h - 6*g*h)) - 3*b*(9*f*g*g + e*e*(4*g - 3*h) - 6*f*f*h -
- e*(6*f*f + g*(18*g + h) - 3*f*(3*g + 4*h)))) +
- 3*c*(3*b*(e*e*h + 3*f*g*h - e*(3*f*g - 6*f*h + 6*g*h + h*h)) +
+(-3*(27*b*b*e*g*g - 27*a*b*f*g*g + 9*a*a*g*g*g - 18*b*b*e*f*h + 18*a*b*f*f*h + 3*a*b*e*g*h -
+ 27*b*b*e*g*h - 9*a*a*f*g*h + 27*a*b*f*g*h - 9*a*a*g*g*h + a*a*e*h*h - 9*a*b*e*h*h +
+ 27*b*b*e*h*h + 6*a*a*f*h*h - 18*a*b*f*h*h - 9*b*b*f*h*h + 3*a*a*g*h*h +
+ 6*a*b*g*h*h - a*a*h*h*h + 9*c*c*(e*e*(g - 3*h) - 3*f*f*h + e*(3*f + 2*g)*h) +
+ d*d*(e*e*e - 9*f*f*f + 9*e*f*(f + g) - e*e*(3*f + 6*g + h)) +
+ d*(-3*c*(-9*f*f*g + e*e*(2*f - 6*g - 3*h) + e*(9*f*g + 6*g*g + f*h)) +
+ a*(-18*f*f*f - 18*e*g*g + 18*g*g*g - 2*e*e*h + 3*e*g*h + 2*e*h*h + 9*f*f*(3*g + 2*h) +
+ 3*f*(6*e*g - 9*g*g - e*h - 6*g*h)) - 3*b*(9*f*g*g + e*e*(4*g - 3*h) - 6*f*f*h -
+ e*(6*f*f + g*(18*g + h) - 3*f*(3*g + 4*h)))) +
+ 3*c*(3*b*(e*e*h + 3*f*g*h - e*(3*f*g - 6*f*h + 6*g*h + h*h)) +
a*(9*f*f*(g - 2*h) + f*h*(-e + 9*g + 4*h) - 3*(2*g*g*h + e*(2*g*g - 4*g*h + h*h))))) )
;
}
-
+
static double calc_xy(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
+ return
// + x*3*
-(-2*a*d*e*e - 7*d*d*e*e + 15*a*d*e*f + 21*d*d*e*f - 9*a*d*f*f - 18*d*d*f*f - 15*a*d*e*g -
- 3*d*d*e*g - 9*a*a*f*g + 9*d*d*f*g + 18*a*a*g*g + 9*a*d*g*g + 2*a*a*e*h - 2*d*d*e*h +
- 3*a*a*f*h + 15*a*d*f*h - 21*a*a*g*h - 15*a*d*g*h + 7*a*a*h*h + 2*a*d*h*h -
- 9*c*c*(2*e*e + 3*f*f + 3*f*h - 2*g*h + e*(-3*f - 4*g + h)) +
- 9*b*b*(3*g*g - 3*g*h + 2*h*(-2*f + h) + e*(-2*f + 3*g + h)) +
- 3*b*(3*c*(e*e + 3*e*(f - 3*g) + (9*f - 3*g - h)*h) + a*(6*f*f + e*g - 9*f*g - 9*g*g - 5*e*h + 9*f*h + 14*g*h - 7*h*h) +
- d*(-e*e + 12*f*f - 27*f*g + e*(-9*f + 20*g - 5*h) + g*(9*g + h))) +
- 3*c*(a*(-(e*f) - 9*f*f + 27*f*g - 12*g*g + 5*e*h - 20*f*h + 9*g*h + h*h) +
- d*(7*e*e + 9*f*f + 9*f*g - 6*g*g - f*h + e*(-14*f - 9*g + 5*h)))) // *y
+(-2*a*d*e*e - 7*d*d*e*e + 15*a*d*e*f + 21*d*d*e*f - 9*a*d*f*f - 18*d*d*f*f - 15*a*d*e*g -
+ 3*d*d*e*g - 9*a*a*f*g + 9*d*d*f*g + 18*a*a*g*g + 9*a*d*g*g + 2*a*a*e*h - 2*d*d*e*h +
+ 3*a*a*f*h + 15*a*d*f*h - 21*a*a*g*h - 15*a*d*g*h + 7*a*a*h*h + 2*a*d*h*h -
+ 9*c*c*(2*e*e + 3*f*f + 3*f*h - 2*g*h + e*(-3*f - 4*g + h)) +
+ 9*b*b*(3*g*g - 3*g*h + 2*h*(-2*f + h) + e*(-2*f + 3*g + h)) +
+ 3*b*(3*c*(e*e + 3*e*(f - 3*g) + (9*f - 3*g - h)*h) + a*(6*f*f + e*g - 9*f*g - 9*g*g - 5*e*h + 9*f*h + 14*g*h - 7*h*h) +
+ d*(-e*e + 12*f*f - 27*f*g + e*(-9*f + 20*g - 5*h) + g*(9*g + h))) +
+ 3*c*(a*(-(e*f) - 9*f*f + 27*f*g - 12*g*g + 5*e*h - 20*f*h + 9*g*h + h*h) +
+ d*(7*e*e + 9*f*f + 9*f*g - 6*g*g - f*h + e*(-14*f - 9*g + 5*h)))) // *y
;
}
@@ -358,7 +358,7 @@ static double (*calc_proc[])(double a, double b, double c, double d,
c = 3*C - 3*D
d = D
*/
-
+
/* http://www.algorithmist.net/bezier3.html
p = 3 * A
q = 3 * B
@@ -369,9 +369,9 @@ static double (*calc_proc[])(double a, double b, double c, double d,
d = D - A + q - r
B(t) = a + t * (b + t * (c + t * d))
-
+
so
-
+
B(t) = a + t*b + t*t*(c + t*d)
= a + t*b + t*t*c + t*t*t*d
*/
diff --git a/experimental/Intersection/CubicParameterizationCode.cpp b/experimental/Intersection/CubicParameterizationCode.cpp
index 15767ddff3..3fe0492bff 100644
--- a/experimental/Intersection/CubicParameterizationCode.cpp
+++ b/experimental/Intersection/CubicParameterizationCode.cpp
@@ -73,80 +73,80 @@ const char result2[] =
const size_t len2 = sizeof(result2) - 1;
/* Given: r1 = Resultant[
- * a*(1 - t)^3 + 3*b*(1 - t)^2*t + 3*c*(1 - t)*t^2 + d*t^3 - x,
+ * a*(1 - t)^3 + 3*b*(1 - t)^2*t + 3*c*(1 - t)*t^2 + d*t^3 - x,
* e*(1 - t)^3 + 3*f*(1 - t)^2*t + 3*g*(1 - t)*t^2 + h*t^3 - y, t]
* Collect[r1, {x, y}, Simplify]
* CForm[%]
* then use regex to replace Power\(([a-h]),3\) with \1*\1*\1
* and Power\(([a-h]),2\) with \1*\1
* yields:
-
-d*d*d*e*e*e - 3*d*d*(3*c*e*e*f + 3*b*e*(-3*f*f + 2*e*g) + a*(9*f*f*f - 9*e*f*g + e*e*h)) -
- h*(27*c*c*c*e*e - 27*c*c*(3*b*e*f - 3*a*f*f + 2*a*e*g) +
- h*(-27*b*b*b*e + 27*a*b*b*f - 9*a*a*b*g + a*a*a*h) +
- 9*c*(9*b*b*e*g + a*b*(-9*f*g + 3*e*h) + a*a*(3*g*g - 2*f*h))) +
- 3*d*(9*c*c*e*e*g + 9*b*b*e*(3*g*g - 2*f*h) + 3*a*b*(-9*f*g*g + 6*f*f*h + e*g*h) +
+
+d*d*d*e*e*e - 3*d*d*(3*c*e*e*f + 3*b*e*(-3*f*f + 2*e*g) + a*(9*f*f*f - 9*e*f*g + e*e*h)) -
+ h*(27*c*c*c*e*e - 27*c*c*(3*b*e*f - 3*a*f*f + 2*a*e*g) +
+ h*(-27*b*b*b*e + 27*a*b*b*f - 9*a*a*b*g + a*a*a*h) +
+ 9*c*(9*b*b*e*g + a*b*(-9*f*g + 3*e*h) + a*a*(3*g*g - 2*f*h))) +
+ 3*d*(9*c*c*e*e*g + 9*b*b*e*(3*g*g - 2*f*h) + 3*a*b*(-9*f*g*g + 6*f*f*h + e*g*h) +
a*a*(9*g*g*g - 9*f*g*h + e*h*h) + 3*c*(3*b*e*(-3*f*g + e*h) + a*(9*f*f*g - 6*e*g*g - e*f*h)))
-
-- Power(e - 3*f + 3*g - h,3)*Power(x,3)
-
-+ 3*(6*b*d*d*e*e - d*d*d*e*e + 18*b*b*d*e*f - 18*b*d*d*e*f -
- 9*b*d*d*f*f - 54*b*b*d*e*g + 12*b*d*d*e*g - 27*b*b*d*g*g - 18*b*b*b*e*h + 18*b*b*d*e*h +
- 18*b*b*d*f*h + a*a*a*h*h - 9*b*b*b*h*h + 9*c*c*c*e*(e + 2*h) +
- a*a*(-3*b*h*(2*g + h) + d*(-27*g*g + 9*g*h - h*(2*e + h) + 9*f*(g + h))) +
- a*(9*b*b*h*(2*f + h) - 3*b*d*(6*f*f - 6*f*(3*g - 2*h) + g*(-9*g + h) + e*(g + h)) +
- d*d*(e*e + 9*f*(3*f - g) + e*(-9*f - 9*g + 2*h))) -
- 9*c*c*(d*e*(e + 2*g) + 3*b*(f*h + e*(f + h)) + a*(-3*f*f - 6*f*h + 2*(g*h + e*(g + h)))) +
- 3*c*(d*d*e*(e + 2*f) + a*a*(3*g*g + 6*g*h - 2*h*(2*f + h)) + 9*b*b*(g*h + e*(g + h)) +
- a*d*(-9*f*f - 18*f*g + 6*g*g + f*h + e*(f + 12*g + h)) +
- b*(d*(-3*e*e + 9*f*g + e*(9*f + 9*g - 6*h)) + 3*a*(h*(2*e - 3*g + h) - 3*f*(g + h)))))*y
-
-- 3*(18*c*c*c*e - 18*c*c*d*e + 6*c*d*d*e - d*d*d*e + 3*c*d*d*f - 9*c*c*d*g + a*a*a*h + 9*c*c*c*h -
- 9*b*b*b*(e + 2*h) - a*a*(d*(e - 9*f + 18*g - 7*h) + 3*c*(2*f - 6*g + h)) +
- a*(-9*c*c*(2*e - 6*f + 2*g - h) + d*d*(-7*e + 18*f - 9*g + h) + 3*c*d*(7*e - 17*f + 3*g + h)) +
- 9*b*b*(3*c*(e + g + h) + a*(f + 2*h) - d*(e - 2*(f - 3*g + h))) -
- 3*b*(-(d*d*(e - 6*f + 2*g)) - 3*c*d*(e + 3*f + 3*g - h) + 9*c*c*(e + f + h) + a*a*(g + 2*h) +
- a*(c*(-3*e + 9*f + 9*g + 3*h) + d*(e + 3*f - 17*g + 7*h))))*Power(y,2)
-
-+ Power(a - 3*b + 3*c - d,3)*Power(y,3)
-
-+ Power(x,2)*(-3*(-9*b*e*f*f + 9*a*f*f*f + 6*b*e*e*g - 9*a*e*f*g + 27*b*e*f*g - 27*a*f*f*g + 18*a*e*g*g - 54*b*e*g*g +
- 27*a*f*g*g + 27*b*f*g*g - 18*a*g*g*g + a*e*e*h - 9*b*e*e*h + 3*a*e*f*h + 9*b*e*f*h + 9*a*f*f*h -
- 18*b*f*f*h - 21*a*e*g*h + 51*b*e*g*h - 9*a*f*g*h - 27*b*f*g*h + 18*a*g*g*h + 7*a*e*h*h - 18*b*e*h*h - 3*a*f*h*h +
- 18*b*f*h*h - 6*a*g*h*h - 3*b*g*h*h + a*h*h*h +
- 3*c*(-9*f*f*(g - 2*h) + 3*g*g*h - f*h*(9*g + 2*h) + e*e*(f - 6*g + 6*h) +
- e*(9*f*g + 6*g*g - 17*f*h - 3*g*h + 3*h*h)) -
- d*(e*e*e + e*e*(-6*f - 3*g + 7*h) - 9*(2*f - g)*(f*f + g*g - f*(g + h)) +
+
+- Power(e - 3*f + 3*g - h,3)*Power(x,3)
+
++ 3*(6*b*d*d*e*e - d*d*d*e*e + 18*b*b*d*e*f - 18*b*d*d*e*f -
+ 9*b*d*d*f*f - 54*b*b*d*e*g + 12*b*d*d*e*g - 27*b*b*d*g*g - 18*b*b*b*e*h + 18*b*b*d*e*h +
+ 18*b*b*d*f*h + a*a*a*h*h - 9*b*b*b*h*h + 9*c*c*c*e*(e + 2*h) +
+ a*a*(-3*b*h*(2*g + h) + d*(-27*g*g + 9*g*h - h*(2*e + h) + 9*f*(g + h))) +
+ a*(9*b*b*h*(2*f + h) - 3*b*d*(6*f*f - 6*f*(3*g - 2*h) + g*(-9*g + h) + e*(g + h)) +
+ d*d*(e*e + 9*f*(3*f - g) + e*(-9*f - 9*g + 2*h))) -
+ 9*c*c*(d*e*(e + 2*g) + 3*b*(f*h + e*(f + h)) + a*(-3*f*f - 6*f*h + 2*(g*h + e*(g + h)))) +
+ 3*c*(d*d*e*(e + 2*f) + a*a*(3*g*g + 6*g*h - 2*h*(2*f + h)) + 9*b*b*(g*h + e*(g + h)) +
+ a*d*(-9*f*f - 18*f*g + 6*g*g + f*h + e*(f + 12*g + h)) +
+ b*(d*(-3*e*e + 9*f*g + e*(9*f + 9*g - 6*h)) + 3*a*(h*(2*e - 3*g + h) - 3*f*(g + h)))))*y
+
+- 3*(18*c*c*c*e - 18*c*c*d*e + 6*c*d*d*e - d*d*d*e + 3*c*d*d*f - 9*c*c*d*g + a*a*a*h + 9*c*c*c*h -
+ 9*b*b*b*(e + 2*h) - a*a*(d*(e - 9*f + 18*g - 7*h) + 3*c*(2*f - 6*g + h)) +
+ a*(-9*c*c*(2*e - 6*f + 2*g - h) + d*d*(-7*e + 18*f - 9*g + h) + 3*c*d*(7*e - 17*f + 3*g + h)) +
+ 9*b*b*(3*c*(e + g + h) + a*(f + 2*h) - d*(e - 2*(f - 3*g + h))) -
+ 3*b*(-(d*d*(e - 6*f + 2*g)) - 3*c*d*(e + 3*f + 3*g - h) + 9*c*c*(e + f + h) + a*a*(g + 2*h) +
+ a*(c*(-3*e + 9*f + 9*g + 3*h) + d*(e + 3*f - 17*g + 7*h))))*Power(y,2)
+
++ Power(a - 3*b + 3*c - d,3)*Power(y,3)
+
++ Power(x,2)*(-3*(-9*b*e*f*f + 9*a*f*f*f + 6*b*e*e*g - 9*a*e*f*g + 27*b*e*f*g - 27*a*f*f*g + 18*a*e*g*g - 54*b*e*g*g +
+ 27*a*f*g*g + 27*b*f*g*g - 18*a*g*g*g + a*e*e*h - 9*b*e*e*h + 3*a*e*f*h + 9*b*e*f*h + 9*a*f*f*h -
+ 18*b*f*f*h - 21*a*e*g*h + 51*b*e*g*h - 9*a*f*g*h - 27*b*f*g*h + 18*a*g*g*h + 7*a*e*h*h - 18*b*e*h*h - 3*a*f*h*h +
+ 18*b*f*h*h - 6*a*g*h*h - 3*b*g*h*h + a*h*h*h +
+ 3*c*(-9*f*f*(g - 2*h) + 3*g*g*h - f*h*(9*g + 2*h) + e*e*(f - 6*g + 6*h) +
+ e*(9*f*g + 6*g*g - 17*f*h - 3*g*h + 3*h*h)) -
+ d*(e*e*e + e*e*(-6*f - 3*g + 7*h) - 9*(2*f - g)*(f*f + g*g - f*(g + h)) +
e*(18*f*f + 9*g*g + 3*g*h + h*h - 3*f*(3*g + 7*h)))) )
-
+
+ Power(x,2)*(3*(a - 3*b + 3*c - d)*Power(e - 3*f + 3*g - h,2)*y)
-
-+ x*(-3*(27*b*b*e*g*g - 27*a*b*f*g*g + 9*a*a*g*g*g - 18*b*b*e*f*h + 18*a*b*f*f*h + 3*a*b*e*g*h -
- 27*b*b*e*g*h - 9*a*a*f*g*h + 27*a*b*f*g*h - 9*a*a*g*g*h + a*a*e*h*h - 9*a*b*e*h*h +
- 27*b*b*e*h*h + 6*a*a*f*h*h - 18*a*b*f*h*h - 9*b*b*f*h*h + 3*a*a*g*h*h +
- 6*a*b*g*h*h - a*a*h*h*h + 9*c*c*(e*e*(g - 3*h) - 3*f*f*h + e*(3*f + 2*g)*h) +
- d*d*(e*e*e - 9*f*f*f + 9*e*f*(f + g) - e*e*(3*f + 6*g + h)) +
- d*(-3*c*(-9*f*f*g + e*e*(2*f - 6*g - 3*h) + e*(9*f*g + 6*g*g + f*h)) +
- a*(-18*f*f*f - 18*e*g*g + 18*g*g*g - 2*e*e*h + 3*e*g*h + 2*e*h*h + 9*f*f*(3*g + 2*h) +
- 3*f*(6*e*g - 9*g*g - e*h - 6*g*h)) - 3*b*(9*f*g*g + e*e*(4*g - 3*h) - 6*f*f*h -
- e*(6*f*f + g*(18*g + h) - 3*f*(3*g + 4*h)))) +
- 3*c*(3*b*(e*e*h + 3*f*g*h - e*(3*f*g - 6*f*h + 6*g*h + h*h)) +
+
++ x*(-3*(27*b*b*e*g*g - 27*a*b*f*g*g + 9*a*a*g*g*g - 18*b*b*e*f*h + 18*a*b*f*f*h + 3*a*b*e*g*h -
+ 27*b*b*e*g*h - 9*a*a*f*g*h + 27*a*b*f*g*h - 9*a*a*g*g*h + a*a*e*h*h - 9*a*b*e*h*h +
+ 27*b*b*e*h*h + 6*a*a*f*h*h - 18*a*b*f*h*h - 9*b*b*f*h*h + 3*a*a*g*h*h +
+ 6*a*b*g*h*h - a*a*h*h*h + 9*c*c*(e*e*(g - 3*h) - 3*f*f*h + e*(3*f + 2*g)*h) +
+ d*d*(e*e*e - 9*f*f*f + 9*e*f*(f + g) - e*e*(3*f + 6*g + h)) +
+ d*(-3*c*(-9*f*f*g + e*e*(2*f - 6*g - 3*h) + e*(9*f*g + 6*g*g + f*h)) +
+ a*(-18*f*f*f - 18*e*g*g + 18*g*g*g - 2*e*e*h + 3*e*g*h + 2*e*h*h + 9*f*f*(3*g + 2*h) +
+ 3*f*(6*e*g - 9*g*g - e*h - 6*g*h)) - 3*b*(9*f*g*g + e*e*(4*g - 3*h) - 6*f*f*h -
+ e*(6*f*f + g*(18*g + h) - 3*f*(3*g + 4*h)))) +
+ 3*c*(3*b*(e*e*h + 3*f*g*h - e*(3*f*g - 6*f*h + 6*g*h + h*h)) +
a*(9*f*f*(g - 2*h) + f*h*(-e + 9*g + 4*h) - 3*(2*g*g*h + e*(2*g*g - 4*g*h + h*h))))) )
-
-+ x*3*(-2*a*d*e*e - 7*d*d*e*e + 15*a*d*e*f + 21*d*d*e*f - 9*a*d*f*f - 18*d*d*f*f - 15*a*d*e*g -
- 3*d*d*e*g - 9*a*a*f*g + 9*d*d*f*g + 18*a*a*g*g + 9*a*d*g*g + 2*a*a*e*h - 2*d*d*e*h +
- 3*a*a*f*h + 15*a*d*f*h - 21*a*a*g*h - 15*a*d*g*h + 7*a*a*h*h + 2*a*d*h*h -
- 9*c*c*(2*e*e + 3*f*f + 3*f*h - 2*g*h + e*(-3*f - 4*g + h)) +
- 9*b*b*(3*g*g - 3*g*h + 2*h*(-2*f + h) + e*(-2*f + 3*g + h)) +
- 3*b*(3*c*(e*e + 3*e*(f - 3*g) + (9*f - 3*g - h)*h) + a*(6*f*f + e*g - 9*f*g - 9*g*g - 5*e*h + 9*f*h + 14*g*h - 7*h*h) +
- d*(-e*e + 12*f*f - 27*f*g + e*(-9*f + 20*g - 5*h) + g*(9*g + h))) +
- 3*c*(a*(-(e*f) - 9*f*f + 27*f*g - 12*g*g + 5*e*h - 20*f*h + 9*g*h + h*h) +
- d*(7*e*e + 9*f*f + 9*f*g - 6*g*g - f*h + e*(-14*f - 9*g + 5*h))))*y
-
+
++ x*3*(-2*a*d*e*e - 7*d*d*e*e + 15*a*d*e*f + 21*d*d*e*f - 9*a*d*f*f - 18*d*d*f*f - 15*a*d*e*g -
+ 3*d*d*e*g - 9*a*a*f*g + 9*d*d*f*g + 18*a*a*g*g + 9*a*d*g*g + 2*a*a*e*h - 2*d*d*e*h +
+ 3*a*a*f*h + 15*a*d*f*h - 21*a*a*g*h - 15*a*d*g*h + 7*a*a*h*h + 2*a*d*h*h -
+ 9*c*c*(2*e*e + 3*f*f + 3*f*h - 2*g*h + e*(-3*f - 4*g + h)) +
+ 9*b*b*(3*g*g - 3*g*h + 2*h*(-2*f + h) + e*(-2*f + 3*g + h)) +
+ 3*b*(3*c*(e*e + 3*e*(f - 3*g) + (9*f - 3*g - h)*h) + a*(6*f*f + e*g - 9*f*g - 9*g*g - 5*e*h + 9*f*h + 14*g*h - 7*h*h) +
+ d*(-e*e + 12*f*f - 27*f*g + e*(-9*f + 20*g - 5*h) + g*(9*g + h))) +
+ 3*c*(a*(-(e*f) - 9*f*f + 27*f*g - 12*g*g + 5*e*h - 20*f*h + 9*g*h + h*h) +
+ d*(7*e*e + 9*f*f + 9*f*g - 6*g*g - f*h + e*(-14*f - 9*g + 5*h))))*y
+
- x*3*Power(a - 3*b + 3*c - d,2)*(e - 3*f + 3*g - h)*Power(y,2)
-
+
*/
-
+
const int factors = 8;
struct coeff {
@@ -276,7 +276,7 @@ void cubecode_test(int test) {
"\n ", 'A' + (it - c.begin()));
if (co[0].s > 0) {
printf(" ");
- }
+ }
if (abs(co[0].s) == 1) {
printf(" ");
}
diff --git a/experimental/Intersection/CubicParameterization_Test.cpp b/experimental/Intersection/CubicParameterization_Test.cpp
index 716aaec9e2..2139f3bc6b 100644
--- a/experimental/Intersection/CubicParameterization_Test.cpp
+++ b/experimental/Intersection/CubicParameterization_Test.cpp
@@ -91,7 +91,7 @@ void CubicParameterization_Test() {
for (size_t index = firstCubicParameterizationTest; index < cubics_count; ++index) {
for (size_t inner = 0; inner < 4; inner += 3) {
if (!point_on_parameterized_curve(cubics[index], cubics[index][inner])) {
- printf("%s [%zu,%zu] 1 parameterization failed\n",
+ printf("%s [%zu,%zu] 1 parameterization failed\n",
__FUNCTION__, index, inner);
}
if (!point_on_parameterized_curve(cubics[index], cubics[index ^ 1][inner])) {
diff --git a/experimental/Intersection/CubicReduceOrder.cpp b/experimental/Intersection/CubicReduceOrder.cpp
index 84f2079826..b9c3c59581 100644
--- a/experimental/Intersection/CubicReduceOrder.cpp
+++ b/experimental/Intersection/CubicReduceOrder.cpp
@@ -30,7 +30,7 @@ static int vertical_line(const Cubic& cubic, Cubic& reduction) {
if (reduction[smaller].y > yExtrema) {
reduction[smaller].y = yExtrema;
continue;
- }
+ }
if (reduction[larger].y < yExtrema) {
reduction[larger].y = yExtrema;
}
@@ -50,7 +50,7 @@ static int horizontal_line(const Cubic& cubic, Cubic& reduction) {
if (reduction[smaller].x > xExtrema) {
reduction[smaller].x = xExtrema;
continue;
- }
+ }
if (reduction[larger].x < xExtrema) {
reduction[larger].x = xExtrema;
}
@@ -183,7 +183,7 @@ http://kaba.hilvi.org
// reduce to a quadratic or smaller
// look for identical points
-// look for all four points in a line
+// look for all four points in a line
// note that three points in a line doesn't simplify a cubic
// look for approximation with single quadratic
// save approximation with multiple quadratics for later
diff --git a/experimental/Intersection/CubicReduceOrder_Test.cpp b/experimental/Intersection/CubicReduceOrder_Test.cpp
index 98662e2049..4a8e622026 100644
--- a/experimental/Intersection/CubicReduceOrder_Test.cpp
+++ b/experimental/Intersection/CubicReduceOrder_Test.cpp
@@ -37,7 +37,7 @@ void CubicReduceOrder_Test() {
int firstQuadraticLineTest = run == RunAll ? 0 : run == RunQuadraticLines ? firstTestIndex : INT_MAX;
int firstQuadraticModLineTest = run == RunAll ? 0 : run == RunQuadraticModLines ? firstTestIndex : INT_MAX;
int firstComputedLinesTest = run == RunAll ? 0 : run == RunComputedLines ? firstTestIndex : INT_MAX;
-
+
for (index = firstPointDegeneratesTest; index < pointDegenerates_count; ++index) {
const Cubic& cubic = pointDegenerates[index];
order = reduceOrder(cubic, reduce, kReduceOrder_QuadraticsAllowed);
@@ -105,11 +105,11 @@ void CubicReduceOrder_Test() {
printf("[%d] line mod quad order=%d\n", (int) index, order);
}
}
-
+
// test if computed line end points are valid
for (index = firstComputedLinesTest; index < lines_count; ++index) {
const Cubic& cubic = lines[index];
- bool controlsInside = controls_inside(cubic);
+ bool controlsInside = controls_inside(cubic);
order = reduceOrder(cubic, reduce, kReduceOrder_QuadraticsAllowed);
if (reduce[0].x == reduce[1].x && reduce[0].y == reduce[1].y) {
printf("[%d] line computed ends match order=%d\n", (int) index, order);
@@ -132,7 +132,7 @@ void CubicReduceOrder_Test() {
|| !approximately_equal(reduce[1].y, bounds.top) && !approximately_equal(reduce[1].y, bounds.bottom)) {
printf("[%d] line computed tight bounds order=%d\n", (int) index, order);
}
-
+
}
}
}
diff --git a/experimental/Intersection/CubicSubDivide.cpp b/experimental/Intersection/CubicSubDivide.cpp
index 0c6ed424f3..98250ad426 100644
--- a/experimental/Intersection/CubicSubDivide.cpp
+++ b/experimental/Intersection/CubicSubDivide.cpp
@@ -3,21 +3,21 @@
/*
Given a cubic c, t1, and t2, find a small cubic segment.
-
+
The new cubic is defined as points A, B, C, and D, where
s1 = 1 - t1
s2 = 1 - t2
A = c[0]*s1*s1*s1 + 3*c[1]*s1*s1*t1 + 3*c[2]*s1*t1*t1 + c[3]*t1*t1*t1
D = c[0]*s2*s2*s2 + 3*c[1]*s2*s2*t2 + 3*c[2]*s2*t2*t2 + c[3]*t2*t2*t2
-
+
We don't have B or C. So We define two equations to isolate them.
First, compute two reference T values 1/3 and 2/3 from t1 to t2:
-
+
c(at (2*t1 + t2)/3) == E
c(at (t1 + 2*t2)/3) == F
-
+
Next, compute where those values must be if we know the values of B and C:
-
+
_12 = A*2/3 + B*1/3
12_ = A*1/3 + B*2/3
_23 = B*2/3 + C*1/3
@@ -36,9 +36,9 @@
= F
E*27 = A*8 + B*12 + C*6 + D
F*27 = A + B*6 + C*12 + D*8
-
+
Group the known values on one side:
-
+
M = E*27 - A*8 - D = B*12 + C* 6
N = F*27 - A - D*8 = B* 6 + C*12
M*2 - N = B*18
@@ -46,7 +46,7 @@ Group the known values on one side:
B = (M*2 - N)/18
C = (N*2 - M)/18
*/
-
+
static double interp_cubic_coords(const double* src, double t)
{
double ab = interp(src[0], src[2], t);
@@ -57,7 +57,7 @@ static double interp_cubic_coords(const double* src, double t)
double abcd = interp(abc, bcd, t);
return abcd;
}
-
+
void sub_divide(const Cubic& src, double t1, double t2, Cubic& dst) {
double ax = dst[0].x = interp_cubic_coords(&src[0].x, t1);
double ay = dst[0].y = interp_cubic_coords(&src[0].y, t1);
diff --git a/experimental/Intersection/DataTypes.cpp b/experimental/Intersection/DataTypes.cpp
index db153f6f9a..546665cebf 100644
--- a/experimental/Intersection/DataTypes.cpp
+++ b/experimental/Intersection/DataTypes.cpp
@@ -7,7 +7,7 @@
extern "C" {
#endif
-void *memcpy(void *, const void *, size_t);
+void *memcpy(void *, const void *, size_t);
#ifdef __cplusplus
}
@@ -29,7 +29,7 @@ union Float_t
bool Negative() const { return (i >> 31) != 0; }
int32_t RawMantissa() const { return i & ((1 << 23) - 1); }
int32_t RawExponent() const { return (i >> 23) & 0xFF; }
-
+
int32_t i;
float f;
#ifdef _DEBUG
@@ -41,25 +41,25 @@ union Float_t
} parts;
#endif
};
-
+
bool AlmostEqualUlps(float A, float B, int maxUlpsDiff)
{
Float_t uA(A);
Float_t uB(B);
-
+
// Different signs means they do not match.
if (uA.Negative() != uB.Negative())
{
// Check for equality to make sure +0==-0
return A == B;
}
-
+
// Find the difference in ULPs.
int ulpsDiff = abs(uA.i - uB.i);
return ulpsDiff <= maxUlpsDiff;
}
-int UlpsDiff(float A, float B)
+int UlpsDiff(float A, float B)
{
Float_t uA(A);
Float_t uB(B);
diff --git a/experimental/Intersection/DataTypes.h b/experimental/Intersection/DataTypes.h
index c06e6ee827..8c924af48d 100644
--- a/experimental/Intersection/DataTypes.h
+++ b/experimental/Intersection/DataTypes.h
@@ -59,7 +59,7 @@ const double SquaredEpsilon = PointEpsilon * PointEpsilon;
#endif
inline bool approximately_zero(double x) {
-
+
return fabs(x) < FLT_EPSILON;
}
@@ -121,7 +121,7 @@ struct _Point {
friend bool operator!=(const _Point& a, const _Point& b) {
return a.x!= b.x || a.y != b.y;
}
-
+
bool approximatelyEqual(const _Point& a) const {
return approximately_equal(a.y, y) && approximately_equal(a.x, x);
}
@@ -137,7 +137,7 @@ struct _Rect {
double top;
double right;
double bottom;
-
+
void add(const _Point& pt) {
if (left > pt.x) {
left = pt.x;
@@ -152,17 +152,17 @@ struct _Rect {
bottom = pt.y;
}
}
-
+
void set(const _Point& pt) {
left = right = pt.x;
top = bottom = pt.y;
}
-
+
void setBounds(const _Line& line) {
set(line[0]);
add(line[1]);
}
-
+
void setBounds(const Cubic& );
void setBounds(const Quadratic& );
void setRawBounds(const Cubic& );
diff --git a/experimental/Intersection/EdgeDemo.cpp b/experimental/Intersection/EdgeDemo.cpp
index 21eefee1f3..33aae21750 100644
--- a/experimental/Intersection/EdgeDemo.cpp
+++ b/experimental/Intersection/EdgeDemo.cpp
@@ -68,7 +68,7 @@ static bool drawCircles(SkCanvas* canvas, int step, bool useOld)
return true;
}
-static void createStar(SkPath& path, SkScalar innerRadius, SkScalar outerRadius,
+static void createStar(SkPath& path, SkScalar innerRadius, SkScalar outerRadius,
SkScalar startAngle, int points, SkPoint center) {
SkScalar angle = startAngle;
for (int index = 0; index < points * 2; ++index) {
diff --git a/experimental/Intersection/EdgeWalker.cpp b/experimental/Intersection/EdgeWalker.cpp
index 4442e9226a..47bd0373e8 100644
--- a/experimental/Intersection/EdgeWalker.cpp
+++ b/experimental/Intersection/EdgeWalker.cpp
@@ -275,10 +275,10 @@ bounds for edge
sort
active T
-if a contour's bounds is outside of the active area, no need to create edges
+if a contour's bounds is outside of the active area, no need to create edges
*/
-/* given one or more paths,
+/* given one or more paths,
find the bounds of each contour, select the active contours
for each active contour, compute a set of edges
each edge corresponds to one or more lines and curves
@@ -303,7 +303,7 @@ void contourBounds(const SkPath& path, SkTDArray<SkRect>& boundsArray) {
bounds.set(pts[0].fX, pts[0].fY, pts[0].fX, pts[0].fY);
count = 0;
break;
- case SkPath::kLine_Verb:
+ case SkPath::kLine_Verb:
count = 1;
break;
case SkPath::kQuad_Verb:
@@ -611,7 +611,7 @@ public:
one, two, endPt1.fX < endPt2.fX ? "true" : "false");
#endif
return endPt1.fX < endPt2.fX;
- }
+ }
SkScalar dx1y2 = (startPt1.fX - endPt1.fX) * dy2;
SkScalar dx2y1 = (startPt2.fX - endPt2.fX) * dy1;
#if DEBUG_OUT_LESS_THAN
@@ -708,7 +708,7 @@ public:
for (index = 0; index < count; ++index) {
const OutEdge& edge = fEdges[index];
uint8_t verb = edge.fVerb;
- SkDebugf("%s %d edge=%d %s (%1.9g,%1.9g) (%1.9g,%1.9g)\n",
+ SkDebugf("%s %d edge=%d %s (%1.9g,%1.9g) (%1.9g,%1.9g)\n",
index == 0 ? __FUNCTION__ : " ",
index + 1, edge.fID, kLVerbStr[verb], edge.fPts[0].fX,
edge.fPts[0].fY, edge.fPts[verb].fX, edge.fPts[verb].fY);
@@ -754,7 +754,7 @@ public:
, fBottomIntercepts(0)
, fExplicit(false) {
}
-
+
Intercepts& operator=(const Intercepts& src) {
fTs = src.fTs;
fTopIntercepts = src.fTopIntercepts;
@@ -808,7 +808,7 @@ public:
unsigned char fTopIntercepts; // 0=init state 1=1 edge >1=multiple edges
unsigned char fBottomIntercepts;
bool fExplicit; // if set, suppress 0 and 1
-
+
};
struct HorizontalEdge {
@@ -842,7 +842,7 @@ struct InEdge {
// Avoid collapsing t values that are close to the same since
// we walk ts to describe consecutive intersections. Since a pair of ts can
// be nearly equal, any problems caused by this should be taken care
- // of later.
+ // of later.
int add(double* ts, size_t count, ptrdiff_t verbIndex) {
// FIXME: in the pathological case where there is a ton of intercepts, binary search?
bool foundIntercept = false;
@@ -885,7 +885,7 @@ struct InEdge {
fContainsIntercepts |= foundIntercept;
return insertedAt;
}
-
+
void addPartial(SkTArray<InEdge>& edges, int ptStart, int ptEnd,
int verbStart, int verbEnd) {
InEdge* edge = edges.push_back_n(1);
@@ -954,7 +954,7 @@ struct InEdge {
}
fContainsIntercepts = fIntersected = false;
}
-
+
void flip() {
size_t index;
size_t last = fPts.count() - 1;
@@ -966,7 +966,7 @@ struct InEdge {
SkTSwap<uint8_t>(fVerbs[index], fVerbs[last]);
}
}
-
+
void flipTs() {
SkASSERT(fIntercepts.count() == 1);
Intercepts& intercepts = fIntercepts[0];
@@ -1006,7 +1006,7 @@ struct InEdge {
++ptPtr;
}
}
-
+
// recompute bounds based on subrange of T values
void setSubBounds() {
SkASSERT(fIntercepts.count() == 1);
@@ -1078,7 +1078,7 @@ struct InEdge {
__FUNCTION__, lastSplit, firstSplit);
#endif
}
- addSplit(edges, pts, verb, intercepts,
+ addSplit(edges, pts, verb, intercepts,
firstSplit, tIndex, true);
#if DEBUG_SPLIT
SkDebugf("%s addSplit 2 tIndex=%d,%d flip\n",
@@ -1180,7 +1180,7 @@ class InEdgeBuilder {
public:
InEdgeBuilder(const SkPath& path, bool ignoreHorizontal, SkTArray<InEdge>& edges,
- SkTDArray<HorizontalEdge>& horizontalEdges)
+ SkTDArray<HorizontalEdge>& horizontalEdges)
: fPath(path)
, fCurrentEdge(NULL)
, fEdges(edges)
@@ -1332,7 +1332,7 @@ struct WorkEdge {
fPts += *fVerb++;
return fVerb != fEdge->fVerbs.end();
}
-
+
const SkPoint* lastPoints() const {
SkASSERT(fPts >= fEdge->fPts.begin() + lastVerb());
return &fPts[-lastVerb()];
@@ -1384,7 +1384,7 @@ public:
if (fVerb != SkPath::kLine_Verb ? noIntersect(rh) : rh.noIntersect(*this)) {
return abCompare(fAbove, fBelow, rh.fAbove, rh.fBelow);
}
- // use whichever of top/tangent tangent/bottom overlaps more
+ // use whichever of top/tangent tangent/bottom overlaps more
// with line top/bot
// assumes quad/cubic can already be upconverted to cubic/cubic
const SkPoint* line[2];
@@ -1405,7 +1405,7 @@ public:
// FIXME: code has been abandoned, incomplete....
return false;
}
-
+
bool abCompare(const SkPoint& a1, const SkPoint& a2, const SkPoint& b1,
const SkPoint& b2) const {
double topD = a1.fX - b1.fX;
@@ -1498,7 +1498,7 @@ public:
SkASSERT(!fExplicitTs);
fTIndex = fTs->count() + 1;
}
-
+
void calcAboveBelow(double tAbove, double tBelow) {
fVerb = fWorkEdge.verb();
switch (fVerb) {
@@ -1520,7 +1520,7 @@ public:
CubicSubDivide(fWorkEdge.fPts, tAbove, tBelow, cubic);
fAbove = cubic[0];
// FIXME: can't see how quad logic for how tangent is used
- // extends to cubic
+ // extends to cubic
fTangent = cubic[0] != cubic[1] ? cubic[1]
: cubic[0] != cubic[2] ? cubic[2] : cubic[3];
fBelow = cubic[3];
@@ -1574,7 +1574,7 @@ public:
bool done(SkScalar bottom) const {
return fDone || fYBottom >= bottom;
}
-
+
void fixBelow() {
if (fFixBelow) {
fTBelow = nextT();
@@ -1636,11 +1636,11 @@ public:
// SkPath::Verb lastVerb() const {
// return fDone ? fWorkEdge.lastVerb() : fWorkEdge.verb();
// }
-
+
const SkPoint* lastPoints() const {
return fDone ? fWorkEdge.lastPoints() : fWorkEdge.points();
}
-
+
bool noIntersect(const ActiveEdge& ) const {
// incomplete
return false;
@@ -1683,7 +1683,7 @@ public:
}
return false;
}
-
+
bool swapUnordered(const ActiveEdge* edge, SkScalar /* bottom */) const {
SkASSERT(fVerb != SkPath::kLine_Verb
|| edge->fVerb != SkPath::kLine_Verb);
@@ -1771,7 +1771,7 @@ public:
}
return IsCoincident(curveSample, lineEdge->fAbove, lineEdge->fBelow);
}
-
+
double nextT() const {
SkASSERT(fTIndex <= fTs->count() - fExplicitTs);
return t(fTIndex + 1);
@@ -1785,7 +1785,7 @@ public:
if (fExplicitTs) {
SkASSERT(tIndex < fTs->count());
return (*fTs)[tIndex];
- }
+ }
if (tIndex == 0) {
return 0;
}
@@ -1805,7 +1805,7 @@ private:
void extractAboveBelow(ActiveEdge& extracted) const {
SkPoint curve[4];
switch (fVerb) {
- case SkPath::kLine_Verb:
+ case SkPath::kLine_Verb:
extracted.fAbove = fAbove;
extracted.fTangent = fTangent;
return;
@@ -1854,10 +1854,10 @@ static void addToActive(SkTDArray<ActiveEdge>& activeEdges, const InEdge* edge)
// Find any intersections in the range of active edges. A pair of edges, on
// either side of another edge, may change the winding contribution for part of
-// the edge.
+// the edge.
// Keep horizontal edges just for
// the purpose of computing when edges change their winding contribution, since
-// this is essentially computing the horizontal intersection.
+// this is essentially computing the horizontal intersection.
static void addBottomT(InEdge** currentPtr, InEdge** lastPtr,
HorizontalEdge** horizontal) {
InEdge** testPtr = currentPtr - 1;
@@ -2134,7 +2134,7 @@ static SkScalar computeInterceptBottom(SkTDArray<ActiveEdge>& activeEdges,
return bottom;
}
-static SkScalar findBottom(InEdge** currentPtr,
+static SkScalar findBottom(InEdge** currentPtr,
InEdge** edgeListEnd, SkTDArray<ActiveEdge>* activeEdges, SkScalar y,
bool /*asFill*/, InEdge**& testPtr) {
InEdge* current = *currentPtr;
@@ -2154,7 +2154,7 @@ static SkScalar findBottom(InEdge** currentPtr,
if (testTop > y) {
bottom = testTop;
break;
- }
+ }
if (y < testBottom) {
if (bottom > testBottom) {
bottom = testBottom;
@@ -2208,7 +2208,7 @@ static void skipCoincidence(int lastWinding, int winding, int windingMask,
ActiveEdge* activePtr, ActiveEdge* firstCoincident) {
if (((lastWinding & windingMask) == 0) ^ (winding & windingMask) != 0) {
return;
- }
+ }
// FIXME: ? shouldn't this be if (lastWinding & windingMask) ?
if (lastWinding) {
#if DEBUG_ADJUST_COINCIDENT
@@ -2374,7 +2374,7 @@ static SkScalar adjustCoincident(SkTDArray<ActiveEdge*>& edgeList,
int priorWinding = winding;
winding += activePtr->fWorkEdge.winding();
nextPtr = edgeList[index];
- if (activePtr->fSkip && nextPtr->fSkip
+ if (activePtr->fSkip && nextPtr->fSkip
&& activePtr->fCoincident == nextPtr->fCoincident) {
if (!firstCoincident) {
firstCoincident = activePtr;
@@ -2441,7 +2441,7 @@ static SkScalar adjustCoincident(SkTDArray<ActiveEdge*>& edgeList,
}
// stitch edge and t range that satisfies operation
-static void stitchEdge(SkTDArray<ActiveEdge*>& edgeList, SkScalar
+static void stitchEdge(SkTDArray<ActiveEdge*>& edgeList, SkScalar
#if DEBUG_STITCH_EDGE
y
#endif
@@ -2487,10 +2487,10 @@ y
SkPath::Verb verb = activePtr->fVerb;
do {
nextT = activePtr->nextT();
- // FIXME: obtuse: want efficient way to say
+ // FIXME: obtuse: want efficient way to say
// !currentT && currentT != 1 || !nextT && nextT != 1
if (currentT * nextT != 0 || currentT + nextT != 1) {
- // OPTIMIZATION: if !inWinding, we only need
+ // OPTIMIZATION: if !inWinding, we only need
// clipped[1].fY
switch (verb) {
case SkPath::kLine_Verb:
@@ -2551,7 +2551,7 @@ y
}
currentT = nextT;
moreToDo = activePtr->advanceT();
- activePtr->fYBottom = clipped[verb].fY; // was activePtr->fCloseCall ? bottom :
+ activePtr->fYBottom = clipped[verb].fY; // was activePtr->fCloseCall ? bottom :
// clearing the fSkip/fCloseCall bit here means that trailing edges
// fall out of sync, if one edge is long and another is a series of short pieces
@@ -2660,7 +2660,7 @@ void simplify(const SkPath& path, bool asFill, SkPath& simple) {
// each contour will need to know whether it is CW or CCW, and then whether
// a ray from that contour hits any a contour that contains it. The ray can
// move to the left and then arbitrarily move up or down (as long as it never
- // moves to the right) to find a reference sibling contour or containing
+ // moves to the right) to find a reference sibling contour or containing
// contour. If the contour is part of an intersection, the companion contour
// that is part of the intersection can determine the containership.
if (builder.containsCurves()) {
diff --git a/experimental/Intersection/EdgeWalkerPolygon4x4_Test.cpp b/experimental/Intersection/EdgeWalkerPolygon4x4_Test.cpp
index befac71c7c..624ef3880b 100755
--- a/experimental/Intersection/EdgeWalkerPolygon4x4_Test.cpp
+++ b/experimental/Intersection/EdgeWalkerPolygon4x4_Test.cpp
@@ -81,7 +81,7 @@ void Simplify4x4QuadralateralsThreaded_Test(int& testsRun)
for (int a = 0; a < 16; ++a) {
for (int b = a ; b < 16; ++b) {
for (int c = b ; c < 16; ++c) {
- for (int d = c; d < 16; ++d) {
+ for (int d = c; d < 16; ++d) {
testsRun += dispatchTest4(testSimplify4x4QuadralateralsMain,
a, b, c, d);
}
diff --git a/experimental/Intersection/EdgeWalkerPolygons_Test.cpp b/experimental/Intersection/EdgeWalkerPolygons_Test.cpp
index 80ef5270ce..78269c4097 100644
--- a/experimental/Intersection/EdgeWalkerPolygons_Test.cpp
+++ b/experimental/Intersection/EdgeWalkerPolygons_Test.cpp
@@ -16,7 +16,7 @@ static void testSimplifyTriangle() {
path.lineTo(20,30);
path.close();
testSimplify(path, true, out, bitmap); // expect |\/|
- // |__|
+ // |__|
}
static void testSimplifyTriangle3() {
@@ -232,7 +232,7 @@ static void testSimplifyTriangle17() {
path.close();
testSimplify(path, true, out, bitmap);
}
-
+
static void testSimplifyTriangle18() {
SkPath path, out;
path.moveTo(0, 0);
@@ -315,7 +315,7 @@ static void testSimplifyDegenerateTriangle2() {
static void testSimplifyWindingParallelogram() {
SkPath path, out;
path.setFillType(SkPath::kWinding_FillType);
- path.moveTo(20,10); // parallelogram _
+ path.moveTo(20,10); // parallelogram _
path.lineTo(30,30); // \ \ .
path.lineTo(40,30); // \_\ .
path.lineTo(30,10);
@@ -326,13 +326,13 @@ static void testSimplifyWindingParallelogram() {
path.lineTo(30,10);
path.close();
testSimplify(path, true, out, bitmap); // expect _
- // / \ .
+ // / \ .
} // /___\ .
static void testSimplifyXorParallelogram() {
SkPath path, out;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.moveTo(20,10); // parallelogram _
+ path.moveTo(20,10); // parallelogram _
path.lineTo(30,30); // \ \ .
path.lineTo(40,30); // \_\ .
path.lineTo(30,10);
@@ -352,7 +352,7 @@ static void testSimplifyTriangle2() {
path.lineTo(10,30); // |_\ .
path.lineTo(20,30);
path.close();
- path.moveTo(10,10); // triangle _
+ path.moveTo(10,10); // triangle _
path.lineTo(20,10); // \ |
path.lineTo(20,30); // \|
path.close(); // _
diff --git a/experimental/Intersection/EdgeWalkerQuadratic4x4_Test.cpp b/experimental/Intersection/EdgeWalkerQuadratic4x4_Test.cpp
index 1f5af8ec6c..aa11a2fa40 100644
--- a/experimental/Intersection/EdgeWalkerQuadratic4x4_Test.cpp
+++ b/experimental/Intersection/EdgeWalkerQuadratic4x4_Test.cpp
@@ -81,7 +81,7 @@ void Simplify4x4QuadraticsThreaded_Test(int& testsRun)
for (int a = 0; a < 16; ++a) {
for (int b = a ; b < 16; ++b) {
for (int c = b ; c < 16; ++c) {
- for (int d = c; d < 16; ++d) {
+ for (int d = c; d < 16; ++d) {
testsRun += dispatchTest4(testSimplify4x4QuadraticsMain,
a, b, c, d);
}
diff --git a/experimental/Intersection/EdgeWalkerRectangles_Test.cpp b/experimental/Intersection/EdgeWalkerRectangles_Test.cpp
index a5448e31b6..f721aa9820 100644
--- a/experimental/Intersection/EdgeWalkerRectangles_Test.cpp
+++ b/experimental/Intersection/EdgeWalkerRectangles_Test.cpp
@@ -64,7 +64,7 @@ static void testSimplifyMulti() {
if (out != expected) {
SkDebugf("%s expected equal\n", __FUNCTION__);
}
-
+
path = out;
path.addRect(30, 10, 40, 20);
path.addRect(10, 30, 20, 40);
@@ -76,7 +76,7 @@ static void testSimplifyMulti() {
if (rect != SkRect::MakeLTRB(10, 10, 40, 40)) {
SkDebugf("%s expected union\n", __FUNCTION__);
}
-
+
path = out;
path.addRect(10, 10, 40, 40, SkPath::kCCW_Direction);
simplify(path, true, out);
@@ -205,7 +205,7 @@ static void testSimplifyDiagonal() {
}
}
if (boundsPtr != bounds) {
- SkASSERT((bounds[0] == rect1 || bounds[1] == rect1)
+ SkASSERT((bounds[0] == rect1 || bounds[1] == rect1)
&& (bounds[0] == rect2 || bounds[1] == rect2));
} else {
SkASSERT(segments == 8);
@@ -228,7 +228,7 @@ static void assertOneContour(const SkPath& out, bool edge, bool extend) {
case SkPath::kMove_Verb:
SkASSERT(count == 0);
break;
- case SkPath::kLine_Verb:
+ case SkPath::kLine_Verb:
SkASSERT(pts[0].fX == pts[1].fX || pts[0].fY == pts[1].fY);
++count;
break;
@@ -264,21 +264,21 @@ static void testSimplifyCoincident() {
path.addRect(rect2, static_cast<SkPath::Direction>(inDir));
simplify(path, true, out);
assertOneContour(out, edge, extend);
-
+
path.reset();
rect1 = SkRect::MakeLTRB(start[startIndex], 40, stop[stopIndex], 50);
path.addRect(rect1, static_cast<SkPath::Direction>(outDir));
path.addRect(rect2, static_cast<SkPath::Direction>(inDir));
simplify(path, true, out);
assertOneContour(out, edge, extend);
-
+
path.reset();
rect1 = SkRect::MakeLTRB(0, start[startIndex], 10, stop[stopIndex]);
path.addRect(rect1, static_cast<SkPath::Direction>(outDir));
path.addRect(rect2, static_cast<SkPath::Direction>(inDir));
simplify(path, true, out);
assertOneContour(out, edge, extend);
-
+
path.reset();
rect1 = SkRect::MakeLTRB(40, start[startIndex], 50, stop[stopIndex]);
path.addRect(rect1, static_cast<SkPath::Direction>(outDir));
@@ -362,7 +362,7 @@ static void testSimplifyDegenerate() {
if (rect != rect2) {
SkDebugf("%s 1 expected union\n", __FUNCTION__);
}
-
+
path.reset();
rect1 = SkRect::MakeLTRB(start[startIndex], 40, stop[stopIndex], 40);
path.addRect(rect1, static_cast<SkPath::Direction>(outDir));
@@ -374,7 +374,7 @@ static void testSimplifyDegenerate() {
if (rect != rect2) {
SkDebugf("%s 2 expected union\n", __FUNCTION__);
}
-
+
path.reset();
rect1 = SkRect::MakeLTRB(0, start[startIndex], 0, stop[stopIndex]);
path.addRect(rect1, static_cast<SkPath::Direction>(outDir));
@@ -386,7 +386,7 @@ static void testSimplifyDegenerate() {
if (rect != rect2) {
SkDebugf("%s 3 expected union\n", __FUNCTION__);
}
-
+
path.reset();
rect1 = SkRect::MakeLTRB(40, start[startIndex], 40, stop[stopIndex]);
path.addRect(rect1, static_cast<SkPath::Direction>(outDir));
@@ -430,10 +430,10 @@ static void (*simplifyTests[])() = {
testSimplifyCoincident,
testSimplifyCoincidentCW,
testSimplifyCoincidentCCW,
- testSimplifyCoincidentVertical,
+ testSimplifyCoincidentVertical,
testSimplifyCoincidentHorizontal,
- testSimplifyAddL,
- testSimplifyMulti,
+ testSimplifyAddL,
+ testSimplifyMulti,
};
static size_t simplifyTestsCount = sizeof(simplifyTests) / sizeof(simplifyTests[0]);
diff --git a/experimental/Intersection/EdgeWalker_Test.h b/experimental/Intersection/EdgeWalker_Test.h
index d0ae3a5dc2..2a7d5d1979 100644
--- a/experimental/Intersection/EdgeWalker_Test.h
+++ b/experimental/Intersection/EdgeWalker_Test.h
@@ -37,7 +37,7 @@ struct State4 {
int d; // sometimes 1 if abc_is_a_triangle
int testsRun;
char filename[256];
-
+
SkCanvas* canvas;
SkBitmap bitmap;
};
diff --git a/experimental/Intersection/IntersectionUtilities.cpp b/experimental/Intersection/IntersectionUtilities.cpp
index 63a5767866..7321fef49b 100644
--- a/experimental/Intersection/IntersectionUtilities.cpp
+++ b/experimental/Intersection/IntersectionUtilities.cpp
@@ -28,13 +28,13 @@
// to subtract another 52 from it.
exponent -= 1075;
- if (mantissa == 0)
+ if (mantissa == 0)
{
return "0";
}
/* Normalize */
- while((mantissa & 1) == 0)
+ while((mantissa & 1) == 0)
{ /* i.e., Mantissa is even */
mantissa >>= 1;
exponent++;
diff --git a/experimental/Intersection/IntersectionUtilities.h b/experimental/Intersection/IntersectionUtilities.h
index 3dfd3114a4..6ed7f96695 100644
--- a/experimental/Intersection/IntersectionUtilities.h
+++ b/experimental/Intersection/IntersectionUtilities.h
@@ -14,7 +14,7 @@ inline int sideBit(double x) {
/* Given the set [0, 1, 2, 3], and two of the four members, compute an XOR mask
that computes the other two. Note that:
-
+
one ^ two == 3 for (0, 3), (1, 2)
one ^ two < 3 for (0, 1), (0, 2), (1, 3), (2, 3)
3 - (one ^ two) is either 0, 1, or 2
diff --git a/experimental/Intersection/Intersection_Tests.cpp b/experimental/Intersection/Intersection_Tests.cpp
index bf28ccbd2e..100e32c9db 100644
--- a/experimental/Intersection/Intersection_Tests.cpp
+++ b/experimental/Intersection/Intersection_Tests.cpp
@@ -24,7 +24,7 @@ void Intersection_Tests() {
QuadraticBezierClip_Test();
QuadraticIntersection_Test();
SimplifyAddIntersectingTs_Test();
-
+
cubecode_test(1);
convert_testx();
// tests are in dependency / complexity order
diff --git a/experimental/Intersection/Intersections.h b/experimental/Intersection/Intersections.h
index 47c413ac7b..879b54e1f5 100644
--- a/experimental/Intersection/Intersections.h
+++ b/experimental/Intersection/Intersections.h
@@ -36,7 +36,7 @@ public:
void swap() {
fSwap ^= 1;
}
-
+
bool swapped() {
return fSwap;
}
diff --git a/experimental/Intersection/LineCubicIntersection.cpp b/experimental/Intersection/LineCubicIntersection.cpp
index aaee2a1d38..a210fb3603 100644
--- a/experimental/Intersection/LineCubicIntersection.cpp
+++ b/experimental/Intersection/LineCubicIntersection.cpp
@@ -19,12 +19,12 @@ Then using Mathematica, solve for the values of t where the cubic intersects the
line:
(in) Resultant[
- a*(1 - t)^3 + 3*b*(1 - t)^2*t + 3*c*(1 - t)*t^2 + d*t^3 - x,
+ a*(1 - t)^3 + 3*b*(1 - t)^2*t + 3*c*(1 - t)*t^2 + d*t^3 - x,
e*(1 - t)^3 + 3*f*(1 - t)^2*t + 3*g*(1 - t)*t^2 + h*t^3 - i*x - j, x]
(out) -e + j +
3 e t - 3 f t -
3 e t^2 + 6 f t^2 - 3 g t^2 +
- e t^3 - 3 f t^3 + 3 g t^3 - h t^3 +
+ e t^3 - 3 f t^3 + 3 g t^3 - h t^3 +
i ( a -
3 a t + 3 b t +
3 a t^2 - 6 b t^2 + 3 c t^2 -
@@ -33,14 +33,14 @@ line:
if i goes to infinity, we can rewrite the line in terms of x. Mathematica:
(in) Resultant[
- a*(1 - t)^3 + 3*b*(1 - t)^2*t + 3*c*(1 - t)*t^2 + d*t^3 - i*y - j,
+ a*(1 - t)^3 + 3*b*(1 - t)^2*t + 3*c*(1 - t)*t^2 + d*t^3 - i*y - j,
e*(1 - t)^3 + 3*f*(1 - t)^2*t + 3*g*(1 - t)*t^2 + h*t^3 - y, y]
- (out) a - j -
- 3 a t + 3 b t +
+ (out) a - j -
+ 3 a t + 3 b t +
3 a t^2 - 6 b t^2 + 3 c t^2 -
- a t^3 + 3 b t^3 - 3 c t^3 + d t^3 -
- i ( e -
- 3 e t + 3 f t +
+ a t^3 + 3 b t^3 - 3 c t^3 + d t^3 -
+ i ( e -
+ 3 e t + 3 f t +
3 e t^2 - 6 f t^2 + 3 g t^2 -
e t^3 + 3 f t^3 - 3 g t^3 + h t^3 )
@@ -58,13 +58,13 @@ The near-vertical case, in terms of: Ax^3 + Bx^2 + Cx + D == 0
B = 3*( ( a - 2*b + c ) - i*( e - 2*f + g ) )
C = 3*( (-a + b ) - i*(-e + f ) )
D = ( ( a ) - i*( e ) - j )
-
+
For horizontal lines:
(in) Resultant[
- a*(1 - t)^3 + 3*b*(1 - t)^2*t + 3*c*(1 - t)*t^2 + d*t^3 - j,
+ a*(1 - t)^3 + 3*b*(1 - t)^2*t + 3*c*(1 - t)*t^2 + d*t^3 - j,
e*(1 - t)^3 + 3*f*(1 - t)^2*t + 3*g*(1 - t)*t^2 + h*t^3 - y, y]
(out) e - j -
- 3 e t + 3 f t +
+ 3 e t + 3 f t +
3 e t^2 - 6 f t^2 + 3 g t^2 -
e t^3 + 3 f t^3 - 3 g t^3 + h t^3
So the cubic coefficients are:
diff --git a/experimental/Intersection/LineIntersection.cpp b/experimental/Intersection/LineIntersection.cpp
index 3efa240d83..6271edcefe 100644
--- a/experimental/Intersection/LineIntersection.cpp
+++ b/experimental/Intersection/LineIntersection.cpp
@@ -15,7 +15,7 @@ int intersect(const _Line& a, const _Line& b, double aRange[2], double bRange[2]
double ayLen = a[1].y - a[0].y;
double bxLen = b[1].x - b[0].x;
double byLen = b[1].y - b[0].y;
- /* Slopes match when denom goes to zero:
+ /* Slopes match when denom goes to zero:
axLen / ayLen == bxLen / byLen
(ayLen * byLen) * axLen / ayLen == (ayLen * byLen) * bxLen / byLen
byLen * axLen == ayLen * bxLen
@@ -309,11 +309,11 @@ int verticalIntersect(const _Line& line, double top, double bottom,
// from http://www.bryceboe.com/wordpress/wp-content/uploads/2006/10/intersect.py
// 4 subs, 2 muls, 1 cmp
static bool ccw(const _Point& A, const _Point& B, const _Point& C) {
- return (C.y - A.y) * (B.x - A.x) > (B.y - A.y) * (C.x - A.x);
+ return (C.y - A.y) * (B.x - A.x) > (B.y - A.y) * (C.x - A.x);
}
// 16 subs, 8 muls, 6 cmps
bool testIntersect(const _Line& a, const _Line& b) {
- return ccw(a[0], b[0], b[1]) != ccw(a[1], b[0], b[1])
+ return ccw(a[0], b[0], b[1]) != ccw(a[1], b[0], b[1])
&& ccw(a[0], a[1], b[0]) != ccw(a[0], a[1], b[1]);
}
diff --git a/experimental/Intersection/LineIntersection_Test.cpp b/experimental/Intersection/LineIntersection_Test.cpp
index c73c9b3f7c..935a168f06 100644
--- a/experimental/Intersection/LineIntersection_Test.cpp
+++ b/experimental/Intersection/LineIntersection_Test.cpp
@@ -9,7 +9,7 @@ const _Line tests[][2] = {
{{{0, 1}, {0, 1}}, {{0, 0}, {0, 2}}},
{{{0, 0}, {1, 0}}, {{0, 0}, {2, 0}}},
{{{1, 1}, {2, 2}}, {{0, 0}, {3, 3}}},
- {{{166.86950047022856, 112.69654129527828}, {166.86948801592692, 112.69655741235339}},
+ {{{166.86950047022856, 112.69654129527828}, {166.86948801592692, 112.69655741235339}},
{{166.86960700313026, 112.6965477747386}, {166.86925794355412, 112.69656471103423}}}
};
diff --git a/experimental/Intersection/LineParameterization.cpp b/experimental/Intersection/LineParameterization.cpp
index 8bf8acd8ff..83d973e6ac 100644
--- a/experimental/Intersection/LineParameterization.cpp
+++ b/experimental/Intersection/LineParameterization.cpp
@@ -8,7 +8,7 @@ bool implicit_matches(const _Line& one, const _Line& two) {
_Point oneD, twoD;
tangent(one, oneD);
tangent(two, twoD);
- /* See if the slopes match, i.e.
+ /* See if the slopes match, i.e.
dx1 / dy1 == dx2 / dy2
(dy1 * dy2) * dx1 / dy1 == (dy1 * dy2) * dx2 / dy2
dy2 * dx1 == dy1 * dx2
@@ -32,7 +32,7 @@ bool implicit_matches_ulps(const _Line& one, const _Line& two, int ulps) {
_Point oneD, twoD;
tangent(one, oneD);
tangent(two, twoD);
- /* See if the slopes match, i.e.
+ /* See if the slopes match, i.e.
dx1 / dy1 == dx2 / dy2
(dy1 * dy2) * dx1 / dy1 == (dy1 * dy2) * dx2 / dy2
dy2 * dx1 == dy1 * dx2
diff --git a/experimental/Intersection/LineParameters.h b/experimental/Intersection/LineParameters.h
index 202ba46c4c..582ca471b9 100644
--- a/experimental/Intersection/LineParameters.h
+++ b/experimental/Intersection/LineParameters.h
@@ -20,19 +20,19 @@ public:
b = pts[3].x - pts[0].x;
c = pts[0].x * pts[3].y - pts[3].x * pts[0].y;
}
-
+
void cubicEndPoints(const Cubic& pts, int s, int e) {
a = pts[s].y - pts[e].y;
b = pts[e].x - pts[s].x;
c = pts[s].x * pts[e].y - pts[e].x * pts[s].y;
}
-
+
void lineEndPoints(const _Line& pts) {
a = pts[0].y - pts[1].y;
b = pts[1].x - pts[0].x;
c = pts[0].x * pts[1].y - pts[1].x * pts[0].y;
}
-
+
void quadEndPoints(const Quadratic& pts) {
a = pts[0].y - pts[2].y;
b = pts[2].x - pts[0].x;
@@ -61,7 +61,7 @@ public:
c *= reciprocal;
return true;
}
-
+
void cubicDistanceY(const Cubic& pts, Cubic& distance) {
double oneThird = 1 / 3.0;
for (int index = 0; index < 4; ++index) {
@@ -83,16 +83,16 @@ public:
distance[index] = a * pts[index + 1].x + b * pts[index + 1].y + c;
}
}
-
+
void controlPtDistance(const Cubic& pts, int i, int j, double distance[2]) {
distance[0] = a * pts[i].x + b * pts[i].y + c;
distance[1] = a * pts[j].x + b * pts[j].y + c;
}
-
+
double controlPtDistance(const Quadratic& pts) {
return a * pts[1].x + b * pts[1].y + c;
}
-
+
double pointDistance(const _Point& pt) {
return a * pt.x + b * pt.y + c;
}
diff --git a/experimental/Intersection/LineParameteters_Test.cpp b/experimental/Intersection/LineParameteters_Test.cpp
index f806250bd1..92e8001c55 100644
--- a/experimental/Intersection/LineParameteters_Test.cpp
+++ b/experimental/Intersection/LineParameteters_Test.cpp
@@ -13,7 +13,7 @@ const Cubic tests[] = {
{{0, .002}, {1, 0}, {2, 0}, {3, 0}},
{{0, .0002}, {1, 0}, {2, 0}, {3, 0}},
{{0, .00002}, {1, 0}, {2, 0}, {3, 0}},
- {{0, PointEpsilon * 2}, {1, 0}, {2, 0}, {3, 0}},
+ {{0, PointEpsilon * 2}, {1, 0}, {2, 0}, {3, 0}},
};
const double answers[][2] = {
@@ -60,7 +60,7 @@ void LineParameter_Test() {
double normalizedDistance[2];
lineParameters.controlPtDistance(cubic, normalizedDistance);
for (inner = 0; inner < 2; ++inner) {
- if (approximately_equal(fabs(normalizedDistance[inner]),
+ if (approximately_equal(fabs(normalizedDistance[inner]),
answers[index][inner])) {
continue;
}
diff --git a/experimental/Intersection/LineQuadraticIntersection.cpp b/experimental/Intersection/LineQuadraticIntersection.cpp
index c3e6d23e52..f269b71d22 100644
--- a/experimental/Intersection/LineQuadraticIntersection.cpp
+++ b/experimental/Intersection/LineQuadraticIntersection.cpp
@@ -3,13 +3,13 @@
#include "LineUtilities.h"
#include "QuadraticUtilities.h"
-/*
+/*
Find the interection of a line and quadratic by solving for valid t values.
From http://stackoverflow.com/questions/1853637/how-to-find-the-mathematical-function-defining-a-bezier-curve
-"A Bezier curve is a parametric function. A quadratic Bezier curve (i.e. three
-control points) can be expressed as: F(t) = A(1 - t)^2 + B(1 - t)t + Ct^2 where
+"A Bezier curve is a parametric function. A quadratic Bezier curve (i.e. three
+control points) can be expressed as: F(t) = A(1 - t)^2 + B(1 - t)t + Ct^2 where
A, B and C are points and t goes from zero to one.
This will give you two equations:
@@ -17,7 +17,7 @@ This will give you two equations:
x = a(1 - t)^2 + b(1 - t)t + ct^2
y = d(1 - t)^2 + e(1 - t)t + ft^2
-If you add for instance the line equation (y = kx + m) to that, you'll end up
+If you add for instance the line equation (y = kx + m) to that, you'll end up
with three equations and three unknowns (x, y and t)."
Similar to above, the quadratic is represented as
@@ -29,24 +29,24 @@ and the line as
Using Mathematica, solve for the values of t where the quadratic intersects the
line:
- (in) t1 = Resultant[a*(1 - t)^2 + 2*b*(1 - t)*t + c*t^2 - x,
+ (in) t1 = Resultant[a*(1 - t)^2 + 2*b*(1 - t)*t + c*t^2 - x,
d*(1 - t)^2 + 2*e*(1 - t)*t + f*t^2 - g*x - h, x]
- (out) -d + h + 2 d t - 2 e t - d t^2 + 2 e t^2 - f t^2 +
+ (out) -d + h + 2 d t - 2 e t - d t^2 + 2 e t^2 - f t^2 +
g (a - 2 a t + 2 b t + a t^2 - 2 b t^2 + c t^2)
(in) Solve[t1 == 0, t]
(out) {
{t -> (-2 d + 2 e + 2 a g - 2 b g -
- Sqrt[(2 d - 2 e - 2 a g + 2 b g)^2 -
+ Sqrt[(2 d - 2 e - 2 a g + 2 b g)^2 -
4 (-d + 2 e - f + a g - 2 b g + c g) (-d + a g + h)]) /
(2 (-d + 2 e - f + a g - 2 b g + c g))
},
{t -> (-2 d + 2 e + 2 a g - 2 b g +
- Sqrt[(2 d - 2 e - 2 a g + 2 b g)^2 -
+ Sqrt[(2 d - 2 e - 2 a g + 2 b g)^2 -
4 (-d + 2 e - f + a g - 2 b g + c g) (-d + a g + h)]) /
(2 (-d + 2 e - f + a g - 2 b g + c g))
}
}
-
+
Using the results above (when the line tends towards horizontal)
A = (-(d - 2*e + f) + g*(a - 2*b + c) )
B = 2*( (d - e ) - g*(a - b ) )
@@ -57,19 +57,19 @@ If g goes to infinity, we can rewrite the line in terms of x.
And solve accordingly in Mathematica:
- (in) t2 = Resultant[a*(1 - t)^2 + 2*b*(1 - t)*t + c*t^2 - g'*y - h',
+ (in) t2 = Resultant[a*(1 - t)^2 + 2*b*(1 - t)*t + c*t^2 - g'*y - h',
d*(1 - t)^2 + 2*e*(1 - t)*t + f*t^2 - y, y]
- (out) a - h' - 2 a t + 2 b t + a t^2 - 2 b t^2 + c t^2 -
+ (out) a - h' - 2 a t + 2 b t + a t^2 - 2 b t^2 + c t^2 -
g' (d - 2 d t + 2 e t + d t^2 - 2 e t^2 + f t^2)
(in) Solve[t2 == 0, t]
(out) {
{t -> (2 a - 2 b - 2 d g' + 2 e g' -
- Sqrt[(-2 a + 2 b + 2 d g' - 2 e g')^2 -
+ Sqrt[(-2 a + 2 b + 2 d g' - 2 e g')^2 -
4 (a - 2 b + c - d g' + 2 e g' - f g') (a - d g' - h')]) /
(2 (a - 2 b + c - d g' + 2 e g' - f g'))
},
{t -> (2 a - 2 b - 2 d g' + 2 e g' +
- Sqrt[(-2 a + 2 b + 2 d g' - 2 e g')^2 -
+ Sqrt[(-2 a + 2 b + 2 d g' - 2 e g')^2 -
4 (a - 2 b + c - d g' + 2 e g' - f g') (a - d g' - h')])/
(2 (a - 2 b + c - d g' + 2 e g' - f g'))
}
@@ -80,7 +80,7 @@ Thus, if the slope of the line tends towards vertical, we use:
B = 2*(-(a - b ) + g'*(d - e ) )
C = ( (a ) - g'*(d ) - h' )
*/
-
+
class LineQuadraticIntersections : public Intersections {
public:
@@ -156,7 +156,7 @@ int verticalIntersect(double axisIntercept) {
}
protected:
-
+
double findLineT(double t) {
const double* qPtr;
const double* lPtr;
diff --git a/experimental/Intersection/LineQuadraticIntersection_Test.cpp b/experimental/Intersection/LineQuadraticIntersection_Test.cpp
index e641fdcb20..2bb8c6c364 100644
--- a/experimental/Intersection/LineQuadraticIntersection_Test.cpp
+++ b/experimental/Intersection/LineQuadraticIntersection_Test.cpp
@@ -15,7 +15,7 @@ struct lineQuad {
{{{1, 1}, {2, 1}, {0, 2}}, {{0, 0}, {1, 1}}, 1, {{1, 1} }},
{{{0, 0}, {1, 1}, {3, 1}}, {{0, 0}, {3, 1}}, 2, {{0, 0}, {3, 1}}},
{{{2, 0}, {1, 1}, {2, 2}}, {{0, 0}, {0, 2}}, 0 },
- {{{4, 0}, {0, 1}, {4, 2}}, {{3, 1}, {4, 1}}, 0, },
+ {{{4, 0}, {0, 1}, {4, 2}}, {{3, 1}, {4, 1}}, 0, },
{{{0, 0}, {0, 1}, {1, 1}}, {{0, 1}, {1, 0}}, 1, {{.25, .75} }},
};
@@ -100,7 +100,7 @@ void LineQuadraticIntersection_Test() {
}
}
-static void testLineIntersect(State4& state, const Quadratic& quad, const _Line& line,
+static void testLineIntersect(State4& state, const Quadratic& quad, const _Line& line,
const double x, const double y) {
char pathStr[1024];
bzero(pathStr, sizeof(pathStr));
@@ -109,7 +109,7 @@ static void testLineIntersect(State4& state, const Quadratic& quad, const _Line&
str += sprintf(str, " path.quadTo(%1.9g, %1.9g, %1.9g, %1.9g);\n", quad[1].x, quad[1].y, quad[2].x, quad[2].y);
str += sprintf(str, " path.moveTo(%1.9g, %1.9g);\n", line[0].x, line[0].y);
str += sprintf(str, " path.lineTo(%1.9g, %1.9g);\n", line[1].x, line[1].y);
-
+
Intersections intersections;
bool flipped = false;
int result = doIntersect(intersections, quad, line, flipped);
diff --git a/experimental/Intersection/LineUtilities.cpp b/experimental/Intersection/LineUtilities.cpp
index 8a1c0d7c62..32ea54d733 100644
--- a/experimental/Intersection/LineUtilities.cpp
+++ b/experimental/Intersection/LineUtilities.cpp
@@ -31,7 +31,7 @@ void sub_divide(const _Line& line, double t1, double t2, _Line& dst) {
dst[1].y = line[0].y - t2 * delta.y;
}
-// may have this below somewhere else already:
+// may have this below somewhere else already:
// copying here because I thought it was clever
// Copyright 2001, softSurfer (www.softsurfer.com)
@@ -86,15 +86,15 @@ void x_at(const _Point& p1, const _Point& p2, double top, double bottom,
int flags, double& minX, double& maxX) {
if (approximately_equal(p1.y, p2.y)) {
// It should be OK to bail early in this case. There's another edge
- // which shares this end point which can intersect without failing to
+ // which shares this end point which can intersect without failing to
// have a slope ... maybe
return;
}
-
+
// p2.x is always greater than p1.x -- the part of points (p1, p2) are
// moving from the start of the cubic towards its end.
// if p1.y < p2.y, minX can be affected
- // if p1.y > p2.y, maxX can be affected
+ // if p1.y > p2.y, maxX can be affected
double slope = (p2.x - p1.x) / (p2.y - p1.y);
int topFlags = flags & (kFindTopMin | kFindTopMax);
if (topFlags && (top <= p1.y && top >= p2.y
diff --git a/experimental/Intersection/QuadraticBezierClip.cpp b/experimental/Intersection/QuadraticBezierClip.cpp
index e27db7c7eb..ce6efad4c7 100644
--- a/experimental/Intersection/QuadraticBezierClip.cpp
+++ b/experimental/Intersection/QuadraticBezierClip.cpp
@@ -10,7 +10,7 @@ bool bezier_clip(const Quadratic& q1, const Quadratic& q2, double& minT, double&
maxT = 0;
// determine normalized implicit line equation for pt[0] to pt[3]
// of the form ax + by + c = 0, where a*a + b*b == 1
-
+
// find the implicit line equation parameters
LineParameters endLine;
endLine.quadEndPoints(q1);
@@ -20,18 +20,18 @@ bool bezier_clip(const Quadratic& q1, const Quadratic& q2, double& minT, double&
}
double distance = endLine.controlPtDistance(q1);
-
+
// find fat line
double top = 0;
double bottom = distance / 2; // http://students.cs.byu.edu/~tom/557/text/cic.pdf (7.6)
if (top > bottom) {
std::swap(top, bottom);
}
-
+
// compute intersecting candidate distance
Quadratic distance2y; // points with X of (0, 1/2, 1)
endLine.quadDistanceY(q2, distance2y);
-
+
int flags = 0;
if (approximately_lesser(distance2y[0].y, top)) {
flags |= kFindTopMin;
@@ -57,6 +57,6 @@ bool bezier_clip(const Quadratic& q1, const Quadratic& q2, double& minT, double&
}
x_at(distance2y[idx], distance2y[next], top, bottom, flags, minT, maxT);
idx = next;
- } while (idx);
+ } while (idx);
return minT < maxT; // returns false if distance shows no intersection
}
diff --git a/experimental/Intersection/QuadraticIntersection.cpp b/experimental/Intersection/QuadraticIntersection.cpp
index a8e87ef6ea..60672757c1 100644
--- a/experimental/Intersection/QuadraticIntersection.cpp
+++ b/experimental/Intersection/QuadraticIntersection.cpp
@@ -6,11 +6,11 @@
class QuadraticIntersections : public Intersections {
public:
-QuadraticIntersections(const Quadratic& q1, const Quadratic& q2, Intersections& i)
+QuadraticIntersections(const Quadratic& q1, const Quadratic& q2, Intersections& i)
: quad1(q1)
, quad2(q2)
, intersections(i)
- , depth(0)
+ , depth(0)
, splits(0) {
}
@@ -37,10 +37,10 @@ bool intersect() {
}
protected:
-
+
bool intersect(double minT1, double maxT1, double minT2, double maxT2) {
Quadratic smaller, larger;
- // FIXME: carry last subdivide and reduceOrder result with quad
+ // FIXME: carry last subdivide and reduceOrder result with quad
sub_divide(quad1, minT1, maxT1, intersections.swapped() ? larger : smaller);
sub_divide(quad2, minT2, maxT2, intersections.swapped() ? smaller : larger);
Quadratic smallResult;
@@ -55,11 +55,11 @@ bool intersect(double minT1, double maxT1, double minT2, double maxT2) {
return false;
}
if (intersections.swapped()) {
- smallT[0] = interp(minT2, maxT2, smallT[0]);
- largeT[0] = interp(minT1, maxT1, largeT[0]);
+ smallT[0] = interp(minT2, maxT2, smallT[0]);
+ largeT[0] = interp(minT1, maxT1, largeT[0]);
} else {
- smallT[0] = interp(minT1, maxT1, smallT[0]);
- largeT[0] = interp(minT2, maxT2, largeT[0]);
+ smallT[0] = interp(minT1, maxT1, smallT[0]);
+ largeT[0] = interp(minT2, maxT2, largeT[0]);
}
intersections.add(smallT[0], largeT[0]);
return true;
@@ -80,7 +80,7 @@ bool intersect(double minT1, double maxT1, double minT2, double maxT2) {
}
return false;
}
-
+
int split;
if (intersections.swapped()) {
double newMinT1 = interp(minT1, maxT1, minT);
@@ -210,11 +210,11 @@ sqrt(x + iy) = sqrt((r + x) / 2) +/- i*sqrt((r - x) / 2)
where the sign of the imaginary part of the root is taken to be same as the sign
of the imaginary part of the original number, and
-
+
r = abs(x + iy) = sqrt(x^2 + y^2)
-is the absolute value or modulus of the original number. The real part of the
+is the absolute value or modulus of the original number. The real part of the
principal value is always non-negative.
-The other square root is simply –1 times the principal square root; in other
+The other square root is simply –1 times the principal square root; in other
words, the two square roots of a number sum to 0.
*/
diff --git a/experimental/Intersection/QuadraticParameterization.cpp b/experimental/Intersection/QuadraticParameterization.cpp
index fb45b17ebb..675b1976f6 100644
--- a/experimental/Intersection/QuadraticParameterization.cpp
+++ b/experimental/Intersection/QuadraticParameterization.cpp
@@ -3,7 +3,7 @@
/* from http://tom.cs.byu.edu/~tom/papers/cvgip84.pdf 4.1
*
- * This paper proves that Syvester's method can compute the implicit form of
+ * This paper proves that Syvester's method can compute the implicit form of
* the quadratic from the parameterized form.
*
* Given x = a*t*t + b*t + c (the parameterized form)
diff --git a/experimental/Intersection/QuadraticParameterization_Test.cpp b/experimental/Intersection/QuadraticParameterization_Test.cpp
index e355140b47..793b796d9e 100644
--- a/experimental/Intersection/QuadraticParameterization_Test.cpp
+++ b/experimental/Intersection/QuadraticParameterization_Test.cpp
@@ -27,7 +27,7 @@ void QuadraticCoincidence_Test() {
for (size_t two = 0; two < quadsCount; ++two) {
for (size_t inner = 0; inner < 3; inner += 2) {
if (!point_on_parameterized_curve(*quads[one], (*quads[two])[inner])) {
- printf("%s %zu [%zu,%zu] %zu parameterization failed\n",
+ printf("%s %zu [%zu,%zu] %zu parameterization failed\n",
__FUNCTION__, index, one, two, inner);
}
}
diff --git a/experimental/Intersection/QuadraticReduceOrder.cpp b/experimental/Intersection/QuadraticReduceOrder.cpp
index 7429f6edaf..5d614f1f79 100644
--- a/experimental/Intersection/QuadraticReduceOrder.cpp
+++ b/experimental/Intersection/QuadraticReduceOrder.cpp
@@ -118,7 +118,7 @@ bool isLinear(const Quadratic& quad, int startIndex, int endIndex) {
// reduce to a quadratic or smaller
// look for identical points
-// look for all four points in a line
+// look for all four points in a line
// note that three points in a line doesn't simplify a cubic
// look for approximation with single quadratic
// save approximation with multiple quadratics for later
diff --git a/experimental/Intersection/QuadraticSubDivide.cpp b/experimental/Intersection/QuadraticSubDivide.cpp
index 7c3164ec99..9aee1dfa1a 100644
--- a/experimental/Intersection/QuadraticSubDivide.cpp
+++ b/experimental/Intersection/QuadraticSubDivide.cpp
@@ -18,7 +18,7 @@ _12 = A/2 + B/2
12_ = B/2 + C/2
123 = A/4 + B/2 + C/4
= D
-
+
Group the known values on one side:
B = D*2 - A/2 - C/2
diff --git a/experimental/Intersection/QuadraticUtilities.cpp b/experimental/Intersection/QuadraticUtilities.cpp
index 88524ca9d7..d42f1e232b 100644
--- a/experimental/Intersection/QuadraticUtilities.cpp
+++ b/experimental/Intersection/QuadraticUtilities.cpp
@@ -11,7 +11,7 @@ and using the roots
t1 = Q / A
t2 = C / Q
-
+
*/
int quadraticRoots(double A, double B, double C, double t[2]) {
diff --git a/experimental/Intersection/Simplify.cpp b/experimental/Intersection/Simplify.cpp
index 9606589fe1..5a026c89a8 100644
--- a/experimental/Intersection/Simplify.cpp
+++ b/experimental/Intersection/Simplify.cpp
@@ -486,7 +486,7 @@ public:
}
return dx * rdy < rdx * dy;
}
-
+
double dx() const {
return fDx;
}
@@ -575,15 +575,15 @@ public:
}
SkASSERT(0); // FIXME: add cubic case
}
-
+
Segment* segment() const {
return const_cast<Segment*>(fSegment);
}
-
+
int sign() const {
return SkSign32(fStart - fEnd);
}
-
+
int start() const {
return fStart;
}
@@ -745,7 +745,7 @@ public:
int oIndex = span->fOtherIndex;
return other->activeAngleInner(oIndex, done, angles);
}
-
+
bool activeAngleInner(int index, int& done, SkTDArray<Angle>& angles) const {
int next = nextSpan(index, 1);
if (next > 0) {
@@ -828,7 +828,7 @@ public:
// fTs[tIndexStart - 1], fTs[tIndexStart], fTs[tIndex]
// if tIndexStart == 0, no prior span
// if nextT == 1, no following span
-
+
// advance the span with zero winding
// if the following span exists (not past the end, non-zero winding)
// connect the two edges
@@ -873,7 +873,7 @@ public:
}
}
}
-
+
void addCoinOutsides(const SkTDArray<double>& outsideTs, Segment& other,
double oEnd) {
// walk this to outsideTs[0]
@@ -910,7 +910,7 @@ public:
addTPair(tStart, other, oStart, false);
} while (tStart < 1 && oStart < 1 && oEnd - oStart >= FLT_EPSILON);
}
-
+
void addCubic(const SkPoint pts[4]) {
init(pts, SkPath::kCubic_Verb);
fBounds.setCubicBounds(pts);
@@ -976,7 +976,7 @@ public:
init(pts, SkPath::kQuad_Verb);
fBounds.setQuadBounds(pts);
}
-
+
// Defer all coincident edge processing until
// after normal intersections have been computed
@@ -1022,7 +1022,7 @@ public:
span->fWindValue = 1;
if ((span->fDone = newT == 1)) {
++fDoneSpans;
- }
+ }
return insertedAt;
}
@@ -1083,7 +1083,7 @@ public:
break;
}
oSpan = &other.fTs[--oIndex];
- }
+ }
test = span;
oTest = oSpan;
} while (test->fT < endT - FLT_EPSILON);
@@ -1197,7 +1197,7 @@ public:
other.addCoinOutsides(oOutsideTs, *this, endT);
}
}
-
+
// FIXME: this doesn't prevent the same span from being added twice
// fix in caller, assert here?
void addTPair(double t, Segment& other, double otherT, bool borrowWind) {
@@ -1226,7 +1226,7 @@ public:
matchWindingValue(insertedAt, t, borrowWind);
other.matchWindingValue(otherInsertedAt, otherT, borrowWind);
}
-
+
void addTwoAngles(int start, int end, SkTDArray<Angle>& angles) const {
// add edge leading into junction
if (fTs[SkMin32(end, start)].fWindValue > 0) {
@@ -1239,7 +1239,7 @@ public:
addAngle(angles, end, tIndex);
}
}
-
+
const Bounds& bounds() const {
return fBounds;
}
@@ -1292,7 +1292,7 @@ public:
SkASSERT(0); // incomplete
return false;
}
-
+
int computeSum(int startIndex, int endIndex) {
SkTDArray<Angle> angles;
addTwoAngles(startIndex, endIndex, angles);
@@ -1300,7 +1300,7 @@ public:
SkTDArray<Angle*> sorted;
sortAngles(angles, sorted);
#if DEBUG_SORT
- sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0);
+ sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0);
#endif
int angleCount = angles.count();
const Angle* angle;
@@ -1365,7 +1365,7 @@ public:
continue;
}
SkPoint edge[4];
- // OPTIMIZE: wrap this so that if start==0 end==fTCount-1 we can
+ // OPTIMIZE: wrap this so that if start==0 end==fTCount-1 we can
// work with the original data directly
double startT = fTs[start].fT;
double endT = fTs[end].fT;
@@ -1428,7 +1428,7 @@ public:
}
return false;
}
-
+
bool decrementSpan(Span* span) {
SkASSERT(span->fWindValue > 0);
if (--(span->fWindValue) == 0) {
@@ -1460,7 +1460,7 @@ public:
// reference an unused other
// for coincident, the last span on the other may be marked done
// (always?)
-
+
// if loop is exhausted, contour may be closed.
// FIXME: pass in close point so we can check for closure
@@ -1469,7 +1469,7 @@ public:
// segments, find the mate that continues the outside.
// note that if there are multiples, but no coincidence, we can limit
// choices to connections in the correct direction
-
+
// mark found segments as done
// start is the index of the beginning T of this edge
@@ -1539,7 +1539,7 @@ public:
// FIXME: found done logic probably fails if there are more than 4
// sorted angles. It should bias towards the first and last undone
// edges -- but not sure that it won't choose a middle (incorrect)
- // edge if one is undone
+ // edge if one is undone
bool foundDone = false;
bool foundDone2 = false;
// iterate through the angle, and compute everyone's winding
@@ -1651,7 +1651,7 @@ public:
#endif
return nextSegment;
}
-
+
Segment* findNextXor(int& nextStart, int& nextEnd) {
const int startIndex = nextStart;
const int endIndex = nextEnd;
@@ -1923,7 +1923,7 @@ public:
SkTDArray<Angle*> sorted;
sortAngles(angles, sorted);
#if DEBUG_SORT
- sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0);
+ sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0);
#endif
// skip edges that have already been processed
firstT = -1;
@@ -1936,7 +1936,7 @@ public:
} while (leftSegment->fTs[SkMin32(tIndex, endIndex)].fDone);
return leftSegment;
}
-
+
// FIXME: not crazy about this
// when the intersections are performed, the other index is into an
// incomplete array. as the array grows, the indices become incorrect
@@ -1959,7 +1959,7 @@ public:
}
}
}
-
+
// OPTIMIZATION: uses tail recursion. Unwise?
Span* innerChaseDone(int index, int step, int winding) {
int end = nextSpan(index, step);
@@ -1975,7 +1975,7 @@ public:
other->markDone(SkMin32(index, otherEnd), winding);
return last;
}
-
+
Span* innerChaseWinding(int index, int step, int winding) {
int end = nextSpan(index, step);
SkASSERT(end >= 0);
@@ -1995,7 +1995,7 @@ public:
other->markWinding(min, winding);
return last;
}
-
+
void init(const SkPoint pts[], SkPath::Verb verb) {
fPts = pts;
fVerb = verb;
@@ -2065,7 +2065,7 @@ public:
SkScalar leftMost(int start, int end) const {
return (*SegmentLeftMost[fVerb])(fPts, fTs[start].fT, fTs[end].fT);
}
-
+
// this span is excluded by the winding rule -- chase the ends
// as long as they are unambiguous to mark connections as done
// and give them the same winding value
@@ -2077,7 +2077,7 @@ public:
markDone(SkMin32(index, endIndex), winding);
return last;
}
-
+
Span* markAndChaseWinding(const Angle* angle, int winding) {
int index = angle->start();
int endIndex = angle->end();
@@ -2087,11 +2087,11 @@ public:
markWinding(min, winding);
return last;
}
-
+
// FIXME: this should also mark spans with equal (x,y)
// This may be called when the segment is already marked done. While this
// wastes time, it shouldn't do any more than spin through the T spans.
- // OPTIMIZATION: abort on first done found (assuming that this code is
+ // OPTIMIZATION: abort on first done found (assuming that this code is
// always called to mark segments done).
void markDone(int index, int winding) {
// SkASSERT(!done());
@@ -2105,7 +2105,7 @@ public:
markOneDone(__FUNCTION__, index, winding);
} while (++index < fTs.count() && fTs[index].fT - referenceT < FLT_EPSILON);
}
-
+
void markOneDone(const char* funName, int tIndex, int winding) {
Span* span = markOneWinding(funName, tIndex, winding);
if (!span) {
@@ -2114,7 +2114,7 @@ public:
span->fDone = true;
fDoneSpans++;
}
-
+
Span* markOneWinding(const char* funName, int tIndex, int winding) {
Span& span = fTs[tIndex];
if (span.fDone) {
@@ -2216,7 +2216,7 @@ public:
const Span& span(int tIndex) const {
return fTs[tIndex];
}
-
+
int spanSign(int startIndex, int endIndex) const {
int result = startIndex < endIndex ? -fTs[startIndex].fWindValue :
fTs[endIndex].fWindValue;
@@ -2235,7 +2235,7 @@ public:
double t(int tIndex) const {
return fTs[tIndex].fT;
}
-
+
static void TrackOutside(SkTDArray<double>& outsideTs, double end,
double start) {
int outCount = outsideTs.count();
@@ -2244,7 +2244,7 @@ public:
*outsideTs.append() = start;
}
}
-
+
void undoneSpan(int& start, int& end) {
size_t tCount = fTs.count();
size_t index;
@@ -2273,7 +2273,7 @@ public:
int windSum(int tIndex) const {
return fTs[tIndex].fWindSum;
}
-
+
int windSum(const Angle* angle) const {
int start = angle->start();
int end = angle->end();
@@ -2284,7 +2284,7 @@ public:
int windValue(int tIndex) const {
return fTs[tIndex].fWindValue;
}
-
+
int windValue(const Angle* angle) const {
int start = angle->start();
int end = angle->end();
@@ -2312,7 +2312,7 @@ public:
}
return span->fPt;
}
-
+
SkScalar yAtT(int index) const {
return yAtT(&fTs[index]);
}
@@ -2402,7 +2402,7 @@ public:
SkDebugf(" %1.9g,%1.9g", fPts[vIndex].fX, fPts[vIndex].fY);
}
const Span* span = &fTs[i];
- SkDebugf(") t=%1.9g (%1.9g,%1.9g)", fTs[i].fT,
+ SkDebugf(") t=%1.9g (%1.9g,%1.9g)", fTs[i].fT,
xAtT(span), yAtT(span));
const Segment* other = fTs[i].fOther;
SkDebugf(" other=%d otherT=%1.9g otherIndex=%d windSum=",
@@ -2562,7 +2562,7 @@ public:
fSegments.push_back().addLine(pts);
return fSegments.count();
}
-
+
void addOtherT(int segIndex, int tIndex, double otherT, int otherIndex) {
fSegments[segIndex].addOtherT(tIndex, otherT, otherIndex);
}
@@ -2581,7 +2581,7 @@ public:
const Bounds& bounds() const {
return fBounds;
}
-
+
void complete() {
setBounds();
fContainsIntercepts = false;
@@ -2591,7 +2591,7 @@ public:
fContainsIntercepts = true;
}
- const Segment* crossedSegment(const SkPoint& basePt, SkScalar& bestY,
+ const Segment* crossedSegment(const SkPoint& basePt, SkScalar& bestY,
int &tIndex, double& hitT) {
int segmentCount = fSegments.count();
const Segment* bestSegment = NULL;
@@ -2631,7 +2631,7 @@ public:
}
return bestSegment;
}
-
+
bool crosses(const Contour* crosser) const {
for (int index = 0; index < fCrosses.count(); ++index) {
if (fCrosses[index] == crosser) {
@@ -2715,14 +2715,14 @@ public:
#endif
}
}
-
+
const SkTArray<Segment>& segments() {
return fSegments;
}
-
+
// OPTIMIZATION: feel pretty uneasy about this. It seems like once again
// we need to sort and walk edges in y, but that on the surface opens the
- // same can of worms as before. But then, this is a rough sort based on
+ // same can of worms as before. But then, this is a rough sort based on
// segments' top, and not a true sort, so it could be ameniable to regular
// sorting instead of linear searching. Still feel like I'm missing something
Segment* topSegment(SkScalar& bestY) {
@@ -2905,13 +2905,13 @@ void walk() {
}
break;
case SkPath::kQuad_Verb:
-
+
reducedVerb = QuadReduceOrder(&pointsPtr[-1], fReducePts);
if (reducedVerb == 0) {
break; // skip degenerate points
}
if (reducedVerb == 1) {
- *fExtra.append() =
+ *fExtra.append() =
fCurrentContour->addLine(fReducePts.end() - 2);
break;
}
@@ -2995,7 +2995,7 @@ public:
kQuad_Segment = SkPath::kQuad_Verb,
kCubic_Segment = SkPath::kCubic_Verb,
};
-
+
void addCoincident(Work& other, const Intersections& ts, bool swap) {
fContour->addCoincident(fIndex, other.fContour, other.fIndex, ts, swap);
}
@@ -3026,7 +3026,7 @@ public:
const Bounds& bounds() const {
return fContour->segments()[fIndex].bounds();
}
-
+
const SkPoint* cubic() const {
return fCubic;
}
@@ -3036,7 +3036,7 @@ public:
fIndex = 0;
fLast = contour->segments().count();
}
-
+
bool isAdjacent(const Work& next) {
return fContour == next.fContour && fIndex + 1 == next.fIndex;
}
@@ -3431,13 +3431,13 @@ static int innerContourCheck(SkTDArray<Contour*>& contourList,
}
test->buildAngles(tIndex, angles);
SkTDArray<Angle*> sorted;
- // OPTIMIZATION: call a sort that, if base point is the leftmost,
+ // OPTIMIZATION: call a sort that, if base point is the leftmost,
// returns the first counterclockwise hour before 6 o'clock,
- // or if the base point is rightmost, returns the first clockwise
+ // or if the base point is rightmost, returns the first clockwise
// hour after 6 o'clock
sortAngles(angles, sorted);
#if DEBUG_SORT
- sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0);
+ sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0);
#endif
// walk the sorted angle fan to find the lowest angle
// above the base point. Currently, the first angle in the sorted array
@@ -3517,10 +3517,10 @@ static int innerContourCheck(SkTDArray<Contour*>& contourList,
// we're broken because we find a vertical span
return winding;
}
-
+
// OPTIMIZATION: not crazy about linear search here to find top active y.
// seems like we should break down and do the sort, or maybe sort each
-// contours' segments?
+// contours' segments?
// Once the segment array is built, there's no reason I can think of not to
// sort it in Y. hmmm
// FIXME: return the contour found to pass to inner contour check
@@ -3590,7 +3590,7 @@ static Segment* findChase(SkTDArray<Span*>& chase, int& tIndex, int& endIndex,
SkTDArray<Angle*> sorted;
sortAngles(angles, sorted);
#if DEBUG_SORT
- sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0);
+ sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0);
#endif
// find first angle, initialize winding to computed fWindSum
int firstIndex = -1;
@@ -3611,7 +3611,7 @@ static Segment* findChase(SkTDArray<Span*>& chase, int& tIndex, int& endIndex,
winding += spanWinding;
}
#if DEBUG_SORT
- segment->debugShowSort(__FUNCTION__, sorted, firstIndex, winding);
+ segment->debugShowSort(__FUNCTION__, sorted, firstIndex, winding);
#endif
// we care about first sign and whether wind sum indicates this
// edge is inside or outside. Maybe need to pass span winding
@@ -3679,7 +3679,7 @@ static bool windingIsActive(int winding, int spanWinding) {
// when winding should follow the intersection direction. If more than one edge
// is an option, choose first edge that continues the inside.
// since we start with leftmost top edge, we'll traverse through a
- // smaller angle counterclockwise to get to the next edge.
+ // smaller angle counterclockwise to get to the next edge.
static void bridgeWinding(SkTDArray<Contour*>& contourList, SkPath& simple) {
bool firstContour = true;
do {
@@ -3713,7 +3713,7 @@ static void bridgeWinding(SkTDArray<Contour*>& contourList, SkPath& simple) {
}
#if DEBUG_WINDING
SkDebugf("%s sumWinding=%d spanWinding=%d sign=%d inner=%d result=%d\n", __FUNCTION__,
- sumWinding, spanWinding, SkSign32(index - endIndex),
+ sumWinding, spanWinding, SkSign32(index - endIndex),
inner, contourWinding);
#endif
}
@@ -3730,7 +3730,7 @@ static void bridgeWinding(SkTDArray<Contour*>& contourList, SkPath& simple) {
// the initial winding should be correctly passed in so that if the
// inner contour is wound the same way, it never finds an accumulated
// winding of zero. Inside 'find next', we need to look for transitions
- // other than zero when resolving sorted angles.
+ // other than zero when resolving sorted angles.
bool active = windingIsActive(winding, spanWinding);
SkTDArray<Span*> chaseArray;
do {
@@ -3826,7 +3826,7 @@ static void bridgeXor(SkTDArray<Contour*>& contourList, SkPath& simple) {
#endif
simple.close();
}
- }
+ }
}
static void fixOtherTIndex(SkTDArray<Contour*>& contourList) {
diff --git a/experimental/Intersection/SimplifyAddIntersectingTs_Test.cpp b/experimental/Intersection/SimplifyAddIntersectingTs_Test.cpp
index f70d2f8916..ce85041f88 100644
--- a/experimental/Intersection/SimplifyAddIntersectingTs_Test.cpp
+++ b/experimental/Intersection/SimplifyAddIntersectingTs_Test.cpp
@@ -92,17 +92,17 @@ static void testPath(const SkPath& path, const SkPoint* pts1, SkPath::Verb c1Typ
// bool c2Intersected = c2.fSegments[0].intersected();
SkDebugf("%s %s (%1.9g,%1.9g %1.9g,%1.9g) %s %s (%1.9g,%1.9g %1.9g,%1.9g)\n",
__FUNCTION__, SimplifyAddIntersectingTsTest::kLVerbStr[c1Type],
- pts1[0].fX, pts1[0].fY,
+ pts1[0].fX, pts1[0].fY,
pts1[c1Type].fX, pts1[c1Type].fY,
c1Intersected ? "intersects" : "does not intersect",
SimplifyAddIntersectingTsTest::kLVerbStr[c2Type],
- pts2[0].fX, pts2[0].fY,
+ pts2[0].fX, pts2[0].fY,
pts2[c2Type].fX, pts2[c2Type].fY);
if (c1Intersected) {
c1.dump();
c2.dump();
}
-#endif
+#endif
}
static const size_t firstO = 6;
diff --git a/experimental/Intersection/SimplifyFindNext_Test.cpp b/experimental/Intersection/SimplifyFindNext_Test.cpp
index 7d33c11a6b..199ba1d6f0 100644
--- a/experimental/Intersection/SimplifyFindNext_Test.cpp
+++ b/experimental/Intersection/SimplifyFindNext_Test.cpp
@@ -4,9 +4,9 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#define DEBUG_TEST 1
-
+
#include "Simplify.h"
namespace SimplifyFindNextTest {
diff --git a/experimental/Intersection/SimplifyNew_Test.cpp b/experimental/Intersection/SimplifyNew_Test.cpp
index 8d6bb509c9..c862c27e1f 100644
--- a/experimental/Intersection/SimplifyNew_Test.cpp
+++ b/experimental/Intersection/SimplifyNew_Test.cpp
@@ -505,7 +505,7 @@ static void testLine18x() {
static void testLine19() {
SkPath path;
path.addRect(0, 0, 12, 12, (SkPath::Direction) 0);
- path.addRect(12, 16, 21, 21, (SkPath::Direction) 0);
+ path.addRect(12, 16, 21, 21, (SkPath::Direction) 0);
testSimplifyx(path);
}
diff --git a/experimental/Intersection/SimplifyRect4x4_Test.cpp b/experimental/Intersection/SimplifyRect4x4_Test.cpp
index 3768da988d..cdd43dd346 100644
--- a/experimental/Intersection/SimplifyRect4x4_Test.cpp
+++ b/experimental/Intersection/SimplifyRect4x4_Test.cpp
@@ -52,14 +52,14 @@ static void* testSimplify4x4RectsMain(void* data)
break;
case 2:
l = aXAlign * 12;
- r = l + 30;
+ r = l + 30;
t = 0; b = 60;
aYAlign = 5;
break;
case 3:
l = 0; r = 60;
t = aYAlign * 12;
- b = l + 30;
+ b = l + 30;
aXAlign = 5;
break;
}
@@ -74,20 +74,20 @@ static void* testSimplify4x4RectsMain(void* data)
switch (bShape) {
case 1: // square
l = bXAlign * 10;
- r = l + 20;
+ r = l + 20;
t = bYAlign * 10;
- b = l + 20;
+ b = l + 20;
break;
case 2:
l = bXAlign * 10;
- r = l + 20;
+ r = l + 20;
t = 10; b = 40;
bYAlign = 5;
break;
case 3:
l = 10; r = 40;
t = bYAlign * 10;
- b = l + 20;
+ b = l + 20;
bXAlign = 5;
break;
}
@@ -102,20 +102,20 @@ static void* testSimplify4x4RectsMain(void* data)
switch (cShape) {
case 1: // square
l = cXAlign * 6;
- r = l + 12;
+ r = l + 12;
t = cYAlign * 6;
- b = l + 12;
+ b = l + 12;
break;
case 2:
l = cXAlign * 6;
- r = l + 12;
+ r = l + 12;
t = 20; b = 30;
cYAlign = 5;
break;
case 3:
l = 20; r = 30;
t = cYAlign * 6;
- b = l + 20;
+ b = l + 20;
cXAlign = 5;
break;
}
@@ -130,20 +130,20 @@ static void* testSimplify4x4RectsMain(void* data)
switch (dShape) {
case 1: // square
l = dXAlign * 4;
- r = l + 9;
+ r = l + 9;
t = dYAlign * 4;
- b = l + 9;
+ b = l + 9;
break;
case 2:
l = dXAlign * 6;
- r = l + 9;
+ r = l + 9;
t = 32; b = 36;
dYAlign = 5;
break;
case 3:
l = 32; r = 36;
t = dYAlign * 6;
- b = l + 9;
+ b = l + 9;
dXAlign = 5;
break;
}
@@ -186,7 +186,7 @@ void Simplify4x4RectsThreaded_Test(int& testsRun)
for (int a = 0; a < 8; ++a) { // outermost
for (int b = a ; b < 8; ++b) {
for (int c = b ; c < 8; ++c) {
- for (int d = c; d < 8; ++d) {
+ for (int d = c; d < 8; ++d) {
testsRun += dispatchTest4(testSimplify4x4RectsMain, a, b, c, d);
}
if (!gRunTestsInOneThread) SkDebugf(".");
diff --git a/experimental/Intersection/SkAntiEdge.cpp b/experimental/Intersection/SkAntiEdge.cpp
index 7e225884bb..5aa134c926 100644
--- a/experimental/Intersection/SkAntiEdge.cpp
+++ b/experimental/Intersection/SkAntiEdge.cpp
@@ -41,7 +41,7 @@ bool SkAntiEdge::setLine(const SkPoint& p0, const SkPoint& p1) {
fLastY = SkScalarToFixed(p1.fY);
if (fFirstY == fLastY) {
return false;
- }
+ }
fFirstX = SkScalarToFixed(p0.fX);
fLastX = SkScalarToFixed(p1.fX);
if (fFirstY > fLastY) {
@@ -190,7 +190,7 @@ uint16_t SkAntiEdge::advanceX(SkFixed left) {
SkFixed yDiff = wy - fY;
SkAssertResult(yDiff >= 0);
SkAssertResult(yDiff <= SK_Fixed1);
- int xCoverage = xDiff >> 1; // throw away 1 bit so multiply
+ int xCoverage = xDiff >> 1; // throw away 1 bit so multiply
int yCoverage = yDiff >> 1; // stays in range
int triangle = xCoverage * yCoverage >> 15;
coverage = partial - 1 - triangle;
@@ -271,7 +271,7 @@ uint16_t SkAntiEdge::advanceFlippedX(SkFixed left) {
SkFixed yDiff = fY - wy;
SkAssertResult(yDiff >= 0);
SkAssertResult(yDiff <= SK_Fixed1);
- int xCoverage = xDiff >> 1; // throw away 1 bit so multiply
+ int xCoverage = xDiff >> 1; // throw away 1 bit so multiply
int yCoverage = yDiff >> 1; // stays in range
int triangle = xCoverage * yCoverage >> 15;
coverage = partial - 1 - triangle;
@@ -384,7 +384,7 @@ extern "C" {
valuea = edgea->fFirstX;
valueb = edgeb->fFirstX;
}
-
+
if (valuea == valueb) {
valuea = edgea->fDX;
valueb = edgeb->fDX;
@@ -666,7 +666,7 @@ void SkAntiEdgeBuilder::walk(uint8_t* result, int rowBytes, int height) {
}
uint8_t old = *resultPtr;
uint8_t pix = coverage_to_8(coverage);
- uint8_t blend = old > pix ? old : pix;
+ uint8_t blend = old > pix ? old : pix;
*resultPtr++ = blend;
++x;
} while (!finished);
diff --git a/experimental/Networking/SampleNetPipeReader.cpp b/experimental/Networking/SampleNetPipeReader.cpp
index f58d5c2164..4332cbd287 100644
--- a/experimental/Networking/SampleNetPipeReader.cpp
+++ b/experimental/Networking/SampleNetPipeReader.cpp
@@ -14,7 +14,7 @@
* received all the data transmitted and attempt to reproduce the drawing calls.
* This reader will only keep the latest batch of data. In order to keep up with
* the server, which may be producing data at a much higher rate than the reader
- * is consuming, the reader will attempt multiple reads and only render the
+ * is consuming, the reader will attempt multiple reads and only render the
* latest frame. this behavior can be adjusted by changing MAX_READS_PER_FRAME
* or disabled by setting fSync to false
*/
@@ -23,11 +23,11 @@
class NetPipeReaderView : public SampleView {
public:
- NetPipeReaderView() {
+ NetPipeReaderView() {
fSocket = NULL;
fSync = true;
}
-
+
~NetPipeReaderView() {
if (fSocket) {
delete fSocket;
@@ -36,23 +36,23 @@ public:
}
virtual void requestMenu(SkOSMenu* menu) {
menu->setTitle("Net Pipe Reader");
- menu->appendTextField("Server IP", "Server IP", this->getSinkID(),
+ menu->appendTextField("Server IP", "Server IP", this->getSinkID(),
"IP address");
menu->appendSwitch("Sync", "Sync", this->getSinkID(), fSync);
}
-
+
protected:
static void readData(int cid, const void* data, size_t size,
SkSocket::DataType type, void* context) {
NetPipeReaderView* view = (NetPipeReaderView*)context;
view->onRead(data, size);
}
-
+
void onRead(const void* data, size_t size) {
if (size > 0)
fDataArray.append(size, (const char*)data);
}
-
+
bool onQuery(SkEvent* evt) {
if (SampleCode::TitleQ(*evt)) {
SampleCode::TitleR(evt, "Net Pipe Reader");
@@ -76,7 +76,7 @@ protected:
return true;
return this->INHERITED::onEvent(evt);
}
-
+
void onDrawContent(SkCanvas* canvas) {
if (NULL == fSocket)
return;
@@ -85,7 +85,7 @@ protected:
int dataToRemove = fDataArray.count();
if (fSync) {
int numreads = 0;
- while (fSocket->readPacket(readData, this) > 0 &&
+ while (fSocket->readPacket(readData, this) > 0 &&
numreads < MAX_READS_PER_FRAME) {
// at this point, new data has been read and stored, discard
// old data since it's not needed anymore
@@ -95,18 +95,18 @@ protected:
++numreads;
}
// clean up if max reads reached
- if (numreads == MAX_READS_PER_FRAME &&
+ if (numreads == MAX_READS_PER_FRAME &&
fDataArray.count() > dataToRemove)
fDataArray.remove(0, dataToRemove);
}
else {
- if (fSocket->readPacket(readData, this) > 0)
+ if (fSocket->readPacket(readData, this) > 0)
fDataArray.remove(0, dataToRemove);
}
}
else
fSocket->connectToServer();
-
+
SkGPipeReader reader(canvas);
size_t bytesRead;
SkGPipeReader::Status fStatus = reader.playback(fDataArray.begin(),
diff --git a/experimental/Networking/SkSockets.cpp b/experimental/Networking/SkSockets.cpp
index 7b7d6fcff7..db9da09d4d 100644
--- a/experimental/Networking/SkSockets.cpp
+++ b/experimental/Networking/SkSockets.cpp
@@ -33,7 +33,7 @@ int SkSocket::createSocket() {
return -1;
}
int reuse = 1;
-
+
if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(int)) < 0) {
SkDebugf("error: %s\n", strerror(errno));
return -1;
@@ -49,10 +49,10 @@ int SkSocket::createSocket() {
void SkSocket::closeSocket(int sockfd) {
if (!fReady)
return;
-
+
close(sockfd);
//SkDebugf("Closed fd:%d\n", sockfd);
-
+
if (FD_ISSET(sockfd, &fMasterSet)) {
FD_CLR(sockfd, &fMasterSet);
if (sockfd >= fMaxfd) {
@@ -60,7 +60,7 @@ void SkSocket::closeSocket(int sockfd) {
fMaxfd -= 1;
}
}
- if (0 == fMaxfd)
+ if (0 == fMaxfd)
fConnected = false;
}
@@ -70,7 +70,7 @@ void SkSocket::onFailedConnection(int sockfd) {
void SkSocket::setNonBlocking(int sockfd) {
int flags = fcntl(sockfd, F_GETFL);
- fcntl(sockfd, F_SETFL, flags | O_NONBLOCK);
+ fcntl(sockfd, F_SETFL, flags | O_NONBLOCK);
}
void SkSocket::addToMasterSet(int sockfd) {
@@ -79,9 +79,9 @@ void SkSocket::addToMasterSet(int sockfd) {
fMaxfd = sockfd;
}
-int SkSocket::readPacket(void (*onRead)(int, const void*, size_t, DataType,
+int SkSocket::readPacket(void (*onRead)(int, const void*, size_t, DataType,
void*), void* context) {
- if (!fConnected || !fReady || NULL == onRead || NULL == context
+ if (!fConnected || !fReady || NULL == onRead || NULL == context
|| fReadSuspended)
return -1;
@@ -91,7 +91,7 @@ int SkSocket::readPacket(void (*onRead)(int, const void*, size_t, DataType,
for (int i = 0; i <= fMaxfd; ++i) {
if (!FD_ISSET (i, &fMasterSet))
continue;
-
+
memset(packet, 0, PACKET_SIZE);
SkDynamicMemoryWStream stream;
int attempts = 0;
@@ -155,13 +155,13 @@ int SkSocket::readPacket(void (*onRead)(int, const void*, size_t, DataType,
this->onFailedConnection(i);
continue;
}
-
+
if (bytesReadInTransfer > 0) {
SkData* data = stream.copyToData();
SkASSERT(data->size() == bytesReadInTransfer);
onRead(i, data->data(), data->size(), h.type, context);
data->unref();
-
+
totalBytesRead += bytesReadInTransfer;
}
}
@@ -312,7 +312,7 @@ int SkTCPServer::disconnectAll() {
SkTCPClient::SkTCPClient(const char* hostname, int port) {
//Add fSockfd since the client will be using it to read/write
this->addToMasterSet(fSockfd);
-
+
hostent* server = gethostbyname(hostname);
if (server) {
fServerAddr.sin_family = AF_INET;
diff --git a/experimental/Networking/SkSockets.h b/experimental/Networking/SkSockets.h
index a72f67d3a9..8d85446ecc 100644
--- a/experimental/Networking/SkSockets.h
+++ b/experimental/Networking/SkSockets.h
@@ -32,14 +32,14 @@ public:
kIncomplete_state,
kDone_state
};
-
+
enum DataType {
kPipeAppend_type,
kPipeReplace_type,
kString_type,
kInt_type
};
-
+
bool isConnected() { return fConnected; }
/**
* Write data to the socket. Data is a pointer to the beginning of the data
@@ -51,12 +51,12 @@ public:
* was an error during the transfer, in which case the method returns -1.
* For blocking sockets, write will block indefinitely if the socket at the
* other end of the connection doesn't receive any data.
- * NOTE: This method guarantees that all of the data will be sent unless
- * there was an error, so it may block temporarily when the write buffer is
+ * NOTE: This method guarantees that all of the data will be sent unless
+ * there was an error, so it may block temporarily when the write buffer is
* full
*/
int writePacket(void* data, size_t size, DataType type = kPipeAppend_type);
-
+
/**
* Read a logical packet from socket. The data read will be stored
* sequentially in the dataArray. This method will keep running until all
@@ -66,16 +66,16 @@ public:
* nonblocking sockets, read will return 0 if there's nothing to read. For
* blocking sockets, read will block indefinitely if the socket doesn't
* receive any data.
- * NOTE: This method guarantees that all the data in a logical packet will
+ * NOTE: This method guarantees that all the data in a logical packet will
* be read so it may block temporarily if it's waiting for parts of a
* packet
*/
- int readPacket(void (*onRead)(int cid, const void* data, size_t size,
+ int readPacket(void (*onRead)(int cid, const void* data, size_t size,
DataType type, void*), void* context);
/**
* Suspend network transfers until resume() is called. Leaves all
- * connections in tact.
+ * connections in tact.
*/
void suspendAll() { fReadSuspended = fWriteSuspended = true; }
/**
@@ -101,7 +101,7 @@ protected:
* Create a socket and return its file descriptor. Returns -1 on failure
*/
int createSocket();
-
+
/**
* Close the socket specified by the socket file descriptor argument. Will
* update fMaxfd and working set properly
@@ -119,7 +119,7 @@ protected:
* Set the socket specified by the socket file descriptor as nonblocking
*/
void setNonBlocking(int sockfd);
-
+
/**
* Add the socket specified by the socket file descriptor to the master
* file descriptor set, which is used to in the select() to detect new data
@@ -134,10 +134,10 @@ protected:
int fMaxfd;
int fPort;
int fSockfd;
-
- /**
+
+ /**
* fMasterSet contains all the file descriptors to be used for read/write.
- * For clients, this only contains the client socket. For servers, this
+ * For clients, this only contains the client socket. For servers, this
* contains all the file descriptors associated with established connections
* to clients
*/
@@ -156,7 +156,7 @@ public:
/**
* Accept any incoming connections to the server, will accept 1 connection
- * at a time. Returns -1 on error. For blocking sockets, this method will
+ * at a time. Returns -1 on error. For blocking sockets, this method will
* block until a client calls connectToServer()
*/
int acceptConnections();
@@ -179,15 +179,15 @@ public:
SkTCPClient(const char* hostname, int port = DEFAULT_PORT);
/**
- * Connect to server. Returns -1 on error or failure. Call this to connect
- * or reconnect to the server. For blocking sockets, this method will block
+ * Connect to server. Returns -1 on error or failure. Call this to connect
+ * or reconnect to the server. For blocking sockets, this method will block
* until the connection is accepted by the server.
*/
int connectToServer();
protected:
/**
- * Client needs to recreate the socket when a connection is broken because
- * connect can only be called successfully once.
+ * Client needs to recreate the socket when a connection is broken because
+ * connect can only be called successfully once.
*/
virtual void onFailedConnection(int sockfd);
private:
diff --git a/experimental/SkSetPoly3To3.cpp b/experimental/SkSetPoly3To3.cpp
index d27e7b1179..cf94eb5f54 100644
--- a/experimental/SkSetPoly3To3.cpp
+++ b/experimental/SkSetPoly3To3.cpp
@@ -33,9 +33,9 @@ static SkScalar dot(SkScalar ax, SkScalar ay, SkScalar bx, SkScalar by) {
bool SkSetPoly3To3(SkMatrix* matrix, const SkPoint src[3], const SkPoint dst[3]) {
const SkPoint& srcAve = src[0];
const SkPoint& dstAve = dst[0];
-
+
SkScalar srcOP[4], dstOP[4];
-
+
computeOuterProduct(srcOP, src, srcAve, src, srcAve);
computeOuterProduct(dstOP, src, srcAve, dst, dstAve);
@@ -45,11 +45,11 @@ bool SkSetPoly3To3(SkMatrix* matrix, const SkPoint src[3], const SkPoint dst[3])
if (SkScalarNearlyZero(det)) {
return false;
}
-
+
SkScalar invDet = SkScalarInvert(det);
-
+
// now compute invDet * [srcOP]T * [dstOP]
-
+
// scale and transpose
const SkScalar srcOP0 = SkScalarMul( srcOP[3], invDet);
const SkScalar srcOP1 = SkScalarMul(-srcOP[1], invDet);
diff --git a/experimental/SkSetPoly3To3_A.cpp b/experimental/SkSetPoly3To3_A.cpp
index 3825073416..c85814568c 100644
--- a/experimental/SkSetPoly3To3_A.cpp
+++ b/experimental/SkSetPoly3To3_A.cpp
@@ -65,9 +65,9 @@ static SkScalar dot(SkScalar ax, SkScalar ay, SkScalar bx, SkScalar by) {
bool SkSetPoly3To3_A(SkMatrix* matrix, const SkPoint src[3], const SkPoint dst[3]) {
const SkPoint& srcAve = src[0];
const SkPoint& dstAve = dst[0];
-
+
SkScalar srcOP[4], dstOP[4];
-
+
computeOuterProduct(srcOP, src, srcAve, src, srcAve);
computeOuterProduct(dstOP, src, srcAve, dst, dstAve);
@@ -75,17 +75,17 @@ bool SkSetPoly3To3_A(SkMatrix* matrix, const SkPoint src[3], const SkPoint dst[3
SkDScalar_setMul(srcOP[1], srcOP[2]);
SkDScalar M[4];
-
+
const SkScalar srcOP0 = srcOP[3];
const SkScalar srcOP1 = -srcOP[1];
const SkScalar srcOP2 = -srcOP[2];
const SkScalar srcOP3 = srcOP[0];
-
+
M[0] = ddot(srcOP0, srcOP1, dstOP[0], dstOP[2]);
M[1] = ddot(srcOP2, srcOP3, dstOP[0], dstOP[2]);
M[2] = ddot(srcOP0, srcOP1, dstOP[1], dstOP[3]);
M[3] = ddot(srcOP2, srcOP3, dstOP[1], dstOP[3]);
-
+
matrix->reset();
matrix->setScaleX(divide(M[0], det));
matrix->setSkewX( divide(M[1], det));
diff --git a/experimental/SkSetPoly3To3_D.cpp b/experimental/SkSetPoly3To3_D.cpp
index 630f578774..283b4e5144 100644
--- a/experimental/SkSetPoly3To3_D.cpp
+++ b/experimental/SkSetPoly3To3_D.cpp
@@ -28,7 +28,7 @@ static void computeOuterProduct(SkMatrix* matrix,
const SkPoint pts1[3], const SkPoint& ave1) {
SkDScalar tmp[4];
sk_bzero(tmp, sizeof(tmp));
-
+
for (int i = 0; i < 3; i++) {
SkScalar x0 = pts0[i].fX - ave0.fX;
SkScalar y0 = pts0[i].fY - ave0.fY;
@@ -54,9 +54,9 @@ static SkScalar dot(SkScalar ax, SkScalar ay, SkScalar bx, SkScalar by) {
bool SkSetPoly3To3_D(SkMatrix* matrix, const SkPoint src[3], const SkPoint dst[3]) {
const SkPoint& srcAve = src[0];
const SkPoint& dstAve = dst[0];
-
+
SkMatrix srcOP, dstOP;
-
+
computeOuterProduct(&srcOP, src, srcAve, src, srcAve);
if (!srcOP.invert(&srcOP)) {
diff --git a/experimental/iOSSampleApp/Shared/SkOptionListController.h b/experimental/iOSSampleApp/Shared/SkOptionListController.h
index 480579af1f..87c044bfe2 100644
--- a/experimental/iOSSampleApp/Shared/SkOptionListController.h
+++ b/experimental/iOSSampleApp/Shared/SkOptionListController.h
@@ -1,6 +1,6 @@
#import <UIKit/UIKit.h>
-@interface SkOptionListController : UITableViewController {
+@interface SkOptionListController : UITableViewController {
NSMutableArray* fOptions;
NSInteger fSelectedIndex;
UITableViewCell* fSelectedCell;
diff --git a/experimental/iOSSampleApp/SkSampleUIView.h b/experimental/iOSSampleApp/SkSampleUIView.h
index 49bdc7da28..6797706636 100644
--- a/experimental/iOSSampleApp/SkSampleUIView.h
+++ b/experimental/iOSSampleApp/SkSampleUIView.h
@@ -15,7 +15,7 @@ struct FPSState;
@interface SkSampleUIView : SkUIView {
BOOL fRedrawRequestPending;
-
+
struct {
EAGLContext* fContext;
GLuint fRenderbuffer;
@@ -24,11 +24,11 @@ struct FPSState;
GLint fWidth;
GLint fHeight;
} fGL;
-
+
NSString* fTitle;
CALayer* fRasterLayer;
CAEAGLLayer* fGLLayer;
-
+
FPSState* fFPSState;
SkiOSDeviceManager* fDevManager;
}
diff --git a/gm/aaclip.cpp b/gm/aaclip.cpp
index 2988cf3a38..f67ac17a9f 100644
--- a/gm/aaclip.cpp
+++ b/gm/aaclip.cpp
@@ -38,7 +38,7 @@ static void compare_canvas(const SkCanvas* a, const SkCanvas* b) {
const SkPMColor* rowa = bma.getAddr32(0, y);
const SkPMColor* rowb = bmb.getAddr32(0, y);
SkASSERT(!memcmp(rowa, rowb, bma.width() << 2));
-
+
for (int x = 1; x < bma.width() - 1; ++x) {
SkASSERT(0xFF000000 == rowa[x]);
SkASSERT(0xFF000000 == rowb[x]);
diff --git a/gm/aarectmodes.cpp b/gm/aarectmodes.cpp
index ed3d3c6c3e..07cfa121f2 100644
--- a/gm/aarectmodes.cpp
+++ b/gm/aarectmodes.cpp
@@ -16,18 +16,18 @@ static void test4(SkCanvas* canvas) {
SkPoint pts[] = {
{10, 160}, {610, 160},
{610, 160}, {10, 160},
-
+
{610, 160}, {610, 160},
{610, 199}, {610, 199},
-
+
{10, 198}, {610, 198},
{610, 199}, {10, 199},
-
+
{10, 160}, {10, 160},
{10, 199}, {10, 199}
};
char verbs[] = {
- 0, 1, 1, 1, 4,
+ 0, 1, 1, 1, 4,
0, 1, 1, 1, 4,
0, 1, 1, 1, 4,
0, 1, 1, 1, 4
@@ -102,7 +102,7 @@ static SkScalar drawCell(SkCanvas* canvas, SkXfermode* mode,
H / 4 + offset,
W / 2, H / 2);
canvas->drawRect(rect, paint);
-
+
return H;
}
@@ -117,7 +117,7 @@ static SkShader* make_bg_shader() {
SkShader* s = SkShader::CreateBitmapShader(bm,
SkShader::kRepeat_TileMode,
SkShader::kRepeat_TileMode);
-
+
SkMatrix m;
m.setScale(SkIntToScalar(6), SkIntToScalar(6));
s->setLocalMatrix(m);
@@ -125,7 +125,7 @@ static SkShader* make_bg_shader() {
}
namespace skiagm {
-
+
class AARectModesGM : public GM {
SkPaint fBGPaint;
public:
@@ -160,7 +160,7 @@ namespace skiagm {
canvas->save();
}
SkXfermode* mode = SkXfermode::Create(gModes[i].fMode);
-
+
canvas->drawRect(bounds, fBGPaint);
canvas->saveLayer(&bounds, NULL);
SkScalar dy = drawCell(canvas, mode,
diff --git a/gm/bitmapfilters.cpp b/gm/bitmapfilters.cpp
index 92c7b43dbb..64192966e6 100644
--- a/gm/bitmapfilters.cpp
+++ b/gm/bitmapfilters.cpp
@@ -92,7 +92,7 @@ class FilterGM : public GM {
public:
SkBitmap fBM8, fBM4444, fBM16, fBM32;
- FilterGM() : fOnce(false) {
+ FilterGM() : fOnce(false) {
this->setBGColor(0xFFDDDDDD);
}
@@ -101,7 +101,7 @@ protected:
return SkString("bitmapfilters");
}
- virtual SkISize onISize() {
+ virtual SkISize onISize() {
return make_isize(540, 330);
}
diff --git a/gm/colormatrix.cpp b/gm/colormatrix.cpp
index 518ccd0f50..af305ee04f 100644
--- a/gm/colormatrix.cpp
+++ b/gm/colormatrix.cpp
@@ -22,7 +22,7 @@ public:
fOnce = true;
return true;
}
-
+
private:
mutable bool fOnce;
};
@@ -49,7 +49,7 @@ public:
ColorMatrixGM() {
this->setBGColor(0xFF808080);
}
-
+
protected:
virtual SkString onShortName() {
return SkString("colormatrix");
@@ -134,7 +134,7 @@ protected:
setArray(&paint, data);
canvas->drawBitmap(fBitmap, 160, 160, &paint);
}
-
+
private:
SkBitmap fBitmap;
typedef GM INHERITED;
diff --git a/gm/complexclip.cpp b/gm/complexclip.cpp
index 7f91b58c89..86386b3d49 100644
--- a/gm/complexclip.cpp
+++ b/gm/complexclip.cpp
@@ -21,7 +21,7 @@ class ComplexClipGM : public GM {
bool fDoAAClip;
bool fDoSaveLayer;
public:
- ComplexClipGM(bool aaclip, bool saveLayer)
+ ComplexClipGM(bool aaclip, bool saveLayer)
: fDoAAClip(aaclip)
, fDoSaveLayer(saveLayer) {
this->setBGColor(0xFFDDDDDD);
@@ -32,7 +32,7 @@ protected:
SkString onShortName() {
SkString str;
- str.printf("complexclip_%s%s",
+ str.printf("complexclip_%s%s",
fDoAAClip ? "aa" : "bw",
fDoSaveLayer ? "_layer" : "");
return str;
@@ -168,7 +168,7 @@ private:
// draw path in hairline
paint.setColor(gPathColor); paint.setAlpha(fade);
canvas->drawPath(path, paint);
-
+
// draw clips in hair line
paint.setColor(gClipAColor); paint.setAlpha(fade);
canvas->drawPath(clipA, paint);
diff --git a/gm/convexpaths.cpp b/gm/convexpaths.cpp
index f6c3383396..5af843f016 100644
--- a/gm/convexpaths.cpp
+++ b/gm/convexpaths.cpp
@@ -12,7 +12,7 @@
class SkOnce : SkNoncopyable {
public:
SkOnce() { fDidOnce = false; }
-
+
bool needToDo() const { return !fDidOnce; }
bool alreadyDone() const { return fDidOnce; }
void accomplished() {
@@ -125,14 +125,14 @@ protected:
fPaths.back().lineTo(98 * SK_Scalar1, 100 * SK_Scalar1);
fPaths.back().lineTo(3 * SK_Scalar1, 96 * SK_Scalar1);
-
+
//It turns out arcTos are not automatically marked as convex and they
//may in fact be ever so slightly concave.
//fPaths.push_back().arcTo(SkRect::MakeXYWH(0, 0,
// 50 * SK_Scalar1,
// 100 * SK_Scalar1),
// 25 * SK_Scalar1, 130 * SK_Scalar1, false);
-
+
// cubics
fPaths.push_back().cubicTo( 1 * SK_Scalar1, 1 * SK_Scalar1,
10 * SK_Scalar1, 90 * SK_Scalar1,
@@ -140,7 +140,7 @@ protected:
fPaths.push_back().cubicTo(100 * SK_Scalar1, 50 * SK_Scalar1,
20 * SK_Scalar1, 100 * SK_Scalar1,
0 * SK_Scalar1, 0 * SK_Scalar1);
-
+
// path that has a cubic with a repeated first control point and
// a repeated last control point.
fPaths.push_back().moveTo(SK_Scalar1 * 10, SK_Scalar1 * 10);
@@ -196,7 +196,7 @@ protected:
// point degenerate
fPaths.push_back().moveTo(50 * SK_Scalar1, 50 * SK_Scalar1);
fPaths.back().lineTo(50 * SK_Scalar1, 50 * SK_Scalar1);
-
+
fPaths.push_back().moveTo(50 * SK_Scalar1, 50 * SK_Scalar1);
fPaths.back().quadTo(50 * SK_Scalar1, 50 * SK_Scalar1,
50 * SK_Scalar1, 50 * SK_Scalar1);
@@ -251,7 +251,7 @@ protected:
canvas->restore();
}
}
-
+
private:
typedef GM INHERITED;
SkTArray<SkPath> fPaths;
diff --git a/gm/cubicpaths.cpp b/gm/cubicpaths.cpp
index 7cd3df159e..1fc13c06cf 100644
--- a/gm/cubicpaths.cpp
+++ b/gm/cubicpaths.cpp
@@ -19,9 +19,9 @@ protected:
SkString onShortName() {
return SkString("cubicpath");
}
-
+
SkISize onISize() { return make_isize(1240, 390); }
-
+
void drawPath(SkPath& path,SkCanvas* canvas,SkColor color,
const SkRect& clip,SkPaint::Cap cap, SkPaint::Join join,
SkPaint::Style style, SkPath::FillType fill,
@@ -38,7 +38,7 @@ protected:
canvas->drawPath(path, paint);
canvas->restore();
}
-
+
virtual void onDraw(SkCanvas* canvas) {
struct FillAndName {
SkPath::FillType fFill;
@@ -111,19 +111,19 @@ protected:
if (0 < style) {
canvas->translate(rect.width() + 40 * SK_Scalar1, 0);
}
-
+
SkColor color = 0xff007000;
this->drawPath(path.fPath, canvas, color, rect,
gCaps[cap].fCap, gCaps[cap].fJoin, gStyles[style].fStyle,
gFills[fill].fFill, SK_Scalar1*10);
-
+
SkPaint rectPaint;
rectPaint.setColor(SK_ColorBLACK);
rectPaint.setStyle(SkPaint::kStroke_Style);
rectPaint.setStrokeWidth(-1);
rectPaint.setAntiAlias(true);
canvas->drawRect(rect, rectPaint);
-
+
SkPaint labelPaint;
labelPaint.setColor(color);
labelPaint.setAntiAlias(true);
@@ -149,7 +149,7 @@ protected:
canvas->restore();
canvas->restore();
}
-
+
private:
typedef GM INHERITED;
};
@@ -162,9 +162,9 @@ protected:
SkString onShortName() {
return SkString("cubicclosepath");
}
-
+
SkISize onISize() { return make_isize(1240, 390); }
-
+
void drawPath(SkPath& path,SkCanvas* canvas,SkColor color,
const SkRect& clip,SkPaint::Cap cap, SkPaint::Join join,
SkPaint::Style style, SkPath::FillType fill,
@@ -181,7 +181,7 @@ protected:
canvas->drawPath(path, paint);
canvas->restore();
}
-
+
virtual void onDraw(SkCanvas* canvas) {
struct FillAndName {
SkPath::FillType fFill;
@@ -255,19 +255,19 @@ protected:
if (0 < style) {
canvas->translate(rect.width() + 40 * SK_Scalar1, 0);
}
-
+
SkColor color = 0xff007000;
this->drawPath(path.fPath, canvas, color, rect,
gCaps[cap].fCap, gCaps[cap].fJoin, gStyles[style].fStyle,
gFills[fill].fFill, SK_Scalar1*10);
-
+
SkPaint rectPaint;
rectPaint.setColor(SK_ColorBLACK);
rectPaint.setStyle(SkPaint::kStroke_Style);
rectPaint.setStrokeWidth(-1);
rectPaint.setAntiAlias(true);
canvas->drawRect(rect, rectPaint);
-
+
SkPaint labelPaint;
labelPaint.setColor(color);
labelPaint.setAntiAlias(true);
@@ -293,7 +293,7 @@ protected:
canvas->restore();
canvas->restore();
}
-
+
private:
typedef GM INHERITED;
};
diff --git a/gm/degeneratesegments.cpp b/gm/degeneratesegments.cpp
index 63d9dba651..2e19d05f7d 100644
--- a/gm/degeneratesegments.cpp
+++ b/gm/degeneratesegments.cpp
@@ -25,11 +25,11 @@ protected:
SkString onShortName() {
return SkString("degeneratesegments");
}
-
+
SkISize onISize() { return make_isize(896, 930); }
typedef SkPoint (*AddSegmentFunc)(SkPath&, SkPoint&);
-
+
// We need to use explicit commands here, instead of addPath, because we
// do not want the moveTo that is added at the beginning of a path to
// appear in the appended path.
@@ -205,7 +205,7 @@ protected:
canvas->drawPath(path, paint);
canvas->restore();
}
-
+
virtual void onDraw(SkCanvas* canvas) {
static const AddSegmentFunc gSegmentFunctions[] = {
AddMove,
@@ -315,7 +315,7 @@ protected:
if (0 < column) {
canvas->translate(rect.width() + 4*SK_Scalar1, 0);
}
-
+
SkColor color = 0xff007000;
StyleAndName style = gStyles[(rand.nextU() >> 16) % numStyles];
CapAndName cap = gCaps[(rand.nextU() >> 16) % numCaps];
@@ -387,7 +387,7 @@ protected:
canvas->restore();
canvas->restore();
}
-
+
private:
typedef GM INHERITED;
};
diff --git a/gm/drawlooper.cpp b/gm/drawlooper.cpp
index b4d6a18527..fa92393213 100644
--- a/gm/drawlooper.cpp
+++ b/gm/drawlooper.cpp
@@ -17,7 +17,7 @@
class DrawLooperGM : public skiagm::GM {
public:
- DrawLooperGM() : fLooper(NULL) {
+ DrawLooperGM() : fLooper(NULL) {
this->setBGColor(0xFFDDDDDD);
}
@@ -29,7 +29,7 @@ protected:
virtual SkISize onISize() {
return SkISize::Make(520, 160);
}
-
+
virtual SkString onShortName() SK_OVERRIDE {
return SkString("drawlooper");
}
@@ -69,14 +69,14 @@ private:
{ SK_ColorBLUE, SkPaint::kFill_Style, 0, 0, 0 },
{ 0x88000000, SkPaint::kFill_Style, 0, SkIntToScalar(10), 3 }
};
-
+
fLooper = new SkLayerDrawLooper;
-
+
SkLayerDrawLooper::LayerInfo info;
info.fFlagsMask = SkPaint::kAntiAlias_Flag;
info.fPaintBits = SkLayerDrawLooper::kStyle_Bit | SkLayerDrawLooper::kMaskFilter_Bit;
info.fColorMode = SkXfermode::kSrc_Mode;
-
+
for (size_t i = 0; i < SK_ARRAY_COUNT(gParams); i++) {
info.fOffset.set(gParams[i].fOffset, gParams[i].fOffset);
SkPaint* paint = fLooper->addLayer(info);
diff --git a/gm/filltypes.cpp b/gm/filltypes.cpp
index e096a6b1fc..86f1fbc9e1 100644
--- a/gm/filltypes.cpp
+++ b/gm/filltypes.cpp
@@ -12,10 +12,10 @@ namespace skiagm {
class FillTypeGM : public GM {
SkPath fPath;
public:
- FillTypeGM() {
+ FillTypeGM() {
this->setBGColor(0xFFDDDDDD);
}
-
+
void makePath() {
if (fPath.isEmpty()) {
const SkScalar radius = SkIntToScalar(45);
@@ -23,13 +23,13 @@ public:
fPath.addCircle(SkIntToScalar(100), SkIntToScalar(100), radius);
}
}
-
+
protected:
virtual SkString onShortName() {
return SkString("filltypes");
}
- virtual SkISize onISize() {
+ virtual SkISize onISize() {
return make_isize(835, 840);
}
@@ -65,7 +65,7 @@ protected:
this->makePath();
canvas->translate(SkIntToScalar(20), SkIntToScalar(20));
-
+
SkPaint paint;
const SkScalar scale = SkIntToScalar(5)/4;
@@ -82,7 +82,7 @@ protected:
canvas->translate(SkIntToScalar(450), 0);
showFour(canvas, scale, paint);
}
-
+
private:
typedef GM INHERITED;
};
diff --git a/gm/filltypespersp.cpp b/gm/filltypespersp.cpp
index e675990631..bdd14a73aa 100644
--- a/gm/filltypespersp.cpp
+++ b/gm/filltypespersp.cpp
@@ -14,7 +14,7 @@ class FillTypePerspGM : public GM {
SkPath fPath;
public:
FillTypePerspGM() {}
-
+
void makePath() {
if (fPath.isEmpty()) {
const SkScalar radius = SkIntToScalar(45);
@@ -22,7 +22,7 @@ public:
fPath.addCircle(SkIntToScalar(100), SkIntToScalar(100), radius);
}
}
-
+
protected:
virtual SkString onShortName() {
return SkString("filltypespersp");
@@ -120,7 +120,7 @@ protected:
canvas->translate(SkIntToScalar(450), 0);
showFour(canvas, scale, true);
}
-
+
private:
typedef GM INHERITED;
};
diff --git a/gm/gammatext.cpp b/gm/gammatext.cpp
index 3e3163ca4a..99642f6e3e 100644
--- a/gm/gammatext.cpp
+++ b/gm/gammatext.cpp
@@ -50,7 +50,7 @@ static CGContextRef makeCG(const SkBitmap& bm) {
CGContextSetAllowsFontSubpixelQuantization(cg, false);
CGContextSetShouldSubpixelQuantizeFonts(cg, false);
-
+
return cg;
}
@@ -81,7 +81,7 @@ static void cgSetPaintForText(CGContextRef cg, const SkPaint& paint) {
CGContextSetAllowsFontSubpixelPositioning(cg, paint.isSubpixelText());
CGContextSetShouldSubpixelPositionFonts(cg, paint.isSubpixelText());
-
+
CGContextSetShouldAntialias(cg, paint.isAntiAlias());
CGContextSetShouldSmoothFonts(cg, paint.isLCDRenderText());
}
@@ -107,7 +107,7 @@ namespace skiagm {
Each region should show as a blue center surrounded by a 2px green
border, with no red.
*/
-
+
#define HEIGHT 480
class GammaTextGM : public GM {
@@ -133,7 +133,7 @@ protected:
#else
SkShader* s = make_heatGradient(pts);
#endif
-
+
canvas->clear(SK_ColorRED);
SkPaint paint;
paint.setShader(s)->unref();
@@ -145,7 +145,7 @@ protected:
#ifdef SK_BUILD_FOR_MAC
CGContextRef cg = makeCG(canvas->getDevice()->accessBitmap(false));
#endif
-
+
drawGrad(canvas);
const SkColor fg[] = {
@@ -154,7 +154,7 @@ protected:
0xFFFF0000, 0xFF00FF00, 0xFF0000FF,
0xFF000000,
};
-
+
const char* text = "Hamburgefons";
size_t len = strlen(text);
@@ -167,13 +167,13 @@ protected:
SkScalar x = SkIntToScalar(10);
for (size_t i = 0; i < SK_ARRAY_COUNT(fg); ++i) {
paint.setColor(fg[i]);
-
+
SkScalar y = SkIntToScalar(40);
SkScalar stopy = SkIntToScalar(HEIGHT);
while (y < stopy) {
if (true) {
canvas->drawText(text, len, x, y, paint);
- }
+ }
#ifdef SK_BUILD_FOR_MAC
else {
cgDrawText(cg, text, len, SkScalarToFloat(x),
diff --git a/gm/getpostextpath.cpp b/gm/getpostextpath.cpp
index 4f32a41927..aa65173512 100644
--- a/gm/getpostextpath.cpp
+++ b/gm/getpostextpath.cpp
@@ -46,11 +46,11 @@ protected:
paint.getTextPath(text, len, 0, 0, &path);
strokePath(canvas, path);
path.reset();
-
+
SkAutoTArray<SkPoint> pos(len);
SkAutoTArray<SkScalar> widths(len);
paint.getTextWidths(text, len, &widths[0]);
-
+
SkRandom rand;
SkScalar x = SkIntToScalar(20);
SkScalar y = SkIntToScalar(100);
@@ -58,9 +58,9 @@ protected:
pos[i].set(x, y + rand.nextSScalar1() * 24);
x += widths[i];
}
-
+
canvas->translate(0, SkIntToScalar(64));
-
+
canvas->drawPosText(text, len, &pos[0], paint);
paint.getPosTextPath(text, len, &pos[0], &path);
strokePath(canvas, path);
diff --git a/gm/gm.h b/gm/gm.h
index 399c3fea9f..d3c2f4ba1f 100644
--- a/gm/gm.h
+++ b/gm/gm.h
@@ -17,7 +17,7 @@
#include "SkTRegistry.h"
namespace skiagm {
-
+
static inline SkISize make_isize(int w, int h) {
SkISize sz;
sz.set(w, h);
@@ -28,7 +28,7 @@ namespace skiagm {
public:
GM();
virtual ~GM();
-
+
enum Flags {
kSkipPDF_Flag = 1 << 0,
kSkipPicture_Flag = 1 << 1,
@@ -39,7 +39,7 @@ namespace skiagm {
void draw(SkCanvas*);
void drawBackground(SkCanvas*);
void drawContent(SkCanvas*);
-
+
SkISize getISize() { return this->onISize(); }
const char* shortName();
@@ -62,8 +62,8 @@ namespace skiagm {
// GM's getISize bounds.
void drawSizeBounds(SkCanvas*, SkColor);
- static void SetResourcePath(const char* resourcePath) {
- gResourcePath = resourcePath;
+ static void SetResourcePath(const char* resourcePath) {
+ gResourcePath = resourcePath;
}
protected:
diff --git a/gm/gradients.cpp b/gm/gradients.cpp
index 8e8bb13ee9..a2d1de24d7 100644
--- a/gm/gradients.cpp
+++ b/gm/gradients.cpp
@@ -77,9 +77,9 @@ static SkShader* Make2Conical(const SkPoint pts[2], const GradData& data,
SkScalar radius1 = SkScalarDiv(pts[1].fX - pts[0].fX, 3);
center0.set(pts[0].fX + radius0, pts[0].fY + radius0);
center1.set(pts[1].fX - radius1, pts[1].fY - radius1);
- return SkGradientShader::CreateTwoPointConical(center1, radius1,
- center0, radius0,
- data.fColors, data.fPos,
+ return SkGradientShader::CreateTwoPointConical(center1, radius1,
+ center0, radius0,
+ data.fColors, data.fPos,
data.fCount, tm, mapper);
}
@@ -93,19 +93,19 @@ static const GradMaker gGradMakers[] = {
class GradientsGM : public GM {
public:
- GradientsGM() {
+ GradientsGM() {
this->setBGColor(0xFFDDDDDD);
}
-
+
protected:
SkString onShortName() {
return SkString("gradients");
}
-
+
virtual SkISize onISize() { return make_isize(640, 615); }
-
+
virtual void onDraw(SkCanvas* canvas) {
-
+
SkPoint pts[2] = {
{ 0, 0 },
{ SkIntToScalar(100), SkIntToScalar(100) }
@@ -114,7 +114,7 @@ protected:
SkRect r = { 0, 0, SkIntToScalar(100), SkIntToScalar(100) };
SkPaint paint;
paint.setAntiAlias(true);
-
+
canvas->translate(SkIntToScalar(20), SkIntToScalar(20));
for (size_t i = 0; i < SK_ARRAY_COUNT(gGradData); i++) {
canvas->save();
@@ -129,7 +129,7 @@ protected:
canvas->translate(SkIntToScalar(120), 0);
}
}
-
+
private:
typedef GM INHERITED;
};
@@ -138,19 +138,19 @@ private:
// gradient shaders' local matrices
class GradientsLocalPerspectiveGM : public GM {
public:
- GradientsLocalPerspectiveGM() {
+ GradientsLocalPerspectiveGM() {
this->setBGColor(0xFFDDDDDD);
}
-
+
protected:
SkString onShortName() {
return SkString("gradients_local_perspective");
}
-
+
virtual SkISize onISize() { return make_isize(640, 615); }
-
+
virtual void onDraw(SkCanvas* canvas) {
-
+
SkPoint pts[2] = {
{ 0, 0 },
{ SkIntToScalar(100), SkIntToScalar(100) }
@@ -159,13 +159,13 @@ protected:
SkRect r = { 0, 0, SkIntToScalar(100), SkIntToScalar(100) };
SkPaint paint;
paint.setAntiAlias(true);
-
+
canvas->translate(SkIntToScalar(20), SkIntToScalar(20));
for (size_t i = 0; i < SK_ARRAY_COUNT(gGradData); i++) {
canvas->save();
for (size_t j = 0; j < SK_ARRAY_COUNT(gGradMakers); j++) {
SkShader* shader = gGradMakers[j](pts, gGradData[i], tm, NULL);
-
+
// apply an increasing y perspective as we move to the right
SkMatrix perspective;
perspective.setIdentity();
@@ -184,7 +184,7 @@ protected:
canvas->translate(SkIntToScalar(120), 0);
}
}
-
+
private:
typedef GM INHERITED;
};
@@ -196,9 +196,9 @@ protected:
SkString onShortName() {
return SkString("gradients_view_perspective");
}
-
+
virtual SkISize onISize() { return make_isize(640, 400); }
-
+
virtual void onDraw(SkCanvas* canvas) {
SkMatrix perspective;
perspective.setIdentity();
@@ -207,7 +207,7 @@ protected:
canvas->concat(perspective);
INHERITED::onDraw(canvas);
}
-
+
private:
typedef GradientsGM INHERITED;
};
@@ -219,7 +219,7 @@ private:
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
-
+
var g = ctx.createRadialGradient(-80, 25, 70, 0, 25, 150);
g.addColorStop(0, '#f00');
g.addColorStop(0.01, '#0f0');
@@ -231,21 +231,21 @@ private:
class GradientsDegenrate2PointGM : public GM {
public:
GradientsDegenrate2PointGM() {}
-
+
protected:
SkString onShortName() {
return SkString("gradients_degenerate_2pt");
}
-
- virtual SkISize onISize() { return make_isize(320, 320); }
-
+
+ virtual SkISize onISize() { return make_isize(320, 320); }
+
void drawBG(SkCanvas* canvas) {
canvas->drawColor(SK_ColorBLUE);
}
-
+
virtual void onDraw(SkCanvas* canvas) {
this->drawBG(canvas);
-
+
SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorGREEN, SK_ColorRED };
SkScalar pos[] = { 0, SkFloatToScalar(0.01f), SkFloatToScalar(0.99f), SK_Scalar1 };
SkPoint c0;
@@ -261,7 +261,7 @@ protected:
paint.setShader(s)->unref();
canvas->drawPaint(paint);
}
-
+
private:
typedef GM INHERITED;
};
@@ -321,7 +321,7 @@ protected:
const SkISize dim = this->getISize();
this->drawBG(canvas);
-
+
SkPaint paint;
paint.setDither(true);
SkPoint center;
diff --git a/gm/hittestpath.cpp b/gm/hittestpath.cpp
index 83f3507da1..4347c9b22f 100644
--- a/gm/hittestpath.cpp
+++ b/gm/hittestpath.cpp
@@ -13,12 +13,12 @@
static void test_hittest(SkCanvas* canvas, const SkPath& path) {
SkPaint paint;
SkRect r = path.getBounds();
-
+
paint.setColor(SK_ColorRED);
canvas->drawPath(path, paint);
-
+
const SkScalar MARGIN = SkIntToScalar(4);
-
+
paint.setColor(0x800000FF);
for (SkScalar y = r.fTop + SK_ScalarHalf - MARGIN; y < r.fBottom + MARGIN; y += SK_Scalar1) {
for (SkScalar x = r.fLeft + SK_ScalarHalf - MARGIN; x < r.fRight + MARGIN; x += SK_Scalar1) {
@@ -32,18 +32,18 @@ static void test_hittest(SkCanvas* canvas, const SkPath& path) {
class HitTestPathGM : public skiagm::GM {
public:
HitTestPathGM () {}
-
+
protected:
virtual SkString onShortName() {
return SkString("hittestpath");
}
-
+
virtual SkISize onISize() { return SkISize::Make(700, 460); }
-
+
virtual void onDraw(SkCanvas* canvas) {
SkPath path;
SkRandom rand;
-
+
int scale = 300;
for (int i = 0; i < 4; ++i) {
path.lineTo(rand.nextUScalar1() * scale, rand.nextUScalar1() * scale);
@@ -53,18 +53,18 @@ protected:
rand.nextUScalar1() * scale, rand.nextUScalar1() * scale,
rand.nextUScalar1() * scale, rand.nextUScalar1() * scale);
}
-
+
path.setFillType(SkPath::kEvenOdd_FillType);
path.offset(SkIntToScalar(20), SkIntToScalar(20));
-
+
test_hittest(canvas, path);
canvas->translate(SkIntToScalar(scale), 0);
path.setFillType(SkPath::kWinding_FillType);
-
+
test_hittest(canvas, path);
}
-
+
private:
typedef GM INHERITED;
};
diff --git a/gm/imageblur.cpp b/gm/imageblur.cpp
index f326f4598b..406f9ef973 100644
--- a/gm/imageblur.cpp
+++ b/gm/imageblur.cpp
@@ -18,7 +18,7 @@ public:
ImageBlurGM() {
this->setBGColor(0xFF000000);
}
-
+
protected:
virtual SkString onShortName() {
return SkString("imageblur");
@@ -46,7 +46,7 @@ protected:
}
canvas->restore();
}
-
+
private:
typedef GM INHERITED;
};
diff --git a/gm/imagefiltersbase.cpp b/gm/imagefiltersbase.cpp
index 31af2c85ac..73ce806e5d 100644
--- a/gm/imagefiltersbase.cpp
+++ b/gm/imagefiltersbase.cpp
@@ -25,7 +25,7 @@ protected:
SkBitmap* result, SkIPoint* offset) {
return false;
}
-
+
FailImageFilter(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {}
private:
@@ -109,27 +109,27 @@ static void draw_text(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) {
static void draw_bitmap(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) {
SkPaint paint;
paint.setImageFilter(imf);
-
+
SkIRect bounds;
r.roundOut(&bounds);
-
+
SkBitmap bm;
bm.setConfig(SkBitmap::kARGB_8888_Config, bounds.width(), bounds.height());
bm.allocPixels();
bm.eraseColor(0);
SkCanvas c(bm);
draw_path(&c, r, NULL);
-
+
canvas->drawBitmap(bm, 0, 0, &paint);
}
static void draw_sprite(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) {
SkPaint paint;
paint.setImageFilter(imf);
-
+
SkIRect bounds;
r.roundOut(&bounds);
-
+
SkBitmap bm;
bm.setConfig(SkBitmap::kARGB_8888_Config, bounds.width(), bounds.height());
bm.allocPixels();
@@ -172,7 +172,7 @@ protected:
draw_bitmap,
draw_sprite
};
-
+
SkColorFilter* cf = SkColorFilter::CreateModeFilter(SK_ColorRED,
SkXfermode::kSrcIn_Mode);
SkImageFilter* filters[] = {
@@ -196,14 +196,14 @@ protected:
canvas->save();
for (size_t j = 0; j < SK_ARRAY_COUNT(filters); ++j) {
drawProc[i](canvas, r, filters[j]);
-
+
draw_frame(canvas, r);
canvas->translate(0, DY);
}
canvas->restore();
canvas->translate(DX, 0);
}
-
+
for(size_t j = 0; j < SK_ARRAY_COUNT(filters); ++j) {
SkSafeUnref(filters[j]);
}
diff --git a/gm/lcdtext.cpp b/gm/lcdtext.cpp
index ab8b8e4b84..706d4fdc79 100644
--- a/gm/lcdtext.cpp
+++ b/gm/lcdtext.cpp
@@ -31,7 +31,7 @@ protected:
SkISize onISize() { return make_isize(640, 480); }
virtual void onDraw(SkCanvas* canvas) {
-
+
y = textHeight;
drawText(canvas, SkString("TEXT: SubpixelTrue LCDRenderTrue"),
true, true);
diff --git a/gm/linepaths.cpp b/gm/linepaths.cpp
index 3d84c379d7..fbf3faf947 100644
--- a/gm/linepaths.cpp
+++ b/gm/linepaths.cpp
@@ -19,9 +19,9 @@ protected:
SkString onShortName() {
return SkString("linepath");
}
-
+
SkISize onISize() { return make_isize(1240, 390); }
-
+
void drawPath(SkPath& path,SkCanvas* canvas,SkColor color,
const SkRect& clip,SkPaint::Cap cap, SkPaint::Join join,
SkPaint::Style style, SkPath::FillType fill,
@@ -38,7 +38,7 @@ protected:
canvas->drawPath(path, paint);
canvas->restore();
}
-
+
virtual void onDraw(SkCanvas* canvas) {
struct FillAndName {
SkPath::FillType fFill;
@@ -109,19 +109,19 @@ protected:
if (0 < style) {
canvas->translate(rect.width() + 40 * SK_Scalar1, 0);
}
-
+
SkColor color = 0xff007000;
this->drawPath(path.fPath, canvas, color, rect,
gCaps[cap].fCap, gCaps[cap].fJoin, gStyles[style].fStyle,
gFills[fill].fFill, SK_Scalar1*10);
-
+
SkPaint rectPaint;
rectPaint.setColor(SK_ColorBLACK);
rectPaint.setStyle(SkPaint::kStroke_Style);
rectPaint.setStrokeWidth(-1);
rectPaint.setAntiAlias(true);
canvas->drawRect(rect, rectPaint);
-
+
SkPaint labelPaint;
labelPaint.setColor(color);
labelPaint.setAntiAlias(true);
@@ -147,7 +147,7 @@ protected:
canvas->restore();
canvas->restore();
}
-
+
private:
typedef GM INHERITED;
};
@@ -160,9 +160,9 @@ protected:
SkString onShortName() {
return SkString("lineclosepath");
}
-
+
SkISize onISize() { return make_isize(1240, 390); }
-
+
void drawPath(SkPath& path,SkCanvas* canvas,SkColor color,
const SkRect& clip,SkPaint::Cap cap, SkPaint::Join join,
SkPaint::Style style, SkPath::FillType fill,
@@ -179,7 +179,7 @@ protected:
canvas->drawPath(path, paint);
canvas->restore();
}
-
+
virtual void onDraw(SkCanvas* canvas) {
struct FillAndName {
SkPath::FillType fFill;
@@ -251,19 +251,19 @@ protected:
if (0 < style) {
canvas->translate(rect.width() + 40 * SK_Scalar1, 0);
}
-
+
SkColor color = 0xff007000;
this->drawPath(path.fPath, canvas, color, rect,
gCaps[cap].fCap, gCaps[cap].fJoin, gStyles[style].fStyle,
gFills[fill].fFill, SK_Scalar1*10);
-
+
SkPaint rectPaint;
rectPaint.setColor(SK_ColorBLACK);
rectPaint.setStyle(SkPaint::kStroke_Style);
rectPaint.setStrokeWidth(-1);
rectPaint.setAntiAlias(true);
canvas->drawRect(rect, rectPaint);
-
+
SkPaint labelPaint;
labelPaint.setColor(color);
labelPaint.setAntiAlias(true);
@@ -289,7 +289,7 @@ protected:
canvas->restore();
canvas->restore();
}
-
+
private:
typedef GM INHERITED;
};
diff --git a/gm/ninepatchstretch.cpp b/gm/ninepatchstretch.cpp
index 226649dc15..fde5b6c3ae 100644
--- a/gm/ninepatchstretch.cpp
+++ b/gm/ninepatchstretch.cpp
@@ -16,7 +16,7 @@ class GrContext;
static void make_bitmap(SkBitmap* bitmap, GrContext* ctx, SkIRect* center) {
SkDevice* dev;
SkCanvas canvas;
-
+
const int kFixed = 28;
const int kStretchy = 8;
const int kSize = 2*kFixed + kStretchy;
@@ -32,19 +32,19 @@ static void make_bitmap(SkBitmap* bitmap, GrContext* ctx, SkIRect* center) {
bitmap->allocPixels();
dev = new SkDevice(*bitmap);
}
-
+
canvas.setDevice(dev)->unref();
canvas.clear(0);
-
+
SkRect r = SkRect::MakeWH(SkIntToScalar(kSize), SkIntToScalar(kSize));
const SkScalar strokeWidth = SkIntToScalar(6);
const SkScalar radius = SkIntToScalar(kFixed) - strokeWidth/2;
-
+
center->setXYWH(kFixed, kFixed, kStretchy, kStretchy);
-
+
SkPaint paint;
paint.setAntiAlias(true);
-
+
paint.setColor(0xFFFF0000);
canvas.drawRoundRect(r, radius, radius, paint);
r.setXYWH(SkIntToScalar(kFixed), 0, SkIntToScalar(kStretchy), SkIntToScalar(kSize));
@@ -56,19 +56,19 @@ static void make_bitmap(SkBitmap* bitmap, GrContext* ctx, SkIRect* center) {
}
namespace skiagm {
-
+
class NinePatchStretchGM : public GM {
public:
SkBitmap fBM;
- NinePatchStretchGM() {}
+ NinePatchStretchGM() {}
protected:
virtual SkString onShortName() {
return SkString("ninepatch-stretch");
}
- virtual SkISize onISize() {
+ virtual SkISize onISize() {
return make_isize(400, 400);
}
@@ -76,25 +76,25 @@ protected:
SkBitmap bm;
SkIRect center;
make_bitmap(&bm, NULL /*SampleCode::GetGr()*/, &center);
-
+
// amount of bm that should not be stretched (unless we have to)
const SkScalar fixed = SkIntToScalar(bm.width() - center.width());
-
+
const SkTSize<SkScalar> size[] = {
{ fixed * 4 / 5, fixed * 4 / 5 }, // shrink in both axes
{ fixed * 4 / 5, fixed * 4 }, // shrink in X
{ fixed * 4, fixed * 4 / 5 }, // shrink in Y
{ fixed * 4, fixed * 4 }
};
-
+
canvas->drawBitmap(bm, SkIntToScalar(10), SkIntToScalar(10), NULL);
-
+
SkScalar x = SkIntToScalar(100);
SkScalar y = SkIntToScalar(100);
-
+
SkPaint paint;
paint.setFilterBitmap(true);
-
+
for (int iy = 0; iy < 2; ++iy) {
for (int ix = 0; ix < 2; ++ix) {
int i = ix * 2 + iy;
@@ -104,7 +104,7 @@ protected:
}
}
}
-
+
private:
typedef GM INHERITED;
};
diff --git a/gm/pathfill.cpp b/gm/pathfill.cpp
index fc864198b4..bfaabc924a 100644
--- a/gm/pathfill.cpp
+++ b/gm/pathfill.cpp
@@ -13,7 +13,7 @@ static SkScalar make_frame(SkPath* path) {
SkRect r = { SkIntToScalar(10), SkIntToScalar(10),
SkIntToScalar(630), SkIntToScalar(470) };
path->addRoundRect(r, SkIntToScalar(15), SkIntToScalar(15));
-
+
SkPaint paint;
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeWidth(SkIntToScalar(5));
@@ -55,7 +55,7 @@ static SkScalar make_sawtooth(SkPath* path) {
const SkScalar x0 = x;
const SkScalar dx = SK_Scalar1 * 5;
const SkScalar dy = SK_Scalar1 * 10;
-
+
path->moveTo(x, y);
for (int i = 0; i < 32; i++) {
x += dx;
@@ -72,10 +72,10 @@ static SkScalar make_sawtooth(SkPath* path) {
static SkScalar make_star(SkPath* path, int n) {
const SkScalar c = SkIntToScalar(45);
const SkScalar r = SkIntToScalar(20);
-
+
SkScalar rad = -SK_ScalarPI / 2;
const SkScalar drad = (n >> 1) * SK_ScalarPI * 2 / n;
-
+
path->moveTo(c, c - r);
for (int i = 1; i < n; i++) {
rad += drad;
@@ -123,26 +123,26 @@ public:
fDY[i] = gProcs[i](&fPath[i]);
}
}
-
+
protected:
virtual SkString onShortName() {
return SkString("pathfill");
}
-
+
virtual SkISize onISize() {
return SkISize::Make(640, 480);
}
-
+
virtual void onDraw(SkCanvas* canvas) {
SkPaint paint;
paint.setAntiAlias(true);
-
+
for (size_t i = 0; i < N; i++) {
canvas->drawPath(fPath[i], paint);
canvas->translate(SkIntToScalar(0), fDY[i]);
}
}
-
+
private:
typedef skiagm::GM INHERITED;
};
@@ -157,16 +157,16 @@ public:
fDY[i] = gProcs[i](&fPath[i]);
}
}
-
+
protected:
virtual SkString onShortName() {
return SkString("pathinvfill");
}
-
+
virtual SkISize onISize() {
return SkISize::Make(450, 220);
}
-
+
static void show(SkCanvas* canvas, const SkPath& path, const SkPaint& paint,
const SkRect* clip, SkScalar top, const SkScalar bottom) {
canvas->save();
@@ -182,7 +182,7 @@ protected:
virtual void onDraw(SkCanvas* canvas) {
SkPath path;
-
+
path.addCircle(SkIntToScalar(50), SkIntToScalar(50), SkIntToScalar(40));
path.toggleInverseFillType();
@@ -197,18 +197,18 @@ protected:
canvas->save();
canvas->clipRect(clipR);
-
+
const SkRect* clipPtr = doclip ? &clipR : NULL;
show(canvas, path, paint, clipPtr, clipR.fTop, clipR.centerY());
show(canvas, path, paint, clipPtr, clipR.centerY(), clipR.fBottom);
-
+
canvas->restore();
canvas->translate(SkIntToScalar(110), 0);
}
}
}
-
+
private:
typedef skiagm::GM INHERITED;
};
diff --git a/gm/pathreverse.cpp b/gm/pathreverse.cpp
index 3f860d5a91..b605a4c647 100644
--- a/gm/pathreverse.cpp
+++ b/gm/pathreverse.cpp
@@ -14,7 +14,7 @@ static void test_path(SkCanvas* canvas, const SkPath& path) {
SkPaint paint;
paint.setAntiAlias(true);
canvas->drawPath(path, paint);
-
+
paint.setStyle(SkPaint::kStroke_Style);
paint.setColor(SK_ColorRED);
canvas->drawPath(path, paint);
@@ -80,15 +80,15 @@ protected:
virtual void onDraw(SkCanvas* canvas) {
if (false) test_rev(canvas); // avoid bit rot, suppress warning
SkRect r = { 10, 10, 100, 60 };
-
+
SkPath path;
-
+
path.addRect(r); test_rev(canvas, path);
-
+
canvas->translate(0, 100);
path.offset(20, 20);
path.addRect(r); test_rev(canvas, path);
-
+
canvas->translate(0, 100);
path.reset();
path.moveTo(10, 10); path.lineTo(30, 30);
@@ -96,7 +96,7 @@ protected:
r.offset(50, 20);
path.addOval(r);
test_rev(canvas, path);
-
+
SkPaint paint;
paint.setTextSize(SkIntToScalar(100));
SkTypeface* hira = SkTypeface::CreateFromName("Hiragino Maru Gothic Pro", SkTypeface::kNormal);
diff --git a/gm/poly2poly.cpp b/gm/poly2poly.cpp
index df824b5c11..9ad5bdcaae 100644
--- a/gm/poly2poly.cpp
+++ b/gm/poly2poly.cpp
@@ -11,38 +11,38 @@ namespace skiagm {
class Poly2PolyGM : public GM {
public:
- Poly2PolyGM() {}
-
+ Poly2PolyGM() {}
+
protected:
virtual SkString onShortName() {
return SkString("poly2poly");
}
- virtual SkISize onISize() {
+ virtual SkISize onISize() {
return make_isize(835, 840);
}
-
+
static void doDraw(SkCanvas* canvas, SkPaint* paint, const int isrc[],
const int idst[], int count) {
SkMatrix matrix;
SkPoint src[4], dst[4];
-
+
for (int i = 0; i < count; i++) {
src[i].set(SkIntToScalar(isrc[2*i+0]), SkIntToScalar(isrc[2*i+1]));
dst[i].set(SkIntToScalar(idst[2*i+0]), SkIntToScalar(idst[2*i+1]));
}
-
+
canvas->save();
matrix.setPolyToPoly(src, dst, count);
canvas->concat(matrix);
-
+
paint->setColor(SK_ColorGRAY);
paint->setStyle(SkPaint::kStroke_Style);
const SkScalar D = SkIntToScalar(64);
canvas->drawRectCoords(0, 0, D, D, *paint);
canvas->drawLine(0, 0, D, D, *paint);
canvas->drawLine(0, D, D, 0, *paint);
-
+
SkPaint::FontMetrics fm;
paint->getFontMetrics(&fm);
paint->setColor(SK_ColorRED);
@@ -52,17 +52,17 @@ protected:
SkString str;
str.appendS32(count);
canvas->drawText(str.c_str(), str.size(), x, y, *paint);
-
+
canvas->restore();
}
-
- virtual void onDraw(SkCanvas* canvas) {
+
+ virtual void onDraw(SkCanvas* canvas) {
SkPaint paint;
paint.setAntiAlias(true);
paint.setStrokeWidth(SkIntToScalar(4));
paint.setTextSize(SkIntToScalar(40));
paint.setTextAlign(SkPaint::kCenter_Align);
-
+
canvas->save();
canvas->translate(SkIntToScalar(10), SkIntToScalar(10));
// translate (1 point)
@@ -70,7 +70,7 @@ protected:
const int dst1[] = { 5, 5 };
doDraw(canvas, &paint, src1, dst1, 1);
canvas->restore();
-
+
canvas->save();
canvas->translate(SkIntToScalar(160), SkIntToScalar(10));
// rotate/uniform-scale (2 points)
@@ -78,7 +78,7 @@ protected:
const int dst2[] = { 32, 32, 64, 48 };
doDraw(canvas, &paint, src2, dst2, 2);
canvas->restore();
-
+
canvas->save();
canvas->translate(SkIntToScalar(10), SkIntToScalar(110));
// rotate/skew (3 points)
@@ -86,7 +86,7 @@ protected:
const int dst3[] = { 0, 0, 96, 0, 24, 64 };
doDraw(canvas, &paint, src3, dst3, 3);
canvas->restore();
-
+
canvas->save();
canvas->translate(SkIntToScalar(160), SkIntToScalar(110));
// perspective (4 points)
@@ -95,7 +95,7 @@ protected:
doDraw(canvas, &paint, src4, dst4, 4);
canvas->restore();
}
-
+
private:
typedef GM INHERITED;
};
diff --git a/gm/quadpaths.cpp b/gm/quadpaths.cpp
index f8b172bc6c..ac91c62df3 100644
--- a/gm/quadpaths.cpp
+++ b/gm/quadpaths.cpp
@@ -19,9 +19,9 @@ protected:
SkString onShortName() {
return SkString("quadpath");
}
-
+
SkISize onISize() { return make_isize(1240, 390); }
-
+
void drawPath(SkPath& path,SkCanvas* canvas,SkColor color,
const SkRect& clip,SkPaint::Cap cap, SkPaint::Join join,
SkPaint::Style style, SkPath::FillType fill,
@@ -38,7 +38,7 @@ protected:
canvas->drawPath(path, paint);
canvas->restore();
}
-
+
virtual void onDraw(SkCanvas* canvas) {
struct FillAndName {
SkPath::FillType fFill;
@@ -110,19 +110,19 @@ protected:
if (0 < style) {
canvas->translate(rect.width() + 40 * SK_Scalar1, 0);
}
-
+
SkColor color = 0xff007000;
this->drawPath(path.fPath, canvas, color, rect,
gCaps[cap].fCap, gCaps[cap].fJoin, gStyles[style].fStyle,
gFills[fill].fFill, SK_Scalar1*10);
-
+
SkPaint rectPaint;
rectPaint.setColor(SK_ColorBLACK);
rectPaint.setStyle(SkPaint::kStroke_Style);
rectPaint.setStrokeWidth(-1);
rectPaint.setAntiAlias(true);
canvas->drawRect(rect, rectPaint);
-
+
SkPaint labelPaint;
labelPaint.setColor(color);
labelPaint.setAntiAlias(true);
@@ -148,7 +148,7 @@ protected:
canvas->restore();
canvas->restore();
}
-
+
private:
typedef GM INHERITED;
};
@@ -161,9 +161,9 @@ protected:
SkString onShortName() {
return SkString("quadclosepath");
}
-
+
SkISize onISize() { return make_isize(1240, 390); }
-
+
void drawPath(SkPath& path,SkCanvas* canvas,SkColor color,
const SkRect& clip,SkPaint::Cap cap, SkPaint::Join join,
SkPaint::Style style, SkPath::FillType fill,
@@ -180,7 +180,7 @@ protected:
canvas->drawPath(path, paint);
canvas->restore();
}
-
+
virtual void onDraw(SkCanvas* canvas) {
struct FillAndName {
SkPath::FillType fFill;
@@ -253,19 +253,19 @@ protected:
if (0 < style) {
canvas->translate(rect.width() + 40 * SK_Scalar1, 0);
}
-
+
SkColor color = 0xff007000;
this->drawPath(path.fPath, canvas, color, rect,
gCaps[cap].fCap, gCaps[cap].fJoin, gStyles[style].fStyle,
gFills[fill].fFill, SK_Scalar1*10);
-
+
SkPaint rectPaint;
rectPaint.setColor(SK_ColorBLACK);
rectPaint.setStyle(SkPaint::kStroke_Style);
rectPaint.setStrokeWidth(-1);
rectPaint.setAntiAlias(true);
canvas->drawRect(rect, rectPaint);
-
+
SkPaint labelPaint;
labelPaint.setColor(color);
labelPaint.setAntiAlias(true);
@@ -291,7 +291,7 @@ protected:
canvas->restore();
canvas->restore();
}
-
+
private:
typedef GM INHERITED;
};
diff --git a/gm/simpleaaclip.cpp b/gm/simpleaaclip.cpp
index 1539cfa64e..c6e8ba9b5c 100644
--- a/gm/simpleaaclip.cpp
+++ b/gm/simpleaaclip.cpp
@@ -38,7 +38,7 @@ static void paint_rgn(SkCanvas* canvas, const SkAAClip& clip,
//////////////////////////////////////////////////////////////////////////////
/*
- * This GM tests anti aliased single operation booleans with SkAAClips,
+ * This GM tests anti aliased single operation booleans with SkAAClips,
* SkRect and SkPaths.
*/
class SimpleClipGM : public GM {
@@ -53,9 +53,9 @@ public:
: fGeomType(geomType) {
// offset the rects a bit so we get anti-aliasing in the rect case
- fBase.set(SkFloatToScalar(100.65f),
- SkFloatToScalar(100.65f),
- SkFloatToScalar(150.65f),
+ fBase.set(SkFloatToScalar(100.65f),
+ SkFloatToScalar(100.65f),
+ SkFloatToScalar(150.65f),
SkFloatToScalar(150.65f));
fRect = fBase;
fRect.inset(5, 5);
@@ -77,14 +77,14 @@ protected:
void drawOrig(SkCanvas* canvas) {
SkPaint paint;
-
+
paint.setStyle(SkPaint::kStroke_Style);
paint.setColor(SK_ColorBLACK);
-
+
canvas->drawRect(fBase, paint);
canvas->drawRect(fRect, paint);
}
-
+
void drawRgnOped(SkCanvas* canvas, SkRegion::Op op, SkColor color) {
SkAAClip clip;
@@ -128,9 +128,9 @@ protected:
virtual SkString onShortName() {
SkString str;
- str.printf("simpleaaclip_%s",
+ str.printf("simpleaaclip_%s",
kRect_GeomType == fGeomType ? "rect" :
- (kPath_GeomType == fGeomType ? "path" :
+ (kPath_GeomType == fGeomType ? "path" :
"aaclip"));
return str;
}
@@ -161,7 +161,7 @@ protected:
for (size_t op = 0; op < SK_ARRAY_COUNT(gOps); op++) {
canvas->drawText(gOps[op].fName, strlen(gOps[op].fName),
- SkIntToScalar(75), SkIntToScalar(50),
+ SkIntToScalar(75), SkIntToScalar(50),
textPaint);
if (kAAClip_GeomType == fGeomType) {
diff --git a/gm/strokerects.cpp b/gm/strokerects.cpp
index 92f2a187bd..62a9639c2b 100644
--- a/gm/strokerects.cpp
+++ b/gm/strokerects.cpp
@@ -23,7 +23,7 @@ static const SkScalar SH = SkIntToScalar(H);
class StrokeRectGM : public GM {
public:
StrokeRectGM() {}
-
+
protected:
virtual SkString onShortName() {
return SkString("strokerects");
@@ -40,7 +40,7 @@ protected:
SkScalar h = rand.nextUScalar1() * (H >> 2);
SkScalar hoffset = rand.nextSScalar1();
SkScalar woffset = rand.nextSScalar1();
-
+
r->set(x, y, x + w, y + h);
r->offset(-w/2 + woffset, -h/2 + hoffset);
}
@@ -70,7 +70,7 @@ protected:
}
}
}
-
+
private:
typedef GM INHERITED;
};
diff --git a/gm/tablecolorfilter.cpp b/gm/tablecolorfilter.cpp
index 6e2b943ce7..c8806f904d 100644
--- a/gm/tablecolorfilter.cpp
+++ b/gm/tablecolorfilter.cpp
@@ -16,7 +16,7 @@ static void make_bm0(SkBitmap* bm) {
bm->setConfig(SkBitmap::kARGB_8888_Config, W, H);
bm->allocPixels();
bm->eraseColor(0);
-
+
SkCanvas canvas(*bm);
SkPaint paint;
SkPoint pts[] = { {0, 0}, {SkIntToScalar(W), SkIntToScalar(H)} };
@@ -35,7 +35,7 @@ static void make_bm1(SkBitmap* bm) {
bm->setConfig(SkBitmap::kARGB_8888_Config, W, H);
bm->allocPixels();
bm->eraseColor(0);
-
+
SkCanvas canvas(*bm);
SkPaint paint;
SkScalar cx = SkIntToScalar(W)/2;
@@ -92,27 +92,27 @@ static SkColorFilter* make_cf3() {
class TableColorFilterGM : public skiagm::GM {
public:
TableColorFilterGM() {}
-
+
protected:
virtual SkString onShortName() {
return SkString("tablecolorfilter");
}
-
+
virtual SkISize onISize() {
return SkISize::Make(700, 300);
}
-
+
virtual void onDraw(SkCanvas* canvas) {
canvas->drawColor(0xFFDDDDDD);
canvas->translate(20, 20);
-
+
SkScalar x = 0, y = 0;
-
+
static void (*gMakers[])(SkBitmap*) = { make_bm0, make_bm1 };
for (size_t maker = 0; maker < SK_ARRAY_COUNT(gMakers); ++maker) {
SkBitmap bm;
gMakers[maker](&bm);
-
+
SkPaint paint;
x = 0;
canvas->drawBitmap(bm, x, y, &paint);
@@ -124,11 +124,11 @@ protected:
canvas->drawBitmap(bm, x, y, &paint);
paint.setColorFilter(make_cf3())->unref(); x += bm.width() * 9 / 8;
canvas->drawBitmap(bm, x, y, &paint);
-
+
y += bm.height() * 9 / 8;
}
}
-
+
private:
typedef GM INHERITED;
};
diff --git a/gm/testimagefilters.cpp b/gm/testimagefilters.cpp
index 113cdfa217..39b974b296 100644
--- a/gm/testimagefilters.cpp
+++ b/gm/testimagefilters.cpp
@@ -52,13 +52,13 @@ static SkImageFilter* make6() {
SkAutoUnref aur1(inner);
SkImageFilter* compose = new SkComposeImageFilter(outer, inner);
SkAutoUnref aur2(compose);
-
+
SkColorFilter* cf = SkColorFilter::CreateModeFilter(0x880000FF,
SkXfermode::kSrcIn_Mode);
SkAutoUnref aur3(cf);
SkImageFilter* blue = new SkColorFilterImageFilter(cf);
SkAutoUnref aur4(blue);
-
+
return new SkMergeImageFilter(compose, blue);
}
@@ -69,13 +69,13 @@ static SkImageFilter* make7() {
SkAutoUnref aur1(inner);
SkImageFilter* compose = new SkComposeImageFilter(outer, inner);
SkAutoUnref aur2(compose);
-
+
SkColorFilter* cf = SkColorFilter::CreateModeFilter(0x880000FF,
SkXfermode::kSrcIn_Mode);
SkAutoUnref aur3(cf);
SkImageFilter* blue = new SkColorFilterImageFilter(cf);
SkAutoUnref aur4(blue);
-
+
return new SkMergeImageFilter(compose, blue);
}
@@ -106,9 +106,9 @@ protected:
static SkImageFilter* (*gFilterProc[])() = {
make0, make1, make2, make3, make4, make5, make6, make7
};
-
+
const SkRect bounds = SkRect::MakeWH(FILTER_WIDTH, FILTER_HEIGHT);
-
+
const SkScalar dx = bounds.width() * 8 / 7;
const SkScalar dy = bounds.height() * 8 / 7;
@@ -124,7 +124,7 @@ protected:
SkPaint p;
p.setStyle(SkPaint::kStroke_Style);
canvas->drawRect(bounds, p);
-
+
SkPaint paint;
paint.setImageFilter(gFilterProc[i]())->unref();
canvas->saveLayer(&bounds, &paint);
diff --git a/gm/texdata.cpp b/gm/texdata.cpp
index 927ee170c3..cf1a701cef 100644
--- a/gm/texdata.cpp
+++ b/gm/texdata.cpp
@@ -87,7 +87,7 @@ protected:
desc.fConfig = kSkia8888_PM_GrPixelConfig;
desc.fWidth = 2 * S;
desc.fHeight = 2 * S;
- GrTexture* texture =
+ GrTexture* texture =
ctx->createUncachedTexture(desc, gTextureData, 0);
if (!texture) {
@@ -129,7 +129,7 @@ protected:
offset = 0;
for (int y = 0; y < S; ++y) {
for (int x = 0; x < S; ++x) {
- gTextureData[offset + y * stride + x] =
+ gTextureData[offset + y * stride + x] =
((x + y) % 2) ? (i ? green : red) : blue;
}
}
diff --git a/gyp/FileReaderApp.gyp b/gyp/FileReaderApp.gyp
index 545eff2b28..b56460bee0 100644
--- a/gyp/FileReaderApp.gyp
+++ b/gyp/FileReaderApp.gyp
@@ -4,7 +4,7 @@
'target_name': 'FileReaderApp',
'type': 'executable',
'mac_bundle' : 1,
-
+
'include_dirs' : [
'../include/pipe',
'../experimental/FileReaderApp',
diff --git a/gyp/SampleApp.gyp b/gyp/SampleApp.gyp
index 23ab8a7bb1..0d65e8b0de 100644
--- a/gyp/SampleApp.gyp
+++ b/gyp/SampleApp.gyp
@@ -104,7 +104,7 @@
'../samplecode/SampleXfermodes.cpp',
'../samplecode/SampleXfermodesBlur.cpp',
'../samplecode/TransitionView.cpp',
-
+
# DrawingBoard
#'../experimental/DrawingBoard/SkColorPalette.h',
#'../experimental/DrawingBoard/SkColorPalette.cpp',
@@ -112,12 +112,12 @@
#'../experimental/DrawingBoard/SkNetPipeController.cpp',
#'../experimental/DrawingBoard/SampleDrawingClient.cpp',
#'../experimental/DrawingBoard/SampleDrawingServer.cpp',
-
+
# Networking
#'../experimental/Networking/SampleNetPipeReader.cpp',
#'../experimental/Networking/SkSockets.cpp',
#'../experimental/Networking/SkSockets.h',
-
+
# Debugger
'../experimental/Debugger/DebuggerViews.h',
'../experimental/Debugger/DebuggerContentView.cpp',
@@ -173,7 +173,7 @@
'../src/views/mac/SampleAppDelegate.mm',
'../src/views/mac/SkSampleNSView.h',
'../src/views/mac/SkSampleNSView.mm',
-
+
# Mac files
'../src/views/mac/SkEventNotifier.h',
'../src/views/mac/SkEventNotifier.mm',
diff --git a/gyp/SimpleCocoaApp.gyp b/gyp/SimpleCocoaApp.gyp
index f20c44449b..dd02c41ac8 100644
--- a/gyp/SimpleCocoaApp.gyp
+++ b/gyp/SimpleCocoaApp.gyp
@@ -18,11 +18,11 @@
'../src/views/mac/SkOSWindow_Mac.mm',
'../src/views/mac/SkTextFieldCell.h',
'../src/views/mac/SkTextFieldCell.m',
-
+
'../experimental/SimpleCocoaApp/SimpleApp-Info.plist',
'../experimental/SimpleCocoaApp/SimpleApp.h',
'../experimental/SimpleCocoaApp/SimpleApp.mm',
-
+
],
'dependencies': [
'core.gyp:core',
diff --git a/gyp/android_deps.gyp b/gyp/android_deps.gyp
index 122f2c3a37..ea7bbf2c13 100644
--- a/gyp/android_deps.gyp
+++ b/gyp/android_deps.gyp
@@ -1,18 +1,18 @@
# This GYP file stores the dependencies necessary to build Skia on the Android
# platform. The OS doesn't provide many stable libraries as part of the
-# distribution so we have to build a few of them ourselves.
+# distribution so we have to build a few of them ourselves.
#
-# We tried adding this gyp file to the android directory at the root of
+# We tried adding this gyp file to the android directory at the root of
# the Skia repo, but that resulted in the generated makefiles being created
# outside of the intended output directory. So to avoid this we created a simple
# shim here that includes the android_deps.gypi file. The actual dependencies
-# are defined and maintained in that gypi file.
-#
+# are defined and maintained in that gypi file.
+#
# Also this assumes that the android directory is a sibling to the directory
# that contains your primary Skia checkout. If it is not then you must manually
# edit the includes below to specify the actual location of the android.gypi.
# This is due to the fact that we cannot use variables in an includes as the
-# variable expansion step for gyp happens after the includes are processed.
+# variable expansion step for gyp happens after the includes are processed.
{
'includes': [
'../../android/gyp/dependencies.gypi',
diff --git a/gyp/android_system.gyp b/gyp/android_system.gyp
index bbc1e69cfa..a2a9a0ab55 100644
--- a/gyp/android_system.gyp
+++ b/gyp/android_system.gyp
@@ -1,18 +1,18 @@
# This GYP file stores the dependencies necessary to build Skia on the Android
# platform. The OS doesn't provide many stable libraries as part of the
-# distribution so we have to build a few of them ourselves.
+# distribution so we have to build a few of them ourselves.
#
-# We tried adding this gyp file to the android directory at the root of
+# We tried adding this gyp file to the android directory at the root of
# the Skia repo, but that resulted in the generated makefiles being created
# outside of the intended output directory. So to avoid this we created a simple
# shim here that includes the android_system.gypi file. The actual dependencies
-# are defined and maintained in that gypi file.
-#
+# are defined and maintained in that gypi file.
+#
# Also this assumes that the android directory is a sibling to the directory
# that contains your primary Skia checkout. If it is not then you must manually
# edit the includes below to specify the actual location of the android.gypi.
# This is due to the fact that we cannot use variables in an includes as the
-# variable expansion step for gyp happens after the includes are processed.
+# variable expansion step for gyp happens after the includes are processed.
{
'includes': [
'../../android/gyp/android.gypi',
diff --git a/gyp/bench.gypi b/gyp/bench.gypi
index 5d2730d296..26d8b36a36 100644
--- a/gyp/bench.gypi
+++ b/gyp/bench.gypi
@@ -9,7 +9,7 @@
'../bench/AAClipBench.cpp',
'../bench/BitmapBench.cpp',
'../bench/BlurBench.cpp',
- '../bench/ChecksumBench.cpp',
+ '../bench/ChecksumBench.cpp',
'../bench/ChromeBench.cpp',
'../bench/DashBench.cpp',
'../bench/DecodeBench.cpp',
diff --git a/gyp/common_variables.gypi b/gyp/common_variables.gypi
index 247fe746c0..79c6ee59b1 100644
--- a/gyp/common_variables.gypi
+++ b/gyp/common_variables.gypi
@@ -101,4 +101,4 @@
# tab-width:2
# indent-tabs-mode:nil
# End:
-# vim: set expandtab tabstop=2 shiftwidth=2: \ No newline at end of file
+# vim: set expandtab tabstop=2 shiftwidth=2:
diff --git a/gyp/gm.gyp b/gyp/gm.gyp
index 13f1976441..f519824357 100644
--- a/gyp/gm.gyp
+++ b/gyp/gm.gyp
@@ -27,7 +27,7 @@
'images.gyp:images',
'pdf.gyp:pdf',
'ports.gyp:ports',
- 'utils.gyp:utils',
+ 'utils.gyp:utils',
],
'conditions': [
['skia_os == "mac"', {
diff --git a/gyp/gpu.gyp b/gyp/gpu.gyp
index 58a8ade3e4..7228758723 100644
--- a/gyp/gpu.gyp
+++ b/gyp/gpu.gyp
@@ -176,7 +176,7 @@
'sources': [
'<@(gr_sources)',
'<@(gr_native_gl_sources)',
- '<@(gr_angle_gl_sources)',
+ '<@(gr_angle_gl_sources)',
'<@(gr_mesa_gl_sources)',
'<@(gr_debug_gl_sources)',
'<@(gr_null_gl_sources)',
diff --git a/gyp/iOSSampleApp.gyp b/gyp/iOSSampleApp.gyp
index 6da247c067..f9c8a582d2 100644
--- a/gyp/iOSSampleApp.gyp
+++ b/gyp/iOSSampleApp.gyp
@@ -111,11 +111,11 @@
'../samplecode/SampleVertices.cpp',
'../samplecode/SampleXfermodes.cpp',
'../samplecode/SampleXfermodesBlur.cpp',
-
+
# Dependencies for the pipe code in SampleApp
'../src/pipe/SkGPipeRead.cpp',
'../src/pipe/SkGPipeWrite.cpp',
-
+
# DrawingBoard
'../experimental/DrawingBoard/SkColorPalette.h',
'../experimental/DrawingBoard/SkColorPalette.cpp',
@@ -123,12 +123,12 @@
'../experimental/DrawingBoard/SkNetPipeController.cpp',
'../experimental/DrawingBoard/SampleDrawingClient.cpp',
'../experimental/DrawingBoard/SampleDrawingServer.cpp',
-
+
# Networking
'../experimental/Networking/SampleNetPipeReader.cpp',
'../experimental/Networking/SkSockets.cpp',
'../experimental/Networking/SkSockets.h',
-
+
# Transition
'../src/utils/SkInterpolator.cpp',
'../include/utils/SkInterpolator.h',
@@ -192,14 +192,14 @@
'../experimental/iOSSampleApp/Shared/SkUIDetailViewController.h',
'../experimental/iOSSampleApp/Shared/SkUIDetailViewController.mm',
'../experimental/iOSSampleApp/Shared/main.m',
-
+
# iPad
'../experimental/iOSSampleApp/iPad/AppDelegate_iPad.h',
'../experimental/iOSSampleApp/iPad/AppDelegate_iPad.mm',
'../experimental/iOSSampleApp/iPad/SkUISplitViewController.h',
'../experimental/iOSSampleApp/iPad/SkUISplitViewController.mm',
'../experimental/iOSSampleApp/iPad/MainWindow_iPad.xib',
-
+
# iPhone
'../experimental/iOSSampleApp/iPhone/AppDelegate_iPhone.h',
'../experimental/iOSSampleApp/iPhone/AppDelegate_iPhone.mm',
diff --git a/gyp/ports.gyp b/gyp/ports.gyp
index c286603bd8..34c0540d75 100644
--- a/gyp/ports.gyp
+++ b/gyp/ports.gyp
@@ -116,7 +116,7 @@
'android_deps.gyp:ft2',
'android_deps.gyp:expat',
],
- }],
+ }],
],
'direct_dependent_settings': {
'include_dirs': [
diff --git a/gyp/shapeops_demo.gyp b/gyp/shapeops_demo.gyp
index 2e594b115e..910e2ec9d3 100644
--- a/gyp/shapeops_demo.gyp
+++ b/gyp/shapeops_demo.gyp
@@ -78,7 +78,7 @@
}],
[ 'skia_os == "mac"', {
'sources': [
-
+
# Mac files
'../src/views/mac/SkEventNotifier.h',
'../src/views/mac/SkEventNotifier.mm',
diff --git a/gyp/utils.gyp b/gyp/utils.gyp
index b4b8785465..9cfe46eb9c 100644
--- a/gyp/utils.gyp
+++ b/gyp/utils.gyp
@@ -73,7 +73,7 @@
#mac
'../include/utils/mac/SkCGUtils.h',
'../src/utils/mac/SkCreateCGImageRef.cpp',
-
+
#windows
'../include/utils/win/SkAutoCoInitialize.h',
'../include/utils/win/SkHRESULT.h',
diff --git a/src/animator/SkAnimateActive.cpp b/src/animator/SkAnimateActive.cpp
index 4177aa0568..00ee9df451 100644
--- a/src/animator/SkAnimateActive.cpp
+++ b/src/animator/SkAnimateActive.cpp
@@ -22,7 +22,7 @@ SkActive::SkActive(SkApply& apply, SkAnimateMaker& maker) : fApply(apply),
fMaxTime(0), fMaker(maker), fDrawIndex(0), fDrawMax(0) {
}
-void SkActive::init()
+void SkActive::init()
{
fAnimators = fApply.fAnimators;
int animators = fAnimators.count();
@@ -98,7 +98,7 @@ void SkActive::append(SkApply* apply) {
saveIndex -= oldCount;
delete[] fSaveRestore[saveIndex];
fSaveRestore.remove(saveIndex);
- delete[] fSaveInterpolators[saveIndex];
+ delete[] fSaveInterpolators[saveIndex];
fSaveInterpolators.remove(saveIndex);
} while (saveIndex > 0);
}
@@ -127,17 +127,17 @@ void SkActive::appendSave(int oldCount) {
SkASSERT(saveIndex >= 0);
SkASSERT(newTotal >= 0);
memmove(&fSaveRestore[newTotal], &fSaveRestore[saveIndex], oldCount);
- memset(&fSaveRestore[newTotal + oldCount], 0,
+ memset(&fSaveRestore[newTotal + oldCount], 0,
sizeof(fSaveRestore[0]) * (newCount - oldCount));
- memmove(&fSaveInterpolators[newTotal],
+ memmove(&fSaveInterpolators[newTotal],
&fSaveInterpolators[saveIndex], oldCount);
- memset(&fSaveInterpolators[newTotal + oldCount], 0,
+ memset(&fSaveInterpolators[newTotal + oldCount], 0,
sizeof(fSaveRestore[0]) * (newCount - oldCount));
} while (saveIndex > 0);
SkASSERT(newTotal == 0);
}
-void SkActive::calcDurations(int index)
+void SkActive::calcDurations(int index)
{
SkAnimateBase* animate = fAnimators[index];
SkMSec duration = animate->dur;
@@ -174,7 +174,7 @@ void SkActive::create(SkDrawable* drawable, SkMSec time) {
if (animate->formula.size() > 0) {
SkTDOperandArray values;
values.setCount(count);
- bool success = animate->fFieldInfo->setValue(fMaker, &values, 0, 0, NULL,
+ bool success = animate->fFieldInfo->setValue(fMaker, &values, 0, 0, NULL,
animate->getValuesType(), animate->formula);
SkASSERT(success);
fApply.applyValues(index, values.begin(), count, animate->getValuesType(), time);
@@ -212,7 +212,7 @@ bool SkActive::immediate(bool enable) {
if (animate->formula.size() > 0) {
SkTDOperandArray values;
values.setCount(count);
- bool success = animate->fFieldInfo->setValue(fMaker, &values, 0, 0, NULL,
+ bool success = animate->fFieldInfo->setValue(fMaker, &values, 0, 0, NULL,
animate->getValuesType(), animate->formula);
SkASSERT(success);
fApply.applyValues(index, values.begin(), count, animate->getValuesType(), time);
@@ -259,7 +259,7 @@ bool SkActive::initializeSave() {
memset(&fSaveRestore[oldCount], 0, sizeof(fSaveRestore[0]) * (activeTotal - oldCount));
SkASSERT(fSaveInterpolators.count() == oldCount);
fSaveInterpolators.setCount(activeTotal);
- memset(&fSaveInterpolators[oldCount], 0,
+ memset(&fSaveInterpolators[oldCount], 0,
sizeof(fSaveInterpolators[0]) * (activeTotal - oldCount));
return true;
}
@@ -287,7 +287,7 @@ void SkActive::initState(SkApply* apply, int offset) {
state.fStarted = false;
state.fSteps = apply->steps;
state.fTicks = 0;
- state.fUnpostedEndEvent = (SkBool8) animate->fHasEndEvent;
+ state.fUnpostedEndEvent = (SkBool8) animate->fHasEndEvent;
calcDurations(index);
setInterpolator(index, from);
}
@@ -317,7 +317,7 @@ void SkActive::pickUp(SkActive* existing) {
if (workingSum < originalSum) {
SkScalar originalDistance = SkScalarSqrt(originalSum);
SkScalar workingDistance = SkScalarSqrt(workingSum);
- existing->fState[index].fDuration = (SkMSec) SkScalarMulDiv(fState[index].fDuration,
+ existing->fState[index].fDuration = (SkMSec) SkScalarMulDiv(fState[index].fDuration,
workingDistance, originalDistance);
}
fInterpolators[index]->reset(components, 2, SkType_Float);
@@ -376,7 +376,7 @@ void SkActive::setInterpolator(int index, SkOperand* from) {
SkMSec duration = fState[index].fDuration;
int components = animate->components();
SkOperandInterpolator& interpolator = *fInterpolators[index];
- interpolator.reset(components, entries == 1 ? 2 : entries, animate->getValuesType());
+ interpolator.reset(components, entries == 1 ? 2 : entries, animate->getValuesType());
interpolator.setMirror(SkToBool(animate->fMirror));
interpolator.setReset(SkToBool(animate->fReset));
interpolator.setRepeatCount(animate->repeat);
@@ -387,7 +387,7 @@ void SkActive::setInterpolator(int index, SkOperand* from) {
}
for (int entry = 0; entry < entries; entry++) {
int blendIndex = SkMin32(animate->blend.count() - 1, entry);
- interpolator.setKeyFrame(entry, entry * duration / (entries - 1), from,
+ interpolator.setKeyFrame(entry, entry * duration / (entries - 1), from,
animate->blend[blendIndex]);
from += components;
}
@@ -475,12 +475,12 @@ void SkActive::validate() {
// the code below should only be bumping fSave, and there shouldn't be anything
// it needs to be synchronized with
-// however, if there are two animates both operating on the same field, then
-// when one replaces the other, it may make sense to pick up the old value as a starting
+// however, if there are two animates both operating on the same field, then
+// when one replaces the other, it may make sense to pick up the old value as a starting
// value for the new one somehow.
//void SkActive::SkState::bumpSave() {
-// if (fMode != SkApply::kMode_hold)
+// if (fMode != SkApply::kMode_hold)
// return;
// if (fTransition == SkApply::kTransition_reverse) {
// if (fSave > 0)
diff --git a/src/animator/SkAnimateBase.cpp b/src/animator/SkAnimateBase.cpp
index fe3815d75d..0e56faaf1e 100644
--- a/src/animator/SkAnimateBase.cpp
+++ b/src/animator/SkAnimateBase.cpp
@@ -39,8 +39,8 @@ const SkMemberInfo SkAnimateBase::fInfo[] = {
DEFINE_GET_MEMBER(SkAnimateBase);
SkAnimateBase::SkAnimateBase() : begin(0), dur(1), repeat(SK_Scalar1),
- fApply(NULL), fFieldInfo(NULL), fFieldOffset(0), fStart((SkMSec) -1), fTarget(NULL),
- fChanged(0), fDelayed(0), fDynamic(0), fHasEndEvent(0), fHasValues(0),
+ fApply(NULL), fFieldInfo(NULL), fFieldOffset(0), fStart((SkMSec) -1), fTarget(NULL),
+ fChanged(0), fDelayed(0), fDynamic(0), fHasEndEvent(0), fHasValues(0),
fMirror(0), fReset(0), fResetPending(0), fTargetIsScope(0) {
blend.setCount(1);
blend[0] = SK_Scalar1;
@@ -54,8 +54,8 @@ SkAnimateBase::~SkAnimateBase() {
}
}
-int SkAnimateBase::components() {
- return 1;
+int SkAnimateBase::components() {
+ return 1;
}
SkDisplayable* SkAnimateBase::deepCopy(SkAnimateMaker* maker) {
@@ -131,9 +131,9 @@ returnBool:
return true;
}
-bool SkAnimateBase::hasExecute() const
+bool SkAnimateBase::hasExecute() const
{
- return false;
+ return false;
}
void SkAnimateBase::onEndElement(SkAnimateMaker& maker) {
@@ -159,11 +159,11 @@ void SkAnimateBase::onEndElement(SkAnimateMaker& maker) {
}
}
-void SkAnimateBase::packARGB(SkScalar array[], int count, SkTDOperandArray* converted)
-{
+void SkAnimateBase::packARGB(SkScalar array[], int count, SkTDOperandArray* converted)
+{
SkASSERT(count == 4);
converted->setCount(1);
- SkColor color = SkColorSetARGB(SkScalarRound(array[0]), SkScalarRound(array[1]),
+ SkColor color = SkColorSetARGB(SkScalarRound(array[0]), SkScalarRound(array[1]),
SkScalarRound(array[2]), SkScalarRound(array[3]));
(*converted)[0].fS32 = color;
}
@@ -228,8 +228,8 @@ void SkAnimateBase::setTarget(SkAnimateMaker& maker) {
}
}
-bool SkAnimateBase::targetNeedsInitialization() const {
- return false;
+bool SkAnimateBase::targetNeedsInitialization() const {
+ return false;
}
diff --git a/src/animator/SkAnimateField.cpp b/src/animator/SkAnimateField.cpp
index 65e084a0a5..43f510e444 100644
--- a/src/animator/SkAnimateField.cpp
+++ b/src/animator/SkAnimateField.cpp
@@ -28,8 +28,8 @@ SkAnimate::SkAnimate() : fComponents(0) {
SkAnimate::~SkAnimate() {
}
-int SkAnimate::components() {
- return fComponents;
+int SkAnimate::components() {
+ return fComponents;
}
#ifdef SK_DUMP_ENABLED
@@ -50,7 +50,7 @@ void SkAnimate::dump(SkAnimateMaker* maker) {
SkDebugf("blend=\"[");
bool firstElem = true;
for (int i = 0; i < blend.count(); i++) {
- if (!firstElem)
+ if (!firstElem)
SkDebugf(",");
firstElem = false;
SkDebugf("%g", SkScalarToFloat(blend[i]));
@@ -82,7 +82,7 @@ void SkAnimate::onEndElement(SkAnimateMaker& maker) {
SkASSERT(to.size() > 0);
fFieldInfo->setValue(maker, &fValues, 0, 0, NULL, outType, to);
SkASSERT(0);
- // !!! this needs to set fComponents
+ // !!! this needs to set fComponents
return;
}
fComponents = fFieldInfo->getCount();
diff --git a/src/animator/SkAnimateMaker.cpp b/src/animator/SkAnimateMaker.cpp
index 414e728979..ddde2eb891 100644
--- a/src/animator/SkAnimateMaker.cpp
+++ b/src/animator/SkAnimateMaker.cpp
@@ -28,7 +28,7 @@ class DefaultTimeline : public SkAnimator::Timeline {
} gDefaultTimeline;
SkAnimateMaker::SkAnimateMaker(SkAnimator* animator, SkCanvas* canvas, SkPaint* paint)
- : fActiveEvent(NULL), fAdjustedStart(0), fCanvas(canvas), fEnableTime(0),
+ : fActiveEvent(NULL), fAdjustedStart(0), fCanvas(canvas), fEnableTime(0),
fHostEventSinkID(0), fMinimumInterval((SkMSec) -1), fPaint(paint), fParentMaker(NULL),
fTimeline(&gDefaultTimeline), fInInclude(false), fInMovie(false),
fFirstScriptError(false), fLoaded(false), fIDs(256), fAnimator(animator)
@@ -82,7 +82,7 @@ bool SkAnimateMaker::computeID(SkDisplayable* displayable, SkDisplayable* parent
SkDisplayable* SkAnimateMaker::createInstance(const char name[], size_t len) {
SkDisplayTypes type = SkDisplayType::GetType(this, name, len );
- if ((int)type >= 0)
+ if ((int)type >= 0)
return SkDisplayType::CreateInstance(this, type);
return NULL;
}
@@ -124,7 +124,7 @@ void SkAnimateMaker::delayEnable(SkApply* apply, SkMSec time) {
if (index < 0) {
*fDelayed.append() = apply;
}
-
+
(new SkEvent(SK_EventType_Delay, fAnimator->getSinkID()))->postTime(time);
}
@@ -302,7 +302,7 @@ void SkAnimateMaker::setErrorString() {
#if defined SK_DEBUG
SkDebugf("%s\n", fErrorString.c_str());
#endif
- }
+ }
}
void SkAnimateMaker::setEnableTime(SkMSec appTime, SkMSec expectedTime) {
@@ -330,7 +330,7 @@ void SkAnimateMaker::setEnableTime(SkMSec appTime, SkMSec expectedTime) {
}
}
-void SkAnimateMaker::setExtraPropertyCallBack(SkDisplayTypes type,
+void SkAnimateMaker::setExtraPropertyCallBack(SkDisplayTypes type,
SkScriptEngine::_propertyCallBack callBack, void* userStorage) {
SkExtras** end = fExtras.end();
for (SkExtras** extraPtr = fExtras.begin(); extraPtr < end; extraPtr++) {
diff --git a/src/animator/SkAnimateMaker.h b/src/animator/SkAnimateMaker.h
index f20a7d433a..53a5521aa2 100644
--- a/src/animator/SkAnimateMaker.h
+++ b/src/animator/SkAnimateMaker.h
@@ -57,16 +57,16 @@ public:
void dump(const char* match);
#endif
int dynamicProperty(SkString& nameStr, SkDisplayable** );
- bool find(const char* str, SkDisplayable** displayablePtr) const {
+ bool find(const char* str, SkDisplayable** displayablePtr) const {
return fIDs.find(str, displayablePtr);
}
- bool find(const char* str, size_t len, SkDisplayable** displayablePtr) const {
+ bool find(const char* str, size_t len, SkDisplayable** displayablePtr) const {
return fIDs.find(str, len, displayablePtr);
}
bool findKey(SkDisplayable* displayable, const char** string) const {
return fIDs.findKey(displayable, string);
}
-// bool find(SkString& string, SkDisplayable** displayablePtr) {
+// bool find(SkString& string, SkDisplayable** displayablePtr) {
// return fIDs.find(string.c_str(), displayablePtr);
// }
SkAnimator* getAnimator() { return fAnimator; }
@@ -80,7 +80,7 @@ public:
bool hasError() { return fError.hasError(); }
void helperAdd(SkDisplayable* trackMe);
void helperRemove(SkDisplayable* alreadyTracked);
- void idsSet(const char* attrValue, size_t len, SkDisplayable* displayable) {
+ void idsSet(const char* attrValue, size_t len, SkDisplayable* displayable) {
fIDs.set(attrValue, len, displayable); }
// void loadMovies();
void notifyInval();
diff --git a/src/animator/SkAnimateSet.cpp b/src/animator/SkAnimateSet.cpp
index 3dd9648afa..f153b16bbd 100644
--- a/src/animator/SkAnimateSet.cpp
+++ b/src/animator/SkAnimateSet.cpp
@@ -32,7 +32,7 @@ const SkMemberInfo SkSet::fInfo[] = {
DEFINE_GET_MEMBER(SkSet);
SkSet::SkSet() {
- dur = 1;
+ dur = 1;
}
#ifdef SK_DUMP_ENABLED
@@ -48,7 +48,7 @@ void SkSet::dump(SkAnimateMaker* maker) {
#endif
void SkSet::refresh(SkAnimateMaker& maker) {
- fFieldInfo->setValue(maker, &fValues, 0, fFieldInfo->fCount, NULL,
+ fFieldInfo->setValue(maker, &fValues, 0, fFieldInfo->fCount, NULL,
fFieldInfo->getType(), to);
}
diff --git a/src/animator/SkAnimator.cpp b/src/animator/SkAnimator.cpp
index c1fba65244..5d1f220a87 100644
--- a/src/animator/SkAnimator.cpp
+++ b/src/animator/SkAnimator.cpp
@@ -34,7 +34,7 @@
#define _static static
#endif
-_static const char gMathPrimerText[] =
+_static const char gMathPrimerText[] =
"<screenplay>"
"<Math id=\"Math\"/>"
"<Number id=\"Number\"/>"
@@ -108,9 +108,9 @@ bool SkAnimator::doClickEvent(int clickState, SkScalar x, SkScalar y) {
state.fX = x;
state.fY = y;
fMaker->fEnableTime = fMaker->getAppTime();
- bool result = fMaker->fEvents.doEvent(*fMaker,
- clickState == 0 ? SkDisplayEvent::kMouseDown :
- clickState == 1 ? SkDisplayEvent::kMouseDrag :
+ bool result = fMaker->fEvents.doEvent(*fMaker,
+ clickState == 0 ? SkDisplayEvent::kMouseDown :
+ clickState == 1 ? SkDisplayEvent::kMouseDrag :
SkDisplayEvent::kMouseUp, &state);
fMaker->notifyInval();
return result;
@@ -160,7 +160,7 @@ SkAnimator::DifferenceType SkAnimator::draw(SkCanvas* canvas, SkMSec time) {
SkPaint paint;
return draw(canvas, &paint, time);
}
-
+
#ifdef SK_DEBUG
void SkAnimator::eventDone(const SkEvent& ) {
}
@@ -231,7 +231,7 @@ SkFieldType SkAnimator::getFieldType(const char* id, const char* fieldID) {
return info->getArrayValue(element, index, operand);
}
-int32_t SkAnimator::getArrayInt(const SkDisplayable* ae,
+int32_t SkAnimator::getArrayInt(const SkDisplayable* ae,
const SkMemberInfo* ai, int index) {
SkOperand operand;
bool result = getArrayCommon(ae, ai, index, &operand, SkType_Int);
@@ -248,7 +248,7 @@ int32_t SkAnimator::getArrayInt(const char* id, const char* fieldID, int index)
return getArrayInt(element, field, index);
}
-SkScalar SkAnimator::getArrayScalar(const SkDisplayable* ae,
+SkScalar SkAnimator::getArrayScalar(const SkDisplayable* ae,
const SkMemberInfo* ai, int index) {
SkOperand operand;
bool result = getArrayCommon(ae, ai, index, &operand, SkType_Float);
@@ -265,7 +265,7 @@ SkScalar SkAnimator::getArrayScalar(const char* id, const char* fieldID, int ind
return getArrayScalar(element, field, index);
}
-const char* SkAnimator::getArrayString(const SkDisplayable* ae,
+const char* SkAnimator::getArrayString(const SkDisplayable* ae,
const SkMemberInfo* ai, int index) {
SkOperand operand;
bool result = getArrayCommon(ae, ai, index, &operand, SkType_String);
@@ -360,7 +360,7 @@ SkScalar SkAnimator::getScalar(const char* id, const char* fieldID) {
return getScalar(element, field);
}
-const char* SkAnimator::getString(const SkDisplayable* ae,
+const char* SkAnimator::getString(const SkDisplayable* ae,
const SkMemberInfo* ai) {
const SkDisplayable* element = (const SkDisplayable*) ae;
const SkMemberInfo* info = (const SkMemberInfo*) ai;
@@ -501,11 +501,11 @@ void SkAnimator::reset() {
}
SkEventSinkID SkAnimator::getHostEventSinkID() const {
- return fMaker->fHostEventSinkID;
+ return fMaker->fHostEventSinkID;
}
void SkAnimator::setHostEventSinkID(SkEventSinkID target) {
- fMaker->fHostEventSinkID = target;
+ fMaker->fHostEventSinkID = target;
}
void SkAnimator::onSetHostHandler(Handler ) {
@@ -530,7 +530,7 @@ bool SkAnimator::setArrayInt(const char* id, const char* fieldID, const int* arr
SkTypedArray tArray(SkType_Int);
tArray.setCount(num);
for (int i = 0; i < num; i++) {
- SkOperand op;
+ SkOperand op;
op.fS32 = array[i];
tArray[i] = op;
}
@@ -546,7 +546,7 @@ bool SkAnimator::setArray(SkDisplayable* element, const SkMemberInfo* info, SkTy
SkDisplayTypes type = element->getType();
if (type == SkType_Array) {
SkDisplayArray* dispArray = (SkDisplayArray*) element;
- dispArray->values = array;
+ dispArray->values = array;
return true;
}
else
@@ -614,9 +614,9 @@ bool SkAnimator::setScalar(const char* id, const char* fieldID, SkScalar scalar)
return setScalar(element, field, scalar);
}
-bool SkAnimator::setString(SkDisplayable* element,
+bool SkAnimator::setString(SkDisplayable* element,
const SkMemberInfo* info, const char* str) {
- // !!! until this is fixed, can't call script with global references from here
+ // !!! until this is fixed, can't call script with global references from here
info->setValue(*fMaker, NULL, 0, info->fCount, element, info->getType(), str, strlen(str));
return true;
}
diff --git a/src/animator/SkAnimatorScript.cpp b/src/animator/SkAnimatorScript.cpp
index 6aae006690..0e639f29e4 100644
--- a/src/animator/SkAnimatorScript.cpp
+++ b/src/animator/SkAnimatorScript.cpp
@@ -64,8 +64,8 @@ SkAnimatorScript::SkAnimatorScript(SkAnimateMaker& maker, SkDisplayable* working
if (SkDisplayType::IsEnum(&maker, type)) {
// !!! for SpiderMonkey, iterate through the enum values, and map them to globals
const SkDisplayEnumMap& map = GetEnumValues(type);
- propertyCallBack(EvalEnum, (void*) map.fValues);
- }
+ propertyCallBack(EvalEnum, (void*) map.fValues);
+ }
for (SkExtras** extraPtr = maker.fExtras.begin(); extraPtr < maker.fExtras.end(); extraPtr++) {
SkExtras* extra = *extraPtr;
if (extra->fExtraCallBack)
@@ -116,7 +116,7 @@ bool SkAnimatorScript::Box(void* user, SkScriptValue* scriptValue) {
SkDisplayString* boxedValue = new SkDisplayString(*scriptValue->fOperand.fString);
displayable = boxedValue;
} break;
- case SkType_Displayable:
+ case SkType_Displayable:
scriptValue->fOperand.fObject = scriptValue->fOperand.fDisplayable;
scriptValue->fType = SkType_Displayable;
return true;
@@ -130,7 +130,7 @@ bool SkAnimatorScript::Box(void* user, SkScriptValue* scriptValue) {
return true;
}
-bool SkAnimatorScript::Eval(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
+bool SkAnimatorScript::Eval(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
void* eng, SkScriptValue* value) {
if (SK_LITERAL_STR_EQUAL("eval", function, len) == false)
return false;
@@ -152,7 +152,7 @@ bool SkAnimatorScript::EvalEnum(const char* token, size_t len, void* callBack, S
const char* tokens = (const char*) callBack;
value->fType = SkType_Int;
if (MapEnums(tokens, token, len, (int*)&value->fOperand.fS32))
- return true;
+ return true;
return false;
}
@@ -160,7 +160,7 @@ bool SkAnimatorScript::EvalID(const char* token, size_t len, void* user, SkScrip
SkAnimatorScript* engine = (SkAnimatorScript*) user;
SkTDict<SkDisplayable*>* ids = &engine->fMaker.fIDs;
SkDisplayable* displayable;
- bool success = ids->find(token, len, &displayable);
+ bool success = ids->find(token, len, &displayable);
if (success == false) {
displayable = engine->fWorking;
if (SK_LITERAL_STR_EQUAL("parent", token, len)) {
@@ -176,7 +176,7 @@ bool SkAnimatorScript::EvalID(const char* token, size_t len, void* user, SkScrip
if (displayable && EvalMember(token, len, displayable, engine, value))
return true;
value->fOperand.fString = NULL;
- value->fType = SkType_String;
+ value->fType = SkType_String;
} else {
SkDisplayable* working = engine->fWorking;
value->fOperand.fDisplayable = displayable;
@@ -199,7 +199,7 @@ bool SkAnimatorScript::EvalNamedColor(const char* token, size_t len, void* callb
return false;
}
-bool SkAnimatorScript::EvalRGB(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
+bool SkAnimatorScript::EvalRGB(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
void* eng, SkScriptValue* value) {
if (SK_LITERAL_STR_EQUAL("rgb", function, len) == false)
return false;
@@ -218,7 +218,7 @@ bool SkAnimatorScript::EvalRGB(const char* function, size_t len, SkTDArray<SkScr
return true;
}
-bool SkAnimatorScript::EvalMemberCommon(SkScriptEngine* engine, const SkMemberInfo* info,
+bool SkAnimatorScript::EvalMemberCommon(SkScriptEngine* engine, const SkMemberInfo* info,
SkDisplayable* displayable, SkScriptValue* value) {
SkDisplayTypes original;
SkDisplayTypes type = original = (SkDisplayTypes) info->getType();
@@ -232,10 +232,10 @@ bool SkAnimatorScript::EvalMemberCommon(SkScriptEngine* engine, const SkMemberIn
case SkType_MSec:
case SkType_Float:
SkASSERT(info->getCount() == 1);
- if (info->fType != SkType_MemberProperty && info->fType != SkType_MemberFunction)
+ if (info->fType != SkType_MemberProperty && info->fType != SkType_MemberFunction)
value->fOperand.fS32 = *(int32_t*) info->memberData(displayable); // OK for SkScalar too
if (type == SkType_MSec) {
- value->fOperand.fScalar = SkScalarDiv((SkScalar) value->fOperand.fS32, 1000); // dividing two ints is the same as dividing two scalars
+ value->fOperand.fScalar = SkScalarDiv((SkScalar) value->fOperand.fS32, 1000); // dividing two ints is the same as dividing two scalars
type = SkType_Float;
}
break;
@@ -269,7 +269,7 @@ bool SkAnimatorScript::EvalMemberCommon(SkScriptEngine* engine, const SkMemberIn
return true;
}
-bool SkAnimatorScript::EvalMember(const char* member, size_t len, void* object, void* eng,
+bool SkAnimatorScript::EvalMember(const char* member, size_t len, void* object, void* eng,
SkScriptValue* value) {
SkScriptEngine* engine = (SkScriptEngine*) eng;
SkDisplayable* displayable = (SkDisplayable*) object;
@@ -292,7 +292,7 @@ bool SkAnimatorScript::EvalMember(const char* member, size_t len, void* object,
return EvalMemberCommon(engine, info, displayable, value);
}
-bool SkAnimatorScript::EvalMemberFunction(const char* member, size_t len, void* object,
+bool SkAnimatorScript::EvalMemberFunction(const char* member, size_t len, void* object,
SkTDArray<SkScriptValue>& params, void* eng, SkScriptValue* value) {
SkScriptEngine* engine = (SkScriptEngine*) eng;
SkDisplayable* displayable = (SkDisplayable*) object;
@@ -303,7 +303,7 @@ bool SkAnimatorScript::EvalMemberFunction(const char* member, size_t len, void*
SkASSERT(0);
return false;
}
- displayable->executeFunction(displayable, info->functionIndex(), params, info->getType(),
+ displayable->executeFunction(displayable, info->functionIndex(), params, info->getType(),
value);
return EvalMemberCommon(engine, info, displayable, value);
}
@@ -355,7 +355,7 @@ bool SkAnimatorScript::EvaluateString(SkAnimateMaker& maker, SkDisplayable* disp
}
const SkDisplayEnumMap& SkAnimatorScript::GetEnumValues(SkDisplayTypes type) {
- int index = SkTSearch<SkDisplayTypes>(&gEnumMaps[0].fType, gEnumMapCount, type,
+ int index = SkTSearch<SkDisplayTypes>(&gEnumMaps[0].fType, gEnumMapCount, type,
sizeof(SkDisplayEnumMap));
SkASSERT(index >= 0);
return gEnumMaps[index];
@@ -369,7 +369,7 @@ bool SkAnimatorScript::Infinity(const char* token, size_t len, void* user, SkScr
return true;
}
-bool SkAnimatorScript::IsFinite(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
+bool SkAnimatorScript::IsFinite(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
void* eng, SkScriptValue* value) {
if (SK_LITERAL_STR_EQUAL(function, "isFinite", len) == false)
return false;
@@ -379,12 +379,12 @@ bool SkAnimatorScript::IsFinite(const char* function, size_t len, SkTDArray<SkSc
SkDisplayTypes type = scriptValue->fType;
SkScalar scalar = scriptValue->fOperand.fScalar;
value->fType = SkType_Int;
- value->fOperand.fS32 = type == SkType_Float ? SkScalarIsNaN(scalar) == false &&
+ value->fOperand.fS32 = type == SkType_Float ? SkScalarIsNaN(scalar) == false &&
SkScalarAbs(scalar) != SK_ScalarInfinity : type == SkType_Int;
return true;
}
-bool SkAnimatorScript::IsNaN(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
+bool SkAnimatorScript::IsNaN(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
void* eng, SkScriptValue* value) {
if (SK_LITERAL_STR_EQUAL("isNaN", function, len) == false)
return false;
@@ -429,7 +429,7 @@ bool SkAnimatorScript::ObjectToString(void* object, void* user, SkScriptValue* v
SkTDict<SkDisplayable*>* ids = (SkTDict<SkDisplayable*>*) user;
SkDisplayable* displayable = (SkDisplayable*) object;
const char* key;
- bool success = ids->findKey(displayable, &key);
+ bool success = ids->findKey(displayable, &key);
if (success == false)
return false;
value->fOperand.fString = new SkString(key);
@@ -480,7 +480,7 @@ bool SkAnimatorScript::Unbox(void* m, SkScriptValue* scriptValue) {
#include "SkAnimator.h"
-static const char scriptTestSetup[] =
+static const char scriptTestSetup[] =
"<screenplay>\n"
"<text id='label' text='defg'/>\n"
"<add id='addLabel' use='label'/>\n"
diff --git a/src/animator/SkAnimatorScript.h b/src/animator/SkAnimatorScript.h
index a23f90de79..c8802a35e7 100644
--- a/src/animator/SkAnimatorScript.h
+++ b/src/animator/SkAnimatorScript.h
@@ -27,8 +27,8 @@ public:
SkAnimatorScript(SkAnimateMaker& , SkDisplayable* , SkDisplayTypes type);
~SkAnimatorScript();
bool evaluate(const char* script, SkScriptValue* , SkDisplayTypes type);
- void track(SkDisplayable* displayable) {
- SkASSERT(fTrackDisplayable.find(displayable) < 0);
+ void track(SkDisplayable* displayable) {
+ SkASSERT(fTrackDisplayable.find(displayable) < 0);
*fTrackDisplayable.append() = displayable; }
static bool EvaluateDisplayable(SkAnimateMaker& , SkDisplayable* , const char* script, SkDisplayable** );
static bool EvaluateFloat(SkAnimateMaker& , SkDisplayable* , const char* script, SkScalar* );
@@ -38,24 +38,24 @@ public:
static bool MapEnums(const char* ptr, const char* match, size_t len, int* value);
protected:
static bool Box(void* user, SkScriptValue* );
- static bool Eval(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
+ static bool Eval(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
void* callBack, SkScriptValue* );
static bool EvalEnum(const char* token, size_t len, void* callBack, SkScriptValue* );
static bool EvalID(const char* token, size_t len, void* callBack, SkScriptValue* );
- static bool EvalMember(const char* member, size_t len, void* object, void* eng,
+ static bool EvalMember(const char* member, size_t len, void* object, void* eng,
SkScriptValue* value);
- static bool EvalMemberCommon(SkScriptEngine* , const SkMemberInfo* info,
+ static bool EvalMemberCommon(SkScriptEngine* , const SkMemberInfo* info,
SkDisplayable* displayable, SkScriptValue* value);
- static bool EvalMemberFunction(const char* member, size_t len, void* object,
+ static bool EvalMemberFunction(const char* member, size_t len, void* object,
SkTDArray<SkScriptValue>& params, void* user, SkScriptValue* value);
static bool EvalNamedColor(const char* token, size_t len, void* callBack, SkScriptValue* );
- static bool EvalRGB(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
+ static bool EvalRGB(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
void* callBack, SkScriptValue* );
- static const SkDisplayEnumMap& GetEnumValues(SkDisplayTypes type);
+ static const SkDisplayEnumMap& GetEnumValues(SkDisplayTypes type);
static bool Infinity(const char* token, size_t len, void* callBack, SkScriptValue* );
- static bool IsFinite(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
+ static bool IsFinite(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
void* callBack, SkScriptValue* );
- static bool IsNaN(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
+ static bool IsNaN(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
void* callBack, SkScriptValue* );
static bool NaN(const char* token, size_t len, void* callBack, SkScriptValue* );
static bool Unbox(void* , SkScriptValue* scriptValue);
diff --git a/src/animator/SkAnimatorScript2.cpp b/src/animator/SkAnimatorScript2.cpp
index ae51fdcd30..45ce3cee58 100644
--- a/src/animator/SkAnimatorScript2.cpp
+++ b/src/animator/SkAnimatorScript2.cpp
@@ -17,29 +17,29 @@
#include "SkScriptCallBack.h"
static const SkDisplayEnumMap gEnumMaps[] = {
- { SkType_AddMode, "indirect|immediate" },
- { SkType_Align, "left|center|right" },
- { SkType_ApplyMode, "immediate|once" },
- { SkType_ApplyTransition, "reverse" },
- { SkType_BitmapEncoding, "jpeg|png" },
- { SkType_BitmapFormat, "none|A1|A8|Index8|RGB16|RGB32" },
- { SkType_Boolean, "false|true" },
- { SkType_Cap, "butt|round|square" },
- { SkType_EventCode, "none|up|down|left|right|back|end|OK|send|leftSoftKey|rightSoftKey|key0|key1|key2|key3|key4|key5|key6|key7|key8|key9|star|hash" },
- { SkType_EventKind, "none|keyChar|keyPress|mouseDown|mouseDrag|mouseMove|mouseUp|onEnd|onLoad|user" },
- { SkType_EventMode, "deferred|immediate" },
- { SkType_FillType, "winding|evenOdd" },
- { SkType_FilterType, "none|bilinear" },
- { SkType_FromPathMode, "normal|angle|position" },
- { SkType_Join, "miter|round|blunt" },
- { SkType_MaskFilterBlurStyle, "normal|solid|outer|inner" },
- { SkType_PathDirection, "cw|ccw" },
- { SkType_Style, "fill|stroke|strokeAndFill" },
- { SkType_TextBoxAlign, "start|center|end" },
- { SkType_TextBoxMode, "oneLine|lineBreak" },
- { SkType_TileMode, "clamp|repeat|mirror" },
- { SkType_Xfermode, "clear|src|dst|srcOver|dstOver|srcIn|dstIn|srcOut|dstOut|"
- "srcATop|dstATop|xor|darken|lighten" },
+ { SkType_AddMode, "indirect|immediate" },
+ { SkType_Align, "left|center|right" },
+ { SkType_ApplyMode, "immediate|once" },
+ { SkType_ApplyTransition, "reverse" },
+ { SkType_BitmapEncoding, "jpeg|png" },
+ { SkType_BitmapFormat, "none|A1|A8|Index8|RGB16|RGB32" },
+ { SkType_Boolean, "false|true" },
+ { SkType_Cap, "butt|round|square" },
+ { SkType_EventCode, "none|up|down|left|right|back|end|OK|send|leftSoftKey|rightSoftKey|key0|key1|key2|key3|key4|key5|key6|key7|key8|key9|star|hash" },
+ { SkType_EventKind, "none|keyChar|keyPress|mouseDown|mouseDrag|mouseMove|mouseUp|onEnd|onLoad|user" },
+ { SkType_EventMode, "deferred|immediate" },
+ { SkType_FillType, "winding|evenOdd" },
+ { SkType_FilterType, "none|bilinear" },
+ { SkType_FromPathMode, "normal|angle|position" },
+ { SkType_Join, "miter|round|blunt" },
+ { SkType_MaskFilterBlurStyle, "normal|solid|outer|inner" },
+ { SkType_PathDirection, "cw|ccw" },
+ { SkType_Style, "fill|stroke|strokeAndFill" },
+ { SkType_TextBoxAlign, "start|center|end" },
+ { SkType_TextBoxMode, "oneLine|lineBreak" },
+ { SkType_TileMode, "clamp|repeat|mirror" },
+ { SkType_Xfermode, "clear|src|dst|srcOver|dstOver|srcIn|dstIn|srcOut|dstOut|"
+ "srcATop|dstATop|xor|darken|lighten" },
};
static int gEnumMapCount = SK_ARRAY_COUNT(gEnumMaps);
@@ -47,575 +47,575 @@ static int gEnumMapCount = SK_ARRAY_COUNT(gEnumMaps);
class SkAnimatorScript_Box : public SkScriptCallBackConvert {
public:
- SkAnimatorScript_Box() {}
-
- ~SkAnimatorScript_Box() {
- for (SkDisplayable** dispPtr = fTrackDisplayable.begin(); dispPtr < fTrackDisplayable.end(); dispPtr++)
- delete *dispPtr;
- }
-
- virtual bool convert(SkOperand2::OpType type, SkOperand2* operand) {
- SkDisplayable* displayable;
- switch (type) {
- case SkOperand2::kArray: {
- SkDisplayArray* boxedValue = new SkDisplayArray(*operand->fArray);
- displayable = boxedValue;
- } break;
- case SkOperand2::kS32: {
- SkDisplayInt* boxedValue = new SkDisplayInt;
- displayable = boxedValue;
- boxedValue->value = operand->fS32;
- } break;
- case SkOperand2::kScalar: {
- SkDisplayFloat* boxedValue = new SkDisplayFloat;
- displayable = boxedValue;
- boxedValue->value = operand->fScalar;
- } break;
- case SkOperand2::kString: {
- SkDisplayString* boxedValue = new SkDisplayString(*operand->fString);
- displayable = boxedValue;
- } break;
- case SkOperand2::kObject:
- return true;
- default:
- SkASSERT(0);
- return false;
- }
- track(displayable);
- operand->fObject = (void*) displayable;
- return true;
- }
-
- virtual SkOperand2::OpType getReturnType(int index) {
- return SkOperand2::kObject;
- }
-
- virtual Type getType() const {
- return kBox;
- }
-
- void track(SkDisplayable* displayable) {
- SkASSERT(fTrackDisplayable.find(displayable) < 0);
- *fTrackDisplayable.append() = displayable;
- }
-
- SkTDDisplayableArray fTrackDisplayable;
+ SkAnimatorScript_Box() {}
+
+ ~SkAnimatorScript_Box() {
+ for (SkDisplayable** dispPtr = fTrackDisplayable.begin(); dispPtr < fTrackDisplayable.end(); dispPtr++)
+ delete *dispPtr;
+ }
+
+ virtual bool convert(SkOperand2::OpType type, SkOperand2* operand) {
+ SkDisplayable* displayable;
+ switch (type) {
+ case SkOperand2::kArray: {
+ SkDisplayArray* boxedValue = new SkDisplayArray(*operand->fArray);
+ displayable = boxedValue;
+ } break;
+ case SkOperand2::kS32: {
+ SkDisplayInt* boxedValue = new SkDisplayInt;
+ displayable = boxedValue;
+ boxedValue->value = operand->fS32;
+ } break;
+ case SkOperand2::kScalar: {
+ SkDisplayFloat* boxedValue = new SkDisplayFloat;
+ displayable = boxedValue;
+ boxedValue->value = operand->fScalar;
+ } break;
+ case SkOperand2::kString: {
+ SkDisplayString* boxedValue = new SkDisplayString(*operand->fString);
+ displayable = boxedValue;
+ } break;
+ case SkOperand2::kObject:
+ return true;
+ default:
+ SkASSERT(0);
+ return false;
+ }
+ track(displayable);
+ operand->fObject = (void*) displayable;
+ return true;
+ }
+
+ virtual SkOperand2::OpType getReturnType(int index) {
+ return SkOperand2::kObject;
+ }
+
+ virtual Type getType() const {
+ return kBox;
+ }
+
+ void track(SkDisplayable* displayable) {
+ SkASSERT(fTrackDisplayable.find(displayable) < 0);
+ *fTrackDisplayable.append() = displayable;
+ }
+
+ SkTDDisplayableArray fTrackDisplayable;
};
class SkAnimatorScript_Enum : public SkScriptCallBackProperty {
public:
- SkAnimatorScript_Enum(const char* tokens) : fTokens(tokens) {}
+ SkAnimatorScript_Enum(const char* tokens) : fTokens(tokens) {}
- virtual bool getConstValue(const char* name, int len, SkOperand2* value) {
- return SkAnimatorScript2::MapEnums(fTokens, name, len, &value->fS32);
- }
+ virtual bool getConstValue(const char* name, int len, SkOperand2* value) {
+ return SkAnimatorScript2::MapEnums(fTokens, name, len, &value->fS32);
+ }
private:
- const char* fTokens;
+ const char* fTokens;
};
- // !!! if type is string, call invoke
- // if any other type, return original value
- // distinction is undone: could do this by returning index == 0 only if param is string
- // still, caller of getParamTypes will attempt to convert param to string (I guess)
+ // !!! if type is string, call invoke
+ // if any other type, return original value
+ // distinction is undone: could do this by returning index == 0 only if param is string
+ // still, caller of getParamTypes will attempt to convert param to string (I guess)
class SkAnimatorScript_Eval : public SkScriptCallBackFunction {
public:
- SkAnimatorScript_Eval(SkAnimatorScript2* engine) : fEngine(engine) {}
-
- virtual bool getIndex(const char* name, int len, size_t* result) {
- if (SK_LITERAL_STR_EQUAL("eval", name, len) != 0)
- return false;
- *result = 0;
- return true;
- }
-
- virtual void getParamTypes(SkIntArray(SkOperand2::OpType)* types) {
- types->setCount(1);
- SkOperand2::OpType* type = types->begin();
- type[0] = SkOperand2::kString;
- }
-
- virtual bool invoke(size_t index, SkOpArray* params, SkOperand2* answer) {
- SkAnimatorScript2 engine(fEngine->getMaker(), fEngine->getWorking(),
- SkAnimatorScript2::ToDisplayType(fEngine->getReturnType()));
- SkOperand2* op = params->begin();
- const char* script = op->fString->c_str();
- SkScriptValue2 value;
- return engine.evaluateScript(&script, &value);
- SkASSERT(value.fType == fEngine->getReturnType());
- *answer = value.fOperand;
- // !!! incomplete ?
- return true;
- }
+ SkAnimatorScript_Eval(SkAnimatorScript2* engine) : fEngine(engine) {}
+
+ virtual bool getIndex(const char* name, int len, size_t* result) {
+ if (SK_LITERAL_STR_EQUAL("eval", name, len) != 0)
+ return false;
+ *result = 0;
+ return true;
+ }
+
+ virtual void getParamTypes(SkIntArray(SkOperand2::OpType)* types) {
+ types->setCount(1);
+ SkOperand2::OpType* type = types->begin();
+ type[0] = SkOperand2::kString;
+ }
+
+ virtual bool invoke(size_t index, SkOpArray* params, SkOperand2* answer) {
+ SkAnimatorScript2 engine(fEngine->getMaker(), fEngine->getWorking(),
+ SkAnimatorScript2::ToDisplayType(fEngine->getReturnType()));
+ SkOperand2* op = params->begin();
+ const char* script = op->fString->c_str();
+ SkScriptValue2 value;
+ return engine.evaluateScript(&script, &value);
+ SkASSERT(value.fType == fEngine->getReturnType());
+ *answer = value.fOperand;
+ // !!! incomplete ?
+ return true;
+ }
private:
- SkAnimatorScript2* fEngine;
+ SkAnimatorScript2* fEngine;
};
class SkAnimatorScript_ID : public SkScriptCallBackProperty {
public:
- SkAnimatorScript_ID(SkAnimatorScript2* engine) : fEngine(engine) {}
-
- virtual bool getIndex(const char* token, int len, size_t* result) {
- SkDisplayable* displayable;
- bool success = fEngine->getMaker().find(token, len, &displayable);
- if (success == false) {
- *result = 0;
- } else {
- *result = (size_t) displayable;
- SkDisplayable* working = fEngine->getWorking();
- if (displayable->canContainDependents() && working && working->isAnimate()) {
- SkAnimateBase* animator = (SkAnimateBase*) working;
- if (animator->isDynamic()) {
- SkDisplayDepend* depend = (SkDisplayDepend* ) displayable;
- depend->addDependent(working);
- }
- }
- }
- return true;
- }
-
- virtual bool getResult(size_t ref, SkOperand2* answer) {
- answer->fObject = (void*) ref;
- return true;
- }
-
- virtual SkOperand2::OpType getReturnType(size_t index) {
- return index == 0 ? SkOperand2::kString : SkOperand2::kObject;
- }
+ SkAnimatorScript_ID(SkAnimatorScript2* engine) : fEngine(engine) {}
+
+ virtual bool getIndex(const char* token, int len, size_t* result) {
+ SkDisplayable* displayable;
+ bool success = fEngine->getMaker().find(token, len, &displayable);
+ if (success == false) {
+ *result = 0;
+ } else {
+ *result = (size_t) displayable;
+ SkDisplayable* working = fEngine->getWorking();
+ if (displayable->canContainDependents() && working && working->isAnimate()) {
+ SkAnimateBase* animator = (SkAnimateBase*) working;
+ if (animator->isDynamic()) {
+ SkDisplayDepend* depend = (SkDisplayDepend* ) displayable;
+ depend->addDependent(working);
+ }
+ }
+ }
+ return true;
+ }
+
+ virtual bool getResult(size_t ref, SkOperand2* answer) {
+ answer->fObject = (void*) ref;
+ return true;
+ }
+
+ virtual SkOperand2::OpType getReturnType(size_t index) {
+ return index == 0 ? SkOperand2::kString : SkOperand2::kObject;
+ }
private:
- SkAnimatorScript2* fEngine;
+ SkAnimatorScript2* fEngine;
};
class SkAnimatorScript_Member : public SkScriptCallBackMember {
public:
- SkAnimatorScript_Member(SkAnimatorScript2* engine) : fEngine(engine) {}
-
- bool getMemberReference(const char* member, size_t len, void* object, SkScriptValue2* ref) {
- SkDisplayable* displayable = (SkDisplayable*) object;
- SkString name(member, len);
- SkDisplayable* named = displayable->contains(name);
- if (named) {
- ref->fType = SkOperand2::kObject;
- ref->fOperand.fObject = named;
- return true;
- }
- const SkMemberInfo* info = displayable->getMember(name.c_str());
- if (info == NULL)
- return false; // !!! add additional error info?
- ref->fType = SkAnimatorScript2::ToOpType(info->getType());
- ref->fOperand.fObject = (void*) info;
- return true;
- }
-
- bool invoke(size_t ref, void* object, SkOperand2* value) {
- const SkMemberInfo* info = (const SkMemberInfo* ) ref;
- SkDisplayable* displayable = (SkDisplayable*) object;
- if (info->fType == SkType_MemberProperty) {
- if (displayable->getProperty2(info->propertyIndex(), value) == false) {
- return false;
- }
- }
- return fEngine->evalMemberCommon(info, displayable, value);
- }
-
- SkAnimatorScript2* fEngine;
+ SkAnimatorScript_Member(SkAnimatorScript2* engine) : fEngine(engine) {}
+
+ bool getMemberReference(const char* member, size_t len, void* object, SkScriptValue2* ref) {
+ SkDisplayable* displayable = (SkDisplayable*) object;
+ SkString name(member, len);
+ SkDisplayable* named = displayable->contains(name);
+ if (named) {
+ ref->fType = SkOperand2::kObject;
+ ref->fOperand.fObject = named;
+ return true;
+ }
+ const SkMemberInfo* info = displayable->getMember(name.c_str());
+ if (info == NULL)
+ return false; // !!! add additional error info?
+ ref->fType = SkAnimatorScript2::ToOpType(info->getType());
+ ref->fOperand.fObject = (void*) info;
+ return true;
+ }
+
+ bool invoke(size_t ref, void* object, SkOperand2* value) {
+ const SkMemberInfo* info = (const SkMemberInfo* ) ref;
+ SkDisplayable* displayable = (SkDisplayable*) object;
+ if (info->fType == SkType_MemberProperty) {
+ if (displayable->getProperty2(info->propertyIndex(), value) == false) {
+ return false;
+ }
+ }
+ return fEngine->evalMemberCommon(info, displayable, value);
+ }
+
+ SkAnimatorScript2* fEngine;
};
class SkAnimatorScript_MemberFunction : public SkScriptCallBackMemberFunction {
public:
- SkAnimatorScript_MemberFunction(SkAnimatorScript2* engine) : fEngine(engine) {}
-
- bool getMemberReference(const char* member, size_t len, void* object, SkScriptValue2* ref) {
- SkDisplayable* displayable = (SkDisplayable*) object;
- SkString name(member, len);
- const SkMemberInfo* info = displayable->getMember(name.c_str());
- if (info == NULL || info->fType != SkType_MemberFunction)
- return false; // !!! add additional error info?
- ref->fType = SkAnimatorScript2::ToOpType(info->getType());
- ref->fOperand.fObject = (void*) info;
- return true;
- }
-
- virtual void getParamTypes(SkIntArray(SkOperand2::OpType)* types) {
- types->setCount(3);
- SkOperand2::OpType* type = types->begin();
- type[0] = type[1] = type[2] = SkOperand2::kS32;
- }
-
- bool invoke(size_t ref, void* object, SkOpArray* params, SkOperand2* value)
- {
- const SkMemberInfo* info = (const SkMemberInfo* ) ref;
- SkDisplayable* displayable = (SkDisplayable*) object;
- displayable->executeFunction2(displayable, info->functionIndex(), params, info->getType(),
- value);
- return fEngine->evalMemberCommon(info, displayable, value);
- }
-
- SkAnimatorScript2* fEngine;
+ SkAnimatorScript_MemberFunction(SkAnimatorScript2* engine) : fEngine(engine) {}
+
+ bool getMemberReference(const char* member, size_t len, void* object, SkScriptValue2* ref) {
+ SkDisplayable* displayable = (SkDisplayable*) object;
+ SkString name(member, len);
+ const SkMemberInfo* info = displayable->getMember(name.c_str());
+ if (info == NULL || info->fType != SkType_MemberFunction)
+ return false; // !!! add additional error info?
+ ref->fType = SkAnimatorScript2::ToOpType(info->getType());
+ ref->fOperand.fObject = (void*) info;
+ return true;
+ }
+
+ virtual void getParamTypes(SkIntArray(SkOperand2::OpType)* types) {
+ types->setCount(3);
+ SkOperand2::OpType* type = types->begin();
+ type[0] = type[1] = type[2] = SkOperand2::kS32;
+ }
+
+ bool invoke(size_t ref, void* object, SkOpArray* params, SkOperand2* value)
+ {
+ const SkMemberInfo* info = (const SkMemberInfo* ) ref;
+ SkDisplayable* displayable = (SkDisplayable*) object;
+ displayable->executeFunction2(displayable, info->functionIndex(), params, info->getType(),
+ value);
+ return fEngine->evalMemberCommon(info, displayable, value);
+ }
+
+ SkAnimatorScript2* fEngine;
};
class SkAnimatorScript_NamedColor : public SkScriptCallBackProperty {
public:
- virtual bool getConstValue(const char* name, int len, SkOperand2* value) {
- return SkParse::FindNamedColor(name, len, (SkColor*) &value->fS32) != NULL;
- }
+ virtual bool getConstValue(const char* name, int len, SkOperand2* value) {
+ return SkParse::FindNamedColor(name, len, (SkColor*) &value->fS32) != NULL;
+ }
};
class SkAnimatorScript_RGB : public SkScriptCallBackFunction {
public:
- virtual bool getIndex(const char* name, int len, size_t* result) {
- if (SK_LITERAL_STR_EQUAL("rgb", name, len) != 0)
- return false;
- *result = 0;
- return true;
- }
-
- virtual void getParamTypes(SkIntArray(SkOperand2::OpType)* types) {
- types->setCount(3);
- SkOperand2::OpType* type = types->begin();
- type[0] = type[1] = type[2] = SkOperand2::kS32;
- }
-
- virtual bool invoke(size_t index, SkOpArray* params, SkOperand2* answer) {
- SkASSERT(index == 0);
- unsigned result = 0xFF000000;
- int shift = 16;
- for (int index = 0; index < 3; index++) {
- result |= SkClampMax(params->begin()[index].fS32, 255) << shift;
- shift -= 8;
- }
- answer->fS32 = result;
- return true;
- }
+ virtual bool getIndex(const char* name, int len, size_t* result) {
+ if (SK_LITERAL_STR_EQUAL("rgb", name, len) != 0)
+ return false;
+ *result = 0;
+ return true;
+ }
+
+ virtual void getParamTypes(SkIntArray(SkOperand2::OpType)* types) {
+ types->setCount(3);
+ SkOperand2::OpType* type = types->begin();
+ type[0] = type[1] = type[2] = SkOperand2::kS32;
+ }
+
+ virtual bool invoke(size_t index, SkOpArray* params, SkOperand2* answer) {
+ SkASSERT(index == 0);
+ unsigned result = 0xFF000000;
+ int shift = 16;
+ for (int index = 0; index < 3; index++) {
+ result |= SkClampMax(params->begin()[index].fS32, 255) << shift;
+ shift -= 8;
+ }
+ answer->fS32 = result;
+ return true;
+ }
};
class SkAnimatorScript_Unbox : public SkScriptCallBackConvert {
public:
- SkAnimatorScript_Unbox(SkAnimatorScript2* engine) : fEngine(engine) {}
-
- virtual bool convert(SkOperand2::OpType type, SkOperand2* operand) {
- SkASSERT(type == SkOperand2::kObject);
- SkDisplayable* displayable = (SkDisplayable*) operand->fObject;
- switch (displayable->getType()) {
- case SkType_Array: {
- SkDisplayArray* boxedValue = (SkDisplayArray*) displayable;
- operand->fArray = new SkOpArray(SkAnimatorScript2::ToOpType(boxedValue->values.getType()));
- int count = boxedValue->values.count();
- operand->fArray->setCount(count);
- memcpy(operand->fArray->begin(), boxedValue->values.begin(), count * sizeof(SkOperand2));
- fEngine->track(operand->fArray);
- } break;
- case SkType_Boolean: {
- SkDisplayBoolean* boxedValue = (SkDisplayBoolean*) displayable;
- operand->fS32 = boxedValue->value;
- } break;
- case SkType_Int: {
- SkDisplayInt* boxedValue = (SkDisplayInt*) displayable;
- operand->fS32 = boxedValue->value;
- } break;
- case SkType_Float: {
- SkDisplayFloat* boxedValue = (SkDisplayFloat*) displayable;
- operand->fScalar = boxedValue->value;
- } break;
- case SkType_String: {
- SkDisplayString* boxedValue = (SkDisplayString*) displayable;
- operand->fString = SkNEW_ARGS(SkString, (boxedValue->value));
- } break;
- default: {
- const char* id;
- bool success = fEngine->getMaker().findKey(displayable, &id);
- SkASSERT(success);
- operand->fString = SkNEW_ARGS(SkString, (id));
- }
- }
- return true;
- }
-
- virtual SkOperand2::OpType getReturnType(int /*index*/, SkOperand2* operand) {
- SkDisplayable* displayable = (SkDisplayable*) operand->fObject;
- switch (displayable->getType()) {
- case SkType_Array:
- return SkOperand2::kArray;
- case SkType_Int:
- return SkOperand2::kS32;
- case SkType_Float:
- return SkOperand2::kScalar;
- case SkType_String:
- default:
- return SkOperand2::kString;
- }
- }
-
- virtual Type getType() const {
- return kUnbox;
- }
-
- SkAnimatorScript2* fEngine;
+ SkAnimatorScript_Unbox(SkAnimatorScript2* engine) : fEngine(engine) {}
+
+ virtual bool convert(SkOperand2::OpType type, SkOperand2* operand) {
+ SkASSERT(type == SkOperand2::kObject);
+ SkDisplayable* displayable = (SkDisplayable*) operand->fObject;
+ switch (displayable->getType()) {
+ case SkType_Array: {
+ SkDisplayArray* boxedValue = (SkDisplayArray*) displayable;
+ operand->fArray = new SkOpArray(SkAnimatorScript2::ToOpType(boxedValue->values.getType()));
+ int count = boxedValue->values.count();
+ operand->fArray->setCount(count);
+ memcpy(operand->fArray->begin(), boxedValue->values.begin(), count * sizeof(SkOperand2));
+ fEngine->track(operand->fArray);
+ } break;
+ case SkType_Boolean: {
+ SkDisplayBoolean* boxedValue = (SkDisplayBoolean*) displayable;
+ operand->fS32 = boxedValue->value;
+ } break;
+ case SkType_Int: {
+ SkDisplayInt* boxedValue = (SkDisplayInt*) displayable;
+ operand->fS32 = boxedValue->value;
+ } break;
+ case SkType_Float: {
+ SkDisplayFloat* boxedValue = (SkDisplayFloat*) displayable;
+ operand->fScalar = boxedValue->value;
+ } break;
+ case SkType_String: {
+ SkDisplayString* boxedValue = (SkDisplayString*) displayable;
+ operand->fString = SkNEW_ARGS(SkString, (boxedValue->value));
+ } break;
+ default: {
+ const char* id;
+ bool success = fEngine->getMaker().findKey(displayable, &id);
+ SkASSERT(success);
+ operand->fString = SkNEW_ARGS(SkString, (id));
+ }
+ }
+ return true;
+ }
+
+ virtual SkOperand2::OpType getReturnType(int /*index*/, SkOperand2* operand) {
+ SkDisplayable* displayable = (SkDisplayable*) operand->fObject;
+ switch (displayable->getType()) {
+ case SkType_Array:
+ return SkOperand2::kArray;
+ case SkType_Int:
+ return SkOperand2::kS32;
+ case SkType_Float:
+ return SkOperand2::kScalar;
+ case SkType_String:
+ default:
+ return SkOperand2::kString;
+ }
+ }
+
+ virtual Type getType() const {
+ return kUnbox;
+ }
+
+ SkAnimatorScript2* fEngine;
};
-SkAnimatorScript2::SkAnimatorScript2(SkAnimateMaker& maker, SkDisplayable* working, SkDisplayTypes type) :
- SkScriptEngine2(ToOpType(type)), fMaker(maker), fWorking(working) {
- *fCallBackArray.append() = new SkAnimatorScript_Member(this);
- *fCallBackArray.append() = new SkAnimatorScript_MemberFunction(this);
- *fCallBackArray.append() = new SkAnimatorScript_Box();
- *fCallBackArray.append() = new SkAnimatorScript_Unbox(this);
- *fCallBackArray.append() = new SkAnimatorScript_ID(this);
- if (type == SkType_ARGB) {
- *fCallBackArray.append() = new SkAnimatorScript_RGB();
- *fCallBackArray.append() = new SkAnimatorScript_NamedColor();
- }
- if (SkDisplayType::IsEnum(&maker, type)) {
- // !!! for SpiderMonkey, iterate through the enum values, and map them to globals
- const SkDisplayEnumMap& map = GetEnumValues(type);
- *fCallBackArray.append() = new SkAnimatorScript_Enum(map.fValues);
- }
- *fCallBackArray.append() = new SkAnimatorScript_Eval(this);
-#if 0 // !!! no extra support for now
- for (SkExtras** extraPtr = maker.fExtras.begin(); extraPtr < maker.fExtras.end(); extraPtr++) {
- SkExtras* extra = *extraPtr;
- if (extra->fExtraCallBack)
- *fCallBackArray.append() = new propertyCallBack(extra->fExtraCallBack, extra->fExtraStorage);
- }
+SkAnimatorScript2::SkAnimatorScript2(SkAnimateMaker& maker, SkDisplayable* working, SkDisplayTypes type) :
+ SkScriptEngine2(ToOpType(type)), fMaker(maker), fWorking(working) {
+ *fCallBackArray.append() = new SkAnimatorScript_Member(this);
+ *fCallBackArray.append() = new SkAnimatorScript_MemberFunction(this);
+ *fCallBackArray.append() = new SkAnimatorScript_Box();
+ *fCallBackArray.append() = new SkAnimatorScript_Unbox(this);
+ *fCallBackArray.append() = new SkAnimatorScript_ID(this);
+ if (type == SkType_ARGB) {
+ *fCallBackArray.append() = new SkAnimatorScript_RGB();
+ *fCallBackArray.append() = new SkAnimatorScript_NamedColor();
+ }
+ if (SkDisplayType::IsEnum(&maker, type)) {
+ // !!! for SpiderMonkey, iterate through the enum values, and map them to globals
+ const SkDisplayEnumMap& map = GetEnumValues(type);
+ *fCallBackArray.append() = new SkAnimatorScript_Enum(map.fValues);
+ }
+ *fCallBackArray.append() = new SkAnimatorScript_Eval(this);
+#if 0 // !!! no extra support for now
+ for (SkExtras** extraPtr = maker.fExtras.begin(); extraPtr < maker.fExtras.end(); extraPtr++) {
+ SkExtras* extra = *extraPtr;
+ if (extra->fExtraCallBack)
+ *fCallBackArray.append() = new propertyCallBack(extra->fExtraCallBack, extra->fExtraStorage);
+ }
#endif
}
SkAnimatorScript2::~SkAnimatorScript2() {
- SkScriptCallBack** end = fCallBackArray.end();
- for (SkScriptCallBack** ptr = fCallBackArray.begin(); ptr < end; ptr++)
- delete *ptr;
+ SkScriptCallBack** end = fCallBackArray.end();
+ for (SkScriptCallBack** ptr = fCallBackArray.begin(); ptr < end; ptr++)
+ delete *ptr;
}
-bool SkAnimatorScript2::evalMemberCommon(const SkMemberInfo* info,
- SkDisplayable* displayable, SkOperand2* value) {
- SkDisplayTypes original;
- SkDisplayTypes type = original = (SkDisplayTypes) info->getType();
- if (info->fType == SkType_Array)
- type = SkType_Array;
- switch (type) {
- case SkType_ARGB:
- type = SkType_Int;
- case SkType_Boolean:
- case SkType_Int:
- case SkType_MSec:
- case SkType_Float:
- SkASSERT(info->getCount() == 1);
- if (info->fType != SkType_MemberProperty && info->fType != SkType_MemberFunction)
- value->fS32 = *(int32_t*) info->memberData(displayable); // OK for SkScalar too
- if (type == SkType_MSec) {
- value->fScalar = SkScalarDiv((SkScalar) value->fS32, 1000); // dividing two ints is the same as dividing two scalars
- type = SkType_Float;
- }
- break;
- case SkType_String: {
- SkString* displayableString;
- if (info->fType != SkType_MemberProperty && info->fType != SkType_MemberFunction) {
- info->getString(displayable, &displayableString);
- value->fString = new SkString(*displayableString);
- }
- } break;
- case SkType_Array: {
- SkASSERT(info->fType != SkType_MemberProperty); // !!! incomplete
- SkTDOperandArray* displayableArray = (SkTDOperandArray*) info->memberData(displayable);
- if (displayable->getType() == SkType_Array) {
- SkDisplayArray* typedArray = (SkDisplayArray*) displayable;
- original = typedArray->values.getType();
- }
- SkASSERT(original != SkType_Unknown);
- SkOpArray* array = value->fArray = new SkOpArray(ToOpType(original));
- track(array);
- int count = displayableArray->count();
- if (count > 0) {
- array->setCount(count);
- memcpy(array->begin(), displayableArray->begin(), count * sizeof(SkOperand2));
- }
- } break;
- default:
- SkASSERT(0); // unimplemented
- }
- return true;
+bool SkAnimatorScript2::evalMemberCommon(const SkMemberInfo* info,
+ SkDisplayable* displayable, SkOperand2* value) {
+ SkDisplayTypes original;
+ SkDisplayTypes type = original = (SkDisplayTypes) info->getType();
+ if (info->fType == SkType_Array)
+ type = SkType_Array;
+ switch (type) {
+ case SkType_ARGB:
+ type = SkType_Int;
+ case SkType_Boolean:
+ case SkType_Int:
+ case SkType_MSec:
+ case SkType_Float:
+ SkASSERT(info->getCount() == 1);
+ if (info->fType != SkType_MemberProperty && info->fType != SkType_MemberFunction)
+ value->fS32 = *(int32_t*) info->memberData(displayable); // OK for SkScalar too
+ if (type == SkType_MSec) {
+ value->fScalar = SkScalarDiv((SkScalar) value->fS32, 1000); // dividing two ints is the same as dividing two scalars
+ type = SkType_Float;
+ }
+ break;
+ case SkType_String: {
+ SkString* displayableString;
+ if (info->fType != SkType_MemberProperty && info->fType != SkType_MemberFunction) {
+ info->getString(displayable, &displayableString);
+ value->fString = new SkString(*displayableString);
+ }
+ } break;
+ case SkType_Array: {
+ SkASSERT(info->fType != SkType_MemberProperty); // !!! incomplete
+ SkTDOperandArray* displayableArray = (SkTDOperandArray*) info->memberData(displayable);
+ if (displayable->getType() == SkType_Array) {
+ SkDisplayArray* typedArray = (SkDisplayArray*) displayable;
+ original = typedArray->values.getType();
+ }
+ SkASSERT(original != SkType_Unknown);
+ SkOpArray* array = value->fArray = new SkOpArray(ToOpType(original));
+ track(array);
+ int count = displayableArray->count();
+ if (count > 0) {
+ array->setCount(count);
+ memcpy(array->begin(), displayableArray->begin(), count * sizeof(SkOperand2));
+ }
+ } break;
+ default:
+ SkASSERT(0); // unimplemented
+ }
+ return true;
}
const SkDisplayEnumMap& SkAnimatorScript2::GetEnumValues(SkDisplayTypes type) {
- int index = SkTSearch<SkDisplayTypes>(&gEnumMaps[0].fType, gEnumMapCount, type,
- sizeof(SkDisplayEnumMap));
- SkASSERT(index >= 0);
- return gEnumMaps[index];
+ int index = SkTSearch<SkDisplayTypes>(&gEnumMaps[0].fType, gEnumMapCount, type,
+ sizeof(SkDisplayEnumMap));
+ SkASSERT(index >= 0);
+ return gEnumMaps[index];
}
SkDisplayTypes SkAnimatorScript2::ToDisplayType(SkOperand2::OpType type) {
- int val = type;
- switch (val) {
- case SkOperand2::kNoType:
- return SkType_Unknown;
- case SkOperand2::kS32:
- return SkType_Int;
- case SkOperand2::kScalar:
- return SkType_Float;
- case SkOperand2::kString:
- return SkType_String;
- case SkOperand2::kArray:
- return SkType_Array;
- case SkOperand2::kObject:
- return SkType_Displayable;
- default:
- SkASSERT(0);
- return SkType_Unknown;
- }
+ int val = type;
+ switch (val) {
+ case SkOperand2::kNoType:
+ return SkType_Unknown;
+ case SkOperand2::kS32:
+ return SkType_Int;
+ case SkOperand2::kScalar:
+ return SkType_Float;
+ case SkOperand2::kString:
+ return SkType_String;
+ case SkOperand2::kArray:
+ return SkType_Array;
+ case SkOperand2::kObject:
+ return SkType_Displayable;
+ default:
+ SkASSERT(0);
+ return SkType_Unknown;
+ }
}
SkOperand2::OpType SkAnimatorScript2::ToOpType(SkDisplayTypes type) {
- if (SkDisplayType::IsDisplayable(NULL /* fMaker */, type))
- return SkOperand2::kObject;
- if (SkDisplayType::IsEnum(NULL /* fMaker */, type))
- return SkOperand2::kS32;
- switch (type) {
- case SkType_ARGB:
- case SkType_MSec:
- case SkType_Int:
- return SkOperand2::kS32;
- case SkType_Float:
- case SkType_Point:
- case SkType_3D_Point:
- return SkOperand2::kScalar;
- case SkType_Base64:
- case SkType_DynamicString:
- case SkType_String:
- return SkOperand2::kString;
- case SkType_Array:
- return SkOperand2::kArray;
- case SkType_Unknown:
- return SkOperand2::kNoType;
- default:
- SkASSERT(0);
- return SkOperand2::kNoType;
- }
+ if (SkDisplayType::IsDisplayable(NULL /* fMaker */, type))
+ return SkOperand2::kObject;
+ if (SkDisplayType::IsEnum(NULL /* fMaker */, type))
+ return SkOperand2::kS32;
+ switch (type) {
+ case SkType_ARGB:
+ case SkType_MSec:
+ case SkType_Int:
+ return SkOperand2::kS32;
+ case SkType_Float:
+ case SkType_Point:
+ case SkType_3D_Point:
+ return SkOperand2::kScalar;
+ case SkType_Base64:
+ case SkType_DynamicString:
+ case SkType_String:
+ return SkOperand2::kString;
+ case SkType_Array:
+ return SkOperand2::kArray;
+ case SkType_Unknown:
+ return SkOperand2::kNoType;
+ default:
+ SkASSERT(0);
+ return SkOperand2::kNoType;
+ }
}
bool SkAnimatorScript2::MapEnums(const char* ptr, const char* match, size_t len, int* value) {
- int index = 0;
- bool more = true;
- do {
- const char* last = strchr(ptr, '|');
- if (last == NULL) {
- last = &ptr[strlen(ptr)];
- more = false;
- }
- size_t length = last - ptr;
- if (len == length && strncmp(ptr, match, length) == 0) {
- *value = index;
- return true;
- }
- index++;
- ptr = last + 1;
- } while (more);
- return false;
+ int index = 0;
+ bool more = true;
+ do {
+ const char* last = strchr(ptr, '|');
+ if (last == NULL) {
+ last = &ptr[strlen(ptr)];
+ more = false;
+ }
+ size_t length = last - ptr;
+ if (len == length && strncmp(ptr, match, length) == 0) {
+ *value = index;
+ return true;
+ }
+ index++;
+ ptr = last + 1;
+ } while (more);
+ return false;
}
#if defined SK_DEBUG
#include "SkAnimator.h"
-static const char scriptTestSetup[] =
+static const char scriptTestSetup[] =
"<screenplay>"
- "<apply>"
- "<paint>"
- "<emboss id='emboss' direction='[1,1,1]' />"
- "</paint>"
- "<animateField id='animation' field='direction' target='emboss' from='[1,1,1]' to='[-1,1,1]' dur='1'/>"
- "<set lval='direction[0]' target='emboss' to='-1' />"
- "</apply>"
- "<color id='testColor' color='0 ? rgb(0,0,0) : rgb(255,255,255)' />"
- "<color id='xColor' color='rgb(12,34,56)' />"
- "<typedArray id='emptyArray' />"
- "<typedArray id='intArray' values='[1, 4, 6]' />"
- "<s32 id='idx' value='2' />"
- "<s32 id='idy' value='2' />"
- "<string id='alpha' value='abc' />"
- "<rectangle id='testRect' left='Math.cos(0)' top='2' right='12' bottom='5' />"
- "<event id='evt'>"
- "<input name='x' />"
- "<apply scope='idy'>"
- "<set field='value' to='evt.x.s32' />"
- "</apply>"
- "</event>"
+ "<apply>"
+ "<paint>"
+ "<emboss id='emboss' direction='[1,1,1]' />"
+ "</paint>"
+ "<animateField id='animation' field='direction' target='emboss' from='[1,1,1]' to='[-1,1,1]' dur='1'/>"
+ "<set lval='direction[0]' target='emboss' to='-1' />"
+ "</apply>"
+ "<color id='testColor' color='0 ? rgb(0,0,0) : rgb(255,255,255)' />"
+ "<color id='xColor' color='rgb(12,34,56)' />"
+ "<typedArray id='emptyArray' />"
+ "<typedArray id='intArray' values='[1, 4, 6]' />"
+ "<s32 id='idx' value='2' />"
+ "<s32 id='idy' value='2' />"
+ "<string id='alpha' value='abc' />"
+ "<rectangle id='testRect' left='Math.cos(0)' top='2' right='12' bottom='5' />"
+ "<event id='evt'>"
+ "<input name='x' />"
+ "<apply scope='idy'>"
+ "<set field='value' to='evt.x.s32' />"
+ "</apply>"
+ "</event>"
"</screenplay>";
static const SkScriptNAnswer scriptTests[] = {
- { "alpha+alpha", SkType_String, 0, 0, "abcabc" },
- { "0 ? Math.sin(0) : 1", SkType_Int, 1 },
- { "intArray[4]", SkType_Unknown },
- { "emptyArray[4]", SkType_Unknown },
- { "idx", SkType_Int, 2 },
- { "intArray.length", SkType_Int, 3 },
- { "intArray.values[0]", SkType_Int, 1 },
- { "intArray[0]", SkType_Int, 1 },
- { "idx.value", SkType_Int, 2 },
- { "alpha.value", SkType_String, 0, 0, "abc" },
- { "alpha", SkType_String, 0, 0, "abc" },
- { "alpha.value+alpha.value", SkType_String, 0, 0, "abcabc" },
- { "alpha+idx", SkType_String, 0, 0, "abc2" },
- { "idx+alpha", SkType_String, 0, 0, "2abc" },
- { "intArray[idx]", SkType_Int, 6 },
- { "alpha.slice(1,2)", SkType_String, 0, 0, "b" },
- { "alpha.value.slice(1,2)", SkType_String, 0, 0, "b" },
- { "Math.sin(0)", SkType_Float, 0, SkIntToScalar(0) },
- { "testRect.left+2", SkType_Float, 0, SkIntToScalar(3) },
- { "0 ? intArray[0] : 1", SkType_Int, 1 },
- { "0 ? intArray.values[0] : 1", SkType_Int, 1 },
- { "0 ? idx : 1", SkType_Int, 1 },
- { "0 ? idx.value : 1", SkType_Int, 1 },
- { "0 ? alpha.slice(1,2) : 1", SkType_Int, 1 },
- { "0 ? alpha.value.slice(1,2) : 1", SkType_Int, 1 },
- { "idy", SkType_Int, 3 }
+ { "alpha+alpha", SkType_String, 0, 0, "abcabc" },
+ { "0 ? Math.sin(0) : 1", SkType_Int, 1 },
+ { "intArray[4]", SkType_Unknown },
+ { "emptyArray[4]", SkType_Unknown },
+ { "idx", SkType_Int, 2 },
+ { "intArray.length", SkType_Int, 3 },
+ { "intArray.values[0]", SkType_Int, 1 },
+ { "intArray[0]", SkType_Int, 1 },
+ { "idx.value", SkType_Int, 2 },
+ { "alpha.value", SkType_String, 0, 0, "abc" },
+ { "alpha", SkType_String, 0, 0, "abc" },
+ { "alpha.value+alpha.value", SkType_String, 0, 0, "abcabc" },
+ { "alpha+idx", SkType_String, 0, 0, "abc2" },
+ { "idx+alpha", SkType_String, 0, 0, "2abc" },
+ { "intArray[idx]", SkType_Int, 6 },
+ { "alpha.slice(1,2)", SkType_String, 0, 0, "b" },
+ { "alpha.value.slice(1,2)", SkType_String, 0, 0, "b" },
+ { "Math.sin(0)", SkType_Float, 0, SkIntToScalar(0) },
+ { "testRect.left+2", SkType_Float, 0, SkIntToScalar(3) },
+ { "0 ? intArray[0] : 1", SkType_Int, 1 },
+ { "0 ? intArray.values[0] : 1", SkType_Int, 1 },
+ { "0 ? idx : 1", SkType_Int, 1 },
+ { "0 ? idx.value : 1", SkType_Int, 1 },
+ { "0 ? alpha.slice(1,2) : 1", SkType_Int, 1 },
+ { "0 ? alpha.value.slice(1,2) : 1", SkType_Int, 1 },
+ { "idy", SkType_Int, 3 }
};
-#define SkScriptNAnswer_testCount SK_ARRAY_COUNT(scriptTests)
+#define SkScriptNAnswer_testCount SK_ARRAY_COUNT(scriptTests)
void SkAnimatorScript2::UnitTest() {
#if defined(SK_SUPPORT_UNITTEST)
- SkAnimator animator;
- SkASSERT(animator.decodeMemory(scriptTestSetup, sizeof(scriptTestSetup)-1));
- SkEvent evt;
- evt.setString("id", "evt");
- evt.setS32("x", 3);
- animator.doUserEvent(evt);
- // set up animator with memory script above, then run value tests
- for (int index = 0; index < SkScriptNAnswer_testCount; index++) {
- SkAnimatorScript2 engine(*animator.fMaker, NULL, scriptTests[index].fType);
- SkScriptValue2 value;
- const char* script = scriptTests[index].fScript;
- bool success = engine.evaluateScript(&script, &value);
- if (success == false) {
- SkASSERT(scriptTests[index].fType == SkType_Unknown);
- continue;
- }
- SkASSERT(value.fType == ToOpType(scriptTests[index].fType));
- SkScalar error;
- switch (value.fType) {
- case SkOperand2::kS32:
- SkASSERT(value.fOperand.fS32 == scriptTests[index].fIntAnswer);
- break;
- case SkOperand2::kScalar:
- error = SkScalarAbs(value.fOperand.fScalar - scriptTests[index].fScalarAnswer);
- SkASSERT(error < SK_Scalar1 / 10000);
- break;
- case SkOperand2::kString:
- SkASSERT(value.fOperand.fString->equals(scriptTests[index].fStringAnswer));
- break;
- default:
- SkASSERT(0);
- }
- }
+ SkAnimator animator;
+ SkASSERT(animator.decodeMemory(scriptTestSetup, sizeof(scriptTestSetup)-1));
+ SkEvent evt;
+ evt.setString("id", "evt");
+ evt.setS32("x", 3);
+ animator.doUserEvent(evt);
+ // set up animator with memory script above, then run value tests
+ for (int index = 0; index < SkScriptNAnswer_testCount; index++) {
+ SkAnimatorScript2 engine(*animator.fMaker, NULL, scriptTests[index].fType);
+ SkScriptValue2 value;
+ const char* script = scriptTests[index].fScript;
+ bool success = engine.evaluateScript(&script, &value);
+ if (success == false) {
+ SkASSERT(scriptTests[index].fType == SkType_Unknown);
+ continue;
+ }
+ SkASSERT(value.fType == ToOpType(scriptTests[index].fType));
+ SkScalar error;
+ switch (value.fType) {
+ case SkOperand2::kS32:
+ SkASSERT(value.fOperand.fS32 == scriptTests[index].fIntAnswer);
+ break;
+ case SkOperand2::kScalar:
+ error = SkScalarAbs(value.fOperand.fScalar - scriptTests[index].fScalarAnswer);
+ SkASSERT(error < SK_Scalar1 / 10000);
+ break;
+ case SkOperand2::kString:
+ SkASSERT(value.fOperand.fString->equals(scriptTests[index].fStringAnswer));
+ break;
+ default:
+ SkASSERT(0);
+ }
+ }
#endif
}
diff --git a/src/animator/SkAnimatorScript2.h b/src/animator/SkAnimatorScript2.h
index e6bf58eb46..c3995f6fd8 100644
--- a/src/animator/SkAnimatorScript2.h
+++ b/src/animator/SkAnimatorScript2.h
@@ -17,33 +17,33 @@ struct SkMemberInfo;
#ifndef SkAnimatorScript_DEFINED
struct SkDisplayEnumMap {
- SkDisplayTypes fType;
- const char* fValues;
+ SkDisplayTypes fType;
+ const char* fValues;
};
#endif
class SkAnimatorScript2 : public SkScriptEngine2 {
public:
- SkAnimatorScript2(SkAnimateMaker& , SkDisplayable* working, SkDisplayTypes type);
- ~SkAnimatorScript2();
- bool evalMemberCommon(const SkMemberInfo* info,
- SkDisplayable* displayable, SkOperand2* value);
- SkAnimateMaker& getMaker() { return fMaker; }
- SkDisplayable* getWorking() { return fWorking; }
- static bool MapEnums(const char* ptr, const char* match, size_t len, int* value);
- static const SkDisplayEnumMap& GetEnumValues(SkDisplayTypes type);
- static SkDisplayTypes ToDisplayType(SkOperand2::OpType type);
- static SkOperand2::OpType ToOpType(SkDisplayTypes type);
+ SkAnimatorScript2(SkAnimateMaker& , SkDisplayable* working, SkDisplayTypes type);
+ ~SkAnimatorScript2();
+ bool evalMemberCommon(const SkMemberInfo* info,
+ SkDisplayable* displayable, SkOperand2* value);
+ SkAnimateMaker& getMaker() { return fMaker; }
+ SkDisplayable* getWorking() { return fWorking; }
+ static bool MapEnums(const char* ptr, const char* match, size_t len, int* value);
+ static const SkDisplayEnumMap& GetEnumValues(SkDisplayTypes type);
+ static SkDisplayTypes ToDisplayType(SkOperand2::OpType type);
+ static SkOperand2::OpType ToOpType(SkDisplayTypes type);
private:
- SkAnimateMaker& fMaker;
- SkDisplayable* fWorking;
- friend class SkDump;
- friend struct SkScriptNAnswer;
- // illegal
- SkAnimatorScript2& operator=(const SkAnimatorScript2&);
+ SkAnimateMaker& fMaker;
+ SkDisplayable* fWorking;
+ friend class SkDump;
+ friend struct SkScriptNAnswer;
+ // illegal
+ SkAnimatorScript2& operator=(const SkAnimatorScript2&);
#ifdef SK_DEBUG
public:
- static void UnitTest();
+ static void UnitTest();
#endif
};
diff --git a/src/animator/SkBoundable.cpp b/src/animator/SkBoundable.cpp
index 017b6b8068..7f36218f5c 100644
--- a/src/animator/SkBoundable.cpp
+++ b/src/animator/SkBoundable.cpp
@@ -39,7 +39,7 @@ void SkBoundable::enableBounder() {
}
-SkBoundableAuto::SkBoundableAuto(SkBoundable* boundable,
+SkBoundableAuto::SkBoundableAuto(SkBoundable* boundable,
SkAnimateMaker& maker) : fBoundable(boundable), fMaker(maker) {
if (fBoundable->hasBounds()) {
fMaker.fCanvas->setBounder(&maker.fDisplayList);
diff --git a/src/animator/SkBuildCondensedInfo.cpp b/src/animator/SkBuildCondensedInfo.cpp
index 30da67ec38..8fb82c7414 100644
--- a/src/animator/SkBuildCondensedInfo.cpp
+++ b/src/animator/SkBuildCondensedInfo.cpp
@@ -10,7 +10,7 @@
#include "SkTypes.h"
#if defined SK_BUILD_CONDENSED
#include "SkMemberInfo.h"
-#if SK_USE_CONDENSED_INFO == 1
+#if SK_USE_CONDENSED_INFO == 1
#error "SK_USE_CONDENSED_INFO must be zero to build condensed info"
#endif
#if !defined SK_BUILD_FOR_WIN32
@@ -115,7 +115,7 @@ void SkDisplayType::BuildCondensedInfo(SkAnimateMaker* maker) {
continue;
AddInfo(gTypeNames[index].fType, info, infoCount);
}
- const SkMemberInfo* extraInfo =
+ const SkMemberInfo* extraInfo =
SkDisplayType::GetMembers(maker, SkType_3D_Point, &infoCount);
AddInfo(SkType_Point, extraInfo, infoCount);
AddInfo(SkType_3D_Point, extraInfo, infoCount);
@@ -239,7 +239,7 @@ void SkDisplayType::BuildCondensedInfo(SkAnimateMaker* maker) {
Get3DName(scratch, gTypeNames[typeNameIndex].fName);
} else
sprintf(scratch, "Unknown%d", unknown++);
- fprintf(condensed, "%d%c // %s\n\t", index,
+ fprintf(condensed, "%d%c // %s\n\t", index,
index < gInfosCounts.count() ? ',' : ' ', scratch);
}
fprintf(condensed, "\n};\n\n");
diff --git a/src/animator/SkCondensedDebug.cpp b/src/animator/SkCondensedDebug.cpp
index c1c7007e75..08764b6649 100644
--- a/src/animator/SkCondensedDebug.cpp
+++ b/src/animator/SkCondensedDebug.cpp
@@ -14,7 +14,7 @@
// To change it, edit the file with the matching debug info.
// Then execute SkDisplayType::BuildCondensedInfo() to regenerate this file.
-static const char gMathStrings[] =
+static const char gMathStrings[] =
"E\0"
"LN10\0"
"LN2\0"
@@ -72,7 +72,7 @@ static const SkMemberInfo gMathInfo[] = {
{123, -18, 66, 98}
};
-static const char gAddStrings[] =
+static const char gAddStrings[] =
"inPlace\0"
"offset\0"
"use\0"
@@ -86,7 +86,7 @@ static const SkMemberInfo gAddInfo[] = {
{19, 28, 37, 1}
};
-static const char gAddCircleStrings[] =
+static const char gAddCircleStrings[] =
"\0"
"radius\0"
"x\0"
@@ -100,7 +100,7 @@ static const SkMemberInfo gAddCircleInfo[] = {
{10, 32, 98, 1}
};
-static const char gUnknown1Strings[] =
+static const char gUnknown1Strings[] =
"direction"
;
@@ -108,7 +108,7 @@ static const SkMemberInfo gUnknown1Info[] = {
{0, 20, 75, 1}
};
-static const char gAddOvalStrings[] =
+static const char gAddOvalStrings[] =
""
;
@@ -116,7 +116,7 @@ static const SkMemberInfo gAddOvalInfo[] = {
{0, 6, 18, 5}
};
-static const char gAddPathStrings[] =
+static const char gAddPathStrings[] =
"matrix\0"
"path"
;
@@ -126,7 +126,7 @@ static const SkMemberInfo gAddPathInfo[] = {
{7, 24, 74, 1}
};
-static const char gAddRectangleStrings[] =
+static const char gAddRectangleStrings[] =
"\0"
"bottom\0"
"left\0"
@@ -142,7 +142,7 @@ static const SkMemberInfo gAddRectangleInfo[] = {
{19, 28, 98, 1}
};
-static const char gAddRoundRectStrings[] =
+static const char gAddRoundRectStrings[] =
"\0"
"rx\0"
"ry"
@@ -154,7 +154,7 @@ static const SkMemberInfo gAddRoundRectInfo[] = {
{4, 44, 98, 1}
};
-static const char gUnknown2Strings[] =
+static const char gUnknown2Strings[] =
"begin\0"
"blend\0"
"dur\0"
@@ -186,7 +186,7 @@ static const SkMemberInfo gUnknown2Info[] = {
{73, -4, 67, 40}
};
-static const char gAnimateFieldStrings[] =
+static const char gAnimateFieldStrings[] =
""
;
@@ -194,7 +194,7 @@ static const SkMemberInfo gAnimateFieldInfo[] = {
{0, 8, 18, 13}
};
-static const char gApplyStrings[] =
+static const char gApplyStrings[] =
"animator\0"
"begin\0"
"dontDraw\0"
@@ -226,7 +226,7 @@ static const SkMemberInfo gApplyInfo[] = {
{88, 56, 14, 1}
};
-static const char gUnknown3Strings[] =
+static const char gUnknown3Strings[] =
"x\0"
"y"
;
@@ -236,7 +236,7 @@ static const SkMemberInfo gUnknown3Info[] = {
{2, 52, 98, 1}
};
-static const char gBitmapStrings[] =
+static const char gBitmapStrings[] =
"\0"
"erase\0"
"format\0"
@@ -254,7 +254,7 @@ static const SkMemberInfo gDrawBitmapInfo[] = {
{30, 68, 96, 1}
};
-static const char gBitmapShaderStrings[] =
+static const char gBitmapShaderStrings[] =
"\0"
"filterType\0"
"image"
@@ -266,7 +266,7 @@ static const SkMemberInfo gDrawBitmapShaderInfo[] = {
{12, 32, 17, 1}
};
-static const char gBlurStrings[] =
+static const char gBlurStrings[] =
"blurStyle\0"
"radius"
;
@@ -276,7 +276,7 @@ static const SkMemberInfo gDrawBlurInfo[] = {
{10, 20, 98, 1}
};
-static const char gBoundsStrings[] =
+static const char gBoundsStrings[] =
"\0"
"inval"
;
@@ -286,7 +286,7 @@ static const SkMemberInfo gDisplayBoundsInfo[] = {
{1, 44, 26, 1}
};
-static const char gClipStrings[] =
+static const char gClipStrings[] =
"path\0"
"rectangle"
;
@@ -296,7 +296,7 @@ static const SkMemberInfo gDrawClipInfo[] = {
{5, 16, 91, 1}
};
-static const char gColorStrings[] =
+static const char gColorStrings[] =
"alpha\0"
"blue\0"
"color\0"
@@ -318,7 +318,7 @@ static const SkMemberInfo gDrawColorInfo[] = {
{42, -7, 67, 98}
};
-static const char gCubicToStrings[] =
+static const char gCubicToStrings[] =
"x1\0"
"x2\0"
"x3\0"
@@ -336,7 +336,7 @@ static const SkMemberInfo gCubicToInfo[] = {
{15, 40, 98, 1}
};
-static const char gDashStrings[] =
+static const char gDashStrings[] =
"intervals\0"
"phase"
;
@@ -346,7 +346,7 @@ static const SkMemberInfo gDashInfo[] = {
{10, 36, 98, 1}
};
-static const char gDataStrings[] =
+static const char gDataStrings[] =
"\0"
"name"
;
@@ -356,7 +356,7 @@ static const SkMemberInfo gDataInfo[] = {
{1, 32, 108, 2}
};
-static const char gDiscreteStrings[] =
+static const char gDiscreteStrings[] =
"deviation\0"
"segLength"
;
@@ -366,7 +366,7 @@ static const SkMemberInfo gDiscreteInfo[] = {
{10, 24, 98, 1}
};
-static const char gDrawToStrings[] =
+static const char gDrawToStrings[] =
"drawOnce\0"
"use"
;
@@ -376,7 +376,7 @@ static const SkMemberInfo gDrawToInfo[] = {
{9, 76, 19, 1}
};
-static const char gDumpStrings[] =
+static const char gDumpStrings[] =
"displayList\0"
"eventList\0"
"events\0"
@@ -394,7 +394,7 @@ static const SkMemberInfo gDumpInfo[] = {
{41, 40, 26, 1}
};
-static const char gEmbossStrings[] =
+static const char gEmbossStrings[] =
"ambient\0"
"direction\0"
"radius\0"
@@ -408,7 +408,7 @@ static const SkMemberInfo gDrawEmbossInfo[] = {
{25, -2, 67, 98}
};
-static const char gEventStrings[] =
+static const char gEventStrings[] =
"code\0"
"disable\0"
"key\0"
@@ -430,7 +430,7 @@ static const SkMemberInfo gDisplayEventInfo[] = {
{36, 40, 98, 1}
};
-static const char gFromPathStrings[] =
+static const char gFromPathStrings[] =
"mode\0"
"offset\0"
"path"
@@ -442,7 +442,7 @@ static const SkMemberInfo gFromPathInfo[] = {
{12, 28, 74, 1}
};
-static const char gUnknown4Strings[] =
+static const char gUnknown4Strings[] =
"\0"
"offsets\0"
"unitMapper"
@@ -454,7 +454,7 @@ static const SkMemberInfo gUnknown4Info[] = {
{9, 44, 108, 2}
};
-static const char gGStrings[] =
+static const char gGStrings[] =
"condition\0"
"enableCondition"
;
@@ -464,7 +464,7 @@ static const SkMemberInfo gGInfo[] = {
{10, 24, 40, 2}
};
-static const char gHitClearStrings[] =
+static const char gHitClearStrings[] =
"targets"
;
@@ -472,7 +472,7 @@ static const SkMemberInfo gHitClearInfo[] = {
{0, 16, 119, 36}
};
-static const char gHitTestStrings[] =
+static const char gHitTestStrings[] =
"bullets\0"
"hits\0"
"targets\0"
@@ -486,7 +486,7 @@ static const SkMemberInfo gHitTestInfo[] = {
{21, 64, 26, 1}
};
-static const char gImageStrings[] =
+static const char gImageStrings[] =
"\0"
"base64\0"
"src"
@@ -498,7 +498,7 @@ static const SkMemberInfo gImageInfo[] = {
{8, 64, 108, 2}
};
-static const char gIncludeStrings[] =
+static const char gIncludeStrings[] =
"src"
;
@@ -506,7 +506,7 @@ static const SkMemberInfo gIncludeInfo[] = {
{0, 16, 108, 2}
};
-static const char gInputStrings[] =
+static const char gInputStrings[] =
"s32\0"
"scalar\0"
"string"
@@ -518,7 +518,7 @@ static const SkMemberInfo gInputInfo[] = {
{11, 24, 108, 2}
};
-static const char gLineStrings[] =
+static const char gLineStrings[] =
"x1\0"
"x2\0"
"y1\0"
@@ -532,7 +532,7 @@ static const SkMemberInfo gLineInfo[] = {
{9, 36, 98, 1}
};
-static const char gLineToStrings[] =
+static const char gLineToStrings[] =
"x\0"
"y"
;
@@ -542,7 +542,7 @@ static const SkMemberInfo gLineToInfo[] = {
{2, 24, 98, 1}
};
-static const char gLinearGradientStrings[] =
+static const char gLinearGradientStrings[] =
"\0"
"points"
;
@@ -552,7 +552,7 @@ static const SkMemberInfo gLinearGradientInfo[] = {
{1, 88, 77, 4}
};
-static const char gMatrixStrings[] =
+static const char gMatrixStrings[] =
"matrix\0"
"perspectX\0"
"perspectY\0"
@@ -582,7 +582,7 @@ static const SkMemberInfo gDrawMatrixInfo[] = {
{87, -11, 67, 98}
};
-static const char gMoveStrings[] =
+static const char gMoveStrings[] =
""
;
@@ -590,7 +590,7 @@ static const SkMemberInfo gMoveInfo[] = {
{0, 1, 18, 4}
};
-static const char gMoveToStrings[] =
+static const char gMoveToStrings[] =
"x\0"
"y"
;
@@ -600,7 +600,7 @@ static const SkMemberInfo gMoveToInfo[] = {
{2, 24, 98, 1}
};
-static const char gMovieStrings[] =
+static const char gMovieStrings[] =
"src"
;
@@ -608,7 +608,7 @@ static const SkMemberInfo gMovieInfo[] = {
{0, 16, 108, 2}
};
-static const char gOvalStrings[] =
+static const char gOvalStrings[] =
""
;
@@ -616,7 +616,7 @@ static const SkMemberInfo gOvalInfo[] = {
{0, 58, 18, 7}
};
-static const char gPaintStrings[] =
+static const char gPaintStrings[] =
"antiAlias\0"
"ascent\0"
"color\0"
@@ -672,7 +672,7 @@ static const SkMemberInfo gDrawPaintInfo[] = {
{235, 100, 121, 1}
};
-static const char gPathStrings[] =
+static const char gPathStrings[] =
"d\0"
"fillType\0"
"length"
@@ -684,7 +684,7 @@ static const SkMemberInfo gDrawPathInfo[] = {
{11, -2, 67, 98}
};
-static const char gUnknown5Strings[] =
+static const char gUnknown5Strings[] =
"x\0"
"y\0"
"z"
@@ -696,7 +696,7 @@ static const SkMemberInfo gUnknown5Info[] = {
{4, 8, 98, 1}
};
-static const char gPointStrings[] =
+static const char gPointStrings[] =
"x\0"
"y"
;
@@ -706,7 +706,7 @@ static const SkMemberInfo gDrawPointInfo[] = {
{2, 20, 98, 1}
};
-static const char gPolyToPolyStrings[] =
+static const char gPolyToPolyStrings[] =
"destination\0"
"source"
;
@@ -716,7 +716,7 @@ static const SkMemberInfo gPolyToPolyInfo[] = {
{12, 20, 80, 1}
};
-static const char gPolygonStrings[] =
+static const char gPolygonStrings[] =
""
;
@@ -724,7 +724,7 @@ static const SkMemberInfo gPolygonInfo[] = {
{0, 48, 18, 1}
};
-static const char gPolylineStrings[] =
+static const char gPolylineStrings[] =
"points"
;
@@ -732,7 +732,7 @@ static const SkMemberInfo gPolylineInfo[] = {
{0, 88, 119, 98}
};
-static const char gPostStrings[] =
+static const char gPostStrings[] =
"delay\0"
"initialized\0"
"mode\0"
@@ -750,7 +750,7 @@ static const SkMemberInfo gPostInfo[] = {
{35, -3, 67, 108}
};
-static const char gQuadToStrings[] =
+static const char gQuadToStrings[] =
"x1\0"
"x2\0"
"y1\0"
@@ -764,7 +764,7 @@ static const SkMemberInfo gQuadToInfo[] = {
{9, 32, 98, 1}
};
-static const char gRCubicToStrings[] =
+static const char gRCubicToStrings[] =
""
;
@@ -772,7 +772,7 @@ static const SkMemberInfo gRCubicToInfo[] = {
{0, 18, 18, 6}
};
-static const char gRLineToStrings[] =
+static const char gRLineToStrings[] =
""
;
@@ -780,7 +780,7 @@ static const SkMemberInfo gRLineToInfo[] = {
{0, 35, 18, 2}
};
-static const char gRMoveToStrings[] =
+static const char gRMoveToStrings[] =
""
;
@@ -788,7 +788,7 @@ static const SkMemberInfo gRMoveToInfo[] = {
{0, 39, 18, 2}
};
-static const char gRQuadToStrings[] =
+static const char gRQuadToStrings[] =
""
;
@@ -796,7 +796,7 @@ static const SkMemberInfo gRQuadToInfo[] = {
{0, 50, 18, 4}
};
-static const char gRadialGradientStrings[] =
+static const char gRadialGradientStrings[] =
"\0"
"center\0"
"radius"
@@ -808,7 +808,7 @@ static const SkMemberInfo gRadialGradientInfo[] = {
{8, 96, 98, 1}
};
-static const char gRandomStrings[] =
+static const char gRandomStrings[] =
"blend\0"
"max\0"
"min\0"
@@ -824,7 +824,7 @@ static const SkMemberInfo gDisplayRandomInfo[] = {
{21, -2, 67, 96}
};
-static const char gRectToRectStrings[] =
+static const char gRectToRectStrings[] =
"destination\0"
"source"
;
@@ -834,7 +834,7 @@ static const SkMemberInfo gRectToRectInfo[] = {
{12, 20, 91, 1}
};
-static const char gRectangleStrings[] =
+static const char gRectangleStrings[] =
"bottom\0"
"height\0"
"left\0"
@@ -854,7 +854,7 @@ static const SkMemberInfo gRectangleInfo[] = {
{41, -3, 67, 98}
};
-static const char gRemoveStrings[] =
+static const char gRemoveStrings[] =
"offset\0"
"where"
;
@@ -864,7 +864,7 @@ static const SkMemberInfo gRemoveInfo[] = {
{7, 28, 37, 1}
};
-static const char gReplaceStrings[] =
+static const char gReplaceStrings[] =
""
;
@@ -872,7 +872,7 @@ static const SkMemberInfo gReplaceInfo[] = {
{0, 1, 18, 4}
};
-static const char gRotateStrings[] =
+static const char gRotateStrings[] =
"center\0"
"degrees"
;
@@ -882,7 +882,7 @@ static const SkMemberInfo gRotateInfo[] = {
{7, 20, 98, 1}
};
-static const char gRoundRectStrings[] =
+static const char gRoundRectStrings[] =
"\0"
"rx\0"
"ry"
@@ -894,7 +894,7 @@ static const SkMemberInfo gRoundRectInfo[] = {
{4, 48, 98, 1}
};
-static const char gS32Strings[] =
+static const char gS32Strings[] =
"value"
;
@@ -902,7 +902,7 @@ static const SkMemberInfo gS32Info[] = {
{0, 16, 96, 1}
};
-static const char gScalarStrings[] =
+static const char gScalarStrings[] =
"value"
;
@@ -910,7 +910,7 @@ static const SkMemberInfo gScalarInfo[] = {
{0, 16, 98, 1}
};
-static const char gScaleStrings[] =
+static const char gScaleStrings[] =
"center\0"
"x\0"
"y"
@@ -922,7 +922,7 @@ static const SkMemberInfo gScaleInfo[] = {
{9, 24, 98, 1}
};
-static const char gSetStrings[] =
+static const char gSetStrings[] =
"begin\0"
"dur\0"
"dynamic\0"
@@ -944,7 +944,7 @@ static const SkMemberInfo gSetInfo[] = {
{45, 76, 40, 2}
};
-static const char gShaderStrings[] =
+static const char gShaderStrings[] =
"matrix\0"
"tileMode"
;
@@ -954,7 +954,7 @@ static const SkMemberInfo gShaderInfo[] = {
{7, 24, 116, 1}
};
-static const char gSkewStrings[] =
+static const char gSkewStrings[] =
"center\0"
"x\0"
"y"
@@ -966,7 +966,7 @@ static const SkMemberInfo gSkewInfo[] = {
{9, 24, 98, 1}
};
-static const char g3D_CameraStrings[] =
+static const char g3D_CameraStrings[] =
"axis\0"
"hackHeight\0"
"hackWidth\0"
@@ -986,7 +986,7 @@ static const SkMemberInfo g3D_CameraInfo[] = {
{50, 48, 106, 3}
};
-static const char g3D_PatchStrings[] =
+static const char g3D_PatchStrings[] =
"origin\0"
"rotateDegrees\0"
"u\0"
@@ -1000,7 +1000,7 @@ static const SkMemberInfo g3D_PatchInfo[] = {
{23, 28, 106, 3}
};
-static const char gUnknown6Strings[] =
+static const char gUnknown6Strings[] =
"x\0"
"y\0"
"z"
@@ -1012,7 +1012,7 @@ static const SkMemberInfo gUnknown6Info[] = {
{4, 8, 98, 1}
};
-static const char gSnapshotStrings[] =
+static const char gSnapshotStrings[] =
"filename\0"
"quality\0"
"sequence\0"
@@ -1026,7 +1026,7 @@ static const SkMemberInfo gSnapshotInfo[] = {
{26, 32, 20, 1}
};
-static const char gStringStrings[] =
+static const char gStringStrings[] =
"length\0"
"slice\0"
"value"
@@ -1038,7 +1038,7 @@ static const SkMemberInfo gStringInfo[] = {
{13, 16, 108, 2}
};
-static const char gTextStrings[] =
+static const char gTextStrings[] =
"length\0"
"text\0"
"x\0"
@@ -1052,7 +1052,7 @@ static const SkMemberInfo gTextInfo[] = {
{14, 36, 98, 1}
};
-static const char gTextBoxStrings[] =
+static const char gTextBoxStrings[] =
"\0"
"mode\0"
"spacingAdd\0"
@@ -1070,7 +1070,7 @@ static const SkMemberInfo gTextBoxInfo[] = {
{41, 44, 108, 2}
};
-static const char gTextOnPathStrings[] =
+static const char gTextOnPathStrings[] =
"offset\0"
"path\0"
"text"
@@ -1082,7 +1082,7 @@ static const SkMemberInfo gTextOnPathInfo[] = {
{12, 32, 110, 1}
};
-static const char gTextToPathStrings[] =
+static const char gTextToPathStrings[] =
"path\0"
"text"
;
@@ -1092,7 +1092,7 @@ static const SkMemberInfo gTextToPathInfo[] = {
{5, 20, 110, 1}
};
-static const char gTranslateStrings[] =
+static const char gTranslateStrings[] =
"x\0"
"y"
;
@@ -1102,7 +1102,7 @@ static const SkMemberInfo gTranslateInfo[] = {
{2, 24, 98, 1}
};
-static const char gTypedArrayStrings[] =
+static const char gTypedArrayStrings[] =
"length\0"
"values"
;
@@ -1112,7 +1112,7 @@ static const SkMemberInfo gTypedArrayInfo[] = {
{7, 16, 119, 0}
};
-static const char gTypefaceStrings[] =
+static const char gTypefaceStrings[] =
"fontName"
;
@@ -1294,7 +1294,7 @@ static const unsigned char gTypeIDs[] = {
117, // Translate
119, // TypedArray
120, // Typeface
-
+
};
static const int kTypeIDs = 81;
diff --git a/src/animator/SkCondensedRelease.cpp b/src/animator/SkCondensedRelease.cpp
index 234e67edab..60fa991edf 100644
--- a/src/animator/SkCondensedRelease.cpp
+++ b/src/animator/SkCondensedRelease.cpp
@@ -14,7 +14,7 @@
// To change it, edit the file with the matching debug info.
// Then execute SkDisplayType::BuildCondensedInfo() to regenerate this file.
-static const char gMathStrings[] =
+static const char gMathStrings[] =
"E\0"
"LN10\0"
"LN2\0"
@@ -72,7 +72,7 @@ static const SkMemberInfo gMathInfo[] = {
{123, -18, 66, 98}
};
-static const char gAddStrings[] =
+static const char gAddStrings[] =
"inPlace\0"
"offset\0"
"use\0"
@@ -86,7 +86,7 @@ static const SkMemberInfo gAddInfo[] = {
{19, 16, 37, 1}
};
-static const char gAddCircleStrings[] =
+static const char gAddCircleStrings[] =
"\0"
"radius\0"
"x\0"
@@ -100,7 +100,7 @@ static const SkMemberInfo gAddCircleInfo[] = {
{10, 20, 98, 1}
};
-static const char gUnknown1Strings[] =
+static const char gUnknown1Strings[] =
"direction"
;
@@ -108,7 +108,7 @@ static const SkMemberInfo gUnknown1Info[] = {
{0, 8, 75, 1}
};
-static const char gAddOvalStrings[] =
+static const char gAddOvalStrings[] =
""
;
@@ -116,7 +116,7 @@ static const SkMemberInfo gAddOvalInfo[] = {
{0, 6, 18, 5}
};
-static const char gAddPathStrings[] =
+static const char gAddPathStrings[] =
"matrix\0"
"path"
;
@@ -126,7 +126,7 @@ static const SkMemberInfo gAddPathInfo[] = {
{7, 12, 74, 1}
};
-static const char gAddRectangleStrings[] =
+static const char gAddRectangleStrings[] =
"\0"
"bottom\0"
"left\0"
@@ -142,7 +142,7 @@ static const SkMemberInfo gAddRectangleInfo[] = {
{19, 16, 98, 1}
};
-static const char gAddRoundRectStrings[] =
+static const char gAddRoundRectStrings[] =
"\0"
"rx\0"
"ry"
@@ -154,7 +154,7 @@ static const SkMemberInfo gAddRoundRectInfo[] = {
{4, 32, 98, 1}
};
-static const char gUnknown2Strings[] =
+static const char gUnknown2Strings[] =
"begin\0"
"blend\0"
"dur\0"
@@ -186,7 +186,7 @@ static const SkMemberInfo gUnknown2Info[] = {
{73, -4, 67, 40}
};
-static const char gAnimateFieldStrings[] =
+static const char gAnimateFieldStrings[] =
""
;
@@ -194,7 +194,7 @@ static const SkMemberInfo gAnimateFieldInfo[] = {
{0, 8, 18, 13}
};
-static const char gApplyStrings[] =
+static const char gApplyStrings[] =
"animator\0"
"begin\0"
"dontDraw\0"
@@ -226,7 +226,7 @@ static const SkMemberInfo gApplyInfo[] = {
{88, 40, 14, 1}
};
-static const char gUnknown3Strings[] =
+static const char gUnknown3Strings[] =
"x\0"
"y"
;
@@ -236,7 +236,7 @@ static const SkMemberInfo gUnknown3Info[] = {
{2, 40, 98, 1}
};
-static const char gBitmapStrings[] =
+static const char gBitmapStrings[] =
"\0"
"erase\0"
"format\0"
@@ -254,7 +254,7 @@ static const SkMemberInfo gDrawBitmapInfo[] = {
{30, 56, 96, 1}
};
-static const char gBitmapShaderStrings[] =
+static const char gBitmapShaderStrings[] =
"\0"
"filterType\0"
"image"
@@ -266,7 +266,7 @@ static const SkMemberInfo gDrawBitmapShaderInfo[] = {
{12, 20, 17, 1}
};
-static const char gBlurStrings[] =
+static const char gBlurStrings[] =
"blurStyle\0"
"radius"
;
@@ -276,7 +276,7 @@ static const SkMemberInfo gDrawBlurInfo[] = {
{10, 8, 98, 1}
};
-static const char gBoundsStrings[] =
+static const char gBoundsStrings[] =
"\0"
"inval"
;
@@ -286,7 +286,7 @@ static const SkMemberInfo gDisplayBoundsInfo[] = {
{1, 32, 26, 1}
};
-static const char gClipStrings[] =
+static const char gClipStrings[] =
"path\0"
"rectangle"
;
@@ -296,7 +296,7 @@ static const SkMemberInfo gDrawClipInfo[] = {
{5, 4, 91, 1}
};
-static const char gColorStrings[] =
+static const char gColorStrings[] =
"alpha\0"
"blue\0"
"color\0"
@@ -318,7 +318,7 @@ static const SkMemberInfo gDrawColorInfo[] = {
{42, -7, 67, 98}
};
-static const char gCubicToStrings[] =
+static const char gCubicToStrings[] =
"x1\0"
"x2\0"
"x3\0"
@@ -336,7 +336,7 @@ static const SkMemberInfo gCubicToInfo[] = {
{15, 28, 98, 1}
};
-static const char gDashStrings[] =
+static const char gDashStrings[] =
"intervals\0"
"phase"
;
@@ -346,7 +346,7 @@ static const SkMemberInfo gDashInfo[] = {
{10, 16, 98, 1}
};
-static const char gDataStrings[] =
+static const char gDataStrings[] =
"\0"
"name"
;
@@ -356,7 +356,7 @@ static const SkMemberInfo gDataInfo[] = {
{1, 16, 108, 1}
};
-static const char gDiscreteStrings[] =
+static const char gDiscreteStrings[] =
"deviation\0"
"segLength"
;
@@ -366,7 +366,7 @@ static const SkMemberInfo gDiscreteInfo[] = {
{10, 12, 98, 1}
};
-static const char gDrawToStrings[] =
+static const char gDrawToStrings[] =
"drawOnce\0"
"use"
;
@@ -376,7 +376,7 @@ static const SkMemberInfo gDrawToInfo[] = {
{9, 40, 19, 1}
};
-static const char gEmbossStrings[] =
+static const char gEmbossStrings[] =
"ambient\0"
"direction\0"
"radius\0"
@@ -390,7 +390,7 @@ static const SkMemberInfo gDrawEmbossInfo[] = {
{25, -2, 67, 98}
};
-static const char gEventStrings[] =
+static const char gEventStrings[] =
"code\0"
"disable\0"
"key\0"
@@ -412,7 +412,7 @@ static const SkMemberInfo gDisplayEventInfo[] = {
{36, 24, 98, 1}
};
-static const char gFromPathStrings[] =
+static const char gFromPathStrings[] =
"mode\0"
"offset\0"
"path"
@@ -424,7 +424,7 @@ static const SkMemberInfo gFromPathInfo[] = {
{12, 16, 74, 1}
};
-static const char gUnknown4Strings[] =
+static const char gUnknown4Strings[] =
"\0"
"offsets\0"
"unitMapper"
@@ -436,7 +436,7 @@ static const SkMemberInfo gUnknown4Info[] = {
{9, 24, 108, 1}
};
-static const char gGStrings[] =
+static const char gGStrings[] =
"condition\0"
"enableCondition"
;
@@ -446,7 +446,7 @@ static const SkMemberInfo gGInfo[] = {
{10, 8, 40, 1}
};
-static const char gHitClearStrings[] =
+static const char gHitClearStrings[] =
"targets"
;
@@ -454,7 +454,7 @@ static const SkMemberInfo gHitClearInfo[] = {
{0, 4, 119, 36}
};
-static const char gHitTestStrings[] =
+static const char gHitTestStrings[] =
"bullets\0"
"hits\0"
"targets\0"
@@ -468,7 +468,7 @@ static const SkMemberInfo gHitTestInfo[] = {
{21, 28, 26, 1}
};
-static const char gImageStrings[] =
+static const char gImageStrings[] =
"\0"
"base64\0"
"src"
@@ -480,7 +480,7 @@ static const SkMemberInfo gImageInfo[] = {
{8, 52, 108, 1}
};
-static const char gIncludeStrings[] =
+static const char gIncludeStrings[] =
"src"
;
@@ -488,7 +488,7 @@ static const SkMemberInfo gIncludeInfo[] = {
{0, 4, 108, 1}
};
-static const char gInputStrings[] =
+static const char gInputStrings[] =
"s32\0"
"scalar\0"
"string"
@@ -500,7 +500,7 @@ static const SkMemberInfo gInputInfo[] = {
{11, 12, 108, 1}
};
-static const char gLineStrings[] =
+static const char gLineStrings[] =
"x1\0"
"x2\0"
"y1\0"
@@ -514,7 +514,7 @@ static const SkMemberInfo gLineInfo[] = {
{9, 24, 98, 1}
};
-static const char gLineToStrings[] =
+static const char gLineToStrings[] =
"x\0"
"y"
;
@@ -524,7 +524,7 @@ static const SkMemberInfo gLineToInfo[] = {
{2, 12, 98, 1}
};
-static const char gLinearGradientStrings[] =
+static const char gLinearGradientStrings[] =
"\0"
"points"
;
@@ -534,7 +534,7 @@ static const SkMemberInfo gLinearGradientInfo[] = {
{1, 48, 77, 4}
};
-static const char gMatrixStrings[] =
+static const char gMatrixStrings[] =
"matrix\0"
"perspectX\0"
"perspectY\0"
@@ -564,7 +564,7 @@ static const SkMemberInfo gDrawMatrixInfo[] = {
{87, -11, 67, 98}
};
-static const char gMoveStrings[] =
+static const char gMoveStrings[] =
""
;
@@ -572,7 +572,7 @@ static const SkMemberInfo gMoveInfo[] = {
{0, 1, 18, 4}
};
-static const char gMoveToStrings[] =
+static const char gMoveToStrings[] =
"x\0"
"y"
;
@@ -582,7 +582,7 @@ static const SkMemberInfo gMoveToInfo[] = {
{2, 12, 98, 1}
};
-static const char gMovieStrings[] =
+static const char gMovieStrings[] =
"src"
;
@@ -590,7 +590,7 @@ static const SkMemberInfo gMovieInfo[] = {
{0, 4, 108, 1}
};
-static const char gOvalStrings[] =
+static const char gOvalStrings[] =
""
;
@@ -598,7 +598,7 @@ static const SkMemberInfo gOvalInfo[] = {
{0, 57, 18, 7}
};
-static const char gPaintStrings[] =
+static const char gPaintStrings[] =
"antiAlias\0"
"ascent\0"
"color\0"
@@ -654,7 +654,7 @@ static const SkMemberInfo gDrawPaintInfo[] = {
{235, 88, 121, 1}
};
-static const char gPathStrings[] =
+static const char gPathStrings[] =
"d\0"
"fillType\0"
"length"
@@ -666,7 +666,7 @@ static const SkMemberInfo gDrawPathInfo[] = {
{11, -2, 67, 98}
};
-static const char gUnknown5Strings[] =
+static const char gUnknown5Strings[] =
"x\0"
"y\0"
"z"
@@ -678,7 +678,7 @@ static const SkMemberInfo gUnknown5Info[] = {
{4, 8, 98, 1}
};
-static const char gPointStrings[] =
+static const char gPointStrings[] =
"x\0"
"y"
;
@@ -688,7 +688,7 @@ static const SkMemberInfo gDrawPointInfo[] = {
{2, 8, 98, 1}
};
-static const char gPolyToPolyStrings[] =
+static const char gPolyToPolyStrings[] =
"destination\0"
"source"
;
@@ -698,7 +698,7 @@ static const SkMemberInfo gPolyToPolyInfo[] = {
{12, 8, 80, 1}
};
-static const char gPolygonStrings[] =
+static const char gPolygonStrings[] =
""
;
@@ -706,7 +706,7 @@ static const SkMemberInfo gPolygonInfo[] = {
{0, 47, 18, 1}
};
-static const char gPolylineStrings[] =
+static const char gPolylineStrings[] =
"points"
;
@@ -714,7 +714,7 @@ static const SkMemberInfo gPolylineInfo[] = {
{0, 56, 119, 98}
};
-static const char gPostStrings[] =
+static const char gPostStrings[] =
"delay\0"
"initialized\0"
"mode\0"
@@ -732,7 +732,7 @@ static const SkMemberInfo gPostInfo[] = {
{35, -3, 67, 108}
};
-static const char gQuadToStrings[] =
+static const char gQuadToStrings[] =
"x1\0"
"x2\0"
"y1\0"
@@ -746,7 +746,7 @@ static const SkMemberInfo gQuadToInfo[] = {
{9, 20, 98, 1}
};
-static const char gRCubicToStrings[] =
+static const char gRCubicToStrings[] =
""
;
@@ -754,7 +754,7 @@ static const SkMemberInfo gRCubicToInfo[] = {
{0, 18, 18, 6}
};
-static const char gRLineToStrings[] =
+static const char gRLineToStrings[] =
""
;
@@ -762,7 +762,7 @@ static const SkMemberInfo gRLineToInfo[] = {
{0, 34, 18, 2}
};
-static const char gRMoveToStrings[] =
+static const char gRMoveToStrings[] =
""
;
@@ -770,7 +770,7 @@ static const SkMemberInfo gRMoveToInfo[] = {
{0, 38, 18, 2}
};
-static const char gRQuadToStrings[] =
+static const char gRQuadToStrings[] =
""
;
@@ -778,7 +778,7 @@ static const SkMemberInfo gRQuadToInfo[] = {
{0, 49, 18, 4}
};
-static const char gRadialGradientStrings[] =
+static const char gRadialGradientStrings[] =
"\0"
"center\0"
"radius"
@@ -790,7 +790,7 @@ static const SkMemberInfo gRadialGradientInfo[] = {
{8, 56, 98, 1}
};
-static const char gRandomStrings[] =
+static const char gRandomStrings[] =
"blend\0"
"max\0"
"min\0"
@@ -806,7 +806,7 @@ static const SkMemberInfo gDisplayRandomInfo[] = {
{21, -2, 67, 96}
};
-static const char gRectToRectStrings[] =
+static const char gRectToRectStrings[] =
"destination\0"
"source"
;
@@ -816,7 +816,7 @@ static const SkMemberInfo gRectToRectInfo[] = {
{12, 8, 91, 1}
};
-static const char gRectangleStrings[] =
+static const char gRectangleStrings[] =
"bottom\0"
"height\0"
"left\0"
@@ -836,7 +836,7 @@ static const SkMemberInfo gRectangleInfo[] = {
{41, -3, 67, 98}
};
-static const char gRemoveStrings[] =
+static const char gRemoveStrings[] =
"offset\0"
"where"
;
@@ -846,7 +846,7 @@ static const SkMemberInfo gRemoveInfo[] = {
{7, 16, 37, 1}
};
-static const char gReplaceStrings[] =
+static const char gReplaceStrings[] =
""
;
@@ -854,7 +854,7 @@ static const SkMemberInfo gReplaceInfo[] = {
{0, 1, 18, 4}
};
-static const char gRotateStrings[] =
+static const char gRotateStrings[] =
"center\0"
"degrees"
;
@@ -864,7 +864,7 @@ static const SkMemberInfo gRotateInfo[] = {
{7, 8, 98, 1}
};
-static const char gRoundRectStrings[] =
+static const char gRoundRectStrings[] =
"\0"
"rx\0"
"ry"
@@ -876,7 +876,7 @@ static const SkMemberInfo gRoundRectInfo[] = {
{4, 36, 98, 1}
};
-static const char gS32Strings[] =
+static const char gS32Strings[] =
"value"
;
@@ -884,7 +884,7 @@ static const SkMemberInfo gS32Info[] = {
{0, 4, 96, 1}
};
-static const char gScalarStrings[] =
+static const char gScalarStrings[] =
"value"
;
@@ -892,7 +892,7 @@ static const SkMemberInfo gScalarInfo[] = {
{0, 4, 98, 1}
};
-static const char gScaleStrings[] =
+static const char gScaleStrings[] =
"center\0"
"x\0"
"y"
@@ -904,7 +904,7 @@ static const SkMemberInfo gScaleInfo[] = {
{9, 12, 98, 1}
};
-static const char gSetStrings[] =
+static const char gSetStrings[] =
"begin\0"
"dur\0"
"dynamic\0"
@@ -926,7 +926,7 @@ static const SkMemberInfo gSetInfo[] = {
{45, 40, 40, 1}
};
-static const char gShaderStrings[] =
+static const char gShaderStrings[] =
"matrix\0"
"tileMode"
;
@@ -936,7 +936,7 @@ static const SkMemberInfo gShaderInfo[] = {
{7, 12, 116, 1}
};
-static const char gSkewStrings[] =
+static const char gSkewStrings[] =
"center\0"
"x\0"
"y"
@@ -948,7 +948,7 @@ static const SkMemberInfo gSkewInfo[] = {
{9, 12, 98, 1}
};
-static const char g3D_CameraStrings[] =
+static const char g3D_CameraStrings[] =
"axis\0"
"hackHeight\0"
"hackWidth\0"
@@ -968,7 +968,7 @@ static const SkMemberInfo g3D_CameraInfo[] = {
{50, 36, 106, 3}
};
-static const char g3D_PatchStrings[] =
+static const char g3D_PatchStrings[] =
"origin\0"
"rotateDegrees\0"
"u\0"
@@ -982,7 +982,7 @@ static const SkMemberInfo g3D_PatchInfo[] = {
{23, 16, 106, 3}
};
-static const char gUnknown6Strings[] =
+static const char gUnknown6Strings[] =
"x\0"
"y\0"
"z"
@@ -994,7 +994,7 @@ static const SkMemberInfo gUnknown6Info[] = {
{4, 8, 98, 1}
};
-static const char gSnapshotStrings[] =
+static const char gSnapshotStrings[] =
"filename\0"
"quality\0"
"sequence\0"
@@ -1008,7 +1008,7 @@ static const SkMemberInfo gSnapshotInfo[] = {
{26, 16, 20, 1}
};
-static const char gStringStrings[] =
+static const char gStringStrings[] =
"length\0"
"slice\0"
"value"
@@ -1020,7 +1020,7 @@ static const SkMemberInfo gStringInfo[] = {
{13, 4, 108, 1}
};
-static const char gTextStrings[] =
+static const char gTextStrings[] =
"length\0"
"text\0"
"x\0"
@@ -1034,7 +1034,7 @@ static const SkMemberInfo gTextInfo[] = {
{14, 20, 98, 1}
};
-static const char gTextBoxStrings[] =
+static const char gTextBoxStrings[] =
"\0"
"mode\0"
"spacingAdd\0"
@@ -1052,7 +1052,7 @@ static const SkMemberInfo gTextBoxInfo[] = {
{41, 32, 108, 1}
};
-static const char gTextOnPathStrings[] =
+static const char gTextOnPathStrings[] =
"offset\0"
"path\0"
"text"
@@ -1064,7 +1064,7 @@ static const SkMemberInfo gTextOnPathInfo[] = {
{12, 20, 110, 1}
};
-static const char gTextToPathStrings[] =
+static const char gTextToPathStrings[] =
"path\0"
"text"
;
@@ -1074,7 +1074,7 @@ static const SkMemberInfo gTextToPathInfo[] = {
{5, 8, 110, 1}
};
-static const char gTranslateStrings[] =
+static const char gTranslateStrings[] =
"x\0"
"y"
;
@@ -1084,7 +1084,7 @@ static const SkMemberInfo gTranslateInfo[] = {
{2, 12, 98, 1}
};
-static const char gTypedArrayStrings[] =
+static const char gTypedArrayStrings[] =
"length\0"
"values"
;
@@ -1094,7 +1094,7 @@ static const SkMemberInfo gTypedArrayInfo[] = {
{7, 4, 119, 0}
};
-static const char gTypefaceStrings[] =
+static const char gTypefaceStrings[] =
"fontName"
;
@@ -1274,7 +1274,7 @@ static const unsigned char gTypeIDs[] = {
117, // Translate
119, // TypedArray
120, // Typeface
-
+
};
static const int kTypeIDs = 80;
diff --git a/src/animator/SkDisplayAdd.cpp b/src/animator/SkDisplayAdd.cpp
index 1cf89a172d..7fd5026584 100644
--- a/src/animator/SkDisplayAdd.cpp
+++ b/src/animator/SkDisplayAdd.cpp
@@ -33,7 +33,7 @@ const SkMemberInfo SkAdd::fInfo[] = {
DEFINE_GET_MEMBER(SkAdd);
-SkAdd::SkAdd() : mode(kMode_indirect),
+SkAdd::SkAdd() : mode(kMode_indirect),
offset(SK_MaxS32), use(NULL), where(NULL) {
}
@@ -119,7 +119,7 @@ bool SkAdd::enable(SkAnimateMaker& maker ) {
parentGroup->markCopySet(index);
useParentList->begin()[index] = use;
break;
- }
+ }
}
*parentList->append() = use;
}
diff --git a/src/animator/SkDisplayAdd.h b/src/animator/SkDisplayAdd.h
index 47948fb7f7..58839630a1 100644
--- a/src/animator/SkDisplayAdd.h
+++ b/src/animator/SkDisplayAdd.h
@@ -16,12 +16,12 @@
class SkAdd : public SkDrawable {
DECLARE_MEMBER_INFO(Add);
SkAdd();
-
+
enum Mode {
kMode_indirect,
kMode_immediate
};
-
+
virtual SkDisplayable* deepCopy(SkAnimateMaker* );
virtual bool draw(SkAnimateMaker& );
#ifdef SK_DUMP_ENABLED
diff --git a/src/animator/SkDisplayApply.cpp b/src/animator/SkDisplayApply.cpp
index d54ee2600f..baa10e7c3f 100644
--- a/src/animator/SkDisplayApply.cpp
+++ b/src/animator/SkDisplayApply.cpp
@@ -51,13 +51,13 @@ const SkMemberInfo SkApply::fInfo[] = {
SK_MEMBER(transition, ApplyTransition)
};
-#endif
+#endif
DEFINE_GET_MEMBER(SkApply);
SkApply::SkApply() : begin(0), dontDraw(false), interval((SkMSec) -1), mode((Mode) -1), /*pickup(false), */
restore(false), scope(NULL), steps(-1), transition((Transition) -1), fActive(NULL), /*fCurrentScope(NULL),*/
- fLastTime(0), fAppended(false), fContainsScope(false), fDeleteScope(false), fEmbedded(false),
+ fLastTime(0), fAppended(false), fContainsScope(false), fDeleteScope(false), fEmbedded(false),
fEnabled(false), fEnabling(false) {
}
@@ -105,7 +105,7 @@ void SkApply::append(SkApply* apply) {
}
void SkApply::applyValues(int animatorIndex, SkOperand* values, int count,
- SkDisplayTypes valuesType, SkMSec time)
+ SkDisplayTypes valuesType, SkMSec time)
{
SkAnimateBase* animator = fActive->fAnimators[animatorIndex];
const SkMemberInfo * info = animator->fFieldInfo;
@@ -149,7 +149,7 @@ void SkApply::applyValues(int animatorIndex, SkOperand* values, int count,
target->setReference(info, values->fDisplayable);
else
info->setValue(target, values, count);
- }
+ }
}
bool SkApply::contains(SkDisplayable* child) {
@@ -178,7 +178,7 @@ void SkApply::disable() {
//!!! this is the right thing to do, but has bad side effects because of other problems
// currently, if an apply is in a g and scopes a statement in another g, it ends up as members
// of both containers. The disabling here incorrectly disables both instances
- // maybe the fEnabled flag needs to be moved to the fActive data so that both
+ // maybe the fEnabled flag needs to be moved to the fActive data so that both
// instances are not affected.
// fEnabled = false;
}
@@ -265,7 +265,7 @@ bool SkApply::enable(SkAnimateMaker& maker) {
bool initialized = fActive != NULL;
if (dynamicScope.size() > 0)
enableDynamic(maker);
- if (maker.fError.hasError())
+ if (maker.fError.hasError())
return false;
int animators = fAnimators.count();
int index;
@@ -333,7 +333,7 @@ bool SkApply::enable(SkAnimateMaker& maker) {
}
#endif
// start here;
- // now that one apply might embed another, only the parent apply should replace the scope
+ // now that one apply might embed another, only the parent apply should replace the scope
// or get appended to the display list
// similarly, an apply added by an add immediate has already been located in the display list
// and should not get moved or added again here
@@ -408,7 +408,7 @@ void SkApply::enableCreate(SkAnimateMaker& maker) {
step = steps; // quit
goto next; // resolveIDs failed
}
- if (newID.size() > 0)
+ if (newID.size() > 0)
maker.setID(copyScope, newID);
if (copy->resolveIDs(maker, this, this)) { // fix up all fields, including target
step = steps; // quit
@@ -517,7 +517,7 @@ bool SkApply::hasDelayedAnimator() const {
SkAnimateBase** animEnd = fAnimators.end();
for (SkAnimateBase** animPtr = fAnimators.begin(); animPtr < animEnd; animPtr++) {
SkAnimateBase* animator = *animPtr;
- if (animator->fDelayed)
+ if (animator->fDelayed)
return true;
}
return false;
@@ -548,7 +548,7 @@ bool SkApply::interpolate(SkAnimateMaker& maker, SkMSec rawTime) {
SkMSec time = maker.getAppTime();
if (lastTime == (SkMSec) -1)
lastTime = rawTime - 1;
- if (fActive != NULL &&
+ if (fActive != NULL &&
strcmp(id, "a3") == 0 && rawTime > lastTime) {
lastTime += 1000;
SkString debugOut;
@@ -593,7 +593,7 @@ bool SkApply::interpolate(SkAnimateMaker& maker, SkMSec rawTime) {
} else
animate->fDelayed = false;
SkMSec innerTime = fLastTime = state.getRelativeTime(time);
- if (restore)
+ if (restore)
fActive->restoreInterpolatorValues(inner);
if (animate->fReset) {
if (transition != SkApply::kTransition_reverse) {
@@ -629,7 +629,7 @@ bool SkApply::interpolate(SkAnimateMaker& maker, SkMSec rawTime) {
fLastTime = animate->dur;
SkTypedArray formulaValues;
formulaValues.setCount(count);
- bool success = animate->fFieldInfo->setValue(maker, &formulaValues, 0, 0, NULL,
+ bool success = animate->fFieldInfo->setValue(maker, &formulaValues, 0, 0, NULL,
animate->getValuesType(), animate->formula);
SkASSERT(success);
if (restore)
@@ -652,7 +652,7 @@ void SkApply::initialize() {
scope->initialize();
}
-void SkApply::onEndElement(SkAnimateMaker& maker)
+void SkApply::onEndElement(SkAnimateMaker& maker)
{
SkDrawable* scopePtr = scope;
while (scopePtr && scopePtr->isApply()) {
@@ -781,7 +781,7 @@ bool SkApply::setProperty(int index, SkScriptValue& scriptValue) {
SkAnimateBase* animate = (SkAnimateBase*) scriptValue.fOperand.fDisplayable;
SkASSERT(animate->isAnimate());
*fAnimators.append() = animate;
- return true;
+ return true;
}
case SK_PROPERTY(steps):
steps = scriptValue.fOperand.fS32;
@@ -792,8 +792,8 @@ bool SkApply::setProperty(int index, SkScriptValue& scriptValue) {
return false;
}
-void SkApply::setSteps(int _steps) {
- steps = _steps;
+void SkApply::setSteps(int _steps) {
+ steps = _steps;
}
#ifdef SK_DEBUG
diff --git a/src/animator/SkDisplayApply.h b/src/animator/SkDisplayApply.h
index 018b894da5..3a066a4397 100644
--- a/src/animator/SkDisplayApply.h
+++ b/src/animator/SkDisplayApply.h
@@ -27,7 +27,7 @@ public:
kTransition_normal,
kTransition_reverse
};
-
+
enum Mode {
kMode_create,
kMode_immediate,
@@ -58,7 +58,7 @@ public:
bool hasDelayedAnimator() const;
virtual bool hasEnable() const;
bool inactivate(SkAnimateMaker& maker);
- virtual void initialize();
+ virtual void initialize();
bool interpolate(SkAnimateMaker& , SkMSec time);
virtual void onEndElement(SkAnimateMaker& );
virtual const SkMemberInfo* preferredChild(SkDisplayTypes type);
diff --git a/src/animator/SkDisplayBounds.cpp b/src/animator/SkDisplayBounds.cpp
index 69ec47ed3c..4c89481b99 100644
--- a/src/animator/SkDisplayBounds.cpp
+++ b/src/animator/SkDisplayBounds.cpp
@@ -36,7 +36,7 @@ bool SkDisplayBounds::draw(SkAnimateMaker& maker) {
maker.fDisplayList.fHasUnion = true;
if (rect.isEmpty())
rect = fBounds;
- else
+ else
rect.join(fBounds);
}
return result;
diff --git a/src/animator/SkDisplayEvent.cpp b/src/animator/SkDisplayEvent.cpp
index 0eb956a361..303e42c662 100644
--- a/src/animator/SkDisplayEvent.cpp
+++ b/src/animator/SkDisplayEvent.cpp
@@ -52,9 +52,9 @@ SkDisplayEvent::~SkDisplayEvent() {
deleteMembers();
}
-bool SkDisplayEvent::add(SkAnimateMaker& , SkDisplayable* child) {
- *fChildren.append() = child;
- return true;
+bool SkDisplayEvent::add(SkAnimateMaker& , SkDisplayable* child) {
+ *fChildren.append() = child;
+ return true;
}
bool SkDisplayEvent::contains(SkDisplayable* match) {
@@ -112,7 +112,7 @@ void SkDisplayEvent::dumpEvent(SkAnimateMaker* maker) {
}
#endif
-bool SkDisplayEvent::enableEvent(SkAnimateMaker& maker)
+bool SkDisplayEvent::enableEvent(SkAnimateMaker& maker)
{
maker.fActiveEvent = this;
if (fChildren.count() == 0)
@@ -134,7 +134,7 @@ bool SkDisplayEvent::enableEvent(SkAnimateMaker& maker)
}
if (displayable->enable(maker))
continue;
- if (maker.hasError())
+ if (maker.hasError())
return true;
if (displayable->isDrawable() == false)
return true; // error
diff --git a/src/animator/SkDisplayEvents.cpp b/src/animator/SkDisplayEvents.cpp
index 38f82a05ba..c42fbdf312 100644
--- a/src/animator/SkDisplayEvents.cpp
+++ b/src/animator/SkDisplayEvents.cpp
@@ -83,7 +83,7 @@ void SkEvents::dump(SkAnimateMaker& maker) {
int count = drawArray.count();
for (index = 0; index < count; index++) {
SkDrawable* drawable = drawArray[index];
- drawable->dumpEvents();
+ drawable->dumpEvents();
}
count = fEvents.count();
for (index = 0; index < count; index++) {
diff --git a/src/animator/SkDisplayInput.cpp b/src/animator/SkDisplayInput.cpp
index 77bc5de51f..7061aa8ea9 100644
--- a/src/animator/SkDisplayInput.cpp
+++ b/src/animator/SkDisplayInput.cpp
@@ -49,7 +49,7 @@ bool SkInput::getProperty(int index, SkScriptValue* value) const {
}
return true;
}
-
+
bool SkInput::hasEnable() const {
return true;
}
diff --git a/src/animator/SkDisplayList.cpp b/src/animator/SkDisplayList.cpp
index 8424b127dd..39465f195d 100644
--- a/src/animator/SkDisplayList.cpp
+++ b/src/animator/SkDisplayList.cpp
@@ -51,7 +51,7 @@ bool SkDisplayList::draw(SkAnimateMaker& maker, SkMSec inTime) {
}
int SkDisplayList::findGroup(SkDrawable* match, SkTDDrawableArray** list,
- SkGroup** parent, SkGroup** found, SkTDDrawableArray**grandList) {
+ SkGroup** parent, SkGroup** found, SkTDDrawableArray**grandList) {
*parent = NULL;
*list = &fDrawList;
*grandList = &fDrawList;
@@ -69,7 +69,7 @@ bool SkDisplayList::onIRect(const SkIRect& r) {
}
int SkDisplayList::SearchForMatch(SkDrawable* match, SkTDDrawableArray** list,
- SkGroup** parent, SkGroup** found, SkTDDrawableArray**grandList) {
+ SkGroup** parent, SkGroup** found, SkTDDrawableArray**grandList) {
*found = NULL;
for (int index = 0; index < (*list)->count(); index++) {
SkDrawable* draw = (**list)[index];
@@ -88,11 +88,11 @@ int SkDisplayList::SearchForMatch(SkDrawable* match, SkTDDrawableArray** list,
return index;
//perhaps should call SearchGroupForMatch here as well (on scope)
}
- }
+ }
}
- if (draw->isGroup() && SearchGroupForMatch(draw, match, list, parent, found, grandList, index))
+ if (draw->isGroup() && SearchGroupForMatch(draw, match, list, parent, found, grandList, index))
return index;
-
+
}
return -1;
}
@@ -120,7 +120,7 @@ void SkDisplayList::reset() {
continue;
SkApply* apply = (SkApply*) draw;
apply->reset();
- }
+ }
}
void SkDisplayList::remove(SkActive* active) {
diff --git a/src/animator/SkDisplayList.h b/src/animator/SkDisplayList.h
index f520b55011..af98aeffc1 100644
--- a/src/animator/SkDisplayList.h
+++ b/src/animator/SkDisplayList.h
@@ -35,8 +35,8 @@ public:
static int fIndent;
static int fDumpIndex;
#endif
- int findGroup(SkDrawable* match, SkTDDrawableArray** list,
- SkGroup** parent, SkGroup** found, SkTDDrawableArray** grandList);
+ int findGroup(SkDrawable* match, SkTDDrawableArray** list,
+ SkGroup** parent, SkGroup** found, SkTDDrawableArray** grandList);
SkDrawable* get(int index) { return fDrawList[index]; }
SkMSec getTime() { return fInTime; }
SkTDDrawableArray* getDrawList() { return &fDrawList; }
@@ -51,8 +51,8 @@ public:
#endif
static int SearchForMatch(SkDrawable* match, SkTDDrawableArray** list,
SkGroup** parent, SkGroup** found, SkTDDrawableArray**grandList);
- static bool SearchGroupForMatch(SkDrawable* draw, SkDrawable* match,
- SkTDDrawableArray** list, SkGroup** parent, SkGroup** found, SkTDDrawableArray** grandList,
+ static bool SearchGroupForMatch(SkDrawable* draw, SkDrawable* match,
+ SkTDDrawableArray** list, SkGroup** parent, SkGroup** found, SkTDDrawableArray** grandList,
int &index);
public:
SkIRect fBounds;
diff --git a/src/animator/SkDisplayMath.cpp b/src/animator/SkDisplayMath.cpp
index c4d496d0a7..bdf377b302 100644
--- a/src/animator/SkDisplayMath.cpp
+++ b/src/animator/SkDisplayMath.cpp
@@ -29,7 +29,7 @@ const SkScalar SkDisplayMath::gConstants[] = {
1.442695041f, // LOG2E
3.141592654f, // PI
0.707106781f, // SQRT1_2
- 1.414213562f // SQRT2
+ 1.414213562f // SQRT2
#else
0x2B7E1, // E
0x24D76, // LN10
@@ -139,7 +139,7 @@ const SkMemberInfo SkDisplayMath::fInfo[] = {
DEFINE_GET_MEMBER(SkDisplayMath);
-void SkDisplayMath::executeFunction(SkDisplayable* target, int index,
+void SkDisplayMath::executeFunction(SkDisplayable* target, int index,
SkTDArray<SkScriptValue>& parameters, SkDisplayTypes type,
SkScriptValue* scriptValue) {
if (scriptValue == NULL)
@@ -151,7 +151,7 @@ void SkDisplayMath::executeFunction(SkDisplayable* target, int index,
SkScalar scalarResult;
switch (index) {
case SK_FUNCTION(abs):
- scalarResult = SkScalarAbs(input);
+ scalarResult = SkScalarAbs(input);
break;
case SK_FUNCTION(acos):
scalarResult = SkScalarACos(input);
@@ -166,7 +166,7 @@ void SkDisplayMath::executeFunction(SkDisplayable* target, int index,
scalarResult = SkScalarATan2(input, parameters[1].fOperand.fScalar);
break;
case SK_FUNCTION(ceil):
- scalarResult = SkIntToScalar(SkScalarCeil(input));
+ scalarResult = SkIntToScalar(SkScalarCeil(input));
break;
case SK_FUNCTION(cos):
scalarResult = SkScalarCos(input);
@@ -175,7 +175,7 @@ void SkDisplayMath::executeFunction(SkDisplayable* target, int index,
scalarResult = SkScalarExp(input);
break;
case SK_FUNCTION(floor):
- scalarResult = SkIntToScalar(SkScalarFloor(input));
+ scalarResult = SkIntToScalar(SkScalarFloor(input));
break;
case SK_FUNCTION(log):
scalarResult = SkScalarLog(input);
@@ -204,7 +204,7 @@ void SkDisplayMath::executeFunction(SkDisplayable* target, int index,
scalarResult = fRandom.nextUScalar1();
break;
case SK_FUNCTION(round):
- scalarResult = SkIntToScalar(SkScalarRound(input));
+ scalarResult = SkIntToScalar(SkScalarRound(input));
break;
case SK_FUNCTION(sin):
scalarResult = SkScalarSin(input);
@@ -212,7 +212,7 @@ void SkDisplayMath::executeFunction(SkDisplayable* target, int index,
case SK_FUNCTION(sqrt): {
SkASSERT(parameters.count() == 1);
SkASSERT(type == SkType_Float);
- scalarResult = SkScalarSqrt(input);
+ scalarResult = SkScalarSqrt(input);
} break;
case SK_FUNCTION(tan):
scalarResult = SkScalarTan(input);
diff --git a/src/animator/SkDisplayMath.h b/src/animator/SkDisplayMath.h
index e21d03f320..faa929e27d 100644
--- a/src/animator/SkDisplayMath.h
+++ b/src/animator/SkDisplayMath.h
@@ -16,7 +16,7 @@
class SkDisplayMath : public SkDisplayable {
DECLARE_DISPLAY_MEMBER_INFO(Math);
- virtual void executeFunction(SkDisplayable* , int index,
+ virtual void executeFunction(SkDisplayable* , int index,
SkTDArray<SkScriptValue>& parameters, SkDisplayTypes type,
SkScriptValue* );
virtual const SkFunctionParamType* getFunctionsParameters();
@@ -27,6 +27,6 @@ private:
static const SkFunctionParamType fFunctionParameters[];
};
-
+
#endif // SkDisplayMath_DEFINED
diff --git a/src/animator/SkDisplayMovie.cpp b/src/animator/SkDisplayMovie.cpp
index 4fbf3f3f21..33123cb019 100644
--- a/src/animator/SkDisplayMovie.cpp
+++ b/src/animator/SkDisplayMovie.cpp
@@ -78,7 +78,7 @@ bool SkDisplayMovie::draw(SkAnimateMaker& maker) {
enable(maker);
maker.fCanvas->save();
SkPaint local = SkPaint(*maker.fPaint);
- bool result = fMovie.draw(maker.fCanvas, &local,
+ bool result = fMovie.draw(maker.fCanvas, &local,
maker.fDisplayList.getTime()) != SkAnimator::kNotDifferent;
maker.fDisplayList.fInvalBounds.join(fMovie.fMaker->fDisplayList.fInvalBounds);
maker.fCanvas->restore();
diff --git a/src/animator/SkDisplayNumber.h b/src/animator/SkDisplayNumber.h
index 7092e213ae..16c6f4fde4 100644
--- a/src/animator/SkDisplayNumber.h
+++ b/src/animator/SkDisplayNumber.h
@@ -18,5 +18,5 @@ class SkDisplayNumber : public SkDisplayable {
virtual bool getProperty(int index, SkScriptValue* value) const;
private:
};
-
+
#endif // SkDisplayNumber_DEFINED
diff --git a/src/animator/SkDisplayPost.cpp b/src/animator/SkDisplayPost.cpp
index bf89055c28..3c9fa19e46 100644
--- a/src/animator/SkDisplayPost.cpp
+++ b/src/animator/SkDisplayPost.cpp
@@ -54,12 +54,12 @@ bool SkPost::add(SkAnimateMaker& , SkDisplayable* child) {
return true;
}
-bool SkPost::childrenNeedDisposing() const {
- return false;
+bool SkPost::childrenNeedDisposing() const {
+ return false;
}
-void SkPost::dirty() {
- fDirty = true;
+void SkPost::dirty() {
+ fDirty = true;
}
#ifdef SK_DUMP_ENABLED
@@ -74,7 +74,7 @@ void SkPost::dump(SkAnimateMaker* maker) {
else
SkDebugf("type=\"%s\" ", eventType->c_str());
delete eventType;
-
+
if (delay > 0) {
SkDebugf("delay=\"%g\" ", SkScalarToFloat(SkScalarDiv(delay, 1000)));
}
@@ -99,7 +99,7 @@ void SkPost::dump(SkAnimateMaker* maker) {
SkDisplayList::fIndent += 4;
//this seems to work, but kinda hacky
//for some reason the last part is id, which i don't want
- //and the parts seem to be in the reverse order from the one in which we find the
+ //and the parts seem to be in the reverse order from the one in which we find the
//data itself
//SkDataInput** ptr = fParts.end();
//SkDataInput* data;
@@ -211,7 +211,7 @@ bool SkPost::enable(SkAnimateMaker& maker ) {
SkAnimator* anim = maker.getAnimator();
if (targetID == 0) {
isAnimatorEvent = fEvent.findString("id") != NULL;
- if (isAnimatorEvent)
+ if (isAnimatorEvent)
targetID = anim->getSinkID();
else if (maker.fHostEventSinkID)
targetID = maker.fHostEventSinkID;
@@ -260,7 +260,7 @@ void SkPost::findSinkID() {
SkAnimator* anim = fTargetMaker->getAnimator();
fSinkID = anim->getSinkID();
}
-
+
bool SkPost::hasEnable() const {
return true;
}
@@ -274,8 +274,8 @@ void SkPost::onEndElement(SkAnimateMaker& maker) {
}
}
-void SkPost::setChildHasID() {
- fChildHasID = true;
+void SkPost::setChildHasID() {
+ fChildHasID = true;
}
bool SkPost::setProperty(int index, SkScriptValue& value) {
diff --git a/src/animator/SkDisplayRandom.cpp b/src/animator/SkDisplayRandom.cpp
index 3f77fcb03c..31a20b5dd6 100644
--- a/src/animator/SkDisplayRandom.cpp
+++ b/src/animator/SkDisplayRandom.cpp
@@ -37,7 +37,7 @@ void SkDisplayRandom::dump(SkAnimateMaker* maker) {
dumpBase(maker);
SkDebugf("min=\"%g\" ", SkScalarToFloat(min));
SkDebugf("max=\"%g\" ", SkScalarToFloat(max));
- SkDebugf("blend=\"%g\" ", SkScalarToFloat(blend));
+ SkDebugf("blend=\"%g\" ", SkScalarToFloat(blend));
SkDebugf("/>\n");
}
#endif
diff --git a/src/animator/SkDisplayType.cpp b/src/animator/SkDisplayType.cpp
index 3527517703..dc52f0cacc 100644
--- a/src/animator/SkDisplayType.cpp
+++ b/src/animator/SkDisplayType.cpp
@@ -67,7 +67,7 @@
#else
#define CASE_DEBUG_RETURN_NIL(_class)
#endif
-
+
SkDisplayTypes SkDisplayType::gNewTypes = kNumberOfTypes;
@@ -224,7 +224,7 @@ SkDisplayable* SkDisplayType::CreateInstance(SkAnimateMaker* maker, SkDisplayTyp
info = SkDisplay##_class::fInfo; infoCount = SkDisplay##_class::fInfoCount; \
break
-const SkMemberInfo* SkDisplayType::GetMembers(SkAnimateMaker* maker,
+const SkMemberInfo* SkDisplayType::GetMembers(SkAnimateMaker* maker,
SkDisplayTypes type, int* infoCountPtr) {
const SkMemberInfo* info = NULL;
int infoCount = 0;
@@ -355,7 +355,7 @@ const SkMemberInfo* SkDisplayType::GetMembers(SkAnimateMaker* maker,
CASE_GET_DRAW_INFO(Typeface);
// xfermode
// knumberoftypes
- default:
+ default:
if (maker) {
SkExtras** end = maker->fExtras.end();
for (SkExtras** extraPtr = maker->fExtras.begin(); extraPtr < end; extraPtr++) {
@@ -370,7 +370,7 @@ const SkMemberInfo* SkDisplayType::GetMembers(SkAnimateMaker* maker,
return info;
}
-const SkMemberInfo* SkDisplayType::GetMember(SkAnimateMaker* maker,
+const SkMemberInfo* SkDisplayType::GetMember(SkAnimateMaker* maker,
SkDisplayTypes type, const char** matchPtr ) {
int infoCount;
const SkMemberInfo* info = GetMembers(maker, type, &infoCount);
@@ -546,7 +546,7 @@ SkDisplayTypes SkDisplayType::GetParent(SkAnimateMaker* maker, SkDisplayTypes ba
SkASSERT(info);
if (info->fType != SkType_BaseClassInfo)
return SkType_Unknown; // if no base, done
- // !!! could change SK_MEMBER_INHERITED macro to take type, stuff in offset, so that
+ // !!! could change SK_MEMBER_INHERITED macro to take type, stuff in offset, so that
// this (and table builder) could know type without the following steps:
const SkMemberInfo* inherited = info->getInherited();
SkDisplayTypes result = (SkDisplayTypes) (SkType_Unknown + 1);
@@ -560,7 +560,7 @@ SkDisplayTypes SkDisplayType::GetParent(SkAnimateMaker* maker, SkDisplayTypes ba
}
SkDisplayTypes SkDisplayType::GetType(SkAnimateMaker* maker, const char match[], size_t len ) {
- int index = SkStrSearch(&gTypeNames[0].fName, kTypeNamesSize, match,
+ int index = SkStrSearch(&gTypeNames[0].fName, kTypeNamesSize, match,
len, sizeof(gTypeNames[0]));
if (index >= 0 && index < kTypeNamesSize)
return gTypeNames[index].fType;
diff --git a/src/animator/SkDisplayType.h b/src/animator/SkDisplayType.h
index 7abde23164..474a65e8e6 100644
--- a/src/animator/SkDisplayType.h
+++ b/src/animator/SkDisplayType.h
@@ -187,7 +187,7 @@ public:
static SkDisplayTypes RegisterNewType();
static SkDisplayTypes Resolve(const char[] , const SkMemberInfo** );
#ifdef SK_DEBUG
- static bool IsAnimate(SkDisplayTypes type ) { return type == SkType_Animate ||
+ static bool IsAnimate(SkDisplayTypes type ) { return type == SkType_Animate ||
type == SkType_Set; }
static const char* GetName(SkAnimateMaker* , SkDisplayTypes );
#endif
diff --git a/src/animator/SkDisplayTypes.cpp b/src/animator/SkDisplayTypes.cpp
index d3bfa101aa..d320fc02d5 100644
--- a/src/animator/SkDisplayTypes.cpp
+++ b/src/animator/SkDisplayTypes.cpp
@@ -11,7 +11,7 @@
#include "SkAnimateBase.h"
bool SkDisplayDepend::canContainDependents() const {
- return true;
+ return true;
}
void SkDisplayDepend::dirty() {
@@ -118,7 +118,7 @@ SkDisplayString::SkDisplayString() {
SkDisplayString::SkDisplayString(SkString& copyFrom) : value(copyFrom) {
}
-void SkDisplayString::executeFunction(SkDisplayable* target, int index,
+void SkDisplayString::executeFunction(SkDisplayable* target, int index,
SkTDArray<SkScriptValue>& parameters, SkDisplayTypes type,
SkScriptValue* scriptValue) {
if (scriptValue == NULL)
@@ -150,7 +150,7 @@ const SkFunctionParamType* SkDisplayString::getFunctionsParameters() {
}
bool SkDisplayString::getProperty(int index, SkScriptValue* scriptValue) const {
- switch (index) {
+ switch (index) {
case SK_PROPERTY(length):
scriptValue->fType = SkType_Int;
scriptValue->fOperand.fS32 = (int32_t) value.size();
@@ -201,7 +201,7 @@ SkDisplayArray::~SkDisplayArray() {
}
bool SkDisplayArray::getProperty(int index, SkScriptValue* value) const {
- switch (index) {
+ switch (index) {
case SK_PROPERTY(length):
value->fType = SkType_Int;
value->fOperand.fS32 = values.count();
diff --git a/src/animator/SkDisplayTypes.h b/src/animator/SkDisplayTypes.h
index 75cace65d5..614018f568 100644
--- a/src/animator/SkDisplayTypes.h
+++ b/src/animator/SkDisplayTypes.h
@@ -75,7 +75,7 @@ class SkDisplayString : public SkDisplayDepend {
DECLARE_DISPLAY_MEMBER_INFO(String);
SkDisplayString();
SkDisplayString(SkString& );
- virtual void executeFunction(SkDisplayable* , int index,
+ virtual void executeFunction(SkDisplayable* , int index,
SkTDArray<SkScriptValue>& parameters, SkDisplayTypes type,
SkScriptValue* );
virtual const SkFunctionParamType* getFunctionsParameters();
diff --git a/src/animator/SkDisplayXMLParser.cpp b/src/animator/SkDisplayXMLParser.cpp
index 68dc259c6c..31be3da80d 100644
--- a/src/animator/SkDisplayXMLParser.cpp
+++ b/src/animator/SkDisplayXMLParser.cpp
@@ -34,7 +34,7 @@ static char const* const gErrorStrings[] = {
"last offset in gradient must be one",
"offsets in gradient must be increasing",
"first offset in gradient must be zero",
- "gradient attribute \"points\" must have length of four",
+ "gradient attribute \"points\" must have length of four",
"in include ",
"in movie ",
"include name unknown or missing ",
@@ -70,7 +70,7 @@ void SkDisplayXMLParserError::setInnerError(SkAnimateMaker* parent, const SkStri
SkDisplayXMLParser::SkDisplayXMLParser(SkAnimateMaker& maker)
- : INHERITED(&maker.fError), fMaker(maker), fInInclude(maker.fInInclude),
+ : INHERITED(&maker.fError), fMaker(maker), fInInclude(maker.fInInclude),
fInSkia(maker.fInInclude), fCurrDisplayable(NULL)
{
}
@@ -94,7 +94,7 @@ bool SkDisplayXMLParser::onAddAttribute(const char name[], const char value[]) {
return onAddAttributeLen(name, value, strlen(value));
}
-bool SkDisplayXMLParser::onAddAttributeLen(const char attrName[], const char attrValue[],
+bool SkDisplayXMLParser::onAddAttributeLen(const char attrName[], const char attrValue[],
size_t attrValueLen)
{
if (fCurrDisplayable == NULL) // this signals we should ignore attributes for this element
@@ -172,16 +172,16 @@ bool SkDisplayXMLParser::onEndElement(const char elem[])
SkDisplayable* displayable = container.fDisplayable;
fMaker.fEndDepth = parentIndex;
displayable->onEndElement(fMaker);
- if (fMaker.fError.hasError())
+ if (fMaker.fError.hasError())
return true;
if (parentIndex > 0) {
SkDisplayable* parent = fParents[parentIndex - 1].fDisplayable;
bool result = parent->add(fMaker, displayable);
- if (fMaker.hasError())
+ if (fMaker.hasError())
return true;
if (result == false) {
int infoCount;
- const SkMemberInfo* info =
+ const SkMemberInfo* info =
SkDisplayType::GetMembers(&fMaker, fParents[parentIndex - 1].fType, &infoCount);
const SkMemberInfo* foundInfo;
if ((foundInfo = searchContainer(info, infoCount)) != NULL) {
@@ -213,7 +213,7 @@ bool SkDisplayXMLParser::onEndElement(const char elem[])
SkDebugf("%s\n", debugOut.c_str());
#endif
fMaker.fEvents.doEvent(fMaker, SkDisplayEvent::kOnload, NULL);
- if (fMaker.fError.hasError())
+ if (fMaker.fError.hasError())
return true;
fMaker.fEvents.removeEvent(SkDisplayEvent::kOnload, NULL);
@@ -281,7 +281,7 @@ const SkMemberInfo* SkDisplayXMLParser::searchContainer(const SkMemberInfo* info
}
Parent* container = fParents.end() - 1;
SkDisplayTypes type = (SkDisplayTypes) info->fType;
- if (type == SkType_MemberProperty)
+ if (type == SkType_MemberProperty)
type = info->propertyType();
SkDisplayTypes containerType = container->fType;
if (type == containerType && (type == SkType_Rect || type == SkType_Polygon ||
@@ -296,7 +296,7 @@ const SkMemberInfo* SkDisplayXMLParser::searchContainer(const SkMemberInfo* info
}
return info;
next:
- if (type == SkType_Drawable || (type == SkType_Displayable &&
+ if (type == SkType_Drawable || (type == SkType_Displayable &&
container->fDisplayable->isDrawable())) {
rectNext:
if (fParents.count() > 1) {
diff --git a/src/animator/SkDisplayable.cpp b/src/animator/SkDisplayable.cpp
index 396ce6b769..753764b3f5 100644
--- a/src/animator/SkDisplayable.cpp
+++ b/src/animator/SkDisplayable.cpp
@@ -21,7 +21,7 @@ SkTDDisplayableArray SkDisplayable::fAllocations;
#endif
#ifdef SK_DEBUG
-SkDisplayable::SkDisplayable() {
+SkDisplayable::SkDisplayable() {
id = _id.c_str();
#ifdef SK_FIND_LEAKS
// fAllocationCount++;
@@ -40,20 +40,20 @@ SkDisplayable::~SkDisplayable() {
}
bool SkDisplayable::add(SkAnimateMaker& , SkDisplayable* child) {
- return false;
+ return false;
}
-//void SkDisplayable::apply(SkAnimateMaker& , const SkMemberInfo* ,
-// SkDisplayable* , SkScalar [], int count) {
-// SkASSERT(0);
+//void SkDisplayable::apply(SkAnimateMaker& , const SkMemberInfo* ,
+// SkDisplayable* , SkScalar [], int count) {
+// SkASSERT(0);
//}
bool SkDisplayable::canContainDependents() const {
- return false;
+ return false;
}
-
-bool SkDisplayable::childrenNeedDisposing() const {
- return false;
+
+bool SkDisplayable::childrenNeedDisposing() const {
+ return false;
}
void SkDisplayable::clearBounder() {
@@ -170,18 +170,18 @@ void SkDisplayable::dumpAttrs(SkAnimateMaker* maker) {
//last two are dummies
dumpValues(info, value.fType, value.fOperand, blankValue.fOperand, value.fOperand, blankValue.fOperand);
}
-
+
propIndex++;
continue;
}
if (SkDisplayType::IsDisplayable(maker, info->fType)) {
continue;
}
-
+
if (info->fType == SkType_MemberFunction)
continue;
-
-
+
+
if (info->fType == SkType_Array) {
SkTDOperandArray* array = (SkTDOperandArray*) info->memberData(this);
int arrayCount;
@@ -201,14 +201,14 @@ void SkDisplayable::dumpAttrs(SkAnimateMaker* maker) {
case SkType_Displayable:
SkDebugf("%s", op->fDisplayable->id);
break;
- case SkType_Int:
+ case SkType_Int:
SkDebugf("%d", op->fS32);
break;
case SkType_Float:
SkDebugf("%g", SkScalarToFloat(op->fScalar));
break;
case SkType_String:
- case SkType_DynamicString:
+ case SkType_DynamicString:
SkDebugf("%s", op->fString->c_str());
break;
default:
@@ -219,16 +219,16 @@ void SkDisplayable::dumpAttrs(SkAnimateMaker* maker) {
SkDebugf("]\" ");
continue;
}
-
+
if (info->fType == SkType_String || info->fType == SkType_DynamicString) {
SkString* string;
info->getString(this, &string);
if (string->isEmpty() == false)
- SkDebugf("%s=\"%s\"\t", info->fName, string->c_str());
+ SkDebugf("%s=\"%s\"\t", info->fName, string->c_str());
continue;
}
-
-
+
+
blankInfo = blankCopy->getMember(index);
int i = info->fCount;
info->getValue(this, values, i);
@@ -252,7 +252,7 @@ void SkDisplayable::dumpBase(SkAnimateMaker* maker) {
}
void SkDisplayable::dumpChildren(SkAnimateMaker* maker, bool closedAngle) {
-
+
int index = -1;
const SkMemberInfo* info;
index = -1;
@@ -354,7 +354,7 @@ void SkDisplayable::dumpValues(const SkMemberInfo* info, SkDisplayTypes type, Sk
break;
case SkType_TileMode:
//correct to look at the S32?
- if (op.fS32 != blankOp.fS32)
+ if (op.fS32 != blankOp.fS32)
SkDebugf("%s=\"%s\" ", info->fName, op.fS32 == 0 ? "clamp" : op.fS32 == 1 ? "repeat" : "mirror");
break;
case SkType_Boolean:
@@ -372,7 +372,7 @@ void SkDisplayable::dumpValues(const SkMemberInfo* info, SkDisplayTypes type, Sk
break;
case SkType_String:
case SkType_DynamicString:
- if (op.fString->size() > 0)
+ if (op.fString->size() > 0)
SkDebugf("%s=\"%s\" ", info->fName, op.fString->c_str());
break;
case SkType_MSec:
@@ -381,24 +381,24 @@ void SkDisplayable::dumpValues(const SkMemberInfo* info, SkDisplayTypes type, Sk
}
default:
SkDebugf("");
- }
+ }
}
#endif
-bool SkDisplayable::enable( SkAnimateMaker& ) {
+bool SkDisplayable::enable( SkAnimateMaker& ) {
return false;
}
void SkDisplayable::enableBounder() {
}
-void SkDisplayable::executeFunction(SkDisplayable* , int index,
+void SkDisplayable::executeFunction(SkDisplayable* , int index,
SkTDArray<SkScriptValue>& , SkDisplayTypes, SkScriptValue* ) {
- SkASSERT(0);
+ SkASSERT(0);
}
-void SkDisplayable::executeFunction(SkDisplayable* target,
+void SkDisplayable::executeFunction(SkDisplayable* target,
const SkMemberInfo* info, SkTypedArray* values, SkScriptValue* value) {
SkTDArray<SkScriptValue> typedValues;
for (SkOperand* op = values->begin(); op < values->end(); op++) {
@@ -410,9 +410,9 @@ void SkDisplayable::executeFunction(SkDisplayable* target,
executeFunction(target, info->functionIndex(), typedValues, info->getType(), value);
}
-void SkDisplayable::executeFunction2(SkDisplayable* , int index,
+void SkDisplayable::executeFunction2(SkDisplayable* , int index,
SkOpArray* params, SkDisplayTypes, SkOperand2* ) {
- SkASSERT(0);
+ SkASSERT(0);
}
void SkDisplayable::getBounds(SkRect* rect) {
@@ -425,15 +425,15 @@ const SkFunctionParamType* SkDisplayable::getFunctionsParameters() {
return NULL;
}
-const SkMemberInfo* SkDisplayable::getMember(int index) {
- return NULL;
+const SkMemberInfo* SkDisplayable::getMember(int index) {
+ return NULL;
}
-const SkMemberInfo* SkDisplayable::getMember(const char name[]) {
- return NULL;
+const SkMemberInfo* SkDisplayable::getMember(const char name[]) {
+ return NULL;
}
-const SkFunctionParamType* SkDisplayable::getParameters(const SkMemberInfo* info,
+const SkFunctionParamType* SkDisplayable::getParameters(const SkMemberInfo* info,
int* paramCount) {
const SkFunctionParamType* params = getFunctionsParameters();
SkASSERT(params != NULL);
@@ -460,17 +460,17 @@ SkDisplayable* SkDisplayable::getParent() const {
}
bool SkDisplayable::getProperty(int index, SkScriptValue* ) const {
-// SkASSERT(0);
- return false;
+// SkASSERT(0);
+ return false;
}
bool SkDisplayable::getProperty2(int index, SkOperand2* value) const {
- SkASSERT(0);
- return false;
+ SkASSERT(0);
+ return false;
}
-SkDisplayTypes SkDisplayable::getType() const {
- return SkType_Unknown;
+SkDisplayTypes SkDisplayable::getType() const {
+ return SkType_Unknown;
}
bool SkDisplayable::hasEnable() const {
@@ -478,7 +478,7 @@ bool SkDisplayable::hasEnable() const {
}
bool SkDisplayable::isDrawable() const {
- return false;
+ return false;
}
void SkDisplayable::onEndElement(SkAnimateMaker& ) {}
@@ -491,8 +491,8 @@ bool SkDisplayable::resolveIDs(SkAnimateMaker& maker, SkDisplayable* original, S
return false;
}
-//SkDisplayable* SkDisplayable::resolveTarget(SkAnimateMaker& ) {
-// return this;
+//SkDisplayable* SkDisplayable::resolveTarget(SkAnimateMaker& ) {
+// return this;
//}
void SkDisplayable::setChildHasID() {
@@ -503,8 +503,8 @@ bool SkDisplayable::setParent(SkDisplayable* ) {
}
bool SkDisplayable::setProperty(int index, SkScriptValue& ) {
- //SkASSERT(0);
- return false;
+ //SkASSERT(0);
+ return false;
}
void SkDisplayable::setReference(const SkMemberInfo* info, SkDisplayable* displayable) {
diff --git a/src/animator/SkDisplayable.h b/src/animator/SkDisplayable.h
index a3db00219b..5fc2d3ef57 100644
--- a/src/animator/SkDisplayable.h
+++ b/src/animator/SkDisplayable.h
@@ -50,30 +50,30 @@ public:
#endif
virtual bool enable( SkAnimateMaker& );
virtual void enableBounder();
- virtual void executeFunction(SkDisplayable* , int functionIndex,
- SkTDArray<SkScriptValue>& , SkDisplayTypes , SkScriptValue* );
- void executeFunction(SkDisplayable* , const SkMemberInfo* ,
- SkTypedArray* , SkScriptValue* );
- virtual void executeFunction2(SkDisplayable* , int functionIndex,
+ virtual void executeFunction(SkDisplayable* , int functionIndex,
+ SkTDArray<SkScriptValue>& , SkDisplayTypes , SkScriptValue* );
+ void executeFunction(SkDisplayable* , const SkMemberInfo* ,
+ SkTypedArray* , SkScriptValue* );
+ virtual void executeFunction2(SkDisplayable* , int functionIndex,
SkOpArray* params , SkDisplayTypes , SkOperand2* ); // compiled scripting experiment
virtual void getBounds(SkRect* );
virtual const SkFunctionParamType* getFunctionsParameters();
virtual const SkMemberInfo* getMember(int index);
virtual const SkMemberInfo* getMember(const char name[]);
- const SkFunctionParamType* getParameters(const SkMemberInfo* info,
+ const SkFunctionParamType* getParameters(const SkMemberInfo* info,
int* paramCount);
virtual SkDisplayable* getParent() const;
virtual bool getProperty(int index, SkScriptValue* value) const;
virtual bool getProperty2(int index, SkOperand2* value) const; // compiled scripting experiment
virtual SkDisplayTypes getType() const;
virtual bool hasEnable() const;
- bool isAnimate() const {
- SkDisplayTypes type = getType();
+ bool isAnimate() const {
+ SkDisplayTypes type = getType();
return type == SkType_Animate || type == SkType_Set; }
bool isApply() const { return getType() == SkType_Apply; }
bool isColor() const { return getType() == SkType_Color; }
virtual bool isDrawable() const;
- bool isGroup() const { return getType() == SkType_Group ||
+ bool isGroup() const { return getType() == SkType_Group ||
getType() == SkType_Save || getType() == SkType_DrawTo ||
getType() == SkType_SaveLayer; }
bool isMatrix() const { return getType() == SkType_Matrix; }
diff --git a/src/animator/SkDraw3D.cpp b/src/animator/SkDraw3D.cpp
index ce2bec4e4c..6ec178fbd6 100644
--- a/src/animator/SkDraw3D.cpp
+++ b/src/animator/SkDraw3D.cpp
@@ -25,7 +25,7 @@ const SkMemberInfo Sk3D_Point::fInfo[] = {
DEFINE_NO_VIRTUALS_GET_MEMBER(Sk3D_Point);
Sk3D_Point::Sk3D_Point() {
- fPoint.set(0, 0, 0);
+ fPoint.set(0, 0, 0);
}
#if SK_USE_CONDENSED_INFO == 0
@@ -85,7 +85,7 @@ const SkMemberInfo Sk3D_Patch::fInfo[] = {
DEFINE_GET_MEMBER(Sk3D_Patch);
-void Sk3D_Patch::executeFunction(SkDisplayable* target, int index,
+void Sk3D_Patch::executeFunction(SkDisplayable* target, int index,
SkTDArray<SkScriptValue>& parameters, SkDisplayTypes type,
SkScriptValue* ) {
SkASSERT(target == this);
@@ -93,7 +93,7 @@ void Sk3D_Patch::executeFunction(SkDisplayable* target, int index,
case SK_FUNCTION(rotateDegrees):
SkASSERT(parameters.count() == 3);
SkASSERT(type == SkType_Float);
- fPatch.rotateDegrees(parameters[0].fOperand.fScalar,
+ fPatch.rotateDegrees(parameters[0].fOperand.fScalar,
parameters[1].fOperand.fScalar, parameters[2].fOperand.fScalar);
break;
default:
diff --git a/src/animator/SkDraw3D.h b/src/animator/SkDraw3D.h
index e6549ea7a1..f4bd82b541 100644
--- a/src/animator/SkDraw3D.h
+++ b/src/animator/SkDraw3D.h
@@ -38,7 +38,7 @@ private:
class Sk3D_Patch : public SkDisplayable {
DECLARE_MEMBER_INFO(3D_Patch);
private:
- virtual void executeFunction(SkDisplayable* , int index,
+ virtual void executeFunction(SkDisplayable* , int index,
SkTDArray<SkScriptValue>& parameters, SkDisplayTypes type,
SkScriptValue* );
virtual const SkFunctionParamType* getFunctionsParameters();
diff --git a/src/animator/SkDrawBitmap.cpp b/src/animator/SkDrawBitmap.cpp
index 420045ab35..4604a7110c 100644
--- a/src/animator/SkDrawBitmap.cpp
+++ b/src/animator/SkDrawBitmap.cpp
@@ -56,7 +56,7 @@ const SkMemberInfo SkDrawBitmap::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawBitmap);
-SkDrawBitmap::SkDrawBitmap() : format((SkBitmap::Config) -1), height(-1),
+SkDrawBitmap::SkDrawBitmap() : format((SkBitmap::Config) -1), height(-1),
rowBytes(0), width(-1), fColor(0), fColorSet(false) {
}
@@ -137,7 +137,7 @@ SkImageBaseBitmap::SkImageBaseBitmap() : fDirty(true), fUriBase(NULL) {
}
SkImageBaseBitmap::~SkImageBaseBitmap() {
- delete[] base64.fData;
+ delete[] base64.fData;
}
SkDisplayable* SkImageBaseBitmap::deepCopy(SkAnimateMaker* maker) {
@@ -151,13 +151,13 @@ void SkImageBaseBitmap::dirty() {
}
bool SkImageBaseBitmap::draw(SkAnimateMaker& maker) {
- if (fDirty)
+ if (fDirty)
resolve();
return INHERITED::draw(maker);
}
bool SkImageBaseBitmap::getProperty(int index, SkScriptValue* value) const {
- if (fDirty)
+ if (fDirty)
resolve();
switch (index) {
case SK_PROPERTY(height):
@@ -188,11 +188,11 @@ void SkImageBaseBitmap::resolve() {
return;
fLast.set(src);
fBitmap.reset();
-
+
//SkStream* stream = SkStream::GetURIStream(fUriBase, src.c_str());
SkStream* stream = new SkFILEStream(src.c_str());
SkAutoTDelete<SkStream> autoDel(stream);
SkImageDecoder::DecodeStream(stream, &fBitmap);
- }
+ }
}
diff --git a/src/animator/SkDrawBitmap.h b/src/animator/SkDrawBitmap.h
index 927c33b215..f9a92126b5 100644
--- a/src/animator/SkDrawBitmap.h
+++ b/src/animator/SkDrawBitmap.h
@@ -65,7 +65,7 @@ private:
protected:
SkBase64 base64;
SkString src;
- SkString fLast; // cache of src so that stream isn't unnecessarily decoded
+ SkString fLast; // cache of src so that stream isn't unnecessarily decoded
SkBool fDirty;
const char* fUriBase;
typedef SkBaseBitmap INHERITED;
diff --git a/src/animator/SkDrawBlur.cpp b/src/animator/SkDrawBlur.cpp
index 57e8e204b5..68996bcb70 100644
--- a/src/animator/SkDrawBlur.cpp
+++ b/src/animator/SkDrawBlur.cpp
@@ -20,7 +20,7 @@ const SkMemberInfo SkDrawBlur::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawBlur);
-SkDrawBlur::SkDrawBlur() : radius(-1),
+SkDrawBlur::SkDrawBlur() : radius(-1),
blurStyle(SkBlurMaskFilter::kNormal_BlurStyle) {
}
diff --git a/src/animator/SkDrawColor.cpp b/src/animator/SkDrawColor.cpp
index 9abc8d06ed..dfe06227ab 100644
--- a/src/animator/SkDrawColor.cpp
+++ b/src/animator/SkDrawColor.cpp
@@ -73,7 +73,7 @@ static SkColor HSV_to_RGB(SkColor color, HSV_Choice choice, SkScalar hsv) {
SkScalar fraction = hue / 60 - SkIntToScalar(sextant);
SkScalar p = SkScalarMul(value , SK_Scalar1 - saturation);
SkScalar q = SkScalarMul(value, SK_Scalar1 - SkScalarMul(saturation, fraction));
- SkScalar t = SkScalarMul(value, SK_Scalar1 -
+ SkScalar t = SkScalarMul(value, SK_Scalar1 -
SkScalarMul(saturation, SK_Scalar1 - fraction));
switch (sextant % 6) {
case 0: red = value; green = t; blue = p; break;
@@ -85,11 +85,11 @@ static SkColor HSV_to_RGB(SkColor color, HSV_Choice choice, SkScalar hsv) {
}
}
//used to say SkToU8((U8CPU) red) etc
- return SkColorSetARGB(SkColorGetA(color), SkScalarRound(red),
+ return SkColorSetARGB(SkColorGetA(color), SkScalarRound(red),
SkScalarRound(green), SkScalarRound(blue));
}
-#if defined _WIN32 && _MSC_VER >= 1300
+#if defined _WIN32 && _MSC_VER >= 1300
#pragma warning ( pop )
#endif
@@ -120,8 +120,8 @@ const SkMemberInfo SkDrawColor::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawColor);
-SkDrawColor::SkDrawColor() : fDirty(false) {
- color = SK_ColorBLACK;
+SkDrawColor::SkDrawColor() : fDirty(false) {
+ color = SK_ColorBLACK;
fHue = fSaturation = fValue = SK_ScalarNaN;
}
@@ -150,13 +150,13 @@ void SkDrawColor::dirty(){
#ifdef SK_DUMP_ENABLED
void SkDrawColor::dump(SkAnimateMaker* maker) {
dumpBase(maker);
- SkDebugf("alpha=\"%d\" red=\"%d\" green=\"%d\" blue=\"%d\" />\n",
+ SkDebugf("alpha=\"%d\" red=\"%d\" green=\"%d\" blue=\"%d\" />\n",
SkColorGetA(color)/255, SkColorGetR(color),
SkColorGetG(color), SkColorGetB(color));
}
#endif
-SkColor SkDrawColor::getColor() {
+SkColor SkDrawColor::getColor() {
if (fDirty) {
if (SkScalarIsNaN(fValue) == false)
color = HSV_to_RGB(color, kGetValue, fValue);
@@ -166,7 +166,7 @@ SkColor SkDrawColor::getColor() {
color = HSV_to_RGB(color, kGetHue, fHue);
fDirty = false;
}
- return color;
+ return color;
}
SkDisplayable* SkDrawColor::getParent() const {
@@ -231,17 +231,17 @@ bool SkDrawColor::setProperty(int index, SkScriptValue& value) {
#else
alpha = SkToU8((scalar - (scalar >= SK_ScalarHalf)) >> 8);
#endif
- color = SkColorSetARGB(alpha, SkColorGetR(color),
+ color = SkColorSetARGB(alpha, SkColorGetR(color),
SkColorGetG(color), SkColorGetB(color));
break;
case SK_PROPERTY(blue):
scalar = SkScalarClampMax(scalar, 255 * SK_Scalar1);
- color = SkColorSetARGB(SkColorGetA(color), SkColorGetR(color),
+ color = SkColorSetARGB(SkColorGetA(color), SkColorGetR(color),
SkColorGetG(color), SkToU8((U8CPU) scalar));
break;
case SK_PROPERTY(green):
scalar = SkScalarClampMax(scalar, 255 * SK_Scalar1);
- color = SkColorSetARGB(SkColorGetA(color), SkColorGetR(color),
+ color = SkColorSetARGB(SkColorGetA(color), SkColorGetR(color),
SkToU8((U8CPU) scalar), SkColorGetB(color));
break;
case SK_PROPERTY(hue):
@@ -250,7 +250,7 @@ bool SkDrawColor::setProperty(int index, SkScriptValue& value) {
break;
case SK_PROPERTY(red):
scalar = SkScalarClampMax(scalar, 255 * SK_Scalar1);
- color = SkColorSetARGB(SkColorGetA(color), SkToU8((U8CPU) scalar),
+ color = SkColorSetARGB(SkColorGetA(color), SkToU8((U8CPU) scalar),
SkColorGetG(color), SkColorGetB(color));
break;
case SK_PROPERTY(saturation):
diff --git a/src/animator/SkDrawEmboss.cpp b/src/animator/SkDrawEmboss.cpp
index 22845044bd..7e47ec270c 100644
--- a/src/animator/SkDrawEmboss.cpp
+++ b/src/animator/SkDrawEmboss.cpp
@@ -22,7 +22,7 @@ const SkMemberInfo SkDrawEmboss::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawEmboss);
-SkDrawEmboss::SkDrawEmboss() : radius(-1) {
+SkDrawEmboss::SkDrawEmboss() : radius(-1) {
direction.setCount(3);
}
diff --git a/src/animator/SkDrawGradient.cpp b/src/animator/SkDrawGradient.cpp
index 9e29074e79..2e751cadf6 100644
--- a/src/animator/SkDrawGradient.cpp
+++ b/src/animator/SkDrawGradient.cpp
@@ -34,16 +34,16 @@ class SkDrawGradientUnitMapper : public SkUnitMapper {
public:
SkDrawGradientUnitMapper(SkAnimateMaker* maker, const char* script) : fMaker(maker), fScript(script) {
}
-
+
SK_DECLARE_UNFLATTENABLE_OBJECT()
-
+
protected:
virtual uint16_t mapUnit16(uint16_t x) {
fUnit = SkUnitToScalar(x);
SkScriptValue value;
SkAnimatorScript engine(*fMaker, NULL, SkType_Float);
engine.propertyCallBack(GetUnitValue, &fUnit);
- if (engine.evaluate(fScript, &value, SkType_Float))
+ if (engine.evaluate(fScript, &value, SkType_Float))
x = SkScalarToUnit(value.fOperand.fScalar);
return x;
}
@@ -79,7 +79,7 @@ SkDrawGradient::SkDrawGradient() : fUnitMapper(NULL) {
}
SkDrawGradient::~SkDrawGradient() {
- for (int index = 0; index < fDrawColors.count(); index++)
+ for (int index = 0; index < fDrawColors.count(); index++)
delete fDrawColors[index];
delete fUnitMapper;
}
@@ -97,7 +97,7 @@ bool SkDrawGradient::add(SkAnimateMaker& , SkDisplayable* child) {
int SkDrawGradient::addPrelude() {
int count = fDrawColors.count();
fColors.setCount(count);
- for (int index = 0; index < count; index++)
+ for (int index = 0; index < count; index++)
fColors[index] = fDrawColors[index]->color;
return count;
}
@@ -116,7 +116,7 @@ void SkDrawGradient::dumpRest(SkAnimateMaker* maker) {
SkDrawColor* color = *ptr;
color->dump(maker);
}
- SkDisplayList::fIndent -= 4;
+ SkDisplayList::fIndent -= 4;
dumpChildren(maker, closedYet); //dumps the matrix if it has one
}
#endif
@@ -146,7 +146,7 @@ void SkDrawGradient::onEndElement(SkAnimateMaker& maker) {
}
}
}
- if (unitMapper.size() > 0)
+ if (unitMapper.size() > 0)
fUnitMapper = new SkDrawGradientUnitMapper(&maker, unitMapper.c_str());
INHERITED::onEndElement(maker);
}
@@ -162,7 +162,7 @@ const SkMemberInfo SkDrawLinearGradient::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawLinearGradient);
-SkDrawLinearGradient::SkDrawLinearGradient() {
+SkDrawLinearGradient::SkDrawLinearGradient() {
}
void SkDrawLinearGradient::onEndElement(SkAnimateMaker& maker)
@@ -203,8 +203,8 @@ const SkMemberInfo SkDrawRadialGradient::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawRadialGradient);
-SkDrawRadialGradient::SkDrawRadialGradient() : radius(0) {
- center.set(0, 0);
+SkDrawRadialGradient::SkDrawRadialGradient() : radius(0) {
+ center.set(0, 0);
}
#ifdef SK_DUMP_ENABLED
diff --git a/src/animator/SkDrawGradient.h b/src/animator/SkDrawGradient.h
index 09eb405e6b..d01ee7097e 100644
--- a/src/animator/SkDrawGradient.h
+++ b/src/animator/SkDrawGradient.h
@@ -23,7 +23,7 @@ class SkDrawGradient : public SkDrawShader {
virtual bool add(SkAnimateMaker& , SkDisplayable* child);
#ifdef SK_DUMP_ENABLED
virtual void dumpRest(SkAnimateMaker*);
-#endif
+#endif
virtual void onEndElement(SkAnimateMaker& );
protected:
SkTDScalarArray offsets;
@@ -55,7 +55,7 @@ class SkDrawRadialGradient : public SkDrawGradient {
SkDrawRadialGradient();
#ifdef SK_DUMP_ENABLED
virtual void dump(SkAnimateMaker*);
-#endif
+#endif
virtual SkShader* getShader();
protected:
SkPoint center;
diff --git a/src/animator/SkDrawGroup.cpp b/src/animator/SkDrawGroup.cpp
index 939bd9fd3d..806da5eb07 100644
--- a/src/animator/SkDrawGroup.cpp
+++ b/src/animator/SkDrawGroup.cpp
@@ -50,7 +50,7 @@ SkGroup::~SkGroup() {
}
bool SkGroup::add(SkAnimateMaker& , SkDisplayable* child) {
- SkASSERT(child);
+ SkASSERT(child);
// SkASSERT(child->isDrawable());
*fChildren.append() = (SkDrawable*) child;
if (child->isGroup()) {
diff --git a/src/animator/SkDrawLine.cpp b/src/animator/SkDrawLine.cpp
index fe93c4ef3a..d0ae7d9297 100644
--- a/src/animator/SkDrawLine.cpp
+++ b/src/animator/SkDrawLine.cpp
@@ -25,7 +25,7 @@ const SkMemberInfo SkLine::fInfo[] = {
DEFINE_GET_MEMBER(SkLine);
-SkLine::SkLine() : x1(0), x2(0), y1(0), y2(0) {
+SkLine::SkLine() : x1(0), x2(0), y1(0), y2(0) {
}
bool SkLine::draw(SkAnimateMaker& maker) {
diff --git a/src/animator/SkDrawMatrix.cpp b/src/animator/SkDrawMatrix.cpp
index 96e8292008..1d7b3e015e 100644
--- a/src/animator/SkDrawMatrix.cpp
+++ b/src/animator/SkDrawMatrix.cpp
@@ -51,9 +51,9 @@ const SkMemberInfo SkDrawMatrix::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawMatrix);
-SkDrawMatrix::SkDrawMatrix() : fChildHasID(false), fDirty(false) {
+SkDrawMatrix::SkDrawMatrix() : fChildHasID(false), fDirty(false) {
fConcat.reset();
- fMatrix.reset();
+ fMatrix.reset();
}
SkDrawMatrix::~SkDrawMatrix() {
@@ -66,11 +66,11 @@ bool SkDrawMatrix::add(SkAnimateMaker& maker, SkDisplayable* child) {
SkMatrixPart* part = (SkMatrixPart*) child;
*fParts.append() = part;
if (part->add())
- maker.setErrorCode(SkDisplayXMLParserError::kErrorAddingToMatrix);
+ maker.setErrorCode(SkDisplayXMLParserError::kErrorAddingToMatrix);
return true;
}
-bool SkDrawMatrix::childrenNeedDisposing() const {
+bool SkDrawMatrix::childrenNeedDisposing() const {
return false;
}
@@ -83,8 +83,8 @@ SkDisplayable* SkDrawMatrix::deepCopy(SkAnimateMaker* maker) {
return copy;
}
-void SkDrawMatrix::dirty() {
- fDirty = true;
+void SkDrawMatrix::dirty() {
+ fDirty = true;
}
bool SkDrawMatrix::draw(SkAnimateMaker& maker) {
@@ -207,8 +207,8 @@ setConcat:
}
}
-void SkDrawMatrix::setChildHasID() {
- fChildHasID = true;
+void SkDrawMatrix::setChildHasID() {
+ fChildHasID = true;
}
bool SkDrawMatrix::setProperty(int index, SkScriptValue& scriptValue) {
diff --git a/src/animator/SkDrawPaint.h b/src/animator/SkDrawPaint.h
index a2a893e8b7..db95d345af 100644
--- a/src/animator/SkDrawPaint.h
+++ b/src/animator/SkDrawPaint.h
@@ -32,7 +32,7 @@ class SkDrawPaint : public SkDrawable {
#ifdef SK_DUMP_ENABLED
virtual void dump(SkAnimateMaker* );
#endif
- virtual void executeFunction(SkDisplayable* target, int index,
+ virtual void executeFunction(SkDisplayable* target, int index,
SkTDArray<SkScriptValue>& parameters, SkDisplayTypes type,
SkScriptValue* );
virtual const SkFunctionParamType* getFunctionsParameters();
diff --git a/src/animator/SkDrawPath.cpp b/src/animator/SkDrawPath.cpp
index 10e92035e4..81cbdb1c24 100644
--- a/src/animator/SkDrawPath.cpp
+++ b/src/animator/SkDrawPath.cpp
@@ -50,17 +50,17 @@ bool SkDrawPath::add(SkAnimateMaker& maker, SkDisplayable* child) {
SkPathPart* part = (SkPathPart*) child;
*fParts.append() = part;
if (part->add())
- maker.setErrorCode(SkDisplayXMLParserError::kErrorAddingToPath);
+ maker.setErrorCode(SkDisplayXMLParserError::kErrorAddingToPath);
fDirty = false;
return true;
}
-bool SkDrawPath::childrenNeedDisposing() const {
- return false;
+bool SkDrawPath::childrenNeedDisposing() const {
+ return false;
}
-void SkDrawPath::dirty() {
- fDirty = true;
+void SkDrawPath::dirty() {
+ fDirty = true;
fLength = SK_ScalarNaN;
if (fParent)
fParent->dirty();
@@ -115,7 +115,7 @@ SkPath& SkDrawPath::getPath() {
fDirty = false;
return fPath;
}
-
+
void SkDrawPath::onEndElement(SkAnimateMaker& ) {
if (d.size() > 0) {
parseSVG();
@@ -153,8 +153,8 @@ bool SkDrawPath::getProperty(int index, SkScriptValue* value) const {
return true;
}
-void SkDrawPath::setChildHasID() {
- fChildHasID = true;
+void SkDrawPath::setChildHasID() {
+ fChildHasID = true;
}
bool SkDrawPath::setParent(SkDisplayable* parent) {
@@ -189,7 +189,7 @@ const SkMemberInfo SkPolyline::fInfo[] = {
DEFINE_GET_MEMBER(SkPolyline);
bool SkPolyline::add(SkAnimateMaker& , SkDisplayable*) const {
- return false;
+ return false;
}
void SkPolyline::onEndElement(SkAnimateMaker& maker) {
diff --git a/src/animator/SkDrawPoint.cpp b/src/animator/SkDrawPoint.cpp
index 94fe4d2762..66d2b4e766 100644
--- a/src/animator/SkDrawPoint.cpp
+++ b/src/animator/SkDrawPoint.cpp
@@ -34,8 +34,8 @@ const SkMemberInfo SkDrawPoint::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawPoint);
-SkDrawPoint::SkDrawPoint() {
- fPoint.set(0, 0);
+SkDrawPoint::SkDrawPoint() {
+ fPoint.set(0, 0);
}
void SkDrawPoint::getBounds(SkRect* rect ) {
diff --git a/src/animator/SkDrawRectangle.cpp b/src/animator/SkDrawRectangle.cpp
index 19edf50bc3..7587e4b3f9 100644
--- a/src/animator/SkDrawRectangle.cpp
+++ b/src/animator/SkDrawRectangle.cpp
@@ -36,8 +36,8 @@ const SkMemberInfo SkDrawRect::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawRect);
-SkDrawRect::SkDrawRect() : fParent(NULL) {
- fRect.setEmpty();
+SkDrawRect::SkDrawRect() : fParent(NULL) {
+ fRect.setEmpty();
}
void SkDrawRect::dirty() {
diff --git a/src/animator/SkDrawRectangle.h b/src/animator/SkDrawRectangle.h
index 49c9cf4c64..321c4ee657 100644
--- a/src/animator/SkDrawRectangle.h
+++ b/src/animator/SkDrawRectangle.h
@@ -44,7 +44,7 @@ class SkRoundRect : public SkDrawRect {
virtual bool draw(SkAnimateMaker& );
#ifdef SK_DUMP_ENABLED
virtual void dump(SkAnimateMaker* );
-#endif
+#endif
protected:
SkScalar rx;
SkScalar ry;
diff --git a/src/animator/SkDrawSaveLayer.cpp b/src/animator/SkDrawSaveLayer.cpp
index a7592db5b6..43ec5c1b55 100644
--- a/src/animator/SkDrawSaveLayer.cpp
+++ b/src/animator/SkDrawSaveLayer.cpp
@@ -35,7 +35,7 @@ bool SkSaveLayer::draw(SkAnimateMaker& maker)
if (!bounds) {
return false;
}
- SkPaint* save = maker.fPaint;
+ SkPaint* save = maker.fPaint;
//paint is an SkDrawPaint
if (paint)
{
diff --git a/src/animator/SkDrawShader.cpp b/src/animator/SkDrawShader.cpp
index 5019622f47..e3aa4da028 100644
--- a/src/animator/SkDrawShader.cpp
+++ b/src/animator/SkDrawShader.cpp
@@ -24,7 +24,7 @@ const SkMemberInfo SkDrawShader::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawShader);
-SkDrawShader::SkDrawShader() : matrix(NULL),
+SkDrawShader::SkDrawShader() : matrix(NULL),
tileMode(SkShader::kClamp_TileMode) {
}
@@ -66,14 +66,14 @@ bool SkDrawBitmapShader::add() {
SkShader* SkDrawBitmapShader::getShader() {
if (image == NULL)
return NULL;
-
+
// 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")
- //
+ //
// oops, bitmapshader no longer takes filterBitmap, but deduces it at
- // draw-time from the paint
- SkShader* shader = SkShader::CreateBitmapShader(image->fBitmap,
+ // draw-time from the paint
+ SkShader* shader = SkShader::CreateBitmapShader(image->fBitmap,
(SkShader::TileMode) tileMode,
(SkShader::TileMode) tileMode);
SkAutoTDelete<SkShader> autoDel(shader);
diff --git a/src/animator/SkDrawText.h b/src/animator/SkDrawText.h
index 7dd2e26e6c..3ac2479138 100644
--- a/src/animator/SkDrawText.h
+++ b/src/animator/SkDrawText.h
@@ -21,7 +21,7 @@ class SkText : public SkBoundable {
#ifdef SK_DUMP_ENABLED
virtual void dump(SkAnimateMaker* );
#endif
- virtual bool getProperty(int index, SkScriptValue* value) const ;
+ virtual bool getProperty(int index, SkScriptValue* value) const ;
const char* getText() { return text.c_str(); }
size_t getSize() { return text.size(); }
protected:
diff --git a/src/animator/SkDrawTextBox.cpp b/src/animator/SkDrawTextBox.cpp
index d97dc5c55c..f920e8eaa2 100644
--- a/src/animator/SkDrawTextBox.cpp
+++ b/src/animator/SkDrawTextBox.cpp
@@ -47,7 +47,7 @@ void SkDrawTextBox::dump(SkAnimateMaker* maker)
{
dumpBase(maker);
dumpAttrs(maker);
- if (mode == 0)
+ if (mode == 0)
SkDebugf("mode=\"oneLine\" ");
if (spacingAlign == 1)
SkDebugf("spacingAlign=\"center\" ");
diff --git a/src/animator/SkDrawable.cpp b/src/animator/SkDrawable.cpp
index 8db0333fe6..9e80c9dc27 100644
--- a/src/animator/SkDrawable.cpp
+++ b/src/animator/SkDrawable.cpp
@@ -13,8 +13,8 @@ bool SkDrawable::doEvent(SkDisplayEvent::Kind , SkEventState* ) {
return false;
}
-bool SkDrawable::isDrawable() const {
- return true;
+bool SkDrawable::isDrawable() const {
+ return true;
}
void SkDrawable::initialize() {
diff --git a/src/animator/SkDrawable.h b/src/animator/SkDrawable.h
index 139ce85a2d..6bb9608541 100644
--- a/src/animator/SkDrawable.h
+++ b/src/animator/SkDrawable.h
@@ -19,7 +19,7 @@ struct SkEventState;
class SkDrawable : public SkDisplayable {
public:
virtual bool doEvent(SkDisplayEvent::Kind , SkEventState* state );
- virtual bool draw(SkAnimateMaker& ) = 0;
+ virtual bool draw(SkAnimateMaker& ) = 0;
virtual void initialize();
virtual bool isDrawable() const;
virtual void setSteps(int steps);
diff --git a/src/animator/SkDump.cpp b/src/animator/SkDump.cpp
index bd912774ff..563b0e104c 100644
--- a/src/animator/SkDump.cpp
+++ b/src/animator/SkDump.cpp
@@ -144,7 +144,7 @@ bool SkDump::hasEnable() const {
}
bool SkDump::setProperty(int index, SkScriptValue& ) {
- return index <= SK_PROPERTY(posts);
+ return index <= SK_PROPERTY(posts);
}
#endif
diff --git a/src/animator/SkGetCondensedInfo.cpp b/src/animator/SkGetCondensedInfo.cpp
index a583cef593..6d83b1d10c 100644
--- a/src/animator/SkGetCondensedInfo.cpp
+++ b/src/animator/SkGetCondensedInfo.cpp
@@ -26,7 +26,7 @@ static int _searchByName(const unsigned char* lengths, int count, const char* st
int mid = (hi + lo) >> 1;
if (strcmp(&strings[lengths[mid << 2]], target) < 0)
lo = mid + 1;
- else
+ else
hi = mid;
}
if (strcmp(&strings[lengths[hi << 2]], target) != 0)
diff --git a/src/animator/SkIntArray.h b/src/animator/SkIntArray.h
index 6769a9e89f..4dac75af24 100644
--- a/src/animator/SkIntArray.h
+++ b/src/animator/SkIntArray.h
@@ -36,21 +36,21 @@ typedef SkIntArray(SkDisplayTypes) SkTDDisplayTypesArray;
typedef SkIntArray(SkMSec) SkTDMSecArray;
typedef SkIntArray(SkScalar) SkTDScalarArray;
-typedef SkLongArray(SkActive*) SkTDActiveArray;
-typedef SkLongArray(SkAnimateBase*) SkTDAnimateArray;
-typedef SkLongArray(SkDataInput*) SkTDDataArray;
-typedef SkLongArray(SkDisplayable*) SkTDDisplayableArray;
-typedef SkLongArray(SkDisplayEvent*) SkTDDisplayEventArray;
-typedef SkLongArray(SkDrawable*) SkTDDrawableArray;
-typedef SkLongArray(SkDrawColor*) SkTDDrawColorArray;
-typedef SkLongArray(SkMatrixPart*) SkTDMatrixPartArray;
+typedef SkLongArray(SkActive*) SkTDActiveArray;
+typedef SkLongArray(SkAnimateBase*) SkTDAnimateArray;
+typedef SkLongArray(SkDataInput*) SkTDDataArray;
+typedef SkLongArray(SkDisplayable*) SkTDDisplayableArray;
+typedef SkLongArray(SkDisplayEvent*) SkTDDisplayEventArray;
+typedef SkLongArray(SkDrawable*) SkTDDrawableArray;
+typedef SkLongArray(SkDrawColor*) SkTDDrawColorArray;
+typedef SkLongArray(SkMatrixPart*) SkTDMatrixPartArray;
typedef SkLongArray(const SkMemberInfo*) SkTDMemberInfoArray;
-typedef SkLongArray(SkPaintPart*) SkTDPaintPartArray;
-typedef SkLongArray(SkPathPart*) SkTDPathPartArray;
-typedef SkLongArray(SkTypedArray*) SkTDTypedArrayArray;
-typedef SkLongArray(SkString*) SkTDStringArray;
-typedef SkLongArray(SkOperand) SkTDOperandArray;
-typedef SkLongArray(SkOperand*) SkTDOperandPtrArray;
+typedef SkLongArray(SkPaintPart*) SkTDPaintPartArray;
+typedef SkLongArray(SkPathPart*) SkTDPathPartArray;
+typedef SkLongArray(SkTypedArray*) SkTDTypedArrayArray;
+typedef SkLongArray(SkString*) SkTDStringArray;
+typedef SkLongArray(SkOperand) SkTDOperandArray;
+typedef SkLongArray(SkOperand*) SkTDOperandPtrArray;
#endif // SkIntArray_DEFINED
diff --git a/src/animator/SkMatrixParts.cpp b/src/animator/SkMatrixParts.cpp
index f00bb8e6bb..221ac0a510 100644
--- a/src/animator/SkMatrixParts.cpp
+++ b/src/animator/SkMatrixParts.cpp
@@ -16,8 +16,8 @@
SkMatrixPart::SkMatrixPart() : fMatrix(NULL) {
}
-void SkMatrixPart::dirty() {
- fMatrix->dirty();
+void SkMatrixPart::dirty() {
+ fMatrix->dirty();
}
SkDisplayable* SkMatrixPart::getParent() const {
@@ -44,8 +44,8 @@ const SkMemberInfo SkRotate::fInfo[] = {
DEFINE_GET_MEMBER(SkRotate);
-SkRotate::SkRotate() : degrees(0) {
- center.fX = center.fY = 0;
+SkRotate::SkRotate() : degrees(0) {
+ center.fX = center.fY = 0;
}
bool SkRotate::add() {
@@ -66,12 +66,12 @@ const SkMemberInfo SkScale::fInfo[] = {
DEFINE_GET_MEMBER(SkScale);
-SkScale::SkScale() : x(SK_Scalar1), y(SK_Scalar1) {
- center.fX = center.fY = 0;
+SkScale::SkScale() : x(SK_Scalar1), y(SK_Scalar1) {
+ center.fX = center.fY = 0;
}
bool SkScale::add() {
- fMatrix->scale(x, y, center);
+ fMatrix->scale(x, y, center);
return false;
}
@@ -88,12 +88,12 @@ const SkMemberInfo SkSkew::fInfo[] = {
DEFINE_GET_MEMBER(SkSkew);
-SkSkew::SkSkew() : x(0), y(0) {
- center.fX = center.fY = 0;
+SkSkew::SkSkew() : x(0), y(0) {
+ center.fX = center.fY = 0;
}
bool SkSkew::add() {
- fMatrix->skew(x, y, center);
+ fMatrix->skew(x, y, center);
return false;
}
@@ -113,7 +113,7 @@ SkTranslate::SkTranslate() : x(0), y(0) {
}
bool SkTranslate::add() {
- fMatrix->translate(x, y);
+ fMatrix->translate(x, y);
return false;
}
@@ -130,7 +130,7 @@ const SkMemberInfo SkFromPath::fInfo[] = {
DEFINE_GET_MEMBER(SkFromPath);
-SkFromPath::SkFromPath() :
+SkFromPath::SkFromPath() :
mode(0), offset(0), path(NULL) {
}
@@ -166,7 +166,7 @@ const SkMemberInfo SkRectToRect::fInfo[] = {
DEFINE_GET_MEMBER(SkRectToRect);
-SkRectToRect::SkRectToRect() :
+SkRectToRect::SkRectToRect() :
source(NULL), destination(NULL) {
}
@@ -200,7 +200,7 @@ void SkRectToRect::dump(SkAnimateMaker* maker) {
SkDisplayList::fIndent += 4;
destination->dump(maker);
SkDisplayList::fIndent -= 4;
- SkDebugf("%*s</destination>\n", SkDisplayList::fIndent, "");
+ SkDebugf("%*s</destination>\n", SkDisplayList::fIndent, "");
}
SkDisplayList::fIndent -= 4;
dumpEnd(maker);
@@ -268,7 +268,7 @@ void SkPolyToPoly::dump(SkAnimateMaker* maker) {
SkDisplayList::fIndent += 4;
destination->dump(maker);
SkDisplayList::fIndent -= 4;
- SkDebugf("%*s</destination>\n", SkDisplayList::fIndent, "");
+ SkDebugf("%*s</destination>\n", SkDisplayList::fIndent, "");
}
SkDisplayList::fIndent -= 4;
dumpEnd(maker);
diff --git a/src/animator/SkMatrixParts.h b/src/animator/SkMatrixParts.h
index 5f6cd54b19..51c95599b7 100644
--- a/src/animator/SkMatrixParts.h
+++ b/src/animator/SkMatrixParts.h
@@ -114,6 +114,6 @@ protected:
SkPolygon* destination;
};
-// !!! add concat matrix ?
+// !!! add concat matrix ?
#endif // SkMatrixParts_DEFINED
diff --git a/src/animator/SkMemberInfo.cpp b/src/animator/SkMemberInfo.cpp
index 7fae5033fd..582b29ad27 100644
--- a/src/animator/SkMemberInfo.cpp
+++ b/src/animator/SkMemberInfo.cpp
@@ -52,7 +52,7 @@ size_t SkMemberInfo::GetSize(SkDisplayTypes type) { // size of simple types only
case SkType_Displayable:
case SkType_Drawable:
case SkType_Matrix:
- byteSize = sizeof(void*);
+ byteSize = sizeof(void*);
break;
case SkType_MSec:
byteSize = sizeof(SkMSec);
@@ -137,7 +137,7 @@ void SkMemberInfo::getString(const SkDisplayable* displayable, SkString** string
void SkMemberInfo::getValue(const SkDisplayable* displayable, SkOperand value[], int count) const {
SkASSERT(fType != SkType_String && fType != SkType_MemberProperty);
- SkASSERT(count == fCount);
+ SkASSERT(count == fCount);
void* valuePtr = memberData(displayable);
size_t byteSize = getSize(displayable);
SkASSERT(sizeof(value[0].fScalar) == sizeof(value[0])); // no support for 64 bit pointers, yet
@@ -150,7 +150,7 @@ void SkMemberInfo::setString(SkDisplayable* displayable, SkString* value) const
displayable->dirty();
}
-void SkMemberInfo::setValue(SkDisplayable* displayable, const SkOperand values[],
+void SkMemberInfo::setValue(SkDisplayable* displayable, const SkOperand values[],
int count) const {
SkASSERT(sizeof(values[0].fScalar) == sizeof(values[0])); // no support for 64 bit pointers, yet
char* dst = (char*) memberData(displayable);
@@ -163,7 +163,7 @@ void SkMemberInfo::setValue(SkDisplayable* displayable, const SkOperand values[]
displayable->dirty();
}
-
+
static inline bool is_between(int c, int min, int max)
{
return (unsigned)(c - min) <= (unsigned)(max - min);
@@ -180,9 +180,9 @@ static inline bool is_hex(int c)
}
-bool SkMemberInfo::setValue(SkAnimateMaker& maker, SkTDOperandArray* arrayStorage,
+bool SkMemberInfo::setValue(SkAnimateMaker& maker, SkTDOperandArray* arrayStorage,
int storageOffset, int maxStorage, SkDisplayable* displayable, SkDisplayTypes outType,
- const char rawValue[], size_t rawValueLen) const
+ const char rawValue[], size_t rawValueLen) const
{
SkString valueStr(rawValue, rawValueLen);
SkScriptValue scriptValue;
@@ -218,7 +218,7 @@ bool SkMemberInfo::setValue(SkAnimateMaker& maker, SkTDOperandArray* arrayStorag
}
*(char*) poundPos = '0'; // overwrite '#'
valueStr.insert(offset + 1, "xFF");
- }
+ }
}
if (SkDisplayType::IsDisplayable(&maker, type) || SkDisplayType::IsEnum(&maker, type) || type == SkType_ARGB)
goto scriptCommon;
@@ -226,22 +226,22 @@ bool SkMemberInfo::setValue(SkAnimateMaker& maker, SkTDOperandArray* arrayStorag
case SkType_String:
#if 0
if (displayable && displayable->isAnimate()) {
-
+
goto noScriptString;
- }
+ }
if (strncmp(rawValue, "#string:", sizeof("#string:") - 1) == 0) {
SkASSERT(sizeof("string") == sizeof("script"));
char* stringHeader = valueStr.writable_str();
memcpy(&stringHeader[1], "script", sizeof("script") - 1);
rawValue = valueStr.c_str();
goto noScriptString;
- } else
+ } else
#endif
if (strncmp(rawValue, "#script:", sizeof("#script:") - 1) != 0)
goto noScriptString;
valueStr.remove(0, 8);
case SkType_Unknown:
- case SkType_Int:
+ case SkType_Int:
case SkType_MSec: // for the purposes of script, MSec is treated as a Scalar
case SkType_Point:
case SkType_3D_Point:
@@ -331,10 +331,10 @@ scriptCommon: {
SkASSERT(0);
break;
}
-// if (SkDisplayType::IsStruct(type) == false)
+// if (SkDisplayType::IsStruct(type) == false)
{
writeStruct:
- if (writeValue(displayable, arrayStorage, storageOffset, maxStorage,
+ if (writeValue(displayable, arrayStorage, storageOffset, maxStorage,
untypedStorage, outType, scriptValue)) {
maker.setErrorCode(SkDisplayXMLParserError::kUnexpectedType);
return false;
@@ -346,18 +346,18 @@ dirty:
return true;
}
-bool SkMemberInfo::setValue(SkAnimateMaker& maker, SkTDOperandArray* arrayStorage,
+bool SkMemberInfo::setValue(SkAnimateMaker& maker, SkTDOperandArray* arrayStorage,
int storageOffset, int maxStorage, SkDisplayable* displayable, SkDisplayTypes outType,
SkString& raw) const {
return setValue(maker, arrayStorage, storageOffset, maxStorage, displayable, outType, raw.c_str(),
raw.size());
}
-bool SkMemberInfo::writeValue(SkDisplayable* displayable, SkTDOperandArray* arrayStorage,
- int storageOffset, int maxStorage, void* untypedStorage, SkDisplayTypes outType,
+bool SkMemberInfo::writeValue(SkDisplayable* displayable, SkTDOperandArray* arrayStorage,
+ int storageOffset, int maxStorage, void* untypedStorage, SkDisplayTypes outType,
SkScriptValue& scriptValue) const
{
- SkOperand* storage = untypedStorage ? (SkOperand*) untypedStorage : arrayStorage ?
+ SkOperand* storage = untypedStorage ? (SkOperand*) untypedStorage : arrayStorage ?
arrayStorage->begin() : NULL;
if (storage)
storage += storageOffset;
@@ -424,7 +424,7 @@ bool SkMemberInfo::writeValue(SkDisplayable* displayable, SkTDOperandArray* arra
string->set(*scriptValue.fOperand.fString);
} else if (type == SkType_ARGB && outType == SkType_Float) {
SkTypedArray* array = scriptValue.fOperand.fArray;
- SkASSERT(scriptValue.fType == SkType_Int || scriptValue.fType == SkType_ARGB ||
+ SkASSERT(scriptValue.fType == SkType_Int || scriptValue.fType == SkType_ARGB ||
scriptValue.fType == SkType_Array);
SkASSERT(scriptValue.fType != SkType_Array || (array != NULL &&
array->getType() == SkType_Int));
@@ -434,7 +434,7 @@ bool SkMemberInfo::writeValue(SkDisplayable* displayable, SkTDOperandArray* arra
if (maxStorage == 0)
arrayStorage->setCount(numberOfComponents);
for (int index = 0; index < numberOfColors; index++) {
- SkColor color = scriptValue.fType == SkType_Array ?
+ SkColor color = scriptValue.fType == SkType_Array ?
(SkColor) array->begin()[index].fS32 : (SkColor) scriptValue.fOperand.fS32;
storage[0].fScalar = SkIntToScalar(SkColorGetA(color));
storage[1].fScalar = SkIntToScalar(SkColorGetR(color));
@@ -528,11 +528,11 @@ const SkMemberInfo* SkMemberInfo::getInherited() const {
#endif // SK_USE_CONDENSED_INFO == 0
#if 0
-bool SkMemberInfo::SetValue(void* valuePtr, const char value[], SkDisplayTypes type,
+bool SkMemberInfo::SetValue(void* valuePtr, const char value[], SkDisplayTypes type,
int count) {
switch (type) {
case SkType_Animate:
- case SkType_BaseBitmap:
+ case SkType_BaseBitmap:
case SkType_Bitmap:
case SkType_Dash:
case SkType_Displayable:
@@ -548,7 +548,7 @@ bool SkMemberInfo::SetValue(void* valuePtr, const char value[], SkDisplayTypes t
case SkType_3D_Point:
case SkType_Point:
// case SkType_PointArray:
- case SkType_ScalarArray:
+ case SkType_ScalarArray:
SkParse::FindScalars(value, (SkScalar*) valuePtr, count);
break;
default:
diff --git a/src/animator/SkMemberInfo.h b/src/animator/SkMemberInfo.h
index f2e690c5f6..007df60ec6 100644
--- a/src/animator/SkMemberInfo.h
+++ b/src/animator/SkMemberInfo.h
@@ -83,15 +83,15 @@ struct SkMemberInfo {
}
void setString(SkDisplayable* , SkString* ) const;
void setValue(SkDisplayable* , const SkOperand values[], int count) const;
- bool setValue(SkAnimateMaker& , SkTDOperandArray* storage,
- int storageOffset, int maxStorage, SkDisplayable* ,
+ bool setValue(SkAnimateMaker& , SkTDOperandArray* storage,
+ int storageOffset, int maxStorage, SkDisplayable* ,
SkDisplayTypes outType, const char value[], size_t len) const;
- bool setValue(SkAnimateMaker& , SkTDOperandArray* storage,
- int storageOffset, int maxStorage, SkDisplayable* ,
+ bool setValue(SkAnimateMaker& , SkTDOperandArray* storage,
+ int storageOffset, int maxStorage, SkDisplayable* ,
SkDisplayTypes outType, SkString& str) const;
// void setValue(SkDisplayable* , const char value[], const char name[]) const;
- bool writeValue(SkDisplayable* displayable, SkTDOperandArray* arrayStorage,
- int storageOffset, int maxStorage, void* untypedStorage, SkDisplayTypes outType,
+ bool writeValue(SkDisplayable* displayable, SkTDOperandArray* arrayStorage,
+ int storageOffset, int maxStorage, void* untypedStorage, SkDisplayTypes outType,
SkScriptValue& scriptValue) const;
#if SK_USE_CONDENSED_INFO == 0
static const SkMemberInfo* Find(const SkMemberInfo [], int count, int* index);
@@ -119,7 +119,7 @@ struct SkMemberInfo {
#define SK_MEMBER_INHERITED \
{ (const char*) INHERITED::fInfo, 0, SkType_BaseClassInfo, INHERITED::fInfoCount }
-// #define SK_MEMBER_KEY_TYPE(_member, _type)
+// #define SK_MEMBER_KEY_TYPE(_member, _type)
// {#_member, (size_t) -1, SkType_##_type, 0}
#define SK_FUNCTION(_member) \
@@ -184,7 +184,7 @@ public: \
#define DECLARE_EMPTY_MEMBER_INFO(_type) \
public: \
virtual SkDisplayTypes getType() const { return SkType_##_type; }
-
+
#define DECLARE_EXTRAS_MEMBER_INFO(_type) \
public: \
static const SkMemberInfo fInfo[]; \
diff --git a/src/animator/SkOpArray.cpp b/src/animator/SkOpArray.cpp
index 1f14476e20..94298cc83a 100644
--- a/src/animator/SkOpArray.cpp
+++ b/src/animator/SkOpArray.cpp
@@ -14,10 +14,10 @@ SkOpArray::SkOpArray(SkOperand2::OpType type) : fType(type) {
}
bool SkOpArray::getIndex(int index, SkOperand2* operand) {
- if (index >= count()) {
- SkASSERT(0);
- return false;
- }
- *operand = begin()[index];
- return true;
+ if (index >= count()) {
+ SkASSERT(0);
+ return false;
+ }
+ *operand = begin()[index];
+ return true;
}
diff --git a/src/animator/SkOpArray.h b/src/animator/SkOpArray.h
index d5b9fe7df8..260bf78be0 100644
--- a/src/animator/SkOpArray.h
+++ b/src/animator/SkOpArray.h
@@ -11,19 +11,19 @@
#include "SkOperand2.h"
#include "SkTDArray_Experimental.h"
-typedef SkLongArray(SkOperand2) SkTDOperand2Array;
+typedef SkLongArray(SkOperand2) SkTDOperand2Array;
class SkOpArray : public SkTDOperand2Array {
public:
- SkOpArray();
- SkOpArray(SkOperand2::OpType type);
- bool getIndex(int index, SkOperand2* operand);
- SkOperand2::OpType getType() { return fType; }
- void setType(SkOperand2::OpType type) {
- fType = type;
- }
+ SkOpArray();
+ SkOpArray(SkOperand2::OpType type);
+ bool getIndex(int index, SkOperand2* operand);
+ SkOperand2::OpType getType() { return fType; }
+ void setType(SkOperand2::OpType type) {
+ fType = type;
+ }
protected:
- SkOperand2::OpType fType;
+ SkOperand2::OpType fType;
};
#endif // SkOpArray_DEFINED
diff --git a/src/animator/SkOperand2.h b/src/animator/SkOperand2.h
index 4f09a01020..f844b6b4c9 100644
--- a/src/animator/SkOperand2.h
+++ b/src/animator/SkOperand2.h
@@ -14,40 +14,40 @@ class SkOpArray;
class SkString;
union SkOperand2 {
- enum OpType {
- kNoType,
- kS32 = 1,
- kScalar = 2,
- kString = 4,
- kArray = 8,
- kObject = 16
- };
- SkOpArray* fArray;
- void* fObject;
- size_t fReference;
- int32_t fS32;
- SkScalar fScalar;
- SkString* fString;
+ enum OpType {
+ kNoType,
+ kS32 = 1,
+ kScalar = 2,
+ kString = 4,
+ kArray = 8,
+ kObject = 16
+ };
+ SkOpArray* fArray;
+ void* fObject;
+ size_t fReference;
+ int32_t fS32;
+ SkScalar fScalar;
+ SkString* fString;
};
struct SkScriptValue2 {
- enum IsConstant {
- kConstant,
- kVariable
- };
- enum IsWritten {
- kUnwritten,
- kWritten
- };
- SkOperand2 fOperand;
- SkOperand2::OpType fType : 8;
- IsConstant fIsConstant : 8;
- IsWritten fIsWritten : 8;
- SkOpArray* getArray() { SkASSERT(fType == SkOperand2::kArray); return fOperand.fArray; }
- void* getObject() { SkASSERT(fType == SkOperand2::kObject); return fOperand.fObject; }
- int32_t getS32() { SkASSERT(fType == SkOperand2::kS32); return fOperand.fS32; }
- SkScalar getScalar() { SkASSERT(fType == SkOperand2::kScalar); return fOperand.fScalar; }
- SkString* getString() { SkASSERT(fType == SkOperand2::kString); return fOperand.fString; }
+ enum IsConstant {
+ kConstant,
+ kVariable
+ };
+ enum IsWritten {
+ kUnwritten,
+ kWritten
+ };
+ SkOperand2 fOperand;
+ SkOperand2::OpType fType : 8;
+ IsConstant fIsConstant : 8;
+ IsWritten fIsWritten : 8;
+ SkOpArray* getArray() { SkASSERT(fType == SkOperand2::kArray); return fOperand.fArray; }
+ void* getObject() { SkASSERT(fType == SkOperand2::kObject); return fOperand.fObject; }
+ int32_t getS32() { SkASSERT(fType == SkOperand2::kS32); return fOperand.fS32; }
+ SkScalar getScalar() { SkASSERT(fType == SkOperand2::kScalar); return fOperand.fScalar; }
+ SkString* getString() { SkASSERT(fType == SkOperand2::kString); return fOperand.fString; }
bool isConstant() const { return fIsConstant == kConstant; }
};
diff --git a/src/animator/SkOperandIterpolator.cpp b/src/animator/SkOperandIterpolator.cpp
index dcc454d07a..bc7d46be24 100644
--- a/src/animator/SkOperandIterpolator.cpp
+++ b/src/animator/SkOperandIterpolator.cpp
@@ -15,7 +15,7 @@ SkOperandInterpolator::SkOperandInterpolator() {
fType = SkType_Unknown;
}
-SkOperandInterpolator::SkOperandInterpolator(int elemCount, int frameCount,
+SkOperandInterpolator::SkOperandInterpolator(int elemCount, int frameCount,
SkDisplayTypes type)
{
this->reset(elemCount, frameCount, type);
diff --git a/src/animator/SkParseSVGPath.cpp b/src/animator/SkParseSVGPath.cpp
index 1b375aa6f3..f020e2e01a 100644
--- a/src/animator/SkParseSVGPath.cpp
+++ b/src/animator/SkParseSVGPath.cpp
@@ -101,7 +101,7 @@ static const char* find_points(const char str[], SkPoint value[], int count,
return str;
}
-static const char* find_scalar(const char str[], SkScalar* value,
+static const char* find_scalar(const char str[], SkScalar* value,
bool isRelative, SkScalar relative)
{
str = SkParse::FindScalar(str, value);
@@ -146,7 +146,7 @@ void SkDrawPath::parseSVG() {
op = 'L';
c = points[0];
break;
- case 'L':
+ case 'L':
data = find_points(data, points, 1, relative, &c);
fPath.lineTo(points[0]);
c = points[0];
@@ -165,10 +165,10 @@ void SkDrawPath::parseSVG() {
c.fY = y;
}
break;
- case 'C':
+ case 'C':
data = find_points(data, points, 3, relative, &c);
goto cubicCommon;
- case 'S':
+ case 'S':
data = find_points(data, &points[1], 2, relative, &c);
points[0] = c;
if (previousOp == 'C' || previousOp == 'S') {
diff --git a/src/animator/SkPathParts.cpp b/src/animator/SkPathParts.cpp
index 5af8150056..3060bd445f 100644
--- a/src/animator/SkPathParts.cpp
+++ b/src/animator/SkPathParts.cpp
@@ -16,8 +16,8 @@
SkPathPart::SkPathPart() : fPath(NULL) {
}
-void SkPathPart::dirty() {
- fPath->dirty();
+void SkPathPart::dirty() {
+ fPath->dirty();
}
SkDisplayable* SkPathPart::getParent() const {
@@ -86,7 +86,7 @@ SkLineTo::SkLineTo() : x(0), y(0) {
}
bool SkLineTo::add() {
- fPath->fPath.lineTo(x, y);
+ fPath->fPath.lineTo(x, y);
return false;
}
@@ -103,7 +103,7 @@ const SkMemberInfo SkRLineTo::fInfo[] = {
DEFINE_GET_MEMBER(SkRLineTo);
bool SkRLineTo::add() {
- fPath->fPath.rLineTo(x, y);
+ fPath->fPath.rLineTo(x, y);
return false;
}
@@ -225,8 +225,8 @@ const SkMemberInfo SkAddRect::fInfo[] = {
DEFINE_GET_MEMBER(SkAddRect);
-SkAddRect::SkAddRect() {
- fRect.setEmpty();
+SkAddRect::SkAddRect() {
+ fRect.setEmpty();
}
bool SkAddRect::add() {
@@ -309,7 +309,7 @@ SkAddPath::SkAddPath() : matrix(NULL), path(NULL) {
}
bool SkAddPath::add() {
- SkASSERT (path != NULL);
+ SkASSERT (path != NULL);
if (matrix)
fPath->fPath.addPath(path->fPath, matrix->getMatrix());
else
diff --git a/src/animator/SkPostParts.cpp b/src/animator/SkPostParts.cpp
index 4b776a8256..b6549a2890 100644
--- a/src/animator/SkPostParts.cpp
+++ b/src/animator/SkPostParts.cpp
@@ -29,7 +29,7 @@ bool SkDataInput::add() {
fParent->fEvent.setS32(dataName, fInt);
else if (SkScalarIsNaN(fFloat) == false)
fParent->fEvent.setScalar(dataName, fFloat);
- else if (string.size() > 0)
+ else if (string.size() > 0)
fParent->fEvent.setString(dataName, string);
// else
// SkASSERT(0);
diff --git a/src/animator/SkScript.cpp b/src/animator/SkScript.cpp
index 3b498fa64b..92e8f3c23e 100644
--- a/src/animator/SkScript.cpp
+++ b/src/animator/SkScript.cpp
@@ -16,7 +16,7 @@
/* things to do
? re-enable support for struct literals (e.g., for initializing points or rects)
{x:1, y:2}
- ? use standard XML / script notation like document.getElementById("canvas");
+ ? use standard XML / script notation like document.getElementById("canvas");
finish support for typed arrays
? allow indexing arrays by string
this could map to the 'name' attribute of a given child of an array
@@ -224,7 +224,7 @@ int SkScriptEngine::arithmeticOp(char ch, char nextChar, bool lastPush) {
if (nextChar == '>') {
op = kShiftRight;
goto twoChar;
- }
+ }
op = kGreaterEqual;
if (nextChar == '=')
goto twoChar;
@@ -253,7 +253,7 @@ int SkScriptEngine::arithmeticOp(char ch, char nextChar, bool lastPush) {
twoChar:
advance++;
break;
- }
+ }
op = kLogicalNot;
break;
case '?':
@@ -298,7 +298,7 @@ twoChar:
} while (true);
signed char topPrecedence = gPrecedence[compare];
SkASSERT(topPrecedence != -1);
- if (topPrecedence > precedence || (topPrecedence == precedence &&
+ if (topPrecedence > precedence || (topPrecedence == precedence &&
gOpAttributes[op].fLeftType == kNoType)) {
break;
}
@@ -327,7 +327,7 @@ void SkScriptEngine::commonCallBack(CallBackType type, UserCallBack& callBack, v
*fUserCallBacks.prepend() = callBack;
}
-bool SkScriptEngine::convertParams(SkTDArray<SkScriptValue>& params,
+bool SkScriptEngine::convertParams(SkTDArray<SkScriptValue>& params,
const SkFunctionParamType* paramTypes, int paramCount) {
if (params.count() > paramCount) {
fError = kTooManyParameters;
@@ -366,7 +366,7 @@ bool SkScriptEngine::convertTo(SkDisplayTypes toType, SkScriptValue* value ) {
return ConvertTo(this, toType, value);
}
-bool SkScriptEngine::evaluateDot(const char*& script, bool suppressed) {
+bool SkScriptEngine::evaluateDot(const char*& script, bool suppressed) {
size_t fieldLength = token_length(++script); // skip dot
if (fieldLength == 0) {
fError = kExpectedFieldName;
@@ -382,8 +382,8 @@ bool SkScriptEngine::evaluateDot(const char*& script, bool suppressed) {
return evaluateDotParam(script, suppressed, field, fieldLength);
}
-bool SkScriptEngine::evaluateDotParam(const char*& script, bool suppressed,
- const char* field, size_t fieldLength) {
+bool SkScriptEngine::evaluateDotParam(const char*& script, bool suppressed,
+ const char* field, size_t fieldLength) {
void* object;
if (suppressed)
object = NULL;
@@ -397,7 +397,7 @@ bool SkScriptEngine::evaluateDotParam(const char*& script, bool suppressed,
fOperandStack.pop();
}
char ch; // see if it is a simple member or a function
- while (is_ws(ch = script[0]))
+ while (is_ws(ch = script[0]))
script++;
bool success = true;
if (ch != '(') {
@@ -410,10 +410,10 @@ bool SkScriptEngine::evaluateDotParam(const char*& script, bool suppressed,
*fBraceStack.push() = kFunctionBrace;
success = functionParams(&script, params);
if (success && suppressed == false &&
- (success = handleMemberFunction(field, fieldLength, object, params)) == false)
- fError = kHandleMemberFunctionFailed;
+ (success = handleMemberFunction(field, fieldLength, object, params)) == false)
+ fError = kHandleMemberFunctionFailed;
}
- return success;
+ return success;
}
bool SkScriptEngine::evaluateScript(const char** scriptPtr, SkScriptValue* value) {
@@ -559,15 +559,15 @@ bool SkScriptEngine::innerScript(const char** scriptPtr, SkScriptValue* value) {
if (convertTo(tokenInfo->getType(), &tokenValue) == false)
return false;
}
- tokenInfo->writeValue(fDisplayable, NULL, 0, 0,
+ tokenInfo->writeValue(fDisplayable, NULL, 0, 0,
(void*) ((char*) fInfo->memberData(fDisplayable) + tokenInfo->fOffset + fArrayOffset),
tokenInfo->getType(), tokenValue);
}
}
lastPush = false;
continue;
- } else
-#endif
+ } else
+#endif
if (fBraceStack.top() == kArrayBrace) {
SkScriptValue tokenValue;
success = innerScript(&script, &tokenValue); // terminate and return on comma, close brace
@@ -579,12 +579,12 @@ bool SkScriptEngine::innerScript(const char** scriptPtr, SkScriptValue* value) {
#if 0 // no support for structures for now
if (tokenValue.fType == SkType_Structure) {
fArrayOffset += (int) fInfo->getSize(fDisplayable);
- } else
+ } else
#endif
{
SkDisplayTypes type = ToDisplayType(fReturnType);
if (fReturnType == kNoType) {
- // !!! short sighted; in the future, allow each returned array component to carry
+ // !!! short sighted; in the future, allow each returned array component to carry
// its own type, and let caller do any needed conversions
if (value->fOperand.fArray->count() == 0)
value->fOperand.fArray->setType(type = tokenValue.fType);
@@ -730,11 +730,11 @@ scalarCommon:
if (success == false)
return false;
lastPush = true;
- continue;
+ continue;
}
// get next token, and evaluate immediately
success = evaluateDot(script, SkToBool(suppressed));
- if (success == false)
+ if (success == false)
return false;
lastPush = true;
continue;
@@ -772,7 +772,7 @@ scalarCommon:
}
#endif
if (ch == ')' && fBraceStack.count() > 0) {
- SkBraceStyle braceStyle = fBraceStack.top();
+ SkBraceStyle braceStyle = fBraceStack.top();
if (braceStyle == kFunctionBrace) {
fBraceStack.pop();
break;
@@ -795,7 +795,7 @@ scalarCommon:
int advance = logicalOp(ch, nextChar);
if (advance < 0) // error
return false;
- if (advance == 0)
+ if (advance == 0)
advance = arithmeticOp(ch, nextChar, lastPush);
if (advance == 0) // unknown token
return false;
@@ -814,7 +814,7 @@ scalarCommon:
return false;
if (processOp() == false)
return false;
- }
+ }
SkOpType topType = fTypeStack.count() > 0 ? fTypeStack.top() : kNoType;
if (suppressed == false && topType != fReturnType &&
topType == kString && fReturnType != kNoType) { // if result is a string, give handle property a chance to convert it to the property value
@@ -945,7 +945,7 @@ bool SkScriptEngine::handleFunction(const char** scriptPtr, bool suppressed) {
for (UserCallBack* callBack = fUserCallBacks.begin(); callBack < fUserCallBacks.end(); callBack++) {
if (callBack->fCallBackType != kFunction)
continue;
- success = (*callBack->fFunctionCallBack)(functionName.c_str(), functionName.size(), params,
+ success = (*callBack->fFunctionCallBack)(functionName.c_str(), functionName.size(), params,
callBack->fUserStorage, &callbackResult);
if (success) {
fOperandStack.push(callbackResult.fOperand);
@@ -986,7 +986,7 @@ bool SkScriptEngine::handleMemberFunction(const char* field, size_t len, void* o
for (UserCallBack* callBack = fUserCallBacks.begin(); callBack < fUserCallBacks.end(); callBack++) {
if (callBack->fCallBackType != kMemberFunction)
continue;
- success = (*callBack->fMemberFunctionCallBack)(field, len, object, params,
+ success = (*callBack->fMemberFunctionCallBack)(field, len, object, params,
callBack->fUserStorage, &callbackResult);
if (success) {
if (callbackResult.fType == SkType_String)
@@ -1008,7 +1008,7 @@ bool SkScriptEngine::handleObjectToString(void* object) {
for (UserCallBack* callBack = fUserCallBacks.begin(); callBack < fUserCallBacks.end(); callBack++) {
if (callBack->fCallBackType != kObjectToString)
continue;
- success = (*callBack->fObjectToStringCallBack)(object,
+ success = (*callBack->fObjectToStringCallBack)(object,
callBack->fUserStorage, &callbackResult);
if (success) {
if (callbackResult.fType == SkType_String)
@@ -1027,14 +1027,14 @@ done:
bool SkScriptEngine::handleProperty(bool suppressed) {
SkScriptValue callbackResult;
bool success = true;
- if (suppressed)
+ if (suppressed)
goto done;
success = false; // note that with standard animator-script plugins, callback never returns false
{
for (UserCallBack* callBack = fUserCallBacks.begin(); callBack < fUserCallBacks.end(); callBack++) {
if (callBack->fCallBackType != kProperty)
continue;
- success = (*callBack->fPropertyCallBack)(fToken, fTokenLength,
+ success = (*callBack->fPropertyCallBack)(fToken, fTokenLength,
callBack->fUserStorage, &callbackResult);
if (success) {
if (callbackResult.fType == SkType_String && callbackResult.fOperand.fString == NULL) {
@@ -1146,7 +1146,7 @@ noMatch:
fError = kMismatchedBrackets;
return -1;
}
- if (match == kParen)
+ if (match == kParen)
fOpStack.pop();
else {
SkOpType indexType;
@@ -1157,7 +1157,7 @@ noMatch:
}
SkOperand indexOperand;
fOperandStack.pop(&indexOperand);
- int index = indexType == kScalar ? SkScalarFloor(indexOperand.fScalar) :
+ int index = indexType == kScalar ? SkScalarFloor(indexOperand.fScalar) :
indexOperand.fS32;
SkOpType arrayType;
fTypeStack.pop(&arrayType);
@@ -1192,7 +1192,7 @@ noMatch:
}
suppress.fSuppress = ifValue.fOperand.fS32 == 0;
suppress.fOperator = kIf;
- suppress.fOpStackDepth = fOpStack.count();
+ suppress.fOpStackDepth = fOpStack.count();
suppress.fElse = false;
fSuppressStack.push(suppress);
// if left is true, do only up to colon
@@ -1218,7 +1218,7 @@ flipSuppress:
if (match == kLogicalOr ? topInt != 0 : topInt == 0) {
suppress.fSuppress = true;
suppress.fOperator = match;
- suppress.fOpStackDepth = fOpStack.count();
+ suppress.fOpStackDepth = fOpStack.count();
suppress.fElse = false;
fSuppressStack.push(suppress);
} else {
@@ -1467,16 +1467,16 @@ void SkScriptEngine::propertyCallBack(_propertyCallBack prop, void* userStorage)
commonCallBack(kProperty, callBack, userStorage);
}
-void SkScriptEngine::track(SkTypedArray* array) {
- SkASSERT(fTrackArray.find(array) < 0);
- *(fTrackArray.end() - 1) = array;
- fTrackArray.appendClear();
+void SkScriptEngine::track(SkTypedArray* array) {
+ SkASSERT(fTrackArray.find(array) < 0);
+ *(fTrackArray.end() - 1) = array;
+ fTrackArray.appendClear();
}
-void SkScriptEngine::track(SkString* string) {
- SkASSERT(fTrackString.find(string) < 0);
- *(fTrackString.end() - 1) = string;
- fTrackString.appendClear();
+void SkScriptEngine::track(SkString* string) {
+ SkASSERT(fTrackString.find(string) < 0);
+ *(fTrackString.end() - 1) = string;
+ fTrackString.appendClear();
}
void SkScriptEngine::unboxCallBack(_unboxCallBack func, void* userStorage) {
@@ -1494,7 +1494,7 @@ bool SkScriptEngine::ConvertTo(SkScriptEngine* engine, SkDisplayTypes toType, Sk
if (toType == SkType_Drawable)
toType = SkType_Displayable;
SkDisplayTypes type = value->fType;
- if (type == toType)
+ if (type == toType)
return true;
SkOperand& operand = value->fOperand;
bool success = true;
@@ -1534,7 +1534,7 @@ bool SkScriptEngine::ConvertTo(SkScriptEngine* engine, SkDisplayTypes toType, Sk
engine->track(strPtr);
if (type == SkType_Int)
strPtr->appendS32(operand.fS32);
- else if (type == SkType_Displayable)
+ else if (type == SkType_Displayable)
SkASSERT(0); // must call through instance version instead of static version
else {
if (type != SkType_Float) {
@@ -1665,17 +1665,17 @@ static const SkScriptNAnswer scriptTests[] = {
testInt((6+7)*8),
testInt(0&&1?2:3),
testInt(3*(4+5)),
- testScalar(1.0+2.0),
- testScalar(1.0+5),
- testScalar(3.0-1.0),
- testScalar(6-1.0),
- testScalar(- -5.5- -1.5),
- testScalar(2.5*6.),
- testScalar(0.5*4),
- testScalar(4.5/.5),
- testScalar(9.5/19),
- testRemainder(9.5, 0.5),
- testRemainder(9.,2),
+ testScalar(1.0+2.0),
+ testScalar(1.0+5),
+ testScalar(3.0-1.0),
+ testScalar(6-1.0),
+ testScalar(- -5.5- -1.5),
+ testScalar(2.5*6.),
+ testScalar(0.5*4),
+ testScalar(4.5/.5),
+ testScalar(9.5/19),
+ testRemainder(9.5, 0.5),
+ testRemainder(9.,2),
testRemainder(9,2.5),
testRemainder(-9,2.5),
testTrue(-9==-9.0),
@@ -1854,7 +1854,7 @@ static const SkScriptNAnswer scriptTests[] = {
testInt(0?2?3:4:5),
testInt(1?0?3:4:5),
testInt(0?0?3:4:5),
-
+
testInt(1?2:(3?4:5)),
testInt(0?2:(3?4:5)),
testInt(1?0:(3?4:5)),
diff --git a/src/animator/SkScript.h b/src/animator/SkScript.h
index 95930e81c8..aa8d9a30c8 100644
--- a/src/animator/SkScript.h
+++ b/src/animator/SkScript.h
@@ -63,9 +63,9 @@ public:
typedef bool (*_boxCallBack)(void* userStorage, SkScriptValue* result);
typedef bool (*_functionCallBack)(const char* func, size_t len, SkTDArray<SkScriptValue>& params,
void* userStorage, SkScriptValue* result);
- typedef bool (*_memberCallBack)(const char* member, size_t len, void* object,
+ typedef bool (*_memberCallBack)(const char* member, size_t len, void* object,
void* userStorage, SkScriptValue* result);
- typedef bool (*_memberFunctionCallBack)(const char* member, size_t len, void* object,
+ typedef bool (*_memberFunctionCallBack)(const char* member, size_t len, void* object,
SkTDArray<SkScriptValue>& params, void* userStorage, SkScriptValue* result);
// typedef bool (*_objectToStringCallBack)(void* object, void* userStorage, SkScriptValue* result);
typedef bool (*_propertyCallBack)(const char* prop, size_t len, void* userStorage, SkScriptValue* result);
@@ -169,7 +169,7 @@ public:
kTowardsNumber = 0,
kTowardsString
};
-
+
protected:
struct SkOperatorAttributes {
diff --git a/src/animator/SkScript2.h b/src/animator/SkScript2.h
index 05073e4a72..03eb92cd14 100644
--- a/src/animator/SkScript2.h
+++ b/src/animator/SkScript2.h
@@ -15,274 +15,274 @@
#include "SkTDict.h"
#include "SkTDStack.h"
-typedef SkLongArray(SkString*) SkTDStringArray;
+typedef SkLongArray(SkString*) SkTDStringArray;
class SkAnimateMaker;
class SkScriptCallBack;
class SkScriptEngine2 {
public:
- enum Error {
- kNoError,
- kArrayIndexOutOfBounds,
- kCouldNotFindReferencedID,
- kFunctionCallFailed,
- kMemberOpFailed,
- kPropertyOpFailed
- };
+ enum Error {
+ kNoError,
+ kArrayIndexOutOfBounds,
+ kCouldNotFindReferencedID,
+ kFunctionCallFailed,
+ kMemberOpFailed,
+ kPropertyOpFailed
+ };
- enum Attrs {
- kConstant,
- kVariable
- };
+ enum Attrs {
+ kConstant,
+ kVariable
+ };
- SkScriptEngine2(SkOperand2::OpType returnType);
- ~SkScriptEngine2();
- bool convertTo(SkOperand2::OpType , SkScriptValue2* );
- bool evaluateScript(const char** script, SkScriptValue2* value);
- void forget(SkOpArray* array);
- Error getError() { return fError; }
- SkOperand2::OpType getReturnType() { return fReturnType; }
- void track(SkOpArray* array) {
- SkASSERT(fTrackArray.find(array) < 0);
- *fTrackArray.append() = array; }
- void track(SkString* string) {
- SkASSERT(fTrackString.find(string) < 0);
- *fTrackString.append() = string;
- }
- static bool ConvertTo(SkScriptEngine2* , SkOperand2::OpType toType, SkScriptValue2* value);
- static SkScalar IntToScalar(int32_t );
- static bool ValueToString(const SkScriptValue2& value, SkString* string);
+ SkScriptEngine2(SkOperand2::OpType returnType);
+ ~SkScriptEngine2();
+ bool convertTo(SkOperand2::OpType , SkScriptValue2* );
+ bool evaluateScript(const char** script, SkScriptValue2* value);
+ void forget(SkOpArray* array);
+ Error getError() { return fError; }
+ SkOperand2::OpType getReturnType() { return fReturnType; }
+ void track(SkOpArray* array) {
+ SkASSERT(fTrackArray.find(array) < 0);
+ *fTrackArray.append() = array; }
+ void track(SkString* string) {
+ SkASSERT(fTrackString.find(string) < 0);
+ *fTrackString.append() = string;
+ }
+ static bool ConvertTo(SkScriptEngine2* , SkOperand2::OpType toType, SkScriptValue2* value);
+ static SkScalar IntToScalar(int32_t );
+ static bool ValueToString(const SkScriptValue2& value, SkString* string);
- enum Op { // used by tokenizer attribute table
- kUnassigned,
- kAdd,
- kBitAnd,
- kBitNot,
- kBitOr,
- kDivide,
- kEqual,
- kFlipOps,
- kGreaterEqual,
- kLogicalAnd,
- kLogicalNot,
- kLogicalOr,
- kMinus,
- kModulo,
- kMultiply,
- kShiftLeft,
- kShiftRight, // signed
- kSubtract,
- kXor,
+ enum Op { // used by tokenizer attribute table
+ kUnassigned,
+ kAdd,
+ kBitAnd,
+ kBitNot,
+ kBitOr,
+ kDivide,
+ kEqual,
+ kFlipOps,
+ kGreaterEqual,
+ kLogicalAnd,
+ kLogicalNot,
+ kLogicalOr,
+ kMinus,
+ kModulo,
+ kMultiply,
+ kShiftLeft,
+ kShiftRight, // signed
+ kSubtract,
+ kXor,
// following not in attribute table
- kArrayOp,
- kElse,
- kIf,
- kParen,
- kLastLogicalOp,
- kArtificialOp = 0x20
- };
+ kArrayOp,
+ kElse,
+ kIf,
+ kParen,
+ kLastLogicalOp,
+ kArtificialOp = 0x20
+ };
- enum TypeOp { // generated by tokenizer
- kNop, // should never get generated
- kAccumulatorPop,
- kAccumulatorPush,
- kAddInt,
- kAddScalar,
- kAddString, // string concat
- kArrayIndex,
- kArrayParam,
- kArrayToken,
- kBitAndInt,
- kBitNotInt,
- kBitOrInt,
- kBoxToken,
- kCallback,
- kDivideInt,
- kDivideScalar,
- kDotOperator,
- kElseOp,
- kEnd,
- kEqualInt,
- kEqualScalar,
- kEqualString,
- kFunctionCall,
- kFlipOpsOp,
- kFunctionToken,
- kGreaterEqualInt,
- kGreaterEqualScalar,
- kGreaterEqualString,
- kIfOp,
- kIntToScalar,
- kIntToScalar2,
- kIntToString,
- kIntToString2,
- kIntegerAccumulator,
- kIntegerOperand,
- kLogicalAndInt,
- kLogicalNotInt,
- kLogicalOrInt,
- kMemberOp,
- kMinusInt,
- kMinusScalar,
- kModuloInt,
- kModuloScalar,
- kMultiplyInt,
- kMultiplyScalar,
- kPropertyOp,
- kScalarAccumulator,
- kScalarOperand,
- kScalarToInt,
- kScalarToInt2,
- kScalarToString,
- kScalarToString2,
- kShiftLeftInt,
- kShiftRightInt, // signed
- kStringAccumulator,
- kStringOperand,
- kStringToInt,
- kStringToScalar,
- kStringToScalar2,
- kStringTrack,
- kSubtractInt,
- kSubtractScalar,
- kToBool,
- kUnboxToken,
- kUnboxToken2,
- kXorInt,
- kLastTypeOp
- };
+ enum TypeOp { // generated by tokenizer
+ kNop, // should never get generated
+ kAccumulatorPop,
+ kAccumulatorPush,
+ kAddInt,
+ kAddScalar,
+ kAddString, // string concat
+ kArrayIndex,
+ kArrayParam,
+ kArrayToken,
+ kBitAndInt,
+ kBitNotInt,
+ kBitOrInt,
+ kBoxToken,
+ kCallback,
+ kDivideInt,
+ kDivideScalar,
+ kDotOperator,
+ kElseOp,
+ kEnd,
+ kEqualInt,
+ kEqualScalar,
+ kEqualString,
+ kFunctionCall,
+ kFlipOpsOp,
+ kFunctionToken,
+ kGreaterEqualInt,
+ kGreaterEqualScalar,
+ kGreaterEqualString,
+ kIfOp,
+ kIntToScalar,
+ kIntToScalar2,
+ kIntToString,
+ kIntToString2,
+ kIntegerAccumulator,
+ kIntegerOperand,
+ kLogicalAndInt,
+ kLogicalNotInt,
+ kLogicalOrInt,
+ kMemberOp,
+ kMinusInt,
+ kMinusScalar,
+ kModuloInt,
+ kModuloScalar,
+ kMultiplyInt,
+ kMultiplyScalar,
+ kPropertyOp,
+ kScalarAccumulator,
+ kScalarOperand,
+ kScalarToInt,
+ kScalarToInt2,
+ kScalarToString,
+ kScalarToString2,
+ kShiftLeftInt,
+ kShiftRightInt, // signed
+ kStringAccumulator,
+ kStringOperand,
+ kStringToInt,
+ kStringToScalar,
+ kStringToScalar2,
+ kStringTrack,
+ kSubtractInt,
+ kSubtractScalar,
+ kToBool,
+ kUnboxToken,
+ kUnboxToken2,
+ kXorInt,
+ kLastTypeOp
+ };
- enum OpBias {
- kNoBias,
- kTowardsNumber = 0,
- kTowardsString
- };
+ enum OpBias {
+ kNoBias,
+ kTowardsNumber = 0,
+ kTowardsString
+ };
protected:
- enum BraceStyle {
- // kStructBrace,
- kArrayBrace,
- kFunctionBrace
- };
+ enum BraceStyle {
+ // kStructBrace,
+ kArrayBrace,
+ kFunctionBrace
+ };
- enum AddTokenRegister {
- kAccumulator,
- kOperand
- };
-
- enum ResultIsBoolean {
- kResultIsNotBoolean,
- kResultIsBoolean
- };
+ enum AddTokenRegister {
+ kAccumulator,
+ kOperand
+ };
- struct OperatorAttributes {
- unsigned int fLeftType : 3; // SkOpType union, but only lower values
- unsigned int fRightType : 3; // SkOpType union, but only lower values
- OpBias fBias : 1;
- ResultIsBoolean fResultIsBoolean : 1;
- };
-
- struct Branch {
- Branch() {
- }
-
- Branch(Op op, int depth, unsigned offset) : fOffset(offset), fOpStackDepth(depth), fOperator(op),
- fPrimed(kIsNotPrimed), fDone(kIsNotDone) {
- }
+ enum ResultIsBoolean {
+ kResultIsNotBoolean,
+ kResultIsBoolean
+ };
- enum Primed {
- kIsNotPrimed,
- kIsPrimed
- };
+ struct OperatorAttributes {
+ unsigned int fLeftType : 3; // SkOpType union, but only lower values
+ unsigned int fRightType : 3; // SkOpType union, but only lower values
+ OpBias fBias : 1;
+ ResultIsBoolean fResultIsBoolean : 1;
+ };
- enum Done {
- kIsNotDone,
- kIsDone,
- };
+ struct Branch {
+ Branch() {
+ }
- unsigned fOffset : 16; // offset in generated stream where branch needs to go
- int fOpStackDepth : 7; // depth when operator was found
- Op fOperator : 6; // operand which generated branch
- mutable Primed fPrimed : 1; // mark when next instruction generates branch
- Done fDone : 1; // mark when branch is complete
- void prime() { fPrimed = kIsPrimed; }
- void resolve(SkDynamicMemoryWStream* , size_t offset);
- };
+ Branch(Op op, int depth, unsigned offset) : fOffset(offset), fOpStackDepth(depth), fOperator(op),
+ fPrimed(kIsNotPrimed), fDone(kIsNotDone) {
+ }
- static const OperatorAttributes gOpAttributes[];
- static const signed char gPrecedence[];
- static const TypeOp gTokens[];
- void addToken(TypeOp );
- void addTokenConst(SkScriptValue2* , AddTokenRegister , SkOperand2::OpType , TypeOp );
- void addTokenInt(int );
- void addTokenScalar(SkScalar );
- void addTokenString(const SkString& );
- void addTokenValue(const SkScriptValue2& , AddTokenRegister );
- int arithmeticOp(char ch, char nextChar, bool lastPush);
- bool convertParams(SkTDArray<SkScriptValue2>* ,
- const SkOperand2::OpType* paramTypes, int paramTypeCount);
- void convertToString(SkOperand2* operand, SkOperand2::OpType type) {
- SkScriptValue2 scriptValue;
- scriptValue.fOperand = *operand;
- scriptValue.fType = type;
- convertTo(SkOperand2::kString, &scriptValue);
- *operand = scriptValue.fOperand;
- }
- bool evaluateDot(const char*& script);
- bool evaluateDotParam(const char*& script, const char* field, size_t fieldLength);
- bool functionParams(const char** scriptPtr, SkTDArray<SkScriptValue2>* params);
- size_t getTokenOffset();
- SkOperand2::OpType getUnboxType(SkOperand2 scriptValue);
- bool handleArrayIndexer(const char** scriptPtr);
- bool handleFunction(const char** scriptPtr);
- bool handleMember(const char* field, size_t len, void* object);
- bool handleMemberFunction(const char* field, size_t len, void* object,
- SkTDArray<SkScriptValue2>* params);
- bool handleProperty();
- bool handleUnbox(SkScriptValue2* scriptValue);
- bool innerScript(const char** scriptPtr, SkScriptValue2* value);
- int logicalOp(char ch, char nextChar);
- void processLogicalOp(Op op);
- bool processOp();
- void resolveBranch(Branch& );
-// void setAnimateMaker(SkAnimateMaker* maker) { fMaker = maker; }
- SkDynamicMemoryWStream fStream;
- SkDynamicMemoryWStream* fActiveStream;
- SkTDStack<BraceStyle> fBraceStack; // curly, square, function paren
- SkTDStack<Branch> fBranchStack; // logical operators, slot to store forward branch
- SkLongArray(SkScriptCallBack*) fCallBackArray;
- SkTDStack<Op> fOpStack;
- SkTDStack<SkScriptValue2> fValueStack;
-// SkAnimateMaker* fMaker;
- SkLongArray(SkOpArray*) fTrackArray;
- SkTDStringArray fTrackString;
- const char* fToken; // one-deep stack
- size_t fTokenLength;
- SkOperand2::OpType fReturnType;
- Error fError;
- SkOperand2::OpType fAccumulatorType; // tracking for code generation
- SkBool fBranchPopAllowed;
- SkBool fConstExpression;
- SkBool fOperandInUse;
+ enum Primed {
+ kIsNotPrimed,
+ kIsPrimed
+ };
+
+ enum Done {
+ kIsNotDone,
+ kIsDone,
+ };
+
+ unsigned fOffset : 16; // offset in generated stream where branch needs to go
+ int fOpStackDepth : 7; // depth when operator was found
+ Op fOperator : 6; // operand which generated branch
+ mutable Primed fPrimed : 1; // mark when next instruction generates branch
+ Done fDone : 1; // mark when branch is complete
+ void prime() { fPrimed = kIsPrimed; }
+ void resolve(SkDynamicMemoryWStream* , size_t offset);
+ };
+
+ static const OperatorAttributes gOpAttributes[];
+ static const signed char gPrecedence[];
+ static const TypeOp gTokens[];
+ void addToken(TypeOp );
+ void addTokenConst(SkScriptValue2* , AddTokenRegister , SkOperand2::OpType , TypeOp );
+ void addTokenInt(int );
+ void addTokenScalar(SkScalar );
+ void addTokenString(const SkString& );
+ void addTokenValue(const SkScriptValue2& , AddTokenRegister );
+ int arithmeticOp(char ch, char nextChar, bool lastPush);
+ bool convertParams(SkTDArray<SkScriptValue2>* ,
+ const SkOperand2::OpType* paramTypes, int paramTypeCount);
+ void convertToString(SkOperand2* operand, SkOperand2::OpType type) {
+ SkScriptValue2 scriptValue;
+ scriptValue.fOperand = *operand;
+ scriptValue.fType = type;
+ convertTo(SkOperand2::kString, &scriptValue);
+ *operand = scriptValue.fOperand;
+ }
+ bool evaluateDot(const char*& script);
+ bool evaluateDotParam(const char*& script, const char* field, size_t fieldLength);
+ bool functionParams(const char** scriptPtr, SkTDArray<SkScriptValue2>* params);
+ size_t getTokenOffset();
+ SkOperand2::OpType getUnboxType(SkOperand2 scriptValue);
+ bool handleArrayIndexer(const char** scriptPtr);
+ bool handleFunction(const char** scriptPtr);
+ bool handleMember(const char* field, size_t len, void* object);
+ bool handleMemberFunction(const char* field, size_t len, void* object,
+ SkTDArray<SkScriptValue2>* params);
+ bool handleProperty();
+ bool handleUnbox(SkScriptValue2* scriptValue);
+ bool innerScript(const char** scriptPtr, SkScriptValue2* value);
+ int logicalOp(char ch, char nextChar);
+ void processLogicalOp(Op op);
+ bool processOp();
+ void resolveBranch(Branch& );
+// void setAnimateMaker(SkAnimateMaker* maker) { fMaker = maker; }
+ SkDynamicMemoryWStream fStream;
+ SkDynamicMemoryWStream* fActiveStream;
+ SkTDStack<BraceStyle> fBraceStack; // curly, square, function paren
+ SkTDStack<Branch> fBranchStack; // logical operators, slot to store forward branch
+ SkLongArray(SkScriptCallBack*) fCallBackArray;
+ SkTDStack<Op> fOpStack;
+ SkTDStack<SkScriptValue2> fValueStack;
+// SkAnimateMaker* fMaker;
+ SkLongArray(SkOpArray*) fTrackArray;
+ SkTDStringArray fTrackString;
+ const char* fToken; // one-deep stack
+ size_t fTokenLength;
+ SkOperand2::OpType fReturnType;
+ Error fError;
+ SkOperand2::OpType fAccumulatorType; // tracking for code generation
+ SkBool fBranchPopAllowed;
+ SkBool fConstExpression;
+ SkBool fOperandInUse;
private:
#ifdef SK_DEBUG
public:
- void decompile(const unsigned char* , size_t );
- static void UnitTest();
- static void ValidateDecompileTable();
+ void decompile(const unsigned char* , size_t );
+ static void UnitTest();
+ static void ValidateDecompileTable();
#endif
};
#ifdef SK_DEBUG
struct SkScriptNAnswer2 {
- const char* fScript;
- SkOperand2::OpType fType;
- int32_t fIntAnswer;
- SkScalar fScalarAnswer;
- const char* fStringAnswer;
+ const char* fScript;
+ SkOperand2::OpType fType;
+ int32_t fIntAnswer;
+ SkScalar fScalarAnswer;
+ const char* fStringAnswer;
};
#endif
diff --git a/src/animator/SkScriptCallBack.h b/src/animator/SkScriptCallBack.h
index b2a1958517..dcbaf11886 100644
--- a/src/animator/SkScriptCallBack.h
+++ b/src/animator/SkScriptCallBack.h
@@ -13,53 +13,53 @@
class SkScriptCallBack {
public:
- enum Type {
- kBox,
- kFunction,
- kMember,
- kMemberFunction,
- kProperty,
- kUnbox
- };
+ enum Type {
+ kBox,
+ kFunction,
+ kMember,
+ kMemberFunction,
+ kProperty,
+ kUnbox
+ };
- virtual bool getReference(const char* , size_t len, SkScriptValue2* result) { return false; }
- virtual SkOperand2::OpType getReturnType(size_t ref, SkOperand2*) {
- return SkOperand2::kS32; }
- virtual Type getType() const = 0;
+ virtual bool getReference(const char* , size_t len, SkScriptValue2* result) { return false; }
+ virtual SkOperand2::OpType getReturnType(size_t ref, SkOperand2*) {
+ return SkOperand2::kS32; }
+ virtual Type getType() const = 0;
};
class SkScriptCallBackConvert : public SkScriptCallBack {
public:
- virtual bool convert(SkOperand2::OpType type, SkOperand2* operand) = 0;
+ virtual bool convert(SkOperand2::OpType type, SkOperand2* operand) = 0;
};
class SkScriptCallBackFunction : public SkScriptCallBack {
public:
- virtual void getParamTypes(SkIntArray(SkOperand2::OpType)* types) = 0;
- virtual Type getType() const { return kFunction; }
- virtual bool invoke(size_t ref, SkOpArray* params, SkOperand2* value) = 0;
+ virtual void getParamTypes(SkIntArray(SkOperand2::OpType)* types) = 0;
+ virtual Type getType() const { return kFunction; }
+ virtual bool invoke(size_t ref, SkOpArray* params, SkOperand2* value) = 0;
};
class SkScriptCallBackMember: public SkScriptCallBack {
public:
- bool getMemberReference(const char* , size_t len, void* object, SkScriptValue2* ref);
- virtual Type getType() const { return kMember; }
- virtual bool invoke(size_t ref, void* object, SkOperand2* value) = 0;
+ bool getMemberReference(const char* , size_t len, void* object, SkScriptValue2* ref);
+ virtual Type getType() const { return kMember; }
+ virtual bool invoke(size_t ref, void* object, SkOperand2* value) = 0;
};
class SkScriptCallBackMemberFunction : public SkScriptCallBack {
public:
- bool getMemberReference(const char* , size_t len, void* object, SkScriptValue2* ref);
- virtual void getParamTypes(SkIntArray(SkOperand2::OpType)* types) = 0;
- virtual Type getType() const { return kMemberFunction; }
- virtual bool invoke(size_t ref, void* object, SkOpArray* params, SkOperand2* value) = 0;
+ bool getMemberReference(const char* , size_t len, void* object, SkScriptValue2* ref);
+ virtual void getParamTypes(SkIntArray(SkOperand2::OpType)* types) = 0;
+ virtual Type getType() const { return kMemberFunction; }
+ virtual bool invoke(size_t ref, void* object, SkOpArray* params, SkOperand2* value) = 0;
};
class SkScriptCallBackProperty : public SkScriptCallBack {
public:
- virtual bool getConstValue(const char* name, size_t len, SkOperand2* value) { return false; }
- virtual bool getResult(size_t ref, SkOperand2* answer) { return false; }
- virtual Type getType() const { return kProperty; }
+ virtual bool getConstValue(const char* name, size_t len, SkOperand2* value) { return false; }
+ virtual bool getResult(size_t ref, SkOperand2* answer) { return false; }
+ virtual Type getType() const { return kProperty; }
};
#endif // SkScriptCallBack_DEFINED
diff --git a/src/animator/SkScriptDecompile.cpp b/src/animator/SkScriptDecompile.cpp
index 26b678c79d..995da874cb 100644
--- a/src/animator/SkScriptDecompile.cpp
+++ b/src/animator/SkScriptDecompile.cpp
@@ -99,7 +99,7 @@ static const struct OperName {
OperandName(kString),
OperandName(kArray),
OperandName(kObject)
-};
+};
static size_t gOperandNamesSize = sizeof(gOperandNames) / sizeof(gOperandNames[0]);
@@ -135,7 +135,7 @@ void SkScriptEngine2::decompile(const unsigned char* start, size_t length) {
opCode += sizeof(index);
SkDebugf(" index: %d", index);
} break;
- case SkScriptEngine2::kFunctionCall:
+ case SkScriptEngine2::kFunctionCall:
case SkScriptEngine2::kMemberOp:
case SkScriptEngine2::kPropertyOp: {
size_t ref;
diff --git a/src/animator/SkScriptRuntime.cpp b/src/animator/SkScriptRuntime.cpp
index 6a96633ba1..b211a71c12 100644
--- a/src/animator/SkScriptRuntime.cpp
+++ b/src/animator/SkScriptRuntime.cpp
@@ -27,326 +27,326 @@
// replace script string with script tokens preceeded by special value
// need second version of script plugins that return private index of found value?
- // then would need in script index of plugin, private index
+ // then would need in script index of plugin, private index
// encode brace stack push/pop as opcodes
// should token script enocde type where possible?
// current flow:
- // strip whitespace
- // if in array brace [ recurse, continue
- // if token, handle function, or array, or property (continue)
- // parse number, continue
- // parse token, continue
- // parse string literal, continue
- // if dot operator, handle dot, continue
- // if [ , handle array literal or accessor, continue
- // if ), pop (if function, break)
- // if ], pop ; if ',' break
- // handle logical ops
- // or, handle arithmetic ops
- // loop
+ // strip whitespace
+ // if in array brace [ recurse, continue
+ // if token, handle function, or array, or property (continue)
+ // parse number, continue
+ // parse token, continue
+ // parse string literal, continue
+ // if dot operator, handle dot, continue
+ // if [ , handle array literal or accessor, continue
+ // if ), pop (if function, break)
+ // if ], pop ; if ',' break
+ // handle logical ops
+ // or, handle arithmetic ops
+ // loop
// !!! things to do
- // add separate processing loop to advance while suppressed
- // or, include jump offset to skip suppressed code?
+ // add separate processing loop to advance while suppressed
+ // or, include jump offset to skip suppressed code?
SkScriptRuntime::~SkScriptRuntime() {
- for (SkString** stringPtr = fTrackString.begin(); stringPtr < fTrackString.end(); stringPtr++)
- delete *stringPtr;
- for (SkOpArray** arrayPtr = fTrackArray.begin(); arrayPtr < fTrackArray.end(); arrayPtr++)
- delete *arrayPtr;
+ for (SkString** stringPtr = fTrackString.begin(); stringPtr < fTrackString.end(); stringPtr++)
+ delete *stringPtr;
+ for (SkOpArray** arrayPtr = fTrackArray.begin(); arrayPtr < fTrackArray.end(); arrayPtr++)
+ delete *arrayPtr;
}
bool SkScriptRuntime::executeTokens(unsigned char* opCode) {
- SkOperand2 operand[2]; // 1=accumulator and 2=operand
- SkScriptEngine2::TypeOp op;
- size_t ref;
- int index, size;
- int registerLoad;
- SkScriptCallBack* callBack SK_INIT_TO_AVOID_WARNING;
- do {
- switch ((op = (SkScriptEngine2::TypeOp) *opCode++)) {
- case SkScriptEngine2::kArrayToken: // create an array
- operand[0].fArray = new SkOpArray(SkOperand2::kNoType /*fReturnType*/);
- break;
- case SkScriptEngine2::kArrayIndex: // array accessor
- index = operand[1].fS32;
- if (index >= operand[0].fArray->count()) {
- fError = kArrayIndexOutOfBounds;
- return false;
- }
- operand[0] = operand[0].fArray->begin()[index];
- break;
- case SkScriptEngine2::kArrayParam: // array initializer, or function param
- *operand[0].fArray->append() = operand[1];
- break;
- case SkScriptEngine2::kCallback:
- memcpy(&index, opCode, sizeof(index));
- opCode += sizeof(index);
- callBack = fCallBackArray[index];
- break;
- case SkScriptEngine2::kFunctionCall: {
- memcpy(&ref, opCode, sizeof(ref));
- opCode += sizeof(ref);
- SkScriptCallBackFunction* callBackFunction = (SkScriptCallBackFunction*) callBack;
- if (callBackFunction->invoke(ref, operand[0].fArray, /* params */
- &operand[0] /* result */) == false) {
- fError = kFunctionCallFailed;
- return false;
- }
- } break;
- case SkScriptEngine2::kMemberOp: {
- memcpy(&ref, opCode, sizeof(ref));
- opCode += sizeof(ref);
- SkScriptCallBackMember* callBackMember = (SkScriptCallBackMember*) callBack;
- if (callBackMember->invoke(ref, operand[0].fObject, &operand[0]) == false) {
- fError = kMemberOpFailed;
- return false;
- }
- } break;
- case SkScriptEngine2::kPropertyOp: {
- memcpy(&ref, opCode, sizeof(ref));
- opCode += sizeof(ref);
- SkScriptCallBackProperty* callBackProperty = (SkScriptCallBackProperty*) callBack;
- if (callBackProperty->getResult(ref, &operand[0])== false) {
- fError = kPropertyOpFailed;
- return false;
- }
- } break;
- case SkScriptEngine2::kAccumulatorPop:
- fRunStack.pop(&operand[0]);
- break;
- case SkScriptEngine2::kAccumulatorPush:
- *fRunStack.push() = operand[0];
- break;
- case SkScriptEngine2::kIntegerAccumulator:
- case SkScriptEngine2::kIntegerOperand:
- registerLoad = op - SkScriptEngine2::kIntegerAccumulator;
- memcpy(&operand[registerLoad].fS32, opCode, sizeof(int32_t));
- opCode += sizeof(int32_t);
- break;
- case SkScriptEngine2::kScalarAccumulator:
- case SkScriptEngine2::kScalarOperand:
- registerLoad = op - SkScriptEngine2::kScalarAccumulator;
- memcpy(&operand[registerLoad].fScalar, opCode, sizeof(SkScalar));
- opCode += sizeof(SkScalar);
- break;
- case SkScriptEngine2::kStringAccumulator:
- case SkScriptEngine2::kStringOperand: {
- SkString* strPtr = new SkString();
- track(strPtr);
- registerLoad = op - SkScriptEngine2::kStringAccumulator;
- memcpy(&size, opCode, sizeof(size));
- opCode += sizeof(size);
- strPtr->set((char*) opCode, size);
- opCode += size;
- operand[registerLoad].fString = strPtr;
- } break;
- case SkScriptEngine2::kStringTrack: // call after kObjectToValue
- track(operand[0].fString);
- break;
- case SkScriptEngine2::kBoxToken: {
- SkOperand2::OpType type;
- memcpy(&type, opCode, sizeof(type));
- opCode += sizeof(type);
- SkScriptCallBackConvert* callBackBox = (SkScriptCallBackConvert*) callBack;
- if (callBackBox->convert(type, &operand[0]) == false)
- return false;
- } break;
- case SkScriptEngine2::kUnboxToken:
- case SkScriptEngine2::kUnboxToken2: {
- SkScriptCallBackConvert* callBackUnbox = (SkScriptCallBackConvert*) callBack;
- if (callBackUnbox->convert(SkOperand2::kObject, &operand[0]) == false)
- return false;
- } break;
- case SkScriptEngine2::kIfOp:
- case SkScriptEngine2::kLogicalAndInt:
- memcpy(&size, opCode, sizeof(size));
- opCode += sizeof(size);
- if (operand[0].fS32 == 0)
- opCode += size; // skip to else (or end of if predicate)
- break;
- case SkScriptEngine2::kElseOp:
- memcpy(&size, opCode, sizeof(size));
- opCode += sizeof(size);
- opCode += size; // if true: after predicate, always skip to end of else
- break;
- case SkScriptEngine2::kLogicalOrInt:
- memcpy(&size, opCode, sizeof(size));
- opCode += sizeof(size);
- if (operand[0].fS32 != 0)
- opCode += size; // skip to kToBool opcode after || predicate
- break;
- // arithmetic conversion ops
- case SkScriptEngine2::kFlipOpsOp:
- SkTSwap(operand[0], operand[1]);
- break;
- case SkScriptEngine2::kIntToString:
- case SkScriptEngine2::kIntToString2:
- case SkScriptEngine2::kScalarToString:
- case SkScriptEngine2::kScalarToString2:{
- SkString* strPtr = new SkString();
- track(strPtr);
- if (op == SkScriptEngine2::kIntToString || op == SkScriptEngine2::kIntToString2)
- strPtr->appendS32(operand[op - SkScriptEngine2::kIntToString].fS32);
- else
- strPtr->appendScalar(operand[op - SkScriptEngine2::kScalarToString].fScalar);
- operand[0].fString = strPtr;
- } break;
- case SkScriptEngine2::kIntToScalar:
- case SkScriptEngine2::kIntToScalar2:
- operand[0].fScalar = SkScriptEngine2::IntToScalar(operand[op - SkScriptEngine2::kIntToScalar].fS32);
- break;
- case SkScriptEngine2::kStringToInt:
- if (SkParse::FindS32(operand[0].fString->c_str(), &operand[0].fS32) == false)
- return false;
- break;
- case SkScriptEngine2::kStringToScalar:
- case SkScriptEngine2::kStringToScalar2:
- if (SkParse::FindScalar(operand[0].fString->c_str(),
- &operand[op - SkScriptEngine2::kStringToScalar].fScalar) == false)
- return false;
- break;
- case SkScriptEngine2::kScalarToInt:
- operand[0].fS32 = SkScalarFloor(operand[0].fScalar);
- break;
- // arithmetic ops
- case SkScriptEngine2::kAddInt:
- operand[0].fS32 += operand[1].fS32;
- break;
- case SkScriptEngine2::kAddScalar:
- operand[0].fScalar += operand[1].fScalar;
- break;
- case SkScriptEngine2::kAddString:
-// if (fTrackString.find(operand[1].fString) < 0) {
-// operand[1].fString = SkNEW_ARGS(SkString, (*operand[1].fString));
-// track(operand[1].fString);
-// }
- operand[0].fString->append(*operand[1].fString);
- break;
- case SkScriptEngine2::kBitAndInt:
- operand[0].fS32 &= operand[1].fS32;
- break;
- case SkScriptEngine2::kBitNotInt:
- operand[0].fS32 = ~operand[0].fS32;
- break;
- case SkScriptEngine2::kBitOrInt:
- operand[0].fS32 |= operand[1].fS32;
- break;
- case SkScriptEngine2::kDivideInt:
- SkASSERT(operand[1].fS32 != 0);
- if (operand[1].fS32 == 0)
- operand[0].fS32 = operand[0].fS32 == 0 ? SK_NaN32 :
- operand[0].fS32 > 0 ? SK_MaxS32 : -SK_MaxS32;
- else
- if (operand[1].fS32 != 0) // throw error on divide by zero?
- operand[0].fS32 /= operand[1].fS32;
- break;
- case SkScriptEngine2::kDivideScalar:
- if (operand[1].fScalar == 0)
- operand[0].fScalar = operand[0].fScalar == 0 ? SK_ScalarNaN :
- operand[0].fScalar > 0 ? SK_ScalarMax : -SK_ScalarMax;
- else
- operand[0].fScalar = SkScalarDiv(operand[0].fScalar, operand[1].fScalar);
- break;
- case SkScriptEngine2::kEqualInt:
- operand[0].fS32 = operand[0].fS32 == operand[1].fS32;
- break;
- case SkScriptEngine2::kEqualScalar:
- operand[0].fS32 = operand[0].fScalar == operand[1].fScalar;
- break;
- case SkScriptEngine2::kEqualString:
- operand[0].fS32 = *operand[0].fString == *operand[1].fString;
- break;
- case SkScriptEngine2::kGreaterEqualInt:
- operand[0].fS32 = operand[0].fS32 >= operand[1].fS32;
- break;
- case SkScriptEngine2::kGreaterEqualScalar:
- operand[0].fS32 = operand[0].fScalar >= operand[1].fScalar;
- break;
- case SkScriptEngine2::kGreaterEqualString:
- operand[0].fS32 = strcmp(operand[0].fString->c_str(), operand[1].fString->c_str()) >= 0;
- break;
- case SkScriptEngine2::kToBool:
- operand[0].fS32 = !! operand[0].fS32;
- break;
- case SkScriptEngine2::kLogicalNotInt:
- operand[0].fS32 = ! operand[0].fS32;
- break;
- case SkScriptEngine2::kMinusInt:
- operand[0].fS32 = -operand[0].fS32;
- break;
- case SkScriptEngine2::kMinusScalar:
- operand[0].fScalar = -operand[0].fScalar;
- break;
- case SkScriptEngine2::kModuloInt:
- operand[0].fS32 %= operand[1].fS32;
- break;
- case SkScriptEngine2::kModuloScalar:
- operand[0].fScalar = SkScalarMod(operand[0].fScalar, operand[1].fScalar);
- break;
- case SkScriptEngine2::kMultiplyInt:
- operand[0].fS32 *= operand[1].fS32;
- break;
- case SkScriptEngine2::kMultiplyScalar:
- operand[0].fScalar = SkScalarMul(operand[0].fScalar, operand[1].fScalar);
- break;
- case SkScriptEngine2::kShiftLeftInt:
- operand[0].fS32 <<= operand[1].fS32;
- break;
- case SkScriptEngine2::kShiftRightInt:
- operand[0].fS32 >>= operand[1].fS32;
- break;
- case SkScriptEngine2::kSubtractInt:
- operand[0].fS32 -= operand[1].fS32;
- break;
- case SkScriptEngine2::kSubtractScalar:
- operand[0].fScalar -= operand[1].fScalar;
- break;
- case SkScriptEngine2::kXorInt:
- operand[0].fS32 ^= operand[1].fS32;
- break;
- case SkScriptEngine2::kEnd:
- goto done;
- case SkScriptEngine2::kNop:
- SkASSERT(0);
+ SkOperand2 operand[2]; // 1=accumulator and 2=operand
+ SkScriptEngine2::TypeOp op;
+ size_t ref;
+ int index, size;
+ int registerLoad;
+ SkScriptCallBack* callBack SK_INIT_TO_AVOID_WARNING;
+ do {
+ switch ((op = (SkScriptEngine2::TypeOp) *opCode++)) {
+ case SkScriptEngine2::kArrayToken: // create an array
+ operand[0].fArray = new SkOpArray(SkOperand2::kNoType /*fReturnType*/);
+ break;
+ case SkScriptEngine2::kArrayIndex: // array accessor
+ index = operand[1].fS32;
+ if (index >= operand[0].fArray->count()) {
+ fError = kArrayIndexOutOfBounds;
+ return false;
+ }
+ operand[0] = operand[0].fArray->begin()[index];
+ break;
+ case SkScriptEngine2::kArrayParam: // array initializer, or function param
+ *operand[0].fArray->append() = operand[1];
+ break;
+ case SkScriptEngine2::kCallback:
+ memcpy(&index, opCode, sizeof(index));
+ opCode += sizeof(index);
+ callBack = fCallBackArray[index];
+ break;
+ case SkScriptEngine2::kFunctionCall: {
+ memcpy(&ref, opCode, sizeof(ref));
+ opCode += sizeof(ref);
+ SkScriptCallBackFunction* callBackFunction = (SkScriptCallBackFunction*) callBack;
+ if (callBackFunction->invoke(ref, operand[0].fArray, /* params */
+ &operand[0] /* result */) == false) {
+ fError = kFunctionCallFailed;
+ return false;
+ }
+ } break;
+ case SkScriptEngine2::kMemberOp: {
+ memcpy(&ref, opCode, sizeof(ref));
+ opCode += sizeof(ref);
+ SkScriptCallBackMember* callBackMember = (SkScriptCallBackMember*) callBack;
+ if (callBackMember->invoke(ref, operand[0].fObject, &operand[0]) == false) {
+ fError = kMemberOpFailed;
+ return false;
+ }
+ } break;
+ case SkScriptEngine2::kPropertyOp: {
+ memcpy(&ref, opCode, sizeof(ref));
+ opCode += sizeof(ref);
+ SkScriptCallBackProperty* callBackProperty = (SkScriptCallBackProperty*) callBack;
+ if (callBackProperty->getResult(ref, &operand[0])== false) {
+ fError = kPropertyOpFailed;
+ return false;
+ }
+ } break;
+ case SkScriptEngine2::kAccumulatorPop:
+ fRunStack.pop(&operand[0]);
+ break;
+ case SkScriptEngine2::kAccumulatorPush:
+ *fRunStack.push() = operand[0];
+ break;
+ case SkScriptEngine2::kIntegerAccumulator:
+ case SkScriptEngine2::kIntegerOperand:
+ registerLoad = op - SkScriptEngine2::kIntegerAccumulator;
+ memcpy(&operand[registerLoad].fS32, opCode, sizeof(int32_t));
+ opCode += sizeof(int32_t);
+ break;
+ case SkScriptEngine2::kScalarAccumulator:
+ case SkScriptEngine2::kScalarOperand:
+ registerLoad = op - SkScriptEngine2::kScalarAccumulator;
+ memcpy(&operand[registerLoad].fScalar, opCode, sizeof(SkScalar));
+ opCode += sizeof(SkScalar);
+ break;
+ case SkScriptEngine2::kStringAccumulator:
+ case SkScriptEngine2::kStringOperand: {
+ SkString* strPtr = new SkString();
+ track(strPtr);
+ registerLoad = op - SkScriptEngine2::kStringAccumulator;
+ memcpy(&size, opCode, sizeof(size));
+ opCode += sizeof(size);
+ strPtr->set((char*) opCode, size);
+ opCode += size;
+ operand[registerLoad].fString = strPtr;
+ } break;
+ case SkScriptEngine2::kStringTrack: // call after kObjectToValue
+ track(operand[0].fString);
+ break;
+ case SkScriptEngine2::kBoxToken: {
+ SkOperand2::OpType type;
+ memcpy(&type, opCode, sizeof(type));
+ opCode += sizeof(type);
+ SkScriptCallBackConvert* callBackBox = (SkScriptCallBackConvert*) callBack;
+ if (callBackBox->convert(type, &operand[0]) == false)
+ return false;
+ } break;
+ case SkScriptEngine2::kUnboxToken:
+ case SkScriptEngine2::kUnboxToken2: {
+ SkScriptCallBackConvert* callBackUnbox = (SkScriptCallBackConvert*) callBack;
+ if (callBackUnbox->convert(SkOperand2::kObject, &operand[0]) == false)
+ return false;
+ } break;
+ case SkScriptEngine2::kIfOp:
+ case SkScriptEngine2::kLogicalAndInt:
+ memcpy(&size, opCode, sizeof(size));
+ opCode += sizeof(size);
+ if (operand[0].fS32 == 0)
+ opCode += size; // skip to else (or end of if predicate)
+ break;
+ case SkScriptEngine2::kElseOp:
+ memcpy(&size, opCode, sizeof(size));
+ opCode += sizeof(size);
+ opCode += size; // if true: after predicate, always skip to end of else
+ break;
+ case SkScriptEngine2::kLogicalOrInt:
+ memcpy(&size, opCode, sizeof(size));
+ opCode += sizeof(size);
+ if (operand[0].fS32 != 0)
+ opCode += size; // skip to kToBool opcode after || predicate
+ break;
+ // arithmetic conversion ops
+ case SkScriptEngine2::kFlipOpsOp:
+ SkTSwap(operand[0], operand[1]);
+ break;
+ case SkScriptEngine2::kIntToString:
+ case SkScriptEngine2::kIntToString2:
+ case SkScriptEngine2::kScalarToString:
+ case SkScriptEngine2::kScalarToString2:{
+ SkString* strPtr = new SkString();
+ track(strPtr);
+ if (op == SkScriptEngine2::kIntToString || op == SkScriptEngine2::kIntToString2)
+ strPtr->appendS32(operand[op - SkScriptEngine2::kIntToString].fS32);
+ else
+ strPtr->appendScalar(operand[op - SkScriptEngine2::kScalarToString].fScalar);
+ operand[0].fString = strPtr;
+ } break;
+ case SkScriptEngine2::kIntToScalar:
+ case SkScriptEngine2::kIntToScalar2:
+ operand[0].fScalar = SkScriptEngine2::IntToScalar(operand[op - SkScriptEngine2::kIntToScalar].fS32);
+ break;
+ case SkScriptEngine2::kStringToInt:
+ if (SkParse::FindS32(operand[0].fString->c_str(), &operand[0].fS32) == false)
+ return false;
+ break;
+ case SkScriptEngine2::kStringToScalar:
+ case SkScriptEngine2::kStringToScalar2:
+ if (SkParse::FindScalar(operand[0].fString->c_str(),
+ &operand[op - SkScriptEngine2::kStringToScalar].fScalar) == false)
+ return false;
+ break;
+ case SkScriptEngine2::kScalarToInt:
+ operand[0].fS32 = SkScalarFloor(operand[0].fScalar);
+ break;
+ // arithmetic ops
+ case SkScriptEngine2::kAddInt:
+ operand[0].fS32 += operand[1].fS32;
+ break;
+ case SkScriptEngine2::kAddScalar:
+ operand[0].fScalar += operand[1].fScalar;
+ break;
+ case SkScriptEngine2::kAddString:
+// if (fTrackString.find(operand[1].fString) < 0) {
+// operand[1].fString = SkNEW_ARGS(SkString, (*operand[1].fString));
+// track(operand[1].fString);
+// }
+ operand[0].fString->append(*operand[1].fString);
+ break;
+ case SkScriptEngine2::kBitAndInt:
+ operand[0].fS32 &= operand[1].fS32;
+ break;
+ case SkScriptEngine2::kBitNotInt:
+ operand[0].fS32 = ~operand[0].fS32;
+ break;
+ case SkScriptEngine2::kBitOrInt:
+ operand[0].fS32 |= operand[1].fS32;
+ break;
+ case SkScriptEngine2::kDivideInt:
+ SkASSERT(operand[1].fS32 != 0);
+ if (operand[1].fS32 == 0)
+ operand[0].fS32 = operand[0].fS32 == 0 ? SK_NaN32 :
+ operand[0].fS32 > 0 ? SK_MaxS32 : -SK_MaxS32;
+ else
+ if (operand[1].fS32 != 0) // throw error on divide by zero?
+ operand[0].fS32 /= operand[1].fS32;
+ break;
+ case SkScriptEngine2::kDivideScalar:
+ if (operand[1].fScalar == 0)
+ operand[0].fScalar = operand[0].fScalar == 0 ? SK_ScalarNaN :
+ operand[0].fScalar > 0 ? SK_ScalarMax : -SK_ScalarMax;
+ else
+ operand[0].fScalar = SkScalarDiv(operand[0].fScalar, operand[1].fScalar);
+ break;
+ case SkScriptEngine2::kEqualInt:
+ operand[0].fS32 = operand[0].fS32 == operand[1].fS32;
+ break;
+ case SkScriptEngine2::kEqualScalar:
+ operand[0].fS32 = operand[0].fScalar == operand[1].fScalar;
+ break;
+ case SkScriptEngine2::kEqualString:
+ operand[0].fS32 = *operand[0].fString == *operand[1].fString;
+ break;
+ case SkScriptEngine2::kGreaterEqualInt:
+ operand[0].fS32 = operand[0].fS32 >= operand[1].fS32;
+ break;
+ case SkScriptEngine2::kGreaterEqualScalar:
+ operand[0].fS32 = operand[0].fScalar >= operand[1].fScalar;
+ break;
+ case SkScriptEngine2::kGreaterEqualString:
+ operand[0].fS32 = strcmp(operand[0].fString->c_str(), operand[1].fString->c_str()) >= 0;
+ break;
+ case SkScriptEngine2::kToBool:
+ operand[0].fS32 = !! operand[0].fS32;
+ break;
+ case SkScriptEngine2::kLogicalNotInt:
+ operand[0].fS32 = ! operand[0].fS32;
+ break;
+ case SkScriptEngine2::kMinusInt:
+ operand[0].fS32 = -operand[0].fS32;
+ break;
+ case SkScriptEngine2::kMinusScalar:
+ operand[0].fScalar = -operand[0].fScalar;
+ break;
+ case SkScriptEngine2::kModuloInt:
+ operand[0].fS32 %= operand[1].fS32;
+ break;
+ case SkScriptEngine2::kModuloScalar:
+ operand[0].fScalar = SkScalarMod(operand[0].fScalar, operand[1].fScalar);
+ break;
+ case SkScriptEngine2::kMultiplyInt:
+ operand[0].fS32 *= operand[1].fS32;
+ break;
+ case SkScriptEngine2::kMultiplyScalar:
+ operand[0].fScalar = SkScalarMul(operand[0].fScalar, operand[1].fScalar);
+ break;
+ case SkScriptEngine2::kShiftLeftInt:
+ operand[0].fS32 <<= operand[1].fS32;
+ break;
+ case SkScriptEngine2::kShiftRightInt:
+ operand[0].fS32 >>= operand[1].fS32;
+ break;
+ case SkScriptEngine2::kSubtractInt:
+ operand[0].fS32 -= operand[1].fS32;
+ break;
+ case SkScriptEngine2::kSubtractScalar:
+ operand[0].fScalar -= operand[1].fScalar;
+ break;
+ case SkScriptEngine2::kXorInt:
+ operand[0].fS32 ^= operand[1].fS32;
+ break;
+ case SkScriptEngine2::kEnd:
+ goto done;
+ case SkScriptEngine2::kNop:
+ SkASSERT(0);
default:
break;
- }
- } while (true);
+ }
+ } while (true);
done:
- fRunStack.push(operand[0]);
- return true;
+ fRunStack.push(operand[0]);
+ return true;
}
bool SkScriptRuntime::getResult(SkOperand2* result) {
- if (fRunStack.count() == 0)
- return false;
- fRunStack.pop(result);
- return true;
+ if (fRunStack.count() == 0)
+ return false;
+ fRunStack.pop(result);
+ return true;
}
-void SkScriptRuntime::track(SkOpArray* array) {
- SkASSERT(fTrackArray.find(array) < 0);
- *fTrackArray.append() = array;
+void SkScriptRuntime::track(SkOpArray* array) {
+ SkASSERT(fTrackArray.find(array) < 0);
+ *fTrackArray.append() = array;
}
-void SkScriptRuntime::track(SkString* string) {
- SkASSERT(fTrackString.find(string) < 0);
- *fTrackString.append() = string;
+void SkScriptRuntime::track(SkString* string) {
+ SkASSERT(fTrackString.find(string) < 0);
+ *fTrackString.append() = string;
}
void SkScriptRuntime::untrack(SkOpArray* array) {
- int index = fTrackArray.find(array);
- SkASSERT(index >= 0);
- fTrackArray.begin()[index] = NULL;
+ int index = fTrackArray.find(array);
+ SkASSERT(index >= 0);
+ fTrackArray.begin()[index] = NULL;
}
void SkScriptRuntime::untrack(SkString* string) {
- int index = fTrackString.find(string);
- SkASSERT(index >= 0);
- fTrackString.begin()[index] = NULL;
+ int index = fTrackString.find(string);
+ SkASSERT(index >= 0);
+ fTrackString.begin()[index] = NULL;
}
diff --git a/src/animator/SkScriptRuntime.h b/src/animator/SkScriptRuntime.h
index 7721bd2c3f..3e73801148 100644
--- a/src/animator/SkScriptRuntime.h
+++ b/src/animator/SkScriptRuntime.h
@@ -14,37 +14,37 @@
class SkScriptCallBack;
-typedef SkLongArray(SkString*) SkTDStringArray;
-typedef SkLongArray(SkScriptCallBack*) SkTDScriptCallBackArray;
+typedef SkLongArray(SkString*) SkTDStringArray;
+typedef SkLongArray(SkScriptCallBack*) SkTDScriptCallBackArray;
class SkScriptRuntime {
public:
- enum SkError {
- kNoError,
- kArrayIndexOutOfBounds,
- kCouldNotFindReferencedID,
- kFunctionCallFailed,
- kMemberOpFailed,
- kPropertyOpFailed
- };
+ enum SkError {
+ kNoError,
+ kArrayIndexOutOfBounds,
+ kCouldNotFindReferencedID,
+ kFunctionCallFailed,
+ kMemberOpFailed,
+ kPropertyOpFailed
+ };
- SkScriptRuntime(SkTDScriptCallBackArray& callBackArray) : fCallBackArray(callBackArray)
- { }
- ~SkScriptRuntime();
- bool executeTokens(unsigned char* opCode);
- bool getResult(SkOperand2* result);
- void untrack(SkOpArray* array);
- void untrack(SkString* string);
+ SkScriptRuntime(SkTDScriptCallBackArray& callBackArray) : fCallBackArray(callBackArray)
+ { }
+ ~SkScriptRuntime();
+ bool executeTokens(unsigned char* opCode);
+ bool getResult(SkOperand2* result);
+ void untrack(SkOpArray* array);
+ void untrack(SkString* string);
private:
- void track(SkOpArray* array);
- void track(SkString* string);
- SkTDScriptCallBackArray& fCallBackArray;
- SkError fError;
- SkTDStack<SkOperand2> fRunStack;
- SkLongArray(SkOpArray*) fTrackArray;
- SkTDStringArray fTrackString;
- // illegal
- SkScriptRuntime& operator=(const SkScriptRuntime&);
+ void track(SkOpArray* array);
+ void track(SkString* string);
+ SkTDScriptCallBackArray& fCallBackArray;
+ SkError fError;
+ SkTDStack<SkOperand2> fRunStack;
+ SkLongArray(SkOpArray*) fTrackArray;
+ SkTDStringArray fTrackString;
+ // illegal
+ SkScriptRuntime& operator=(const SkScriptRuntime&);
};
#endif // SkScriptRuntime_DEFINED
diff --git a/src/animator/SkScriptTokenizer.cpp b/src/animator/SkScriptTokenizer.cpp
index 90a50b6666..9547a988b2 100644
--- a/src/animator/SkScriptTokenizer.cpp
+++ b/src/animator/SkScriptTokenizer.cpp
@@ -17,31 +17,31 @@
const SkScriptEngine2::OperatorAttributes SkScriptEngine2::gOpAttributes[] = {
{ SkOperand2::kNoType, SkOperand2::kNoType, kNoBias, kResultIsNotBoolean },
-{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar | SkOperand2::kString),
+{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar | SkOperand2::kString),
SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar | SkOperand2::kString), kTowardsString, kResultIsNotBoolean }, // kAdd
{ SkOperand2::kS32, SkOperand2::kS32, kNoBias, kResultIsNotBoolean }, // kBitAnd
{ SkOperand2::kNoType, SkOperand2::kS32, kNoBias, kResultIsNotBoolean }, // kBitNot
{ SkOperand2::kS32, SkOperand2::kS32, kNoBias, kResultIsNotBoolean }, // kBitOr
-{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar),
+{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar),
SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar), kNoBias, kResultIsNotBoolean }, // kDivide
-{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar | SkOperand2::kString),
- SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar |SkOperand2:: kString), kTowardsNumber,
+{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar | SkOperand2::kString),
+ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar |SkOperand2:: kString), kTowardsNumber,
kResultIsBoolean }, // kEqual
{ SkOperand2::kS32, SkOperand2::kNoType, kNoBias, kResultIsNotBoolean }, // kFlipOps
-{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar | SkOperand2::kString),
+{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar | SkOperand2::kString),
SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar | SkOperand2::kString), kTowardsNumber,
kResultIsBoolean }, // kGreaterEqual
{ SkOperand2::kNoType, SkOperand2::kS32, kNoBias, kResultIsNotBoolean }, // kLogicalAnd (really, ToBool)
{ SkOperand2::kNoType, SkOperand2::kS32, kNoBias, kResultIsNotBoolean }, // kLogicalNot
{ SkOperand2::kS32, SkOperand2::kS32, kNoBias, kResultIsNotBoolean }, // kLogicalOr
{ SkOperand2::kNoType, SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar), kNoBias, kResultIsNotBoolean }, // kMinus
-{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar),
+{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar),
SkOperand2::OpType(SkOperand2::kS32 |SkOperand2:: kScalar), kNoBias, kResultIsNotBoolean }, // kModulo
-{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar),
+{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar),
SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar), kNoBias, kResultIsNotBoolean }, // kMultiply
{ SkOperand2::kS32, SkOperand2::kS32, kNoBias, kResultIsNotBoolean }, // kShiftLeft
{ SkOperand2::kS32, SkOperand2::kS32, kNoBias, kResultIsNotBoolean }, // kShiftRight
-{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar),
+{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar),
SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar), kNoBias, kResultIsNotBoolean }, // kSubtract
{ SkOperand2::kS32, SkOperand2::kS32, kNoBias, kResultIsNotBoolean } // kXor
};
@@ -120,7 +120,7 @@ static int token_length(const char* start) {
}
SkScriptEngine2::SkScriptEngine2(SkOperand2::OpType returnType) : fActiveStream(&fStream),
-fTokenLength(0), fReturnType(returnType), fError(kNoError),
+fTokenLength(0), fReturnType(returnType), fError(kNoError),
fAccumulatorType(SkOperand2::kNoType),
fBranchPopAllowed(true), fConstExpression(true), fOperandInUse(false)
{
@@ -151,7 +151,7 @@ void SkScriptEngine2::addToken(SkScriptEngine2::TypeOp op) {
fActiveStream->write(&charOp, sizeof(charOp));
}
-void SkScriptEngine2::addTokenConst(SkScriptValue2* value, AddTokenRegister reg,
+void SkScriptEngine2::addTokenConst(SkScriptValue2* value, AddTokenRegister reg,
SkOperand2::OpType toType, SkScriptEngine2::TypeOp op) {
if (value->fIsConstant == SkScriptValue2::kConstant && convertTo(toType, value))
return;
@@ -243,7 +243,7 @@ int SkScriptEngine2::arithmeticOp(char ch, char nextChar, bool lastPush) {
if (nextChar == '>') {
op = kShiftRight;
goto twoChar;
- }
+ }
op = kGreaterEqual;
if (nextChar == '=')
goto twoChar;
@@ -272,7 +272,7 @@ int SkScriptEngine2::arithmeticOp(char ch, char nextChar, bool lastPush) {
twoChar:
advance++;
break;
- }
+ }
op = kLogicalNot;
break;
case '?':
@@ -316,7 +316,7 @@ twoChar:
} while (true);
signed char topPrecedence = gPrecedence[compare];
SkASSERT(topPrecedence != -1);
- if (topPrecedence > precedence || (topPrecedence == precedence &&
+ if (topPrecedence > precedence || (topPrecedence == precedence &&
gOpAttributes[op].fLeftType == SkOperand2::kNoType)) {
break;
}
@@ -331,14 +331,14 @@ twoChar:
return advance;
}
-bool SkScriptEngine2::convertParams(SkTDArray<SkScriptValue2>* params,
+bool SkScriptEngine2::convertParams(SkTDArray<SkScriptValue2>* params,
const SkOperand2::OpType* paramTypes, int paramCount) {
int count = params->count();
if (count > paramCount) {
SkASSERT(0);
return false; // too many parameters passed
}
- for (int index = 0; index < count; index++)
+ for (int index = 0; index < count; index++)
convertTo(paramTypes[index], &(*params)[index]);
return true;
}
@@ -355,7 +355,7 @@ bool SkScriptEngine2::convertTo(SkOperand2::OpType toType, SkScriptValue2* value
return ConvertTo(this, toType, value);
}
-bool SkScriptEngine2::evaluateDot(const char*& script) {
+bool SkScriptEngine2::evaluateDot(const char*& script) {
size_t fieldLength = token_length(++script); // skip dot
SkASSERT(fieldLength > 0); // !!! add error handling
const char* field = script;
@@ -370,14 +370,14 @@ error:
return false;
}
-bool SkScriptEngine2::evaluateDotParam(const char*& script, const char* field, size_t fieldLength) {
+bool SkScriptEngine2::evaluateDotParam(const char*& script, const char* field, size_t fieldLength) {
SkScriptValue2& top = fValueStack.top();
if (top.fType != SkOperand2::kObject)
return false;
void* object = top.fOperand.fObject;
fValueStack.pop();
char ch; // see if it is a simple member or a function
- while (is_ws(ch = script[0]))
+ while (is_ws(ch = script[0]))
script++;
bool success = true;
if (ch != '(')
@@ -389,7 +389,7 @@ bool SkScriptEngine2::evaluateDotParam(const char*& script, const char* field, s
if (success)
success = handleMemberFunction(field, fieldLength, object, &params);
}
- return success;
+ return success;
}
bool SkScriptEngine2::evaluateScript(const char** scriptPtr, SkScriptValue2* value) {
@@ -492,7 +492,7 @@ bool SkScriptEngine2::innerScript(const char** scriptPtr, SkScriptValue2* value)
{
SkOperand2::OpType type = fReturnType;
if (fReturnType == SkOperand2::kNoType) {
- // !!! short sighted; in the future, allow each returned array component to carry
+ // !!! short sighted; in the future, allow each returned array component to carry
// its own type, and let caller do any needed conversions
if (value->fOperand.fArray->count() == 0)
value->fOperand.fArray->setType(type = tokenValue.fType);
@@ -513,7 +513,7 @@ bool SkScriptEngine2::innerScript(const char** scriptPtr, SkScriptValue2* value)
if (ch == '(') {
*fBraceStack.push() = kFunctionBrace;
SkString functionName(fToken, fTokenLength);
-
+
if (handleFunction(&script) == false)
return false;
lastPush = true;
@@ -611,7 +611,7 @@ scalarCommon:
SkASSERT(fValueStack.count() > 0); // !!! add error handling
SkScriptValue2 top;
fValueStack.pop(&top);
-
+
addTokenInt(top.fType);
addToken(kBoxToken);
top.fType = SkOperand2::kObject;
@@ -621,7 +621,7 @@ scalarCommon:
success = evaluateDotParam(script, token, tokenLength);
SkASSERT(success);
lastPush = true;
- continue;
+ continue;
}
// get next token, and evaluate immediately
success = evaluateDot(script);
@@ -638,7 +638,7 @@ scalarCommon:
*fBraceStack.push() = kArrayBrace;
operand.fOperand.fArray = value->fOperand.fArray = new SkOpArray(fReturnType);
track(value->fOperand.fArray);
-
+
operand.fType = SkOperand2::kArray;
operand.fIsConstant = SkScriptValue2::kVariable;
fValueStack.push(operand);
@@ -663,7 +663,7 @@ scalarCommon:
}
#endif
if (ch == ')' && fBraceStack.count() > 0) {
- BraceStyle braceStyle = fBraceStack.top();
+ BraceStyle braceStyle = fBraceStack.top();
if (braceStyle == kFunctionBrace) {
fBraceStack.pop();
break;
@@ -681,7 +681,7 @@ scalarCommon:
}
char nextChar = script[1];
int advance = logicalOp(ch, nextChar);
- if (advance == 0)
+ if (advance == 0)
advance = arithmeticOp(ch, nextChar, lastPush);
if (advance == 0) // unknown token
return false;
@@ -760,7 +760,7 @@ scalarCommon:
if (fValueStack.count() == 0)
return false;
fValueStack.pop(value);
- if (value->fType != fReturnType && value->fType == SkOperand2::kObject &&
+ if (value->fType != fReturnType && value->fType == SkOperand2::kObject &&
fReturnType != SkOperand2::kNoType)
convertTo(fReturnType, value);
}
@@ -850,7 +850,7 @@ done:
return success;
}
-bool SkScriptEngine2::handleMemberFunction(const char* field, size_t len, void* object,
+bool SkScriptEngine2::handleMemberFunction(const char* field, size_t len, void* object,
SkTDArray<SkScriptValue2>* params) {
bool success = true;
for (SkScriptCallBack** callBack = fCallBackArray.begin(); callBack < fCallBackArray.end(); callBack++) {
@@ -980,13 +980,13 @@ void SkScriptEngine2::processLogicalOp(Op op) {
case kParen:
case kArrayOp:
SkASSERT(fOpStack.count() > 1 && fOpStack.top() == op); // !!! add error handling
- if (op == kParen)
+ if (op == kParen)
fOpStack.pop();
else {
SkScriptValue2 value;
fValueStack.pop(&value);
SkASSERT(value.fType == SkOperand2::kS32 || value.fType == SkOperand2::kScalar); // !!! add error handling (although, could permit strings eventually)
- int index = value.fType == SkOperand2::kScalar ? SkScalarFloor(value.fOperand.fScalar) :
+ int index = value.fType == SkOperand2::kScalar ? SkScalarFloor(value.fOperand.fScalar) :
value.fOperand.fS32;
SkScriptValue2 arrayValue;
fValueStack.pop(&arrayValue);
@@ -1046,7 +1046,7 @@ void SkScriptEngine2::processLogicalOp(Op op) {
// if 'or', write bne goto to bool
addToken(op == kLogicalAnd ? kLogicalAndInt : kLogicalOrInt);
Branch branch(op, fOpStack.count(), getTokenOffset());
- addTokenInt(0); // placeholder for future branch
+ addTokenInt(0); // placeholder for future branch
oldTop.fPrimed = wasPrime;
oldTop.fDone = wasDone;
*fBranchStack.push() = branch;
@@ -1073,7 +1073,7 @@ bool SkScriptEngine2::processOp() {
bool constantOperands = value2.fIsConstant == SkScriptValue2::kConstant;
if (attributes->fLeftType != SkOperand2::kNoType) {
fValueStack.pop(&value1);
- constantOperands &= value1.fIsConstant == SkScriptValue2::kConstant;
+ constantOperands &= value1.fIsConstant == SkScriptValue2::kConstant;
value1.fIsWritten = SkScriptValue2::kUnwritten;
if (op == kFlipOps) {
SkTSwap(value1, value2);
@@ -1094,17 +1094,17 @@ bool SkScriptEngine2::processOp() {
}
if (attributes->fLeftType != SkOperand2::kNoType) {
if (value1.fType != value2.fType) {
- if ((attributes->fLeftType & SkOperand2::kString) && attributes->fBias & kTowardsString &&
+ if ((attributes->fLeftType & SkOperand2::kString) && attributes->fBias & kTowardsString &&
((value1.fType | value2.fType) & SkOperand2::kString)) {
if (value1.fType == SkOperand2::kS32 || value1.fType == SkOperand2::kScalar) {
- addTokenConst(&value1, kAccumulator, SkOperand2::kString,
+ addTokenConst(&value1, kAccumulator, SkOperand2::kString,
value1.fType == SkOperand2::kS32 ? kIntToString : kScalarToString);
}
if (value2.fType == SkOperand2::kS32 || value2.fType == SkOperand2::kScalar) {
- addTokenConst(&value2, kOperand, SkOperand2::kString,
+ addTokenConst(&value2, kOperand, SkOperand2::kString,
value2.fType == SkOperand2::kS32 ? kIntToString2 : kScalarToString2);
}
- } else if (attributes->fLeftType & SkOperand2::kScalar && ((value1.fType | value2.fType) &
+ } else if (attributes->fLeftType & SkOperand2::kScalar && ((value1.fType | value2.fType) &
SkOperand2::kScalar)) {
if (value1.fType == SkOperand2::kS32)
addTokenConst(&value1, kAccumulator, SkOperand2::kScalar, kIntToScalar);
@@ -1115,7 +1115,7 @@ bool SkScriptEngine2::processOp() {
if ((value1.fType & attributes->fLeftType) == 0 || value1.fType != value2.fType) {
if (value1.fType == SkOperand2::kString)
addTokenConst(&value1, kAccumulator, SkOperand2::kScalar, kStringToScalar);
- if (value1.fType == SkOperand2::kScalar && (attributes->fLeftType == SkOperand2::kS32 ||
+ if (value1.fType == SkOperand2::kScalar && (attributes->fLeftType == SkOperand2::kS32 ||
value2.fType == SkOperand2::kS32))
addTokenConst(&value1, kAccumulator, SkOperand2::kS32, kScalarToInt);
}
@@ -1125,7 +1125,7 @@ bool SkScriptEngine2::processOp() {
if ((value2.fType & attributes->fRightType) == 0 || value1.fType != value2.fType) {
if (value2.fType == SkOperand2::kString)
addTokenConst(&value2, rhRegister, SkOperand2::kScalar, kStringToScalar2);
- if (value2.fType == SkOperand2::kScalar && (attributes->fRightType == SkOperand2::kS32 ||
+ if (value2.fType == SkOperand2::kScalar && (attributes->fRightType == SkOperand2::kS32 ||
value1.fType == SkOperand2::kS32))
addTokenConst(&value2, rhRegister, SkOperand2::kS32, kScalarToInt2);
}
@@ -1154,7 +1154,7 @@ bool SkScriptEngine2::processOp() {
if (constantOperands) {
addToken(kEnd);
SkAutoDataUnref data(fStream.copyToData());
-#ifdef SK_DEBUG
+#ifdef SK_DEBUG
decompile(data->bytes(), data->size());
#endif
SkScriptRuntime runtime(fCallBackArray);
@@ -1195,7 +1195,7 @@ void SkScriptEngine2::resolveBranch(SkScriptEngine2::Branch& branch) {
bool SkScriptEngine2::ConvertTo(SkScriptEngine2* engine, SkOperand2::OpType toType, SkScriptValue2* value ) {
SkASSERT(value);
SkOperand2::OpType type = value->fType;
- if (type == toType)
+ if (type == toType)
return true;
SkOperand2& operand = value->fOperand;
bool success = true;
@@ -1288,18 +1288,18 @@ bool SkScriptEngine2::ValueToString(const SkScriptValue2& value, SkString* strin
static const SkScriptNAnswer2 scriptTests[] = {
testInt(1||(0&&3)),
testScalar(- -5.5- -1.5),
- testScalar(1.0+5),
+ testScalar(1.0+5),
testInt((6+7)*8),
testInt(3*(4+5)),
testScalar(1.0+2.0),
- testScalar(3.0-1.0),
- testScalar(6-1.0),
- testScalar(2.5*6.),
- testScalar(0.5*4),
- testScalar(4.5/.5),
- testScalar(9.5/19),
- testRemainder(9.5, 0.5),
- testRemainder(9.,2),
+ testScalar(3.0-1.0),
+ testScalar(6-1.0),
+ testScalar(2.5*6.),
+ testScalar(0.5*4),
+ testScalar(4.5/.5),
+ testScalar(9.5/19),
+ testRemainder(9.5, 0.5),
+ testRemainder(9.,2),
testRemainder(9,2.5),
testRemainder(-9,2.5),
testTrue(-9==-9.0),
diff --git a/src/animator/SkTDArray_Experimental.h b/src/animator/SkTDArray_Experimental.h
index e598a6dad6..094d106bb6 100644
--- a/src/animator/SkTDArray_Experimental.h
+++ b/src/animator/SkTDArray_Experimental.h
@@ -38,9 +38,9 @@ protected:
int32_t* append() { return this->append(1, NULL); }
int32_t* append(U16CPU count, const int32_t* src = NULL);
- int32_t* appendClear()
- {
- int32_t* result = this->append();
+ int32_t* appendClear()
+ {
+ int32_t* result = this->append();
*result = 0;
return result;
}
@@ -108,9 +108,9 @@ public:
SkTDS32Array(const SkTDS32Array<T>& src) : SkDS32Array(src) {}
~SkTDS32Array() { sk_free(fArray); }
T& operator[](int index) const { SYNC(); SkASSERT((unsigned)index < fCount); return ((T*) fArray)[index]; }
- SkTDS32Array<T>& operator=(const SkTDS32Array<T>& src) {
+ SkTDS32Array<T>& operator=(const SkTDS32Array<T>& src) {
return (SkTDS32Array<T>&) SkDS32Array::operator=(src); }
- friend int operator==(const SkTDS32Array<T>& a, const SkTDS32Array<T>& b) {
+ friend int operator==(const SkTDS32Array<T>& a, const SkTDS32Array<T>& b) {
return operator==((const SkDS32Array&) a, (const SkDS32Array&) b); }
T* append() { return (T*) SkDS32Array::append(); }
T* appendClear() { return (T*) SkDS32Array::appendClear(); }
diff --git a/src/animator/SkTextOnPath.cpp b/src/animator/SkTextOnPath.cpp
index e7f7651fad..7bdb7fd977 100644
--- a/src/animator/SkTextOnPath.cpp
+++ b/src/animator/SkTextOnPath.cpp
@@ -33,7 +33,7 @@ bool SkTextOnPath::draw(SkAnimateMaker& maker) {
SkASSERT(text);
SkASSERT(path);
SkBoundableAuto boundable(this, maker);
- maker.fCanvas->drawTextOnPathHV(text->getText(), text->getSize(),
+ maker.fCanvas->drawTextOnPathHV(text->getText(), text->getSize(),
path->getPath(), offset, 0, *maker.fPaint);
return false;
}
diff --git a/src/animator/SkTextToPath.cpp b/src/animator/SkTextToPath.cpp
index cf78ff5d95..b38daff7ec 100644
--- a/src/animator/SkTextToPath.cpp
+++ b/src/animator/SkTextToPath.cpp
@@ -42,7 +42,7 @@ void SkTextToPath::onEndElement(SkAnimateMaker& maker) {
}
SkPaint realPaint;
paint->setupPaint(&realPaint);
- realPaint.getTextPath(text->getText(), text->getSize(), text->x,
+ realPaint.getTextPath(text->getText(), text->getSize(), text->x,
text->y, &path->getPath());
}
diff --git a/src/animator/SkTime.cpp b/src/animator/SkTime.cpp
index 35c7eb8f84..06ad9bd44b 100644
--- a/src/animator/SkTime.cpp
+++ b/src/animator/SkTime.cpp
@@ -51,7 +51,7 @@ void SkTime::GetDateTime(DateTime* t)
{
tm syst;
time_t tm;
-
+
time(&tm);
localtime_r(&tm, &syst);
t->fYear = SkToU16(syst.tm_year);
diff --git a/src/animator/SkTypedArray.h b/src/animator/SkTypedArray.h
index 222c8df667..e93b106702 100644
--- a/src/animator/SkTypedArray.h
+++ b/src/animator/SkTypedArray.h
@@ -20,7 +20,7 @@ public:
bool getIndex(int index, SkOperand* operand);
SkDisplayTypes getType() { return fType; }
SkScriptEngine::SkOpType getOpType() { return SkScriptEngine::ToOpType(fType); }
- void setType(SkDisplayTypes type) {
+ void setType(SkDisplayTypes type) {
// SkASSERT(count() == 0);
fType = type;
}
diff --git a/src/gpu/GrAAHairLinePathRenderer.h b/src/gpu/GrAAHairLinePathRenderer.h
index cf8b8d3037..c04d0626ca 100644
--- a/src/gpu/GrAAHairLinePathRenderer.h
+++ b/src/gpu/GrAAHairLinePathRenderer.h
@@ -28,7 +28,7 @@ protected:
const GrVec* translate,
GrDrawTarget* target,
bool antiAlias) SK_OVERRIDE;
-
+
private:
GrAAHairLinePathRenderer(const GrContext* context,
diff --git a/src/gpu/GrAARectRenderer.cpp b/src/gpu/GrAARectRenderer.cpp
index 652adcb47c..36f37abf40 100644
--- a/src/gpu/GrAARectRenderer.cpp
+++ b/src/gpu/GrAARectRenderer.cpp
@@ -88,7 +88,7 @@ int GrAARectRenderer::aaStrokeRectIndexCount() {
GrIndexBuffer* GrAARectRenderer::aaStrokeRectIndexBuffer(GrGpu* gpu) {
if (NULL == fAAStrokeRectIndexBuffer) {
- fAAStrokeRectIndexBuffer =
+ fAAStrokeRectIndexBuffer =
gpu->createIndexBuffer(sizeof(gStrokeAARectIdx), false);
if (NULL != fAAStrokeRectIndexBuffer) {
#if GR_DEBUG
diff --git a/src/gpu/GrAllocator.h b/src/gpu/GrAllocator.h
index ae456cd170..dc4c3de281 100755
--- a/src/gpu/GrAllocator.h
+++ b/src/gpu/GrAllocator.h
@@ -55,8 +55,8 @@ public:
} else if (fOwnFirstBlock) {
fBlocks[0] = GrMalloc(fBlockSize);
}
- }
- void* ret = (char*)fBlocks[fCount/fItemsPerBlock] +
+ }
+ void* ret = (char*)fBlocks[fCount/fItemsPerBlock] +
fItemSize * indexInBlock;
++fCount;
return ret;
@@ -65,8 +65,8 @@ public:
/**
* removes all added items
*/
- void reset() {
- int blockCount = GrMax((unsigned)1,
+ void reset() {
+ int blockCount = GrMax((unsigned)1,
GrUIDivRoundUp(fCount, fItemsPerBlock));
for (int i = 1; i < blockCount; ++i) {
GrFree(fBlocks[i]);
@@ -85,12 +85,12 @@ public:
int count() const {
return fCount;
}
-
+
/**
* is the count 0
*/
bool empty() const { return fCount == 0; }
-
+
/**
* access last item, only call if count() != 0
*/
@@ -98,7 +98,7 @@ public:
GrAssert(fCount);
return (*this)[fCount-1];
}
-
+
/**
* access last item, only call if count() != 0
*/
@@ -106,28 +106,28 @@ public:
GrAssert(fCount);
return (*this)[fCount-1];
}
-
+
/**
* access item by index.
- */
+ */
void* operator[] (int i) {
GrAssert(i >= 0 && i < fCount);
- return (char*)fBlocks[i / fItemsPerBlock] +
+ return (char*)fBlocks[i / fItemsPerBlock] +
fItemSize * (i % fItemsPerBlock);
}
/**
* access item by index.
- */
+ */
const void* operator[] (int i) const {
GrAssert(i >= 0 && i < fCount);
- return (const char*)fBlocks[i / fItemsPerBlock] +
+ return (const char*)fBlocks[i / fItemsPerBlock] +
fItemSize * (i % fItemsPerBlock);
}
private:
static const int NUM_INIT_BLOCK_PTRS = 8;
-
+
SkSTArray<NUM_INIT_BLOCK_PTRS, void*> fBlocks;
size_t fBlockSize;
size_t fItemSize;
@@ -184,19 +184,19 @@ public:
}
fAllocator.reset();
}
-
+
/**
* count of items
*/
int count() const {
return fAllocator.count();
}
-
+
/**
* is the count 0
*/
bool empty() const { return fAllocator.empty(); }
-
+
/**
* access last item, only call if count() != 0
*/
@@ -213,11 +213,11 @@ public:
/**
* access item by index.
- */
+ */
T& operator[] (int i) {
return *(T*)(fAllocator[i]);
}
-
+
/**
* access item by index.
*/
diff --git a/src/gpu/GrClipMaskManager.h b/src/gpu/GrClipMaskManager.h
index 1187a0816c..fe56ded5fa 100644
--- a/src/gpu/GrClipMaskManager.h
+++ b/src/gpu/GrClipMaskManager.h
@@ -216,7 +216,7 @@ private:
}
void acquireMask(GrContext* context,
- const SkClipStack& clip,
+ const SkClipStack& clip,
const GrTextureDesc& desc,
const GrIRect& bound) {
@@ -237,11 +237,11 @@ private:
}
SkClipStack fLastClip;
- // The mask's width & height values are used in setupDrawStateAAClip to
+ // The mask's width & height values are used in setupDrawStateAAClip to
// correctly scale the uvs for geometry drawn with this mask
GrAutoScratchTexture fLastMask;
- // fLastBound stores the bounding box of the clip mask in canvas
- // space. The left and top fields are used to offset the uvs for
+ // fLastBound stores the bounding box of the clip mask in canvas
+ // space. The left and top fields are used to offset the uvs for
// geometry drawn with this mask (in setupDrawStateAAClip)
GrIRect fLastBound;
};
@@ -253,9 +253,9 @@ private:
};
/**
- * The clip mask creator handles the generation of the clip mask. If anti
- * aliasing is requested it will (in the future) generate a single channel
- * (8bit) mask. If no anti aliasing is requested it will generate a 1-bit
+ * The clip mask creator handles the generation of the clip mask. If anti
+ * aliasing is requested it will (in the future) generate a single channel
+ * (8bit) mask. If no anti aliasing is requested it will generate a 1-bit
* mask in the stencil buffer. In the non anti-aliasing case, if the clip
* mask can be represented as a rectangle then scissoring is used. In all
* cases scissoring is used to bound the range of the clip mask.
@@ -299,7 +299,7 @@ public:
return fAACache.getContext();
}
- void setGpu(GrGpu* gpu) {
+ void setGpu(GrGpu* gpu) {
fGpu = gpu;
}
@@ -330,7 +330,7 @@ private:
kStencil_ClipMaskType,
kAlpha_ClipMaskType,
} fCurrClipMaskType;
-
+
GrClipMaskCache fAACache; // cache for the AA path
bool createStencilClipMask(const GrClipData& clipDataIn,
@@ -356,7 +356,7 @@ private:
void getTemp(const GrIRect& bounds, GrAutoScratchTexture* temp);
- void setupCache(const SkClipStack& clip,
+ void setupCache(const SkClipStack& clip,
const GrIRect& bounds);
/**
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index cc68aede70..1db2e4afa3 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -24,7 +24,7 @@
class GrDrawState : public GrRefCnt {
public:
SK_DECLARE_INST_COUNT(GrDrawState)
-
+
/**
* Number of texture stages. Each stage takes as input a color and
* 2D texture coordinates. The color input to the first enabled stage is the
@@ -40,8 +40,8 @@ public:
* or not.
*
* Stages 0 through GrPaint::kTotalStages-1 are reserved for setting up
- * the draw (i.e., textures and filter masks). Stages GrPaint::kTotalStages
- * through kNumStages-1 are earmarked for use by GrTextContext and
+ * the draw (i.e., textures and filter masks). Stages GrPaint::kTotalStages
+ * through kNumStages-1 are earmarked for use by GrTextContext and
* GrPathRenderer-derived classes.
*/
enum {
@@ -49,13 +49,13 @@ public:
kMaxTexCoords = kNumStages
};
- GrDrawState()
+ GrDrawState()
: fRenderTarget(NULL) {
this->reset();
}
- GrDrawState(const GrDrawState& state)
+ GrDrawState(const GrDrawState& state)
: fRenderTarget(NULL) {
*this = state;
@@ -70,7 +70,7 @@ public:
* Resets to the default state.
* Sampler states *will* be modified: textures or CustomStage objects
* will be released.
- */
+ */
void reset() {
this->disableStages();
@@ -147,7 +147,7 @@ public:
////
/**
- * Sets a constant fractional coverage to be applied to the draw. The
+ * Sets a constant fractional coverage to be applied to the draw. The
* initial value (after construction or reset()) is 0xff. The constant
* coverage is ignored when per-vertex coverage is provided.
*/
@@ -280,22 +280,22 @@ public:
/**
* A common pattern is to compute a color with the initial stages and then
* modulate that color by a coverage value in later stage(s) (AA, mask-
- * filters, glyph mask, etc). Color-filters, xfermodes, etc should be
- * computed based on the pre-coverage-modulated color. The division of
- * stages between color-computing and coverage-computing is specified by
+ * filters, glyph mask, etc). Color-filters, xfermodes, etc should be
+ * computed based on the pre-coverage-modulated color. The division of
+ * stages between color-computing and coverage-computing is specified by
* this method. Initially this is kNumStages (all stages
* are color-computing).
*/
void setFirstCoverageStage(int firstCoverageStage) {
GrAssert((unsigned)firstCoverageStage <= kNumStages);
- fFirstCoverageStage = firstCoverageStage;
+ fFirstCoverageStage = firstCoverageStage;
}
/**
* Gets the index of the first coverage-computing stage.
*/
int getFirstCoverageStage() const {
- return fFirstCoverageStage;
+ return fFirstCoverageStage;
}
///@}
@@ -495,7 +495,7 @@ public:
*
* @param target The render target to set.
*/
- void setRenderTarget(GrRenderTarget* target) {
+ void setRenderTarget(GrRenderTarget* target) {
GrSafeAssign(fRenderTarget, target);
}
@@ -607,7 +607,7 @@ public:
/* 1-pixel wide line
2D implicit line eq (a*x + b*y +c = 0). 4th component unused */
kHairLine_EdgeType,
- /* Quadratic specified by u^2-v canonical coords (only 2
+ /* Quadratic specified by u^2-v canonical coords (only 2
components used). Coverage based on signed distance with negative
being inside, positive outside. Edge specified in window space
(y-down) */
@@ -623,7 +623,7 @@ public:
};
/**
- * Determines the interpretation per-vertex edge data when the
+ * Determines the interpretation per-vertex edge data when the
* kEdge_VertexLayoutBit is set (see GrDrawTarget). When per-vertex edges
* are not specified the value of this setting has no effect.
*/
@@ -753,7 +753,7 @@ public:
* @return the current draw face(s).
*/
DrawFace getDrawFace() const { return fDrawFace; }
-
+
/// @}
///////////////////////////////////////////////////////////////////////////
@@ -795,7 +795,7 @@ public:
}
bool operator !=(const GrDrawState& s) const { return !(*this == s); }
- // Most stages are usually not used, so conditionals here
+ // Most stages are usually not used, so conditionals here
// reduce the expected number of bytes touched by 50%.
GrDrawState& operator =(const GrDrawState& s) {
memcpy(this->podStart(), s.podStart(), this->podSize());
@@ -843,7 +843,7 @@ private:
GrColor fPodStartMarker;
};
GrColor fColorFilterColor;
- DrawFace fDrawFace;
+ DrawFace fDrawFace;
VertexEdgeType fVertexEdgeType;
GrStencilSettings fStencilSettings;
union {
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 5b90480cba..a567699560 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -26,7 +26,7 @@ namespace {
* generate the new masks. (We attempted to force the compiler to generate the
* masks using recursive templates but always wound up with static initializers
* under gcc, even if they were just a series of immediate->memory moves.)
- *
+ *
*/
void gen_mask_arrays(GrVertexLayout* stageTexCoordMasks,
GrVertexLayout* texCoordMasks) {
@@ -44,14 +44,14 @@ void gen_mask_arrays(GrVertexLayout* stageTexCoordMasks,
}
}
-/**
+/**
* Run this function to generate the code that declares the global masks.
*/
void gen_globals() {
GrVertexLayout stageTexCoordMasks[GrDrawState::kNumStages];
GrVertexLayout texCoordMasks[GrDrawState::kMaxTexCoords];
gen_mask_arrays(stageTexCoordMasks, texCoordMasks);
-
+
GrPrintf("const GrVertexLayout gStageTexCoordMasks[] = {\n");
for (int s = 0; s < GrDrawState::kNumStages; ++s) {
GrPrintf(" 0x%x,\n", stageTexCoordMasks[s]);
@@ -136,7 +136,7 @@ size_t GrDrawTarget::VertexSize(GrVertexLayout vertexLayout) {
/**
* Functions for computing offsets of various components from the layout
* bitfield.
- *
+ *
* Order of vertex components:
* Position
* Tex Coord 0
@@ -529,7 +529,7 @@ bool GrDrawTarget::reserveIndexSpace(int indexCount,
GrAssert(NULL != indices);
this->releasePreviousIndexSource();
geoSrc.fIndexSrc = kNone_GeometrySrcType;
-
+
acquired = this->onReserveIndexSpace(indexCount, indices);
}
if (acquired) {
@@ -539,7 +539,7 @@ bool GrDrawTarget::reserveIndexSpace(int indexCount,
*indices = NULL;
}
return acquired;
-
+
}
bool GrDrawTarget::StageUsesTexCoords(GrVertexLayout layout, int stage) {
@@ -695,7 +695,7 @@ void GrDrawTarget::pushGeometrySource() {
void GrDrawTarget::popGeometrySource() {
// if popping last element then pops are unbalanced with pushes
GrAssert(fGeoSrcStateStack.count() > 1);
-
+
this->geometrySourceWillPop(fGeoSrcStateStack.fromBack(1));
this->releasePreviousVertexSource();
this->releasePreviousIndexSource();
@@ -902,7 +902,7 @@ GrDrawTarget::getBlendOpts(bool forceCoverage,
// stenciling is enabled. Having color writes disabled is effectively
// (0,1). The same applies when coverage is known to be 0.
if ((kZero_GrBlendCoeff == *srcCoeff && dstCoeffIsOne) ||
- (!(layout & kCoverage_VertexLayoutBit) &&
+ (!(layout & kCoverage_VertexLayoutBit) &&
0 == drawState.getCoverage())) {
if (drawState.getStencil().doesWrite()) {
return kDisableBlend_BlendOptFlag |
@@ -915,7 +915,7 @@ GrDrawTarget::getBlendOpts(bool forceCoverage,
// check for coverage due to constant coverage, per-vertex coverage,
// edge aa or coverage texture stage
bool hasCoverage = forceCoverage ||
- 0xffffffff != drawState.getCoverage() ||
+ 0xffffffff != drawState.getCoverage() ||
(layout & kCoverage_VertexLayoutBit) ||
(layout & kEdge_VertexLayoutBit);
for (int s = drawState.getFirstCoverageStage();
@@ -959,7 +959,7 @@ GrDrawTarget::getBlendOpts(bool forceCoverage,
} else if (srcAIsOne) {
// the dst coeff is effectively zero so blend works out to:
// cS + (c)(0)D + (1-c)D = cS + (1-c)D.
- // If Sa is 1 then we can replace Sa with c
+ // If Sa is 1 then we can replace Sa with c
// and set dst coeff to 1-Sa.
*dstCoeff = kISA_GrBlendCoeff;
return kCoverageAsAlpha_BlendOptFlag;
@@ -1026,7 +1026,7 @@ void GrDrawTarget::drawIndexedInstances(GrPrimitiveType type,
////////////////////////////////////////////////////////////////////////////////
-void GrDrawTarget::drawRect(const GrRect& rect,
+void GrDrawTarget::drawRect(const GrRect& rect,
const GrMatrix* matrix,
const GrRect* srcRects[],
const GrMatrix* srcMatrices[]) {
@@ -1038,7 +1038,7 @@ void GrDrawTarget::drawRect(const GrRect& rect,
return;
}
- SetRectVertices(rect, matrix, srcRects,
+ SetRectVertices(rect, matrix, srcRects,
srcMatrices, layout, geo.vertices());
drawNonIndexed(kTriangleFan_GrPrimitiveType, 0, 4);
@@ -1061,10 +1061,10 @@ GrVertexLayout GrDrawTarget::GetRectVertexLayout(const GrRect* srcRects[]) {
}
void GrDrawTarget::SetRectVertices(const GrRect& rect,
- const GrMatrix* matrix,
- const GrRect* srcRects[],
+ const GrMatrix* matrix,
+ const GrRect* srcRects[],
const GrMatrix* srcMatrices[],
- GrVertexLayout layout,
+ GrVertexLayout layout,
void* vertices) {
#if GR_DEBUG
// check that the layout and srcRects agree
@@ -1189,7 +1189,7 @@ GrDrawTarget::AutoReleaseGeometry::AutoReleaseGeometry(
fTarget = NULL;
this->set(target, vertexLayout, vertexCount, indexCount);
}
-
+
GrDrawTarget::AutoReleaseGeometry::AutoReleaseGeometry() {
fTarget = NULL;
}
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index 030b0921d5..5f241a6bff 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -114,7 +114,7 @@ public:
* 1. The caller intends to somehow specify coverage. This can be
* specified either by enabling a coverage stage on the GrDrawState or
* via the vertex layout.
- * 2. Other than enabling coverage stages, the current configuration of
+ * 2. Other than enabling coverage stages, the current configuration of
* the target's GrDrawState is as it will be at draw time.
* 3. If a vertex source has not yet been specified then all stages with
* non-NULL textures will be referenced by the vertex layout.
@@ -131,7 +131,7 @@ public:
bool canTweakAlphaForCoverage() const;
/**
- * Given the current draw state and hw support, will HW AA lines be used
+ * Given the current draw state and hw support, will HW AA lines be used
* (if line primitive type is drawn)? If a vertex source has not yet been
* specified then the function assumes that all stages with non-NULL
* textures will be referenced by the vertex layout.
@@ -143,7 +143,7 @@ public:
* Flags that indicate the layout of vertex data. Vertices always contain
* positions and may also contain up to GrDrawState::kMaxTexCoords sets
* of 2D texture coordinates, per-vertex colors, and per-vertex coverage.
- * Each stage can
+ * Each stage can
* use any of the texture coordinates as its input texture coordinates or it
* may use the positions as texture coordinates.
*
@@ -154,8 +154,8 @@ public:
* example StageTexCoordVertexLayoutBit(0, 2) and
* StagePosAsTexCoordVertexLayoutBit(0) cannot both be specified.
*
- * The order in memory is always (position, texture coord 0, ..., color,
- * coverage) with any unused fields omitted. Note that this means that if
+ * The order in memory is always (position, texture coord 0, ..., color,
+ * coverage) with any unused fields omitted. Note that this means that if
* only texture coordinates 1 is referenced then there is no texture
* coordinates 0 and the order would be (position, texture coordinate 1
* [, color][, coverage]).
@@ -238,7 +238,7 @@ public:
* that the draw target make room for some amount of vertex and/or index
* data. The target provides ptrs to hold the vertex and/or index data.
*
- * The data is writable up until the next drawIndexed, drawNonIndexed,
+ * The data is writable up until the next drawIndexed, drawNonIndexed,
* drawIndexedInstances, or pushGeometrySource. At this point the data is
* frozen and the ptrs are no longer valid.
*
@@ -247,7 +247,7 @@ public:
*
* 3. Vertex and Index Buffers. This is most useful for geometry that will
* is long-lived. When the data in the buffer is consumed depends on the
- * GrDrawTarget subclass. For deferred subclasses the caller has to
+ * GrDrawTarget subclass. For deferred subclasses the caller has to
* guarantee that the data is still available in the buffers at playback.
* (TODO: Make this more automatic as we have done for read/write pixels)
*/
@@ -255,7 +255,7 @@ public:
/**
* Reserves space for vertices and/or indices. Zero can be specifed as
* either the vertex or index count if the caller desires to only reserve
- * space for only indices or only vertices. If zero is specifed for
+ * space for only indices or only vertices. If zero is specifed for
* vertexCount then the vertex source will be unmodified and likewise for
* indexCount.
*
@@ -276,7 +276,7 @@ public:
* 0.
* @param indexCount the number of indices to reserve space for. Can be 0.
* @param vertices will point to reserved vertex space if vertexCount is
- * non-zero. Illegal to pass NULL if vertexCount > 0.
+ * non-zero. Illegal to pass NULL if vertexCount > 0.
* @param indices will point to reserved index space if indexCount is
* non-zero. Illegal to pass NULL if indexCount > 0.
*/
@@ -352,7 +352,7 @@ public:
* before indexed draw call.
*/
void setIndexSourceToBuffer(const GrIndexBuffer* buffer);
-
+
/**
* Resets vertex source. Drawing from reset vertices is illegal. Set vertex
* source to reserved, array, or buffer before next draw. May be able to free
@@ -360,7 +360,7 @@ public:
* reserveVertexSpace.
*/
void resetVertexSource();
-
+
/**
* Resets index source. Indexed Drawing from reset indices is illegal. Set
* index source to reserved, array, or buffer before next indexed draw. May
@@ -368,7 +368,7 @@ public:
* or reserveIndexSpace.
*/
void resetIndexSource();
-
+
/**
* Query to find out if the vertex or index source is reserved.
*/
@@ -497,11 +497,11 @@ public:
}
/**
- * Clear the current render target if one isn't passed in. Ignores the
- * clip and all other draw state (blend mode, stages, etc). Clears the
+ * Clear the current render target if one isn't passed in. Ignores the
+ * clip and all other draw state (blend mode, stages, etc). Clears the
* whole thing if rect is NULL, otherwise just the rect.
*/
- virtual void clear(const GrIRect* rect,
+ virtual void clear(const GrIRect* rect,
GrColor color,
GrRenderTarget* renderTarget = NULL) = 0;
@@ -534,7 +534,7 @@ public:
* // Therefore, rt is set on the GrDrawState
* // that will be restored after asr's
* // destructor rather than target's current
- * // GrDrawState.
+ * // GrDrawState.
*/
class AutoStateRestore : ::GrNoncopyable {
public:
@@ -573,7 +573,7 @@ public:
////////////////////////////////////////////////////////////////////////////
- /**
+ /**
* Sets the view matrix to I and preconcats all stage matrices enabled in
* mask by the view inverse. Destructor undoes these changes.
*/
@@ -622,7 +622,7 @@ public:
private:
void reset();
-
+
GrDrawTarget* fTarget;
void* fVertices;
void* fIndices;
@@ -644,9 +644,9 @@ public:
GrDrawTarget* fTarget;
const GrClipData* fClip;
};
-
+
////////////////////////////////////////////////////////////////////////////
-
+
class AutoGeometryPush : ::GrNoncopyable {
public:
AutoGeometryPush(GrDrawTarget* target) {
@@ -906,7 +906,7 @@ protected:
kArray_GeometrySrcType, //<! src was set using set*SourceToArray
kBuffer_GeometrySrcType //<! src was set using set*SourceToBuffer
};
-
+
struct GeometrySrcState {
GeometrySrcType fVertexSrc;
union {
@@ -915,7 +915,7 @@ protected:
// valid if src type is reserved or array
int fVertexCount;
};
-
+
GeometrySrcType fIndexSrc;
union {
// valid if src type is buffer
@@ -923,7 +923,7 @@ protected:
// valid if src type is reserved or array
int fIndexCount;
};
-
+
GrVertexLayout fVertexLayout;
};
@@ -952,7 +952,7 @@ protected:
virtual void willReserveVertexAndIndexSpace(GrVertexLayout vertexLayout,
int vertexCount,
int indexCount) {}
-
+
// implemented by subclass to allocate space for reserved geom
virtual bool onReserveVertexSpace(GrVertexLayout vertexLayout,
@@ -1021,7 +1021,7 @@ protected:
Caps fCaps;
// subclasses must call this in their destructors to ensure all vertex
- // and index sources have been released (including those held by
+ // and index sources have been released (including those held by
// pushGeometrySource())
void releaseGeometry();
@@ -1031,7 +1031,7 @@ private:
int vertexCount,
void** vertices);
bool reserveIndexSpace(int indexCount, void** indices);
-
+
// called by drawIndexed and drawNonIndexed. Use a negative indexCount to
// indicate non-indexed drawing.
bool checkDraw(GrPrimitiveType type, int startVertex,
@@ -1040,11 +1040,11 @@ private:
// called when setting a new vert/idx source to unref prev vb/ib
void releasePreviousVertexSource();
void releasePreviousIndexSource();
-
+
enum {
kPreallocGeoSrcStateStackCnt = 4,
};
- SkSTArray<kPreallocGeoSrcStateStackCnt,
+ SkSTArray<kPreallocGeoSrcStateStackCnt,
GeometrySrcState, true> fGeoSrcStateStack;
typedef GrRefCnt INHERITED;
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index 923f711cc7..f38b819556 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -147,7 +147,7 @@ GrTexture* GrGpu::createTexture(const GrTextureDesc& desc,
const void* srcData, size_t rowBytes) {
this->handleDirtyContext();
GrTexture* tex = this->onCreateTexture(desc, srcData, rowBytes);
- if (NULL != tex &&
+ if (NULL != tex &&
(kRenderTarget_GrTextureFlagBit & desc.fFlags) &&
!(kNoStencil_GrTextureFlagBit & desc.fFlags)) {
GrAssert(NULL != tex->asRenderTarget());
@@ -162,7 +162,7 @@ GrTexture* GrGpu::createTexture(const GrTextureDesc& desc,
bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt) {
GrAssert(NULL == rt->getStencilBuffer());
- GrStencilBuffer* sb =
+ GrStencilBuffer* sb =
this->getContext()->findStencilBuffer(rt->width(),
rt->height(),
rt->numSamples());
@@ -233,11 +233,11 @@ GrPath* GrGpu::createPath(const SkPath& path) {
return this->onCreatePath(path);
}
-void GrGpu::clear(const GrIRect* rect,
- GrColor color,
+void GrGpu::clear(const GrIRect* rect,
+ GrColor color,
GrRenderTarget* renderTarget) {
GrRenderTarget* oldRT = NULL;
- if (NULL != renderTarget &&
+ if (NULL != renderTarget &&
renderTarget != this->drawState()->getRenderTarget()) {
oldRT = this->drawState()->getRenderTarget();
this->drawState()->setRenderTarget(renderTarget);
@@ -489,12 +489,12 @@ bool GrGpu::onReserveVertexSpace(GrVertexLayout vertexLayout,
int vertexCount,
void** vertices) {
GeometryPoolState& geomPoolState = fGeomPoolStateStack.back();
-
+
GrAssert(vertexCount > 0);
GrAssert(NULL != vertices);
-
+
this->prepareVertexPool();
-
+
*vertices = fVertexPool->makeSpace(vertexLayout,
vertexCount,
&geomPoolState.fPoolVertexBuffer,
@@ -508,7 +508,7 @@ bool GrGpu::onReserveVertexSpace(GrVertexLayout vertexLayout,
bool GrGpu::onReserveIndexSpace(int indexCount, void** indices) {
GeometryPoolState& geomPoolState = fGeomPoolStateStack.back();
-
+
GrAssert(indexCount > 0);
GrAssert(NULL != indices);
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index f502dba23d..d700de506e 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -57,7 +57,7 @@ public:
// The GrContext sets itself as the owner of this Gpu object
void setContext(GrContext* context) {
- GrAssert(NULL == fContext);
+ GrAssert(NULL == fContext);
fContext = context;
fClipMaskManager.setContext(context);
}
@@ -197,7 +197,7 @@ public:
* However, the caller (GrContext) may have transformations to apply and can
* simply fold in the y-flip for free. On the other hand, the subclass may
* be able to do it for free itself. For example, the subclass may have to
- * do memcpys to handle rowBytes that aren't tight. It could do the y-flip
+ * do memcpys to handle rowBytes that aren't tight. It could do the y-flip
* concurrently.
*
* This function returns true if a y-flip is required to put the pixels in
@@ -290,7 +290,7 @@ public:
void removeResource(GrResource* resource);
// GrDrawTarget overrides
- virtual void clear(const GrIRect* rect,
+ virtual void clear(const GrIRect* rect,
GrColor color,
GrRenderTarget* renderTarget = NULL) SK_OVERRIDE;
@@ -321,7 +321,7 @@ public:
* Can the provided configuration act as a color render target?
*/
bool isConfigRenderable(GrPixelConfig config) const {
- GrAssert(kGrPixelConfigCount > config);
+ GrAssert(kGrPixelConfigCount > config);
return fConfigRenderSupport[config];
}
@@ -406,12 +406,12 @@ protected:
struct GeometryPoolState {
const GrVertexBuffer* fPoolVertexBuffer;
int fPoolStartVertex;
-
+
const GrIndexBuffer* fPoolIndexBuffer;
int fPoolStartIndex;
};
- const GeometryPoolState& getGeomPoolState() {
- return fGeomPoolStateStack.back();
+ const GeometryPoolState& getGeomPoolState() {
+ return fGeomPoolStateStack.back();
}
// The state of the scissor is controlled by the clip manager
@@ -453,7 +453,7 @@ protected:
// assumed 3D context state and dirty any state cache.
virtual void onResetContext() = 0;
-
+
// overridden by API-specific derived class to create objects.
virtual GrTexture* onCreateTexture(const GrTextureDesc& desc,
const void* srcData,
@@ -466,7 +466,7 @@ protected:
bool dynamic) = 0;
virtual GrPath* onCreatePath(const SkPath& path) = 0;
- // overridden by API-specific derivated class to perform the clear and
+ // overridden by API-specific derivated class to perform the clear and
// clearRect. NULL rect means clear whole target.
virtual void onClear(const GrIRect* rect, GrColor color) = 0;
@@ -522,7 +522,7 @@ protected:
// Should attach the SB to the RT. Returns false if compatible sb could
// not be created.
virtual bool createStencilBufferForRenderTarget(GrRenderTarget* rt,
- int width,
+ int width,
int height) = 0;
// attaches an existing SB to an existing RT.
@@ -540,23 +540,23 @@ protected:
private:
GrContext* fContext; // not reffed (context refs gpu)
-
+
ResetTimestamp fResetTimestamp;
GrVertexBufferAllocPool* fVertexPool;
GrIndexBufferAllocPool* fIndexPool;
-
+
// counts number of uses of vertex/index pool in the geometry stack
int fVertexPoolUseCnt;
int fIndexPoolUseCnt;
-
+
enum {
kPreallocGeomPoolStateStackCnt = 4,
};
SkSTArray<kPreallocGeomPoolStateStackCnt,
GeometryPoolState, true> fGeomPoolStateStack;
-
+
mutable GrIndexBuffer* fQuadIndexBuffer; // mutable so it can be
// created on-demand
diff --git a/src/gpu/GrGpuVertex.h b/src/gpu/GrGpuVertex.h
index d093e2d068..570a77c885 100644
--- a/src/gpu/GrGpuVertex.h
+++ b/src/gpu/GrGpuVertex.h
@@ -15,7 +15,7 @@
#include "GrPoint.h"
#if GR_TEXT_SCALAR_IS_USHORT
- typedef uint16_t GrTextScalar;
+ typedef uint16_t GrTextScalar;
#define GrIntToTextScalar(x) ((uint16_t)x)
#define GrFixedToTextScalar(x) (x)
#elif GR_TEXT_SCALAR_IS_FIXED
@@ -23,7 +23,7 @@
#define GrIntToTextScalar(x) GrIntToFixed(x)
#define GrFixedToTextScalar(x) (x)
#elif GR_TEXT_SCALAR_IS_FLOAT
- typedef float GrTextScalar;
+ typedef float GrTextScalar;
#define GrIntToTextScalar(x) ((GrTextScalar)x)
#define GrFixedToTextScalar(x) GrFixedToFloat(x)
#else
@@ -45,12 +45,12 @@ struct GrGpuTextVertex {
fX = GrIntToTextScalar(x);
fY = GrIntToTextScalar(y);
}
-
+
void setX(GrFixed x, GrFixed y) {
fX = GrFixedToTextScalar(x);
fY = GrFixedToTextScalar(y);
}
-
+
// rect fan is counter-clockwise
void setRectFan(GrTextScalar l, GrTextScalar t, GrTextScalar r,
diff --git a/src/gpu/GrPathRenderer.h b/src/gpu/GrPathRenderer.h
index de7f253a21..5cbaab1693 100644
--- a/src/gpu/GrPathRenderer.h
+++ b/src/gpu/GrPathRenderer.h
@@ -22,7 +22,7 @@ struct GrPoint;
/**
* Base class for drawing paths into a GrDrawTarget.
*
- * Derived classes can use stages GrPaint::kTotalStages through
+ * Derived classes can use stages GrPaint::kTotalStages through
* GrDrawState::kNumStages-1. The stages before GrPaint::kTotalStages
* are reserved for setting up the draw (i.e., textures and filter masks).
*/
@@ -75,7 +75,7 @@ public:
/**
* Returns true if this path renderer is able to render the path.
- * Returning false allows the caller to fallback to another path renderer
+ * Returning false allows the caller to fallback to another path renderer
* This function is called when searching for a path renderer capable of
* rendering a path.
*
@@ -92,7 +92,7 @@ public:
bool antiAlias) const = 0;
/**
* Draws the path into the draw target. If requiresStencilBuffer returned
- * false then the target may be setup for stencil rendering (since the
+ * false then the target may be setup for stencil rendering (since the
* path renderer didn't claim that it needs to use the stencil internally).
*
* @param path the path to draw.
diff --git a/src/gpu/GrPathUtils.cpp b/src/gpu/GrPathUtils.cpp
index 2d4abe0610..e0ddea868f 100644
--- a/src/gpu/GrPathUtils.cpp
+++ b/src/gpu/GrPathUtils.cpp
@@ -201,13 +201,13 @@ void GrPathUtils::QuadUVMatrix::set(const GrPoint qPts[3]) {
// We invert the control pt matrix and post concat to both sides to get M.
UVpts.setAll(0, GR_ScalarHalf, GR_Scalar1,
0, 0, GR_Scalar1,
- SkScalarToPersp(GR_Scalar1),
- SkScalarToPersp(GR_Scalar1),
+ SkScalarToPersp(GR_Scalar1),
+ SkScalarToPersp(GR_Scalar1),
SkScalarToPersp(GR_Scalar1));
m.setAll(qPts[0].fX, qPts[1].fX, qPts[2].fX,
qPts[0].fY, qPts[1].fY, qPts[2].fY,
- SkScalarToPersp(GR_Scalar1),
- SkScalarToPersp(GR_Scalar1),
+ SkScalarToPersp(GR_Scalar1),
+ SkScalarToPersp(GR_Scalar1),
SkScalarToPersp(GR_Scalar1));
if (!m.invert(&m)) {
// The quad is degenerate. Hopefully this is rare. Find the pts that are
@@ -348,7 +348,7 @@ void convert_noninflect_cubic_to_quads(const SkPoint p[4],
// When the ab and cd tangents are nearly parallel with vector from d to a the constraint that
// the quad point falls between the tangents becomes hard to enforce and we are likely to hit
// the max subdivision count. However, in this case the cubic is approaching a line and the
- // accuracy of the quad point isn't so important. We check if the two middle cubic control
+ // accuracy of the quad point isn't so important. We check if the two middle cubic control
// points are very close to the baseline vector. If so then we just pick quadratic points on the
// control polygon.
diff --git a/src/gpu/GrPlotMgr.h b/src/gpu/GrPlotMgr.h
index 38589f361c..6dd7114c06 100644
--- a/src/gpu/GrPlotMgr.h
+++ b/src/gpu/GrPlotMgr.h
@@ -32,7 +32,7 @@ public:
delete[] fBusy;
}
}
-
+
void reset() {
Gr_bzero(fBusy, fDim.fX * fDim.fY);
}
diff --git a/src/gpu/GrRectanizer.cpp b/src/gpu/GrRectanizer.cpp
index 8df3b05121..87ea92e27a 100644
--- a/src/gpu/GrRectanizer.cpp
+++ b/src/gpu/GrRectanizer.cpp
@@ -38,7 +38,7 @@ public:
struct Row {
GrIPoint16 fLoc;
int fRowHeight;
-
+
bool canAddWidth(int width, int containerWidth) const {
return fLoc.fX + width <= containerWidth;
}
diff --git a/src/gpu/GrSWMaskHelper.h b/src/gpu/GrSWMaskHelper.h
index 44b15e20aa..c7807691d4 100644
--- a/src/gpu/GrSWMaskHelper.h
+++ b/src/gpu/GrSWMaskHelper.h
@@ -39,22 +39,22 @@ class GrDrawTarget;
*/
class GrSWMaskHelper : public GrNoncopyable {
public:
- GrSWMaskHelper(GrContext* context)
+ GrSWMaskHelper(GrContext* context)
: fContext(context) {
}
// set up the internal state in preparation for draws. Since many masks
- // may be accumulated in the helper during creation, "resultBounds"
- // allows the caller to specify the region of interest - to limit the
+ // may be accumulated in the helper during creation, "resultBounds"
+ // allows the caller to specify the region of interest - to limit the
// amount of work.
bool init(const GrIRect& resultBounds, const GrMatrix* matrix);
// Draw a single rect into the accumulation bitmap using the specified op
- void draw(const GrRect& rect, SkRegion::Op op,
+ void draw(const GrRect& rect, SkRegion::Op op,
bool antiAlias, uint8_t alpha);
// Draw a single path into the accumuation bitmap using the specified op
- void draw(const SkPath& path, SkRegion::Op op,
+ void draw(const SkPath& path, SkRegion::Op op,
GrPathFill fill, bool antiAlias, uint8_t alpha);
// Helper function to get a scratch texture suitable for capturing the
@@ -80,14 +80,14 @@ public:
GrMatrix* matrix);
// This utility routine is used to add a path's mask to some other draw.
- // The ClipMaskManager uses it to accumulate clip masks while the
+ // The ClipMaskManager uses it to accumulate clip masks while the
// GrSoftwarePathRenderer uses it to fulfill a drawPath call.
- // It draws with "texture" as a path mask into "target" using "rect" as
+ // It draws with "texture" as a path mask into "target" using "rect" as
// geometry and the current drawState. The current drawState is altered to
// accommodate the mask.
- // Note that this method assumes that the GrPaint::kTotalStages slot in
+ // Note that this method assumes that the GrPaint::kTotalStages slot in
// the draw state can be used to hold the mask texture stage.
- // This method is really only intended to be used with the
+ // This method is really only intended to be used with the
// output of DrawPathMaskToTexture.
static void DrawToTargetWithPathMask(GrTexture* texture,
GrDrawTarget* target,
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index 16b859fef1..edac161c91 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -19,7 +19,7 @@ bool GrSoftwarePathRenderer::canDrawPath(const SkPath& path,
// TODO: We could allow the SW path to also handle non-AA paths but
// this would mean that GrDefaultPathRenderer would never be called
// (since it appears after the SW renderer in the path renderer
- // chain). Some testing would need to be done r.e. performance
+ // chain). Some testing would need to be done r.e. performance
// and consistency of the resulting images before removing
// the "!antiAlias" clause from the above test
return false;
@@ -32,7 +32,7 @@ namespace {
////////////////////////////////////////////////////////////////////////////////
// gets device coord bounds of path (not considering the fill) and clip. The
-// path bounds will be a subset of the clip bounds. returns false if
+// path bounds will be a subset of the clip bounds. returns false if
// path bounds would be empty.
bool get_path_and_clip_bounds(const GrDrawTarget* target,
const SkPath& path,
@@ -48,7 +48,7 @@ bool get_path_and_clip_bounds(const GrDrawTarget* target,
target->getClip()->getConservativeBounds(rt, devClipBounds);
- // TODO: getConservativeBounds already intersects with the
+ // TODO: getConservativeBounds already intersects with the
// render target's bounding box. Remove this next line
if (!devPathBounds->intersect(*devClipBounds)) {
return false;
@@ -81,22 +81,22 @@ void draw_around_inv_path(GrDrawTarget* target,
}
GrRect rect;
if (devClipBounds.fTop < devPathBounds.fTop) {
- rect.iset(devClipBounds.fLeft, devClipBounds.fTop,
+ rect.iset(devClipBounds.fLeft, devClipBounds.fTop,
devClipBounds.fRight, devPathBounds.fTop);
target->drawSimpleRect(rect, NULL);
}
if (devClipBounds.fLeft < devPathBounds.fLeft) {
- rect.iset(devClipBounds.fLeft, devPathBounds.fTop,
+ rect.iset(devClipBounds.fLeft, devPathBounds.fTop,
devPathBounds.fLeft, devPathBounds.fBottom);
target->drawSimpleRect(rect, NULL);
}
if (devClipBounds.fRight > devPathBounds.fRight) {
- rect.iset(devPathBounds.fRight, devPathBounds.fTop,
+ rect.iset(devPathBounds.fRight, devPathBounds.fTop,
devClipBounds.fRight, devPathBounds.fBottom);
target->drawSimpleRect(rect, NULL);
}
if (devClipBounds.fBottom > devPathBounds.fBottom) {
- rect.iset(devClipBounds.fLeft, devPathBounds.fBottom,
+ rect.iset(devClipBounds.fLeft, devPathBounds.fBottom,
devClipBounds.fRight, devClipBounds.fBottom);
target->drawSimpleRect(rect, NULL);
}
@@ -133,8 +133,8 @@ bool GrSoftwarePathRenderer::onDrawPath(const SkPath& path,
}
SkAutoTUnref<GrTexture> texture(
- GrSWMaskHelper::DrawPathMaskToTexture(fContext, path,
- devPathBounds, fill,
+ GrSWMaskHelper::DrawPathMaskToTexture(fContext, path,
+ devPathBounds, fill,
antiAlias, &vm));
if (NULL == texture) {
return false;
diff --git a/src/gpu/GrSoftwarePathRenderer.h b/src/gpu/GrSoftwarePathRenderer.h
index 6e18b5907c..7884cbb35b 100644
--- a/src/gpu/GrSoftwarePathRenderer.h
+++ b/src/gpu/GrSoftwarePathRenderer.h
@@ -20,7 +20,7 @@ class GrAutoScratchTexture;
*/
class GrSoftwarePathRenderer : public GrPathRenderer {
public:
- GrSoftwarePathRenderer(GrContext* context)
+ GrSoftwarePathRenderer(GrContext* context)
: fContext(context) {
}
@@ -34,7 +34,7 @@ protected:
const GrVec* translate,
GrDrawTarget* target,
bool antiAlias) SK_OVERRIDE;
-
+
private:
GrContext* fContext;
diff --git a/src/gpu/GrStencil.h b/src/gpu/GrStencil.h
index b4aa70e554..1af98e6a8b 100644
--- a/src/gpu/GrStencil.h
+++ b/src/gpu/GrStencil.h
@@ -274,7 +274,7 @@ public:
fFlags |= writes ? kDoesWrite_StencilFlag : kDoesNotWrite_StencilFlag;
return writes;
}
-
+
void invalidate() {
// write an illegal value to the first member
fPassOps[0] = (GrStencilOp)(uint8_t)-1;
@@ -284,18 +284,18 @@ public:
bool operator == (const GrStencilSettings& s) const {
static const size_t gCompareSize = sizeof(GrStencilSettings) -
sizeof(fFlags);
- GrAssert((const char*)&fFlags + sizeof(fFlags) ==
+ GrAssert((const char*)&fFlags + sizeof(fFlags) ==
(const char*)this + sizeof(GrStencilSettings));
if (this->isDisabled() & s.isDisabled()) { // using & not &&
return true;
}
return 0 == memcmp(this, &s, gCompareSize);
}
-
+
bool operator != (const GrStencilSettings& s) const {
return !(*this == s);
}
-
+
GrStencilSettings& operator =(const GrStencilSettings& s) {
memcpy(this, &s, sizeof(GrStencilSettings));
return *this;
@@ -305,7 +305,7 @@ private:
friend class GrClipMaskManager;
enum {
- kMaxStencilClipPasses = 2 // maximum number of passes to add a clip
+ kMaxStencilClipPasses = 2 // maximum number of passes to add a clip
// element to the stencil buffer.
};
@@ -316,15 +316,15 @@ private:
* needs to be drawn to the client portion of the stencil first.
* 2. How many passes are needed.
* 3. What those passes are.
- * 4. The fill rule that should actually be used to render (will
+ * 4. The fill rule that should actually be used to render (will
* always be non-inverted).
*
- * @param op the set op to combine this element with the
+ * @param op the set op to combine this element with the
* existing clip
* @param stencilClipMask mask with just the stencil bit used for clipping
* enabled.
* @param invertedFill is this path inverted
- * @param numPasses out: the number of passes needed to add the
+ * @param numPasses out: the number of passes needed to add the
* element to the clip.
* @param settings out: the stencil settings to use for each pass
*
@@ -332,7 +332,7 @@ private:
* stencil clip bit. Will only be true if canBeDirect is true.
* numPasses will be 1 if return value is true.
*/
- static bool GetClipPasses(SkRegion::Op op,
+ static bool GetClipPasses(SkRegion::Op op,
bool canBeDirect,
unsigned int stencilClipMask,
bool invertedFill,
diff --git a/src/gpu/GrStencilBuffer.cpp b/src/gpu/GrStencilBuffer.cpp
index 7f733f4f0f..bf14f4864e 100644
--- a/src/gpu/GrStencilBuffer.cpp
+++ b/src/gpu/GrStencilBuffer.cpp
@@ -62,7 +62,7 @@ void GrStencilBuffer::unlockInCache() {
namespace {
// we should never have more than one stencil buffer with same combo of
// (width,height,samplecount)
-void gen_stencil_key_values(int width,
+void gen_stencil_key_values(int width,
int height,
int sampleCnt,
GrCacheID* cacheID) {
@@ -77,8 +77,8 @@ void gen_stencil_key_values(int width,
}
}
-GrResourceKey GrStencilBuffer::ComputeKey(int width,
- int height,
+GrResourceKey GrStencilBuffer::ComputeKey(int width,
+ int height,
int sampleCnt) {
GrCacheID id(GrStencilBuffer::GetResourceType());
gen_stencil_key_values(width, height, sampleCnt, &id);
diff --git a/src/gpu/GrTBSearch.h b/src/gpu/GrTBSearch.h
index 2697f3733b..1d77c958c1 100644
--- a/src/gpu/GrTBSearch.h
+++ b/src/gpu/GrTBSearch.h
@@ -18,7 +18,7 @@ int GrTBSearch(const ELEM array[], int count, KEY target) {
// we should insert it at 0
return ~0;
}
-
+
int high = count - 1;
int low = 0;
while (high > low) {
@@ -29,12 +29,12 @@ int GrTBSearch(const ELEM array[], int count, KEY target) {
high = index;
}
}
-
+
// check if we found it
if (EQ(array[high], target)) {
return high;
}
-
+
// now return the ~ of where we should insert it
if (LT(array[high], target)) {
high += 1;
diff --git a/src/gpu/GrTDArray.h b/src/gpu/GrTDArray.h
index 731001a8c9..0e5b6bb987 100644
--- a/src/gpu/GrTDArray.h
+++ b/src/gpu/GrTDArray.h
@@ -72,7 +72,7 @@ public:
T* begin() const { return fArray; }
T* end() const { return fArray + fCount; }
- T* back() const { GrAssert(fCount); return fArray + (fCount - 1); }
+ T* back() const { GrAssert(fCount); return fArray + (fCount - 1); }
T* prepend() {
this->growAt(0);
diff --git a/src/gpu/GrTLList.h b/src/gpu/GrTLList.h
index ea310ac20e..e875118d2d 100644
--- a/src/gpu/GrTLList.h
+++ b/src/gpu/GrTLList.h
@@ -30,7 +30,7 @@ public:
T* head() const { return fHead; }
T* tail() const { return fTail; }
-
+
void addToHead(T*);
void addToTail(T*);
void removeFromList(T*);
diff --git a/src/gpu/GrTemplates.h b/src/gpu/GrTemplates.h
index 4378d70949..69720dc111 100644
--- a/src/gpu/GrTemplates.h
+++ b/src/gpu/GrTemplates.h
@@ -40,20 +40,20 @@ template <typename Dst, typename Src> Dst GrTCast(Src src) {
template <typename T> class GrAutoTRestore : public GrNoncopyable {
public:
GrAutoTRestore() : fPtr(NULL), fVal() {}
-
+
GrAutoTRestore(T* ptr) {
fPtr = ptr;
if (NULL != ptr) {
fVal = *ptr;
}
}
-
+
~GrAutoTRestore() {
if (NULL != fPtr) {
*fPtr = fVal;
}
}
-
+
// restores previously saved value (if any) and saves value for passed T*
void reset(T* ptr) {
if (NULL != fPtr) {
diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp
index 23b16dd3ae..edd92db088 100644
--- a/src/gpu/GrTextContext.cpp
+++ b/src/gpu/GrTextContext.cpp
@@ -111,10 +111,10 @@ GrTextContext::GrTextContext(GrContext* context,
/*
We need to call preConcatMatrix with our viewmatrix's inverse, for each
- texture and mask in the paint. However, computing the inverse can be
+ texture and mask in the paint. However, computing the inverse can be
expensive, and its possible we may not have any textures or masks, so these
two loops are written such that we only compute the inverse (once) if we
- need it. We do this on our copy of the paint rather than directly on the
+ need it. We do this on our copy of the paint rather than directly on the
draw target because we re-provide the paint to the context when we have
to flush our glyphs or draw a glyph as a path midstream.
*/
@@ -142,7 +142,7 @@ GrTextContext::GrTextContext(GrContext* context,
fVertices = NULL;
fMaxVertices = 0;
- fVertexLayout =
+ fVertexLayout =
GrDrawTarget::kTextFormat_VertexLayoutBit |
GrDrawTarget::StageTexCoordVertexLayoutBit(kGlyphMaskStage, 0);
}
@@ -272,7 +272,7 @@ HAS_ATLAS:
fMaxVertices = maxQuadVertices;
}
bool success = fDrawTarget->reserveVertexAndIndexSpace(
- fVertexLayout,
+ fVertexLayout,
fMaxVertices,
0,
GrTCast<void**>(&fVertices),
diff --git a/src/gpu/GrTextStrike_impl.h b/src/gpu/GrTextStrike_impl.h
index 1b6392c1fe..a3f37b3a7b 100644
--- a/src/gpu/GrTextStrike_impl.h
+++ b/src/gpu/GrTextStrike_impl.h
@@ -16,16 +16,16 @@ public:
Key(GrFontScaler* scaler) {
fFontScalerKey = scaler->getKey();
}
-
+
uint32_t getHash() const { return fFontScalerKey->getHash(); }
-
+
static bool LT(const GrTextStrike& strike, const Key& key) {
return *strike.getFontScalerKey() < *key.fFontScalerKey;
}
static bool EQ(const GrTextStrike& strike, const Key& key) {
return *strike.getFontScalerKey() == *key.fFontScalerKey;
}
-
+
private:
const GrKey* fFontScalerKey;
};
@@ -50,7 +50,7 @@ void GrFontCache::detachStrikeFromList(GrTextStrike* strike) {
GrTextStrike* GrFontCache::getStrike(GrFontScaler* scaler) {
this->validate();
-
+
Key key(scaler);
GrTextStrike* strike = fCache.find(key);
if (NULL == strike) {
@@ -79,16 +79,16 @@ GrTextStrike* GrFontCache::getStrike(GrFontScaler* scaler) {
class GrTextStrike::Key {
public:
Key(GrGlyph::PackedID id) : fPackedID(id) {}
-
+
uint32_t getHash() const { return fPackedID; }
-
+
static bool LT(const GrGlyph& glyph, const Key& key) {
return glyph.fPackedID < key.fPackedID;
}
static bool EQ(const GrGlyph& glyph, const Key& key) {
return glyph.fPackedID == key.fPackedID;
}
-
+
private:
GrGlyph::PackedID fPackedID;
};
diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp
index 182c90e5d2..ce6109bf4a 100644
--- a/src/gpu/GrTexture.cpp
+++ b/src/gpu/GrTexture.cpp
@@ -17,7 +17,7 @@
SK_DEFINE_INST_COUNT(GrTexture)
GR_DEFINE_RESOURCE_CACHE_TYPE(GrTexture)
-/**
+/**
* This method allows us to interrupt the normal deletion process and place
* textures back in the texture cache when their ref count goes to zero.
*/
@@ -31,7 +31,7 @@ void GrTexture::internal_dispose() const {
nonConstThis->resetFlag((GrTextureFlags) kReturnToCache_FlagBit);
nonConstThis->INHERITED::getContext()->addExistingTextureToCache(nonConstThis);
- // Note: "this" texture might be freed inside addExistingTextureToCache
+ // Note: "this" texture might be freed inside addExistingTextureToCache
// if it is purged.
return;
}
@@ -117,7 +117,7 @@ void GrTexture::validateDesc() const {
enum TextureBits {
/*
* The kNPOT bit is set when the texture is NPOT and is being repeated
- * but the hardware doesn't support that feature.
+ * but the hardware doesn't support that feature.
*/
kNPOT_TextureBit = 0x1,
/*
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index f7e5152482..556608659b 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -59,7 +59,7 @@ enum {
// all the blur tests.
#define BLUR_SIGMA_SCALE 0.6f
// This constant represents the screen alignment criterion in texels for
-// requiring texture domain clamping to prevent color bleeding when drawing
+// requiring texture domain clamping to prevent color bleeding when drawing
// a sub region of a larger source image.
#define COLOR_BLEED_TOLERANCE SkFloatToScalar(0.001f)
@@ -84,7 +84,7 @@ public:
SkAutoCachedTexture()
: fDevice(NULL)
, fTexture(NULL) {
- }
+ }
SkAutoCachedTexture(SkGpuDevice* device,
const SkBitmap& bitmap,
@@ -118,7 +118,7 @@ public:
}
return result;
}
-
+
private:
SkGpuDevice* fDevice;
GrTexture* fTexture;
@@ -199,7 +199,7 @@ void SkGpuDevice::initFromRenderTarget(GrContext* context,
// if this RT is also a texture, hold a ref on it
fTexture = fRenderTarget->asTexture();
SkSafeRef(fTexture);
-
+
// Create a pixel ref for the underlying SkBitmap. We prefer a texture pixel
// ref to a render target pixel reft. The pixel ref may get ref'ed outside
// the device via accessBitmap. This external ref may outlive the device.
@@ -267,7 +267,7 @@ SkGpuDevice::~SkGpuDevice() {
}
// The SkGpuDevice gives the context the render target (e.g., in gainFocus)
- // This call gives the context a chance to relinquish it
+ // This call gives the context a chance to relinquish it
fContext->setRenderTarget(NULL);
SkSafeUnref(fTexture);
@@ -599,7 +599,7 @@ inline bool skPaint2GrPaintShader(SkGpuDevice* dev,
constantColor,
&textures[kColorFilterTextureIdx],
grPaint);
- } else if (!skPaint2GrPaintNoShader(dev, skPaint, true, false,
+ } else if (!skPaint2GrPaintNoShader(dev, skPaint, true, false,
&textures[kColorFilterTextureIdx], grPaint)) {
return false;
}
@@ -1120,7 +1120,7 @@ void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath,
if (!drawWithGPUMaskFilter(fContext, *devPathPtr, paint.getMaskFilter(),
*draw.fMatrix, *draw.fClip, draw.fBounder,
&grPaint, pathFillType)) {
- SkPaint::Style style = doFill ? SkPaint::kFill_Style :
+ SkPaint::Style style = doFill ? SkPaint::kFill_Style :
SkPaint::kStroke_Style;
drawWithMaskFilter(fContext, *devPathPtr, paint.getMaskFilter(),
*draw.fMatrix, *draw.fClip, draw.fBounder,
@@ -1371,7 +1371,7 @@ bool hasAlignedSamples(const SkRect& srcRect, const SkRect& transformedRect) {
// detect pixel disalignment
if (SkScalarAbs(SkScalarRoundToScalar(transformedRect.left()) -
transformedRect.left()) < COLOR_BLEED_TOLERANCE &&
- SkScalarAbs(SkScalarRoundToScalar(transformedRect.top()) -
+ SkScalarAbs(SkScalarRoundToScalar(transformedRect.top()) -
transformedRect.top()) < COLOR_BLEED_TOLERANCE &&
SkScalarAbs(transformedRect.width() - srcRect.width()) <
COLOR_BLEED_TOLERANCE &&
@@ -1387,7 +1387,7 @@ bool mayColorBleed(const SkRect& srcRect, const SkRect& transformedRect,
// Only gets called if hasAlignedSamples returned false.
// So we can assume that sampling is axis aligned but not texel aligned.
GrAssert(!hasAlignedSamples(srcRect, transformedRect));
- SkRect innerSrcRect(srcRect), innerTransformedRect,
+ SkRect innerSrcRect(srcRect), innerTransformedRect,
outerTransformedRect(transformedRect);
innerSrcRect.inset(SK_ScalarHalf, SK_ScalarHalf);
m.mapRect(&innerTransformedRect, innerSrcRect);
@@ -1453,7 +1453,7 @@ void SkGpuDevice::internalDrawBitmap(const SkDraw& draw,
SkFloatToScalar(srcRect.fRight * wInv),
SkFloatToScalar(srcRect.fBottom * hInv));
- bool needsTextureDomain = false;
+ bool needsTextureDomain = false;
if (sampler->textureParams()->isBilerp()) {
// Need texture domain if drawing a sub rect.
needsTextureDomain = srcRect.width() < bitmap.width() || srcRect.height() < bitmap.height();
@@ -1464,7 +1464,7 @@ void SkGpuDevice::internalDrawBitmap(const SkDraw& draw,
SkMatrix srcToDeviceMatrix(m);
srcToDeviceMatrix.postConcat(*draw.fMatrix);
srcToDeviceMatrix.mapRect(&transformedRect, floatSrcRect);
-
+
if (hasAlignedSamples(floatSrcRect, transformedRect)) {
// Samples are texel-aligned, so filtering is futile
sampler->textureParams()->setBilerp(false);
@@ -1474,7 +1474,7 @@ void SkGpuDevice::internalDrawBitmap(const SkDraw& draw,
mayColorBleed(floatSrcRect, transformedRect, m);
}
}
- }
+ }
GrRect textureDomain = GrRect::MakeEmpty();
@@ -1495,7 +1495,7 @@ void SkGpuDevice::internalDrawBitmap(const SkDraw& draw,
} else {
top = bottom = GrScalarHalf(paintRect.top() + paintRect.bottom());
}
- textureDomain.setLTRB(left, top, right, bottom);
+ textureDomain.setLTRB(left, top, right, bottom);
sampler->setCustomStage(SkNEW_ARGS(GrTextureDomainEffect,
(texture,
textureDomain)))->unref();
@@ -1589,7 +1589,7 @@ void SkGpuDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
filteredTexture->unref();
}
}
-
+
fContext->drawRectToRect(grPaint,
GrRect::MakeXYWH(GrIntToScalar(left),
GrIntToScalar(top),
@@ -1633,7 +1633,7 @@ void SkGpuDevice::drawDevice(const SkDraw& draw, SkDevice* device,
filteredTexture->unref();
}
}
-
+
const SkBitmap& bm = dev->accessBitmap(false);
int w = bm.width();
int h = bm.height();
@@ -1682,7 +1682,7 @@ bool SkGpuDevice::filterImage(SkImageFilter* filter, const SkBitmap& src,
SkAutoCachedTexture act(this, src, sampler->textureParams(), &texture);
result->setConfig(src.config(), src.width(), src.height());
- GrRect rect = GrRect::MakeWH(SkIntToScalar(src.width()),
+ GrRect rect = GrRect::MakeWH(SkIntToScalar(src.width()),
SkIntToScalar(src.height()));
GrTexture* resultTexture = filter_texture(fContext, texture, filter, rect);
if (resultTexture) {
diff --git a/src/gpu/gl/GrGLPath.h b/src/gpu/gl/GrGLPath.h
index f9febb46b6..dfe3405443 100644
--- a/src/gpu/gl/GrGLPath.h
+++ b/src/gpu/gl/GrGLPath.h
@@ -26,7 +26,7 @@ public:
GrGLPath(GrGpuGL* gpu, const SkPath& path);
virtual ~GrGLPath();
GrGLuint pathID() const { return fPathID; }
- // TODO: Figure out how to get an approximate size of the path in Gpu
+ // TODO: Figure out how to get an approximate size of the path in Gpu
// memory.
virtual size_t sizeInBytes() const SK_OVERRIDE { return 100; }
diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h
index 989b7c67b4..b755f7571d 100644
--- a/src/gpu/gl/GrGLProgram.h
+++ b/src/gpu/gl/GrGLProgram.h
@@ -127,17 +127,17 @@ public:
/**
Smear alpha across all four channels. This is incompatible with
- kSwapRAndB, kMulRGBByAlpha* and kSmearRed. It is prefereable
- to perform the smear outside the shader using
- GL_ARB_texture_swizzle if possible rather than setting this
+ kSwapRAndB, kMulRGBByAlpha* and kSmearRed. It is prefereable
+ to perform the smear outside the shader using
+ GL_ARB_texture_swizzle if possible rather than setting this
flag.
*/
kSmearAlpha_InConfigFlag = 0x02,
/**
- Smear the red channel across all four channels. This flag is
- incompatible with kSwapRAndB, kMulRGBByAlpha*and kSmearAlpha.
- It is preferable to use GL_ARB_texture_swizzle instead of this
+ Smear the red channel across all four channels. This flag is
+ incompatible with kSwapRAndB, kMulRGBByAlpha*and kSmearAlpha.
+ It is preferable to use GL_ARB_texture_swizzle instead of this
flag.
*/
kSmearRed_InConfigFlag = 0x04,
diff --git a/src/gpu/gl/GrGLTexture.h b/src/gpu/gl/GrGLTexture.h
index 1095d53ca3..2e9ee173c8 100644
--- a/src/gpu/gl/GrGLTexture.h
+++ b/src/gpu/gl/GrGLTexture.h
@@ -83,7 +83,7 @@ public:
virtual void invalidateCachedState() SK_OVERRIDE { fTexParams.invalidate(); }
- // these functions
+ // these functions
const TexParams& getCachedTexParams(GrGpu::ResetTimestamp* timestamp) const {
*timestamp = fTexParamsTimestamp;
return fTexParams;
diff --git a/src/gpu/gl/GrGpuGL.h b/src/gpu/gl/GrGpuGL.h
index ae19b2ef13..2cfdd0d5f5 100644
--- a/src/gpu/gl/GrGpuGL.h
+++ b/src/gpu/gl/GrGpuGL.h
@@ -27,7 +27,7 @@ public:
GrGpuGL(const GrGLContextInfo& ctxInfo);
virtual ~GrGpuGL();
- const GrGLInterface* glInterface() const {
+ const GrGLInterface* glInterface() const {
return fGLContextInfo.interface();
}
GrGLBinding glBinding() const { return fGLContextInfo.binding(); }
@@ -84,9 +84,9 @@ protected:
virtual void onForceRenderTargetFlush() SK_OVERRIDE;
virtual bool onReadPixels(GrRenderTarget* target,
- int left, int top,
+ int left, int top,
int width, int height,
- GrPixelConfig,
+ GrPixelConfig,
void* buffer,
size_t rowBytes,
bool invertY) SK_OVERRIDE;
diff --git a/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp b/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp
index 4b55a5d031..ef8eccc2b9 100644
--- a/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp
+++ b/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp
@@ -25,7 +25,7 @@
const GrGLInterface* GrGLCreateNativeInterface() {
// wglGetProcAddress requires a context.
// GL Function pointers retrieved in one context may not be valid in another
- // context. For that reason we create a new GrGLInterface each time we're
+ // context. For that reason we create a new GrGLInterface each time we're
// called.
if (NULL != wglGetCurrentContext()) {
const char* versionString = (const char*) glGetString(GL_VERSION);
@@ -118,7 +118,7 @@ const GrGLInterface* GrGLCreateNativeInterface() {
GR_GL_GET_PROC(GetQueryiv);
GR_GL_GET_PROC(GetQueryObjectiv);
GR_GL_GET_PROC(GetQueryObjectuiv);
- if (glVer > GR_GL_VER(3,3) ||
+ if (glVer > GR_GL_VER(3,3) ||
GrGLHasExtensionFromString("GL_ARB_timer_query", extString)) {
GR_GL_GET_PROC(GetQueryObjecti64v);
GR_GL_GET_PROC(GetQueryObjectui64v);
@@ -166,7 +166,7 @@ const GrGLInterface* GrGLCreateNativeInterface() {
// First look for GL3.0 FBO or GL_ARB_framebuffer_object (same since
// GL_ARB_framebuffer_object doesn't use ARB suffix.)
- if (glVer > GR_GL_VER(3,0) ||
+ if (glVer > GR_GL_VER(3,0) ||
GrGLHasExtensionFromString("GL_ARB_framebuffer_object", extString)) {
GR_GL_GET_PROC(GenFramebuffers);
GR_GL_GET_PROC(GetFramebufferAttachmentParameteriv);
diff --git a/src/gpu/gl/win/SkNativeGLContext_win.cpp b/src/gpu/gl/win/SkNativeGLContext_win.cpp
index 9650bc1199..00829207ac 100644
--- a/src/gpu/gl/win/SkNativeGLContext_win.cpp
+++ b/src/gpu/gl/win/SkNativeGLContext_win.cpp
@@ -84,7 +84,7 @@ const GrGLInterface* SkNativeGLContext::createGLContext() {
this->destroyGLContext();
return NULL;
}
-
+
PIXELFORMATDESCRIPTOR pfd;
ZeroMemory(&pfd, sizeof(pfd));
pfd.nSize = sizeof(pfd);
@@ -95,20 +95,20 @@ const GrGLInterface* SkNativeGLContext::createGLContext() {
pfd.cDepthBits = 0;
pfd.cStencilBits = 0;
pfd.iLayerType = PFD_MAIN_PLANE;
-
+
int pixelFormat = 0;
if (!(pixelFormat = ChoosePixelFormat(fDeviceContext, &pfd))) {
SkDebugf("No matching pixel format descriptor.\n");
this->destroyGLContext();
return NULL;
}
-
+
if (!SetPixelFormat(fDeviceContext, pixelFormat, &pfd)) {
SkDebugf("Could not set the pixel format %d.\n", pixelFormat);
this->destroyGLContext();
return NULL;
}
-
+
if (!(fGlRenderContext = wglCreateContext(fDeviceContext))) {
SkDebugf("Could not create rendering context.\n");
this->destroyGLContext();
diff --git a/src/gpu/gr_unittests.cpp b/src/gpu/gr_unittests.cpp
index 4d11721c3f..a0f0c183e1 100644
--- a/src/gpu/gr_unittests.cpp
+++ b/src/gpu/gr_unittests.cpp
@@ -101,7 +101,7 @@ static void test_binHashKey()
GrTBinHashKey<BogusEntry, kDataLenUsedForKey> keyB;
keyB.setKeyData(testStringB);
GrAssert(keyA.compare(keyB) < 0);
- GrAssert(keyA.getHash() != keyB.getHash());
+ GrAssert(keyA.getHash() != keyB.getHash());
}
diff --git a/src/gpu/ios/GrGLDefaultInterface_iOS.cpp b/src/gpu/ios/GrGLDefaultInterface_iOS.cpp
index 19d7ae0726..ae43d982c0 100644
--- a/src/gpu/ios/GrGLDefaultInterface_iOS.cpp
+++ b/src/gpu/ios/GrGLDefaultInterface_iOS.cpp
@@ -123,18 +123,18 @@ const GrGLInterface* GrGLDefaultInterface() {
interface->fDeleteRenderbuffers = glDeleteRenderbuffers;
interface->fFramebufferRenderbuffer = glFramebufferRenderbuffer;
interface->fBindRenderbuffer = glBindRenderbuffer;
-
+
#if GL_OES_mapbuffer
interface->fMapBuffer = glMapBufferOES;
interface->fUnmapBuffer = glUnmapBufferOES;
#endif
-
+
#if GL_APPLE_framebuffer_multisample
interface->fRenderbufferStorageMultisample = glRenderbufferStorageMultisampleAPPLE;
interface->fResolveMultisampleFramebuffer = glResolveMultisampleFramebufferAPPLE;
#endif
interface->fBindFragDataLocationIndexed = NULL;
-
+
interface->fBindingsExported = kES2_GrGLBinding;
}
glInterface.get()->ref();
diff --git a/src/images/SkFlipPixelRef.cpp b/src/images/SkFlipPixelRef.cpp
index 4e42d6c909..f3f54e85c8 100644
--- a/src/images/SkFlipPixelRef.cpp
+++ b/src/images/SkFlipPixelRef.cpp
@@ -86,7 +86,7 @@ static void copyRect(const SkBitmap& dst, const SkIRect& rect,
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);
@@ -116,10 +116,10 @@ void SkFlipPixelRef::CopyBitsFromAddr(const SkBitmap& dst, const SkRegion& clip,
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/src/images/SkImageDecoder_libbmp.cpp b/src/images/SkImageDecoder_libbmp.cpp
index d3bb871111..2cbdcc33f0 100644
--- a/src/images/SkImageDecoder_libbmp.cpp
+++ b/src/images/SkImageDecoder_libbmp.cpp
@@ -6,7 +6,7 @@
* found in the LICENSE file.
*/
-
+
#include "bmpdecoderhelper.h"
#include "SkImageDecoder.h"
#include "SkScaledBitmapSampler.h"
@@ -18,7 +18,7 @@
class SkBMPImageDecoder : public SkImageDecoder {
public:
SkBMPImageDecoder() {}
-
+
virtual Format getFormat() const {
return kBMP_Format;
}
@@ -33,10 +33,10 @@ DEFINE_DECODER_CREATOR(BMPImageDecoder);
static SkImageDecoder* sk_libbmp_dfactory(SkStream* stream) {
static const char kBmpMagic[] = { 'B', 'M' };
-
+
size_t len = stream->getLength();
char buffer[sizeof(kBmpMagic)];
-
+
if (len > sizeof(kBmpMagic) &&
stream->read(buffer, sizeof(kBmpMagic)) == sizeof(kBmpMagic) &&
!memcmp(buffer, kBmpMagic, sizeof(kBmpMagic))) {
@@ -61,7 +61,7 @@ public:
if (fJustBounds) {
return NULL;
}
-
+
fRGB.setCount(width * height * 3); // 3 == r, g, b
return fRGB.begin();
}
@@ -81,11 +81,11 @@ bool SkBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
size_t length = stream->getLength();
SkAutoMalloc storage(length);
-
+
if (stream->read(storage.get(), length) != length) {
return false;
}
-
+
const bool justBounds = SkImageDecoder::kDecodeBounds_Mode == mode;
SkBmpDecoderCallback callback(justBounds);
@@ -98,11 +98,11 @@ bool SkBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
return false;
}
}
-
+
// we don't need this anymore, so free it now (before we try to allocate
// the bitmap's pixels) rather than waiting for its destructor
storage.free();
-
+
int width = callback.width();
int height = callback.height();
SkBitmap::Config config = this->getPrefConfig(k32Bit_SrcDepth, false);
@@ -124,9 +124,9 @@ bool SkBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
if (!this->allocPixelRef(bm, NULL)) {
return false;
}
-
+
SkAutoLockPixels alp(*bm);
-
+
if (!sampler.begin(bm, SkScaledBitmapSampler::kRGB, getDitherImage())) {
return false;
}
@@ -134,7 +134,7 @@ bool SkBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
const int srcRowBytes = width * 3;
const int dstHeight = sampler.scaledHeight();
const uint8_t* srcRow = callback.rgb();
-
+
srcRow += sampler.srcY0() * srcRowBytes;
for (int y = 0; y < dstHeight; y++) {
sampler.next(srcRow);
diff --git a/src/images/SkImageDecoder_libgif.cpp b/src/images/SkImageDecoder_libgif.cpp
index cd4ee223f5..3008130545 100644
--- a/src/images/SkImageDecoder_libgif.cpp
+++ b/src/images/SkImageDecoder_libgif.cpp
@@ -21,7 +21,7 @@ public:
virtual Format getFormat() const {
return kGIF_Format;
}
-
+
protected:
virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode mode);
};
@@ -48,7 +48,7 @@ public:
fCurrY = *fStartYPtr++;
fDeltaY = *fDeltaYPtr++;
}
-
+
int currY() const {
SkASSERT(fStartYPtr);
SkASSERT(fDeltaYPtr);
@@ -77,7 +77,7 @@ public:
}
fCurrY = y;
}
-
+
private:
const int fHeight;
int fCurrY;
@@ -167,22 +167,22 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm, Mode mode) {
GifRecordType recType;
GifByteType *extData;
int transpIndex = -1; // -1 means we don't have it (yet)
-
+
do {
if (DGifGetRecordType(gif, &recType) == GIF_ERROR) {
return error_return(gif, *bm, "DGifGetRecordType");
}
-
+
switch (recType) {
case IMAGE_DESC_RECORD_TYPE: {
if (DGifGetImageDesc(gif) == GIF_ERROR) {
return error_return(gif, *bm, "IMAGE_DESC_RECORD_TYPE");
}
-
+
if (gif->ImageCount < 1) { // sanity check
return error_return(gif, *bm, "ImageCount < 1");
}
-
+
width = gif->SWidth;
height = gif->SHeight;
if (width <= 0 || height <= 0 ||
@@ -190,21 +190,21 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm, Mode mode) {
width, height)) {
return error_return(gif, *bm, "chooseFromOneChoice");
}
-
+
bm->setConfig(SkBitmap::kIndex8_Config, width, height);
if (SkImageDecoder::kDecodeBounds_Mode == mode)
return true;
SavedImage* image = &gif->SavedImages[gif->ImageCount-1];
const GifImageDesc& desc = image->ImageDesc;
-
+
// check for valid descriptor
if ( (desc.Top | desc.Left) < 0 ||
desc.Left + desc.Width > width ||
desc.Top + desc.Height > height) {
return error_return(gif, *bm, "TopLeft");
}
-
+
// now we decode the colortable
int colorCount = 0;
{
@@ -218,7 +218,7 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm, Mode mode) {
SkPMColor* colorPtr = ctable->lockColors();
for (int index = 0; index < colorCount; index++)
colorPtr[index] = SkPackARGB32(0xFF,
- cmap->Colors[index].Red,
+ cmap->Colors[index].Red,
cmap->Colors[index].Green,
cmap->Colors[index].Blue);
@@ -234,7 +234,7 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm, Mode mode) {
return error_return(gif, *bm, "allocPixelRef");
}
}
-
+
SkAutoLockPixels alp(*bm);
// time to decode the scanlines
@@ -268,7 +268,7 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm, Mode mode) {
// bump our starting address
scanline += desc.Top * rowBytes + desc.Left;
}
-
+
// now decode each scanline
if (gif->Image.Interlace)
{
@@ -294,7 +294,7 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm, Mode mode) {
}
goto DONE;
} break;
-
+
case EXTENSION_RECORD_TYPE:
if (DGifGetExtension(gif, &temp_save.Function,
&extData) == GIF_ERROR) {
@@ -313,11 +313,11 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm, Mode mode) {
temp_save.Function = 0;
}
break;
-
+
case TERMINATE_RECORD_TYPE:
break;
-
- default: /* Should be trapped by DGifGetRecordType */
+
+ default: /* Should be trapped by DGifGetRecordType */
break;
}
} while (recType != TERMINATE_RECORD_TYPE);
diff --git a/src/images/SkImageDecoder_libico.cpp b/src/images/SkImageDecoder_libico.cpp
index 30611cbd33..5167fe1adb 100644
--- a/src/images/SkImageDecoder_libico.cpp
+++ b/src/images/SkImageDecoder_libico.cpp
@@ -15,7 +15,7 @@
class SkICOImageDecoder : public SkImageDecoder {
public:
SkICOImageDecoder();
-
+
virtual Format getFormat() const {
return kICO_Format;
}
@@ -46,23 +46,23 @@ SkICOImageDecoder::SkICOImageDecoder()
}
//helpers - my function pointer will call one of these, depending on the bitCount, each time through the inner loop
-static void editPixelBit1(const int pixelNo, const unsigned char* buf,
- const int xorOffset, int& x, int y, const int w,
+static void editPixelBit1(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 void editPixelBit4(const int pixelNo, const unsigned char* buf,
- const int xorOffset, int& x, int y, const int w,
+static void editPixelBit4(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 void editPixelBit8(const int pixelNo, const unsigned char* buf,
- const int xorOffset, int& x, int y, const int w,
+static void editPixelBit8(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 void editPixelBit24(const int pixelNo, const unsigned char* buf,
- const int xorOffset, int& x, int y, const int w,
+static void editPixelBit24(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 void editPixelBit32(const int pixelNo, const unsigned char* buf,
- const int xorOffset, int& x, int y, const int w,
+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
@@ -84,7 +84,7 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
if (stream->read((void*)buf, length) != length) {
return false;
}
-
+
//these should always be the same - should i use for error checking? - what about files that have some
//incorrect values, but still decode properly?
int reserved = read2Bytes(buf, 0); // 0
@@ -92,11 +92,11 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
if (reserved != 0 || type != 1)
return false;
int count = read2Bytes(buf, 4);
-
+
//need to at least have enough space to hold the initial table of info
if (length < (size_t)(6 + count*16))
return false;
-
+
int choice;
Chooser* chooser = this->getChooser();
//FIXME:if no chooser, consider providing the largest color image
@@ -120,7 +120,7 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
case 1:
case 4:
// In reality, at least for the moment, these will be decoded into kARGB_8888 bitmaps.
- // However, this will be used to distinguish between the lower quality 1bpp and 4 bpp
+ // However, this will be used to distinguish between the lower quality 1bpp and 4 bpp
// images and the higher quality images.
c = SkBitmap::kIndex8_Config;
break;
@@ -137,11 +137,11 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
}
choice = chooser->choose();
}
-
+
//you never know what the chooser is going to supply
- if (choice >= count || choice < 0)
+ if (choice >= count || choice < 0)
return false;
-
+
//skip ahead to the correct header
//commented out lines are not used, but if i switch to other read method, need to know how many to skip
//otherwise, they could be used for error checking
@@ -160,9 +160,9 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
//int height = read4Bytes(buf, offset+8); //should == 2*h
//int planesToo = read2Bytes(buf, offset+12); //should == 1 (does it?)
int bitCount = read2Bytes(buf, offset+14);
-
- void (*placePixel)(const int pixelNo, const unsigned char* buf,
- const int xorOffset, int& x, int y, const int w,
+
+ void (*placePixel)(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) = NULL;
switch (bitCount)
{
@@ -190,7 +190,7 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
SkDEBUGF(("Decoding %ibpp is unimplemented\n", bitCount));
return false;
}
-
+
//these should all be zero, but perhaps are not - need to check
//int compression = read4Bytes(buf, offset+16); //0
//int imageSize = read4Bytes(buf, offset+20); //0 - sometimes has a value
@@ -198,13 +198,13 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
//int yPixels = read4Bytes(buf, offset+28); //0
//int colorsUsed = read4Bytes(buf, offset+32) //0 - might have an actual value though
//int colorsImportant = read4Bytes(buf, offset+36); //0
-
+
int begin = offset + 40;
//this array represents the colortable
//if i allow other types of bitmaps, it may actually be used as a part of the bitmap
SkPMColor* colors = NULL;
int blue, green, red;
- if (colorCount)
+ if (colorCount)
{
colors = new SkPMColor[colorCount];
for (int j = 0; j < colorCount; j++)
@@ -221,11 +221,11 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
int mask = -(((test >> 4) | (test >> 3) | (test >> 2) | (test >> 1) | test) & 0x1); //either 0xFFFFFFFF or 0
int lineBitWidth = (bitWidth & 0xFFFFFFE0) + (0x20 & mask);
int lineWidth = lineBitWidth/bitCount;
-
+
int xorOffset = begin + colorCount*4; //beginning of the color bitmap
//other read method means we will just be here already
int andOffset = xorOffset + ((lineWidth*h*bitCount) >> 3);
-
+
/*int */test = w & 0x1F; //the low 5 bits - we are rounding up to the next 32 (2^5)
/*int */mask = -(((test >> 4) | (test >> 3) | (test >> 2) | (test >> 1) | test) & 0x1); //either 0xFFFFFFFF or 0
int andLineWidth = (w & 0xFFFFFFE0) + (0x20 & mask);
@@ -236,7 +236,7 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
//however, with small images with large colortables, maybe it's better to still do argb_8888
bm->setConfig(SkBitmap::kARGB_8888_Config, w, h, calculateRowBytesFor8888(w, bitCount));
-
+
if (SkImageDecoder::kDecodeBounds_Mode == mode) {
delete[] colors;
return true;
@@ -247,7 +247,7 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
delete[] colors;
return false;
}
-
+
SkAutoLockPixels alp(*bm);
for (int y = 0; y < h; y++)
@@ -255,7 +255,7 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
for (int x = 0; x < w; x++)
{
//U32* address = bm->getAddr32(x, y);
-
+
//check the alpha bit first, but pass it along to the function to figure out how to deal with it
int andPixelNo = andLineWidth*(h-y-1)+x;
//only need to get a new alphaByte when x %8 == 0
@@ -264,7 +264,7 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
int alphaByte = readByte(buf, andOffset + (andPixelNo >> 3));
int shift = 7 - (andPixelNo & 0x7);
int m = 1 << shift;
-
+
int pixelNo = lineWidth*(h-y-1)+x;
placePixel(pixelNo, buf, xorOffset, x, y, w, bm, alphaByte, m, shift, colors);
@@ -279,8 +279,8 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
} //onDecode
//function to place the pixel, determined by the bitCount
-static void editPixelBit1(const int pixelNo, const unsigned char* buf,
- const int xorOffset, int& x, int y, const int w,
+static void editPixelBit1(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)
{
// note that this should be the same as/similar to the AND bitmap
@@ -288,15 +288,15 @@ 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.
+ // 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
+ // 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)
{
-
+
colorBit = (byte & m) >> shift;
alphaBit = (alphaByte & m) >> shift;
*address = (alphaBit-1)&(colors[colorBit]);
@@ -308,8 +308,8 @@ static void editPixelBit1(const int pixelNo, const unsigned char* buf,
}
x--;
}
-static void editPixelBit4(const int pixelNo, const unsigned char* buf,
- const int xorOffset, int& x, int y, const int w,
+static void editPixelBit4(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)
{
SkPMColor* address = bm->getAddr32(x, y);
@@ -328,18 +328,18 @@ static void editPixelBit4(const int pixelNo, const unsigned char* buf,
*address = (alphaBit-1)&(colors[pixel]);
}
-static void editPixelBit8(const int pixelNo, const unsigned char* buf,
- const int xorOffset, int& x, int y, const int w,
+static void editPixelBit8(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)
{
SkPMColor* address = bm->getAddr32(x, y);
int pixel = readByte(buf, xorOffset + pixelNo);
int alphaBit = (alphaByte & m) >> shift;
*address = (alphaBit-1)&(colors[pixel]);
-}
+}
-static void editPixelBit24(const int pixelNo, const unsigned char* buf,
- const int xorOffset, int& x, int y, const int w,
+static void editPixelBit24(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)
{
SkPMColor* address = bm->getAddr32(x, y);
@@ -349,11 +349,11 @@ static void editPixelBit24(const int pixelNo, const unsigned char* buf,
int alphaBit = (alphaByte & m) >> shift;
//alphaBit == 1 => alpha = 0
int alpha = (alphaBit-1) & 0xFF;
- *address = SkPreMultiplyARGB(alpha, red, green, blue);
+ *address = SkPreMultiplyARGB(alpha, red, green, blue);
}
-static void editPixelBit32(const int pixelNo, const unsigned char* buf,
- const int xorOffset, int& x, int y, const int w,
+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)
{
SkPMColor* address = bm->getAddr32(x, y);
diff --git a/src/images/SkImageDecoder_libjpeg.cpp b/src/images/SkImageDecoder_libjpeg.cpp
index 8989d35d58..6bae965e42 100644
--- a/src/images/SkImageDecoder_libjpeg.cpp
+++ b/src/images/SkImageDecoder_libjpeg.cpp
@@ -147,7 +147,7 @@ static bool return_false(const jpeg_decompress_struct& cinfo,
// method moves the "scanline" pointer in its processing
static void convert_CMYK_to_RGB(uint8_t* scanline, unsigned int width) {
// At this point we've received CMYK pixels from libjpeg. We
- // perform a crude conversion to RGB (based on the formulae
+ // perform a crude conversion to RGB (based on the formulae
// from easyrgb.com):
// CMYK -> CMY
// C = ( C * (1 - K) + K ) // for each CMY component
@@ -294,9 +294,9 @@ bool SkJPEGImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
a significant performance boost.
*/
if (sampleSize == 1 &&
- ((config == SkBitmap::kARGB_8888_Config &&
+ ((config == SkBitmap::kARGB_8888_Config &&
cinfo.out_color_space == JCS_RGBA_8888) ||
- (config == SkBitmap::kRGB_565_Config &&
+ (config == SkBitmap::kRGB_565_Config &&
cinfo.out_color_space == JCS_RGB_565)))
{
bm->setConfig(config, cinfo.output_width, cinfo.output_height);
@@ -310,7 +310,7 @@ bool SkJPEGImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
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.
diff --git a/src/images/SkImageDecoder_libpng.cpp b/src/images/SkImageDecoder_libpng.cpp
index 8fe342301a..d48bce51f8 100644
--- a/src/images/SkImageDecoder_libpng.cpp
+++ b/src/images/SkImageDecoder_libpng.cpp
@@ -27,7 +27,7 @@ public:
virtual Format getFormat() const {
return kPNG_Format;
}
-
+
protected:
virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode);
};
@@ -85,7 +85,7 @@ static bool pos_le(int value, int 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) {
@@ -195,18 +195,18 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) {
png_set_expand_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
if (doDither) {
@@ -226,7 +226,7 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
doDither = false;
}
}
-
+
if (color_type == PNG_COLOR_TYPE_PALETTE) {
bool paletteHasAlpha = hasTransparencyInPalette(png_ptr, info_ptr);
config = this->getPrefConfig(kIndex_SrcDepth, paletteHasAlpha);
@@ -237,11 +237,11 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
} else {
png_color_16p transpColor = NULL;
int numTransp = 0;
-
+
png_get_tRNS(png_ptr, info_ptr, NULL, &numTransp, &transpColor);
-
+
bool valid = 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
@@ -304,7 +304,7 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
if (!this->chooseFromOneChoice(config, origWidth, origHeight)) {
return false;
}
-
+
const int sampleSize = this->getSampleSize();
SkScaledBitmapSampler sampler(origWidth, origHeight, sampleSize);
@@ -313,7 +313,7 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
if (SkImageDecoder::kDecodeBounds_Mode == mode) {
return true;
}
-
+
// from here down we are concerned with colortables and pixels
// we track if we actually see a non-opaque pixels, since sometimes a PNG sets its colortype
@@ -329,9 +329,9 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
int num_trans;
png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette);
-
+
/* BUGGY IMAGE WORKAROUND
-
+
We hit some images (e.g. fruit_.png) who contain bytes that are == colortable_count
which is a problem since we use the byte as an index. To work around this we grow
the colortable by 1 (if its < 256) and duplicate the last color into that slot.
@@ -347,7 +347,7 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
} else {
num_trans = 0;
colorTable->setFlags(colorTable->getFlags() | SkColorTable::kColorsAreOpaque_Flag);
- }
+ }
// check for bad images that might make us crash
if (num_trans > num_palette) {
num_trans = num_palette;
@@ -374,7 +374,7 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
}
colorTable->unlockColors(true);
}
-
+
SkAutoUnref aur(colorTable);
if (!this->allocPixelRef(decodedBitmap,
@@ -382,7 +382,7 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
colorTable : NULL)) {
return false;
}
-
+
SkAutoLockPixels alp(*decodedBitmap);
/* swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */
@@ -401,7 +401,7 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
* png_read_image(). To see how to handle interlacing passes,
* see the png_read_row() method below:
*/
- const int number_passes = interlace_type != PNG_INTERLACE_NONE ?
+ const int number_passes = interlace_type != PNG_INTERLACE_NONE ?
png_set_interlace_handling(png_ptr) : 1;
/* Optional call to gamma correct and add the background to the palette
@@ -420,7 +420,7 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
} else {
SkScaledBitmapSampler::SrcConfig sc;
int srcBytesPerPixel = 4;
-
+
if (colorTable != NULL) {
sc = SkScaledBitmapSampler::kIndex;
srcBytesPerPixel = 1;
@@ -508,7 +508,7 @@ typedef void (*transform_scanline_proc)(const char* SK_RESTRICT src,
static void transform_scanline_565(const char* SK_RESTRICT src, int width,
char* SK_RESTRICT dst) {
- const uint16_t* SK_RESTRICT srcP = (const uint16_t*)src;
+ const uint16_t* SK_RESTRICT srcP = (const uint16_t*)src;
for (int i = 0; i < width; i++) {
unsigned c = *srcP++;
*dst++ = SkPacked16ToR32(c);
@@ -519,7 +519,7 @@ static void transform_scanline_565(const char* SK_RESTRICT src, int width,
static void transform_scanline_888(const char* SK_RESTRICT src, int width,
char* SK_RESTRICT dst) {
- const SkPMColor* SK_RESTRICT srcP = (const SkPMColor*)src;
+ const SkPMColor* SK_RESTRICT srcP = (const SkPMColor*)src;
for (int i = 0; i < width; i++) {
SkPMColor c = *srcP++;
*dst++ = SkGetPackedR32(c);
@@ -530,7 +530,7 @@ static void transform_scanline_888(const char* SK_RESTRICT src, int width,
static void transform_scanline_444(const char* SK_RESTRICT src, int width,
char* SK_RESTRICT dst) {
- const SkPMColor16* SK_RESTRICT srcP = (const SkPMColor16*)src;
+ const SkPMColor16* SK_RESTRICT srcP = (const SkPMColor16*)src;
for (int i = 0; i < width; i++) {
SkPMColor16 c = *srcP++;
*dst++ = SkPacked4444ToR32(c);
@@ -542,7 +542,7 @@ static void transform_scanline_444(const char* SK_RESTRICT src, int width,
static void transform_scanline_8888(const char* SK_RESTRICT src, int width,
char* SK_RESTRICT dst) {
const SkPMColor* SK_RESTRICT srcP = (const SkPMColor*)src;
- const SkUnPreMultiply::Scale* SK_RESTRICT table =
+ const SkUnPreMultiply::Scale* SK_RESTRICT table =
SkUnPreMultiply::GetScaleTable();
for (int i = 0; i < width; i++) {
@@ -568,7 +568,7 @@ static void transform_scanline_8888(const char* SK_RESTRICT src, int width,
static void transform_scanline_4444(const char* SK_RESTRICT src, int width,
char* SK_RESTRICT dst) {
const SkPMColor16* SK_RESTRICT srcP = (const SkPMColor16*)src;
- const SkUnPreMultiply::Scale* SK_RESTRICT table =
+ const SkUnPreMultiply::Scale* SK_RESTRICT table =
SkUnPreMultiply::GetScaleTable();
for (int i = 0; i < width; i++) {
@@ -603,7 +603,7 @@ static transform_scanline_proc choose_proc(SkBitmap::Config config,
if (SkBitmap::kIndex8_Config == config) {
hasAlpha = false; // we store false in the table entries for kIndex8
}
-
+
static const struct {
SkBitmap::Config fConfig;
bool fHasAlpha;
@@ -644,7 +644,7 @@ static int computeBitDepth(int colorCount) {
/* 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
*/
@@ -672,7 +672,7 @@ static inline int pack_palette(SkColorTable* ctable,
}
num_trans -= 1;
}
-
+
const SkUnPreMultiply::Scale* SK_RESTRICT table =
SkUnPreMultiply::GetScaleTable();
@@ -684,11 +684,11 @@ static inline int pack_palette(SkColorTable* ctable,
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++;
@@ -743,7 +743,7 @@ bool SkPNGImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bitmap,
default:
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)) {
@@ -752,7 +752,7 @@ bool SkPNGImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bitmap,
} else {
sig_bit.alpha = 0;
}
-
+
SkAutoLockPixels alp(bitmap);
// readyToDraw checks for pixels (and colortable if that is required)
if (!bitmap.readyToDraw()) {
diff --git a/src/images/SkImageDecoder_wbmp.cpp b/src/images/SkImageDecoder_wbmp.cpp
index fedeedbab1..175a444008 100644
--- a/src/images/SkImageDecoder_wbmp.cpp
+++ b/src/images/SkImageDecoder_wbmp.cpp
@@ -20,7 +20,7 @@ public:
virtual Format getFormat() const {
return kWBMP_Format;
}
-
+
protected:
virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode);
};
@@ -40,7 +40,7 @@ static bool read_mbf(SkStream* stream, int* value)
}
n = (n << 7) | (data & 0x7F);
} while (data & 0x80);
-
+
*value = n;
return true;
}
@@ -48,11 +48,11 @@ static bool read_mbf(SkStream* stream, int* value)
struct wbmp_head {
int fWidth;
int fHeight;
-
+
bool init(SkStream* stream)
{
uint8_t data;
-
+
if (!read_byte(stream, &data) || data != 0) { // unknown type
return false;
}
@@ -68,11 +68,11 @@ struct wbmp_head {
return fWidth != 0 && fHeight != 0;
}
};
-
+
static void expand_bits_to_bytes(uint8_t dst[], const uint8_t src[], int bits)
{
int bytes = bits >> 3;
-
+
for (int i = 0; i < bytes; i++) {
unsigned mask = *src++;
dst[0] = (mask >> 7) & 1;
@@ -85,14 +85,14 @@ static void expand_bits_to_bytes(uint8_t dst[], const uint8_t src[], int bits)
dst[7] = (mask >> 0) & 1;
dst += 8;
}
-
+
bits &= 7;
if (bits > 0) {
unsigned mask = *src;
do {
*dst++ = (mask >> 7) & 1;;
mask <<= 1;
- } while (--bits != 0);
+ } while (--bits != 0);
}
}
@@ -100,21 +100,21 @@ bool SkWBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* decodedBitmap,
Mode mode)
{
wbmp_head head;
-
+
if (!head.init(stream)) {
return false;
}
-
+
int width = head.fWidth;
int height = head.fHeight;
-
+
// assign these directly, in case we return kDimensions_Result
decodedBitmap->setConfig(SkBitmap::kIndex8_Config, width, height);
decodedBitmap->setIsOpaque(true);
-
+
if (SkImageDecoder::kDecodeBounds_Mode == mode)
return true;
-
+
const SkPMColor colors[] = { SK_ColorBLACK, SK_ColorWHITE };
SkColorTable* ct = SkNEW_ARGS(SkColorTable, (colors, 2));
SkAutoUnref aur(ct);
diff --git a/src/images/SkImageRefPool.cpp b/src/images/SkImageRefPool.cpp
index c24dba0da8..b8bbfd2f6e 100644
--- a/src/images/SkImageRefPool.cpp
+++ b/src/images/SkImageRefPool.cpp
@@ -56,7 +56,7 @@ void SkImageRefPool::purgeIfNeeded() {
void SkImageRefPool::setRAMUsed(size_t limit) {
SkImageRef* ref = fTail;
-
+
while (NULL != ref && fRAMUsed > limit) {
// only purge it if its pixels are unlocked
if (!ref->isLocked() && ref->fBitmap.getPixels()) {
@@ -71,7 +71,7 @@ void SkImageRefPool::setRAMUsed(size_t limit) {
ref->fBitmap.bytesPerPixel(),
(int)size, (int)fRAMUsed);
#endif
-
+
// remember the bitmap config (don't call reset),
// just clear the pixel memory
ref->fBitmap.setPixels(NULL);
@@ -86,44 +86,44 @@ void SkImageRefPool::setRAMUsed(size_t limit) {
void SkImageRefPool::addToHead(SkImageRef* ref) {
ref->fNext = fHead;
ref->fPrev = NULL;
-
+
if (fHead) {
SkASSERT(NULL == fHead->fPrev);
fHead->fPrev = ref;
}
fHead = ref;
-
+
if (NULL == fTail) {
fTail = ref;
}
fCount += 1;
SkASSERT(computeCount() == fCount);
-
+
fRAMUsed += ref->ramUsed();
}
void SkImageRefPool::addToTail(SkImageRef* ref) {
ref->fNext = NULL;
ref->fPrev = fTail;
-
+
if (fTail) {
SkASSERT(NULL == fTail->fNext);
fTail->fNext = ref;
}
fTail = ref;
-
+
if (NULL == fHead) {
fHead = ref;
}
fCount += 1;
SkASSERT(computeCount() == fCount);
-
+
fRAMUsed += ref->ramUsed();
}
void SkImageRefPool::detach(SkImageRef* ref) {
SkASSERT(fCount > 0);
-
+
if (fHead == ref) {
fHead = ref->fNext;
}
@@ -136,12 +136,12 @@ void SkImageRefPool::detach(SkImageRef* ref) {
if (ref->fNext) {
ref->fNext->fPrev = ref->fPrev;
}
-
+
ref->fNext = ref->fPrev = NULL;
-
+
fCount -= 1;
SkASSERT(computeCount() == fCount);
-
+
SkASSERT(fRAMUsed >= ref->ramUsed());
fRAMUsed -= ref->ramUsed();
}
@@ -149,23 +149,23 @@ void SkImageRefPool::detach(SkImageRef* ref) {
int SkImageRefPool::computeCount() const {
SkImageRef* ref = fHead;
int count = 0;
-
+
while (ref != NULL) {
count += 1;
ref = ref->fNext;
}
-
+
#ifdef SK_DEBUG
ref = fTail;
int count2 = 0;
-
+
while (ref != NULL) {
count2 += 1;
ref = ref->fPrev;
}
SkASSERT(count2 == count);
#endif
-
+
return count;
}
@@ -177,15 +177,15 @@ void SkImageRefPool::dump() const {
#if defined(SK_DEBUG) || defined(DUMP_IMAGEREF_LIFECYCLE)
SkDebugf("ImagePool dump: bugdet: %d used: %d count: %d\n",
(int)fRAMBudget, (int)fRAMUsed, fCount);
-
+
SkImageRef* ref = fHead;
-
+
while (ref != NULL) {
SkDebugf(" [%3d %3d %d] ram=%d data=%d locked=%d %s\n", ref->fBitmap.width(),
ref->fBitmap.height(), ref->fBitmap.config(),
ref->ramUsed(), (int)ref->fStream->getLength(),
ref->isLocked(), ref->getURI());
-
+
ref = ref->fNext;
}
#endif
diff --git a/src/images/SkImageRefPool.h b/src/images/SkImageRefPool.h
index d29b8dbc61..08633ee39f 100644
--- a/src/images/SkImageRefPool.h
+++ b/src/images/SkImageRefPool.h
@@ -17,30 +17,30 @@ class SkImageRefPool {
public:
SkImageRefPool();
~SkImageRefPool();
-
+
size_t getRAMBudget() const { return fRAMBudget; }
void setRAMBudget(size_t);
-
+
size_t getRAMUsed() const { return fRAMUsed; }
void setRAMUsed(size_t limit);
-
+
void addToHead(SkImageRef*);
void addToTail(SkImageRef*);
void detach(SkImageRef*);
void dump() const;
-
+
private:
size_t fRAMBudget;
size_t fRAMUsed;
-
+
int fCount;
SkImageRef* fHead, *fTail;
-
+
int computeCount() const;
-
+
friend class SkImageRef_GlobalPool;
-
+
void justAddedPixels(SkImageRef*);
void canLosePixels(SkImageRef*);
void purgeIfNeeded();
diff --git a/src/images/SkImageRef_GlobalPool.cpp b/src/images/SkImageRef_GlobalPool.cpp
index bd63f729be..a5a71a3d9d 100644
--- a/src/images/SkImageRef_GlobalPool.cpp
+++ b/src/images/SkImageRef_GlobalPool.cpp
@@ -56,10 +56,10 @@ bool SkImageRef_GlobalPool::onDecode(SkImageDecoder* codec, SkStream* stream,
}
return true;
}
-
+
void SkImageRef_GlobalPool::onUnlockPixels() {
this->INHERITED::onUnlockPixels();
-
+
// by design, onUnlockPixels() already is inside the mutex-lock
GetGlobalPool()->canLosePixels(this);
}
@@ -87,7 +87,7 @@ void SkImageRef_GlobalPool::SetRAMBudget(size_t size) {
}
size_t SkImageRef_GlobalPool::GetRAMUsed() {
- SkAutoMutexAcquire ac(gImageRefMutex);
+ SkAutoMutexAcquire ac(gImageRefMutex);
return GetGlobalPool()->getRAMUsed();
}
diff --git a/src/images/SkMovie.cpp b/src/images/SkMovie.cpp
index 978cd16f6a..e671950bb9 100644
--- a/src/images/SkMovie.cpp
+++ b/src/images/SkMovie.cpp
@@ -57,7 +57,7 @@ bool SkMovie::setTime(SkMSec time)
SkMSec dur = this->duration();
if (time > dur)
time = dur;
-
+
bool changed = false;
if (time != fCurrTime)
{
diff --git a/src/images/SkMovie_gif.cpp b/src/images/SkMovie_gif.cpp
index 91d359169e..9cebc0fc8b 100644
--- a/src/images/SkMovie_gif.cpp
+++ b/src/images/SkMovie_gif.cpp
@@ -25,7 +25,7 @@ protected:
virtual bool onGetInfo(Info*);
virtual bool onSetTime(SkMSec);
virtual bool onGetBitmap(SkBitmap*);
-
+
private:
GifFileType* fGIF;
int fCurrIndex;
diff --git a/src/images/SkPageFlipper.cpp b/src/images/SkPageFlipper.cpp
index 8e51e637a6..4fd8632574 100644
--- a/src/images/SkPageFlipper.cpp
+++ b/src/images/SkPageFlipper.cpp
@@ -32,7 +32,7 @@ SkPageFlipper::SkPageFlipper(int width, int height) {
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();
diff --git a/src/images/SkScaledBitmapSampler.cpp b/src/images/SkScaledBitmapSampler.cpp
index 15633d3a63..25b32fd9b8 100644
--- a/src/images/SkScaledBitmapSampler.cpp
+++ b/src/images/SkScaledBitmapSampler.cpp
@@ -302,7 +302,7 @@ SkScaledBitmapSampler::SkScaledBitmapSampler(int width, int height,
if (width <= 0 || height <= 0) {
sk_throw();
}
-
+
if (sampleSize <= 1) {
fScaledWidth = width;
fScaledHeight = height;
@@ -310,25 +310,25 @@ SkScaledBitmapSampler::SkScaledBitmapSampler(int width, int height,
fDX = fDY = 1;
return;
}
-
+
int dx = SkMin32(sampleSize, width);
int dy = SkMin32(sampleSize, height);
-
+
fScaledWidth = width / dx;
fScaledHeight = height / dy;
-
+
SkASSERT(fScaledWidth > 0);
SkASSERT(fScaledHeight > 0);
-
+
fX0 = dx >> 1;
fY0 = dy >> 1;
-
+
SkASSERT(fX0 >= 0 && fX0 < width);
SkASSERT(fY0 >= 0 && fY0 < height);
-
+
fDX = dx;
fDY = dy;
-
+
SkASSERT(fDX > 0 && (fX0 + fDX * (fScaledWidth - 1)) < width);
SkASSERT(fDY > 0 && (fY0 + fDY * (fScaledHeight - 1)) < height);
}
@@ -413,7 +413,7 @@ bool SkScaledBitmapSampler::begin(SkBitmap* dst, SrcConfig sc, bool dither,
default:
return false;
}
-
+
fRowProc = gProcs[index];
fDstRow = (char*)dst->getPixels();
fDstRowBytes = dst->rowBytes();
diff --git a/src/images/SkScaledBitmapSampler.h b/src/images/SkScaledBitmapSampler.h
index 8a735dfdba..f6de4ccc10 100644
--- a/src/images/SkScaledBitmapSampler.h
+++ b/src/images/SkScaledBitmapSampler.h
@@ -16,10 +16,10 @@ class SkBitmap;
class SkScaledBitmapSampler {
public:
SkScaledBitmapSampler(int origWidth, int origHeight, int cellSize);
-
+
int scaledWidth() const { return fScaledWidth; }
int scaledHeight() const { return fScaledHeight; }
-
+
int srcY0() const { return fY0; }
int srcDY() const { return fDY; }
@@ -59,7 +59,7 @@ private:
char* fDstRow; // points into bitmap's pixels
int fDstRowBytes;
int fCurrY; // used for dithering
- int fSrcPixelSize; // 1, 3, 4
+ int fSrcPixelSize; // 1, 3, 4
RowProc fRowProc;
// optional reference to the src colors if the src is a palette model
diff --git a/src/images/bmpdecoderhelper.h b/src/images/bmpdecoderhelper.h
index f3324eeaf5..f2f410941e 100644
--- a/src/images/bmpdecoderhelper.h
+++ b/src/images/bmpdecoderhelper.h
@@ -32,14 +32,14 @@ public:
~scoped_array() {
delete[] ptr_;
}
-
+
void reset(T* p = 0) {
if (p != ptr_) {
delete[] ptr_;
ptr_ = p;
}
}
-
+
T& operator[](int i) const {
return ptr_[i];
}
@@ -53,7 +53,7 @@ class BmpDecoderCallback {
public:
BmpDecoderCallback() { }
virtual ~BmpDecoderCallback() {}
-
+
/**
* This is called once for an image. It is passed the width and height and
* should return the address of a buffer that is large enough to store
@@ -62,7 +62,7 @@ class BmpDecoderCallback {
* valid dimensions.
*/
virtual uint8* SetSize(int width, int height) = 0;
-
+
private:
DISALLOW_EVIL_CONSTRUCTORS(BmpDecoderCallback);
};
@@ -110,7 +110,7 @@ class BmpDecoderHelper {
uint8* output_;
bool inverted_;
};
-
+
} // namespace
#endif
diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp
index 9f0177e669..5cb801feca 100644
--- a/src/pdf/SkPDFFont.cpp
+++ b/src/pdf/SkPDFFont.cpp
@@ -469,7 +469,7 @@ static void append_bfrange_section(const SkTDArray<BFRange>& bfrange,
void append_cmap_sections(const SkTDArray<SkUnichar>& glyphToUnicode,
const SkPDFGlyphSet* subset,
SkDynamicMemoryWStream* cmap);
-
+
void append_cmap_sections(const SkTDArray<SkUnichar>& glyphToUnicode,
const SkPDFGlyphSet* subset,
SkDynamicMemoryWStream* cmap) {
diff --git a/src/pdf/SkPDFShader.cpp b/src/pdf/SkPDFShader.cpp
index 09a4352110..e6f1d7f108 100644
--- a/src/pdf/SkPDFShader.cpp
+++ b/src/pdf/SkPDFShader.cpp
@@ -275,14 +275,14 @@ static SkString twoPointRadialCode(const SkShader::GradientInfo& info) {
}
/* Conical gradient shader, based on the Canvas spec for radial gradients
- See: http://www.w3.org/TR/2dcontext/#dom-context-2d-createradialgradient
+ See: http://www.w3.org/TR/2dcontext/#dom-context-2d-createradialgradient
*/
static SkString twoPointConicalCode(const SkShader::GradientInfo& info) {
SkScalar dx = info.fPoint[1].fX - info.fPoint[0].fX;
SkScalar dy = info.fPoint[1].fY - info.fPoint[0].fY;
SkScalar r0 = info.fRadius[0];
SkScalar dr = info.fRadius[1] - info.fRadius[0];
- SkScalar a = SkScalarMul(dx, dx) + SkScalarMul(dy, dy) -
+ SkScalar a = SkScalarMul(dx, dx) + SkScalarMul(dy, dy) -
SkScalarMul(dr, dr);
// First compute t, if the pixel falls outside the cone, then we'll end
@@ -327,7 +327,7 @@ static SkString twoPointConicalCode(const SkShader::GradientInfo& info) {
// quadratic case: the Canvas spec wants the largest
// root t for which radius(t) > 0
-
+
// compute the discriminant (b^2 - 4ac)
function.appendScalar(SkScalarMul(SkIntToScalar(4), a));
function.append(" mul sub dup\n");
diff --git a/src/pdf/SkPDFTypes.h b/src/pdf/SkPDFTypes.h
index 7d249408d1..28034ef405 100644
--- a/src/pdf/SkPDFTypes.h
+++ b/src/pdf/SkPDFTypes.h
@@ -113,7 +113,7 @@ public:
private:
SkRefPtr<SkPDFObject> fObj;
-
+
typedef SkPDFObject INHERITED;
};
@@ -137,7 +137,7 @@ public:
private:
int32_t fValue;
-
+
typedef SkPDFObject INHERITED;
};
@@ -162,7 +162,7 @@ public:
private:
bool fValue;
-
+
typedef SkPDFObject INHERITED;
};
@@ -188,7 +188,7 @@ public:
private:
SkScalar fValue;
-
+
typedef SkPDFObject INHERITED;
};
@@ -262,7 +262,7 @@ private:
const SkString fValue;
static SkString FormatName(const SkString& input);
-
+
typedef SkPDFObject INHERITED;
};
@@ -329,7 +329,7 @@ public:
private:
static const int kMaxLen = 8191;
SkTDArray<SkPDFObject*> fValue;
-
+
typedef SkPDFObject INHERITED;
};
@@ -427,7 +427,7 @@ private:
static const int kMaxLen = 4095;
SkTDArray<struct Rec> fValue;
-
+
typedef SkPDFObject INHERITED;
};
diff --git a/src/pipe/SkGPipePriv.h b/src/pipe/SkGPipePriv.h
index edfe2b6edd..207a3bdc8a 100644
--- a/src/pipe/SkGPipePriv.h
+++ b/src/pipe/SkGPipePriv.h
@@ -212,7 +212,7 @@ static inline bool shouldFlattenBitmaps(uint32_t flags) {
enum PaintOps {
kReset_PaintOp, // no arg
-
+
kFlags_PaintOp, // arg inline
kColor_PaintOp, // arg 32
kStyle_PaintOp, // arg inline
@@ -220,7 +220,7 @@ enum PaintOps {
kCap_PaintOp, // arg inline
kWidth_PaintOp, // arg scalar
kMiter_PaintOp,// arg scalar
-
+
kEncoding_PaintOp, // arg inline - text
kHinting_PaintOp, // arg inline - text
kAlign_PaintOp, // arg inline - text
@@ -254,14 +254,14 @@ static inline unsigned PaintOp_unpackData(uint32_t op32) {
static inline uint32_t PaintOp_packOp(PaintOps op) {
SkASSERT(0 == (op & ~PAINTOPS_OP_MASK));
-
+
return op << (PAINTOPS_FLAG_BITS + PAINTOPS_DATA_BITS);
}
static inline uint32_t PaintOp_packOpData(PaintOps op, unsigned data) {
SkASSERT(0 == (op & ~PAINTOPS_OP_MASK));
SkASSERT(0 == (data & ~PAINTOPS_DATA_MASK));
-
+
return (op << (PAINTOPS_FLAG_BITS + PAINTOPS_DATA_BITS)) | data;
}
@@ -269,7 +269,7 @@ static inline uint32_t PaintOp_packOpFlagData(PaintOps op, unsigned flags, unsig
SkASSERT(0 == (op & ~PAINTOPS_OP_MASK));
SkASSERT(0 == (flags & ~PAINTOPS_FLAG_MASK));
SkASSERT(0 == (data & ~PAINTOPS_DATA_MASK));
-
+
return (op << (PAINTOPS_FLAG_BITS + PAINTOPS_DATA_BITS)) |
(flags << PAINTOPS_DATA_BITS) |
data;
diff --git a/src/pipe/SkGPipeRead.cpp b/src/pipe/SkGPipeRead.cpp
index d217aeb85d..ce83c83e83 100644
--- a/src/pipe/SkGPipeRead.cpp
+++ b/src/pipe/SkGPipeRead.cpp
@@ -85,7 +85,7 @@ public:
const SkPaint& paint() const { return fPaint; }
SkPaint* editPaint() { return &fPaint; }
-
+
SkFlattenable* getFlat(unsigned index) const {
if (0 == index) {
return NULL;
@@ -151,12 +151,12 @@ public:
const void* data = fReader->skip(SkAlign4(size));
SkMemoryStream stream(data, size, false);
*fTypefaces.append() = SkTypeface::Deserialize(&stream);
- }
+ }
void setTypeface(SkPaint* paint, unsigned id) {
paint->setTypeface(id ? fTypefaces[id - 1] : NULL);
}
-
+
private:
void updateReader() {
if (NULL == fReader) {
@@ -720,7 +720,7 @@ SkGPipeReader::Status SkGPipeReader::playback(const void* data, size_t length,
uint32_t op32 = reader.readUInt();
unsigned op = DrawOp_unpackOp(op32);
// SkDEBUGCODE(DrawOps drawOp = (DrawOps)op;)
-
+
if (op >= SK_ARRAY_COUNT(gReadTable)) {
SkDebugf("---- bad op during GPipeState::playback\n");
status = kError_Status;
@@ -731,7 +731,7 @@ SkGPipeReader::Status SkGPipeReader::playback(const void* data, size_t length,
break;
}
table[op](canvas, reader.getReader32(), op32, fState);
- if (readAtom &&
+ if (readAtom &&
(table[op] != paintOp_rp &&
table[op] != def_Typeface_rp &&
table[op] != def_PaintFlat_rp &&
diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp
index 42f82c9bcd..b41ebb72fd 100644
--- a/src/pipe/SkGPipeWrite.cpp
+++ b/src/pipe/SkGPipeWrite.cpp
@@ -84,7 +84,7 @@ public:
void setBitmapStorage(SkBitmapHeap* heap) {
this->setBitmapHeap(heap);
}
-
+
const SkFlatData* flatToReplace() const;
// Mark an SkFlatData as one that should not be returned by flatToReplace.
@@ -385,11 +385,11 @@ int SkGPipeCanvas::flattenToIndex(SkFlattenable* obj, PaintFlats paintflat) {
class BitmapShuttle : public SkBitmapHeap::ExternalStorage {
public:
BitmapShuttle(SkGPipeCanvas*);
-
+
~BitmapShuttle();
-
+
virtual bool insert(const SkBitmap& bitmap, int32_t slot) SK_OVERRIDE;
-
+
private:
SkGPipeCanvas* fCanvas;
};
@@ -401,7 +401,7 @@ private:
#define FLATTENABLES_TO_KEEP 10
SkGPipeCanvas::SkGPipeCanvas(SkGPipeController* controller,
- SkWriter32* writer, uint32_t flags,
+ SkWriter32* writer, uint32_t flags,
uint32_t width, uint32_t height)
: fFactorySet(isCrossProcess(flags) ? SkNEW(SkNamedFactorySet) : NULL)
, fWriter(*writer)
@@ -426,7 +426,7 @@ SkGPipeCanvas::SkGPipeCanvas(SkGPipeController* controller,
if (this->needOpBytes()) {
this->writeOp(kReportFlags_DrawOp, fFlags, 0);
}
-
+
if (shouldFlattenBitmaps(flags)) {
BitmapShuttle* shuttle = SkNEW_ARGS(BitmapShuttle, (this));
fBitmapHeap = SkNEW_ARGS(SkBitmapHeap, (shuttle, BITMAPS_TO_KEEP));
@@ -744,7 +744,7 @@ void SkGPipeCanvas::drawBitmapRect(const SkBitmap& bm, const SkIRect* src,
} else {
flags = 0;
}
-
+
if (this->commonDrawBitmap(bm, kDrawBitmapRect_DrawOp, flags, opBytesNeeded, paint)) {
if (hasSrc) {
fWriter.write32(src->fLeft);
@@ -760,7 +760,7 @@ void SkGPipeCanvas::drawBitmapMatrix(const SkBitmap& bm, const SkMatrix& matrix,
const SkPaint* paint) {
NOTIFY_SETUP(this);
size_t opBytesNeeded = matrix.writeToMemory(NULL);
-
+
if (this->commonDrawBitmap(bm, kDrawBitmapMatrix_DrawOp, 0, opBytesNeeded, paint)) {
fWriter.writeMatrix(matrix);
}
@@ -939,7 +939,7 @@ void SkGPipeCanvas::flushRecording(bool detachCurrentBlock) {
doNotify();
if (detachCurrentBlock) {
// force a new block to be requested for the next recorded command
- fBlockSize = 0;
+ fBlockSize = 0;
}
}
diff --git a/src/ports/SkFontDescriptor.cpp b/src/ports/SkFontDescriptor.cpp
index 34f4f17e88..7679d92a14 100644
--- a/src/ports/SkFontDescriptor.cpp
+++ b/src/ports/SkFontDescriptor.cpp
@@ -13,7 +13,7 @@ enum {
kFontFamilyName = 0x01,
kFullName = 0x04,
kPostscriptName = 0x06,
-
+
// These count backwards from 0xFF, so as not to collide with the SFNT
// defines for names in its 'name' table.
kFontFileName = 0xFE,
diff --git a/src/ports/SkFontDescriptor.h b/src/ports/SkFontDescriptor.h
index b2260299bb..5febfd81a3 100644
--- a/src/ports/SkFontDescriptor.h
+++ b/src/ports/SkFontDescriptor.h
@@ -28,7 +28,7 @@ public:
const char* getFullName() { return fFullName.c_str(); }
const char* getPostscriptName() { return fPostscriptName.c_str(); }
const char* getFontFileName() { return fFontFileName.c_str(); }
-
+
void setFamilyName(const char* name) { fFamilyName.set(name); }
void setFullName(const char* name) { fFullName.set(name); }
void setPostscriptName(const char* name) { fPostscriptName.set(name); }
diff --git a/src/ports/SkFontHost_FONTPATH.cpp b/src/ports/SkFontHost_FONTPATH.cpp
index 04e49345f1..69e73f536d 100644
--- a/src/ports/SkFontHost_FONTPATH.cpp
+++ b/src/ports/SkFontHost_FONTPATH.cpp
@@ -14,14 +14,14 @@
#include <stdio.h>
/* define this if we can use mmap() to access fonts from the filesystem */
-#define SK_CAN_USE_MMAP
+#define SK_CAN_USE_MMAP
#ifndef SK_FONTPATH
#define SK_FONTPATH "the complete path for a font file"
#endif
struct FontFaceRec {
- const char* fFileName;
+ const char* fFileName;
uint8_t fFamilyIndex;
SkBool8 fBold;
SkBool8 fItalic;
@@ -39,7 +39,7 @@ const FontFaceRec& FontFaceRec::FindFace(const FontFaceRec rec[], int count,
int isBold, int isItalic)
{
SkASSERT(count > 0);
-
+
int i;
// look for an exact match
@@ -63,7 +63,7 @@ const FontFaceRec& FontFaceRec::FindFace(const FontFaceRec rec[], int count,
enum {
DEFAULT_FAMILY_INDEX,
-
+
FAMILY_INDEX_COUNT
};
@@ -236,7 +236,7 @@ SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace,
SkTypeface::Style style)
{
const FontFamilyRec* family;
-
+
if (familyFace)
family = &gFamilies[
((FontFaceRec_Typeface*)familyFace)->fFace.fFamilyIndex];
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index 550fae01b2..45ae7ecffc 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -610,7 +610,7 @@ void SkFontHost::FilterRec(SkScalerContext::Rec* rec) {
if (rec->fTextSize > SkIntToScalar(1 << 14)) {
rec->fTextSize = SkIntToScalar(1 << 14);
}
-
+
if (!gLCDSupportValid) {
InitFreetype();
FT_Done_FreeType(gFTLibrary);
diff --git a/src/ports/SkFontHost_FreeType_common.cpp b/src/ports/SkFontHost_FreeType_common.cpp
index 91f172b440..332b8c47b8 100644
--- a/src/ports/SkFontHost_FreeType_common.cpp
+++ b/src/ports/SkFontHost_FreeType_common.cpp
@@ -89,7 +89,7 @@ static void copyFT2LCD16(const SkGlyph& glyph, const FT_Bitmap& bitmap,
SkTSwap(srcR, srcB);
}
for (int x = 0; x < width; x++) {
- dst[x] = packTriple(sk_apply_lut_if<APPLY_PREBLEND>(*srcR++, tableR),
+ dst[x] = packTriple(sk_apply_lut_if<APPLY_PREBLEND>(*srcR++, tableR),
sk_apply_lut_if<APPLY_PREBLEND>(*srcG++, tableG),
sk_apply_lut_if<APPLY_PREBLEND>(*srcB++, tableB));
}
@@ -98,14 +98,14 @@ static void copyFT2LCD16(const SkGlyph& glyph, const FT_Bitmap& bitmap,
const uint8_t* triple = src;
if (lcdIsBGR) {
for (int x = 0; x < width; x++) {
- dst[x] = packTriple(sk_apply_lut_if<APPLY_PREBLEND>(triple[2], tableR),
+ dst[x] = packTriple(sk_apply_lut_if<APPLY_PREBLEND>(triple[2], tableR),
sk_apply_lut_if<APPLY_PREBLEND>(triple[1], tableG),
sk_apply_lut_if<APPLY_PREBLEND>(triple[0], tableB));
triple += 3;
}
} else {
for (int x = 0; x < width; x++) {
- dst[x] = packTriple(sk_apply_lut_if<APPLY_PREBLEND>(triple[0], tableR),
+ dst[x] = packTriple(sk_apply_lut_if<APPLY_PREBLEND>(triple[0], tableR),
sk_apply_lut_if<APPLY_PREBLEND>(triple[1], tableG),
sk_apply_lut_if<APPLY_PREBLEND>(triple[2], tableB));
triple += 3;
@@ -302,7 +302,7 @@ void SkScalerContext_FreeType_Base::generateGlyphImage(FT_Face face,
if (SkMask::kA8_Format == glyph.fMaskFormat && maskPreBlend) {
uint8_t* SK_RESTRICT dst = (uint8_t*)glyph.fImage;
unsigned rowBytes = glyph.rowBytes();
-
+
for (int y = glyph.fHeight - 1; y >= 0; --y) {
for (int x = glyph.fWidth - 1; x >= 0; --x) {
dst[x] = tableG[dst[x]];
diff --git a/src/ports/SkFontHost_ascender.cpp b/src/ports/SkFontHost_ascender.cpp
index ccfedefeb5..067d474357 100644
--- a/src/ports/SkFontHost_ascender.cpp
+++ b/src/ports/SkFontHost_ascender.cpp
@@ -52,20 +52,20 @@ SkScalerContext_Ascender::SkScalerContext_Ascender(const SkDescriptor* desc)
{
int size = aca_Get_FontHandleRec_Size();
fHandle = (aca_FontHandle)sk_malloc_throw(size);
-
+
// get the pointer to the font
-
+
fFontStream = new SkMMAPStream("/UcsGB2312-Hei-H.FDL");
fHintStream = new SkMMAPStream("/genv6-23.bin");
-
+
void* hints = sk_malloc_throw(fHintStream->getLength());
memcpy(hints, fHintStream->getMemoryBase(), fHintStream->getLength());
-
+
aca_Create_Font_Handle(fHandle,
(void*)fFontStream->getMemoryBase(), fFontStream->getLength(),
"fred",
hints, fHintStream->getLength());
-
+
// compute our factors from the record
SkMatrix m;
@@ -75,17 +75,17 @@ SkScalerContext_Ascender::SkScalerContext_Ascender(const SkDescriptor* desc)
// now compute our scale factors
SkScalar sx = m.getScaleX();
SkScalar sy = m.getScaleY();
-
+
int ppemX = SkScalarRound(sx);
int ppemY = SkScalarRound(sy);
-
+
size = aca_Find_Font_Memory_Required(fHandle, ppemX, ppemY);
size *= 8; // Jeff suggests this :)
fWorkspace = sk_malloc_throw(size);
aca_Set_Font_Memory(fHandle, (uint8_t*)fWorkspace, size);
aca_GlyphAttribsRec rec;
-
+
memset(&rec, 0, sizeof(rec));
rec.xSize = ppemX;
rec.ySize = ppemY;
@@ -95,7 +95,7 @@ SkScalerContext_Ascender::SkScalerContext_Ascender(const SkDescriptor* desc)
rec.doInterpolate = true;
rec.grayMode = 2;
aca_Set_Font_Attributes(fHandle, &rec, &size);
-
+
fGlyphWorkspace = sk_malloc_throw(size);
aca_Set_Glyph_Memory(fHandle, fGlyphWorkspace);
}
@@ -123,10 +123,10 @@ void SkScalerContext_Ascender::generateMetrics(SkGlyph* glyph)
{
glyph->fRsbDelta = 0;
glyph->fLsbDelta = 0;
-
+
aca_GlyphImageRec rec;
aca_Vector topLeft;
-
+
int adv = aca_Get_Adv_Width(fHandle, glyph->getGlyphID());
if (aca_GLYPH_NOT_PRESENT == adv)
goto ERROR;
@@ -144,7 +144,7 @@ ERROR:
glyph->fAdvanceY = 0;
return;
}
-
+
glyph->fWidth = rec.width;
glyph->fHeight = rec.rows;
glyph->fRowBytes = rec.width;
@@ -158,13 +158,13 @@ void SkScalerContext_Ascender::generateImage(const SkGlyph& glyph)
{
aca_GlyphImageRec rec;
aca_Vector topLeft;
-
+
aca_Rasterize(glyph.getGlyphID(), fHandle, &rec, &topLeft);
-
+
const uint8_t* src = (const uint8_t*)rec.buffer;
uint8_t* dst = (uint8_t*)glyph.fImage;
int height = glyph.fHeight;
-
+
src += rec.y0 * rec.pitch + rec.x0;
while (--height >= 0)
{
@@ -179,7 +179,7 @@ void SkScalerContext_Ascender::generateImage(const SkGlyph& glyph)
void SkScalerContext_Ascender::generatePath(const SkGlyph& glyph, SkPath* path)
{
SkRect r;
-
+
r.set(0, 0, SkIntToScalar(4), SkIntToScalar(4));
path->reset();
path->addRect(r);
diff --git a/src/ports/SkFontHost_freetype_mac.cpp b/src/ports/SkFontHost_freetype_mac.cpp
index 8b1272aef6..652fb463db 100644
--- a/src/ports/SkFontHost_freetype_mac.cpp
+++ b/src/ports/SkFontHost_freetype_mac.cpp
@@ -22,7 +22,7 @@ public:
fStream->unref();
}
- SkStream* fStream;
+ SkStream* fStream;
};
static FTMacTypeface* create_from_path(const char path[]) {
@@ -42,7 +42,7 @@ static SkTypeface* ref_default_typeface() {
if (NULL == gDef) {
gDef = create_from_path(FONT_PATH);
}
-
+
gDef->ref();
return gDef;
}
diff --git a/src/ports/SkFontHost_mac_coretext.cpp b/src/ports/SkFontHost_mac_coretext.cpp
index 91fb92c0b9..52ac1cf61b 100644
--- a/src/ports/SkFontHost_mac_coretext.cpp
+++ b/src/ports/SkFontHost_mac_coretext.cpp
@@ -46,7 +46,7 @@ class AutoCFRelease : SkNoncopyable {
public:
AutoCFRelease(CFTypeRef obj) : fObj(obj) {}
~AutoCFRelease() { CFSafeRelease(fObj); }
-
+
private:
CFTypeRef fObj;
};
@@ -180,7 +180,7 @@ static unsigned CGRGBPixel_getAlpha(CGRGBPixel pixel) {
static const char FONT_DEFAULT_NAME[] = "Lucida Sans";
-// see Source/WebKit/chromium/base/mac/mac_util.mm DarwinMajorVersionInternal
+// see Source/WebKit/chromium/base/mac/mac_util.mm DarwinMajorVersionInternal
// for original source
static int readVersion() {
struct utsname info;
@@ -303,7 +303,7 @@ public:
CGRGBPixel* getCG(const SkScalerContext_Mac& context, const SkGlyph& glyph,
CGGlyph glyphID, size_t* rowBytesPtr);
-
+
private:
enum {
kSize = 32 * 32 * sizeof(CGRGBPixel)
@@ -352,8 +352,8 @@ static SkTypeface::Style computeStyleBits(CTFontRef font, bool* isMonospace) {
class AutoCFDataRelease {
public:
AutoCFDataRelease(CFDataRef obj) : fObj(obj) {}
- const uint16_t* getShortPtr() {
- return fObj ? (const uint16_t*) CFDataGetBytePtr(fObj) : NULL;
+ const uint16_t* getShortPtr() {
+ return fObj ? (const uint16_t*) CFDataGetBytePtr(fObj) : NULL;
}
~AutoCFDataRelease() { CFSafeRelease(fObj); }
private:
@@ -367,7 +367,7 @@ static SkFontID CTFontRef_to_SkFontID(CTFontRef fontRef) {
id &= 0x3FFFFFFF; // make top two bits 00
return id;
}
- // CTFontGetPlatformFont returns NULL if the font is local
+ // CTFontGetPlatformFont returns NULL if the font is local
// (e.g., was created by a CSS3 @font-face rule).
CGFontRef cgFont = CTFontCopyGraphicsFont(fontRef, NULL);
AutoCFDataRelease headRef(CGFontCopyTableForTag(cgFont, 'head'));
@@ -777,11 +777,11 @@ CGRGBPixel* Offscreen::getCG(const SkScalerContext_Mac& context, const SkGlyph&
CGContextSetAllowsFontSubpixelPositioning(fCG, context.fDoSubPosition);
CGContextSetShouldSubpixelPositionFonts(fCG, context.fDoSubPosition);
-
+
// Draw white on black to create mask.
// TODO: Draw black on white and invert, CG has a special case codepath.
CGContextSetGrayFillColor(fCG, 1.0f, 1.0f);
-
+
// force our checks below to happen
fDoAA = !doAA;
fDoLCD = !doLCD;
@@ -848,9 +848,9 @@ void SkScalerContext_Mac::getVerticalOffset(CGGlyph glyphID, SkIPoint* offset) c
* field. The choice of long or short offsets is dependent on the maximum
* possible offset distance.
*
- * 'loca' short version: The actual local offset divided by 2 is stored.
+ * 'loca' short version: The actual local offset divided by 2 is stored.
* 'loca' long version: The actual local offset is stored.
- *
+ *
* The result is a offset into a table of 2 byte (16 bit) entries.
*/
static uint32_t getLocaTableEntry(const uint16_t*& locaPtr, int locaFormat) {
@@ -982,7 +982,7 @@ void SkScalerContext_Mac::generateMetrics(SkGlyph* glyph) {
if (!isSnowLeopard()) {
// Lion and Leopard respect the vertical font metrics.
CTFontGetBoundingRectsForGlyphs(fCTVerticalFont,
- kCTFontVerticalOrientation,
+ kCTFontVerticalOrientation,
&cgGlyph, &theBounds, 1);
} else {
// Snow Leopard and earlier respect the vertical font metrics for
@@ -1013,7 +1013,7 @@ void SkScalerContext_Mac::generateMetrics(SkGlyph* glyph) {
CGPathRelease(path);
}
}
-
+
glyph->zeroMetrics();
glyph->fAdvanceX = SkFloatToFixed(theAdvance.width);
glyph->fAdvanceY = -SkFloatToFixed(theAdvance.height);
@@ -1021,7 +1021,7 @@ void SkScalerContext_Mac::generateMetrics(SkGlyph* glyph) {
if (CGRectIsEmpty_inline(theBounds)) {
return;
}
-
+
if (isLeopard() && !fVertical) {
// Leopard does not consider the matrix skew in its bounds.
// Run the bounding rectangle through the skew matrix to determine
@@ -1048,7 +1048,7 @@ void SkScalerContext_Mac::generateMetrics(SkGlyph* glyph) {
// Get the metrics
bool lionAdjustedMetrics = false;
if (isLion() || isMountainLion()) {
- if (cgGlyph < fGlyphCount && cgGlyph >= getAdjustStart()
+ if (cgGlyph < fGlyphCount && cgGlyph >= getAdjustStart()
&& generateBBoxes()) {
lionAdjustedMetrics = true;
SkRect adjust;
@@ -1131,7 +1131,7 @@ static void rgb_to_a8(const CGRGBPixel* SK_RESTRICT cgPixels, size_t cgRowBytes,
const int width = glyph.fWidth;
size_t dstRB = glyph.rowBytes();
uint8_t* SK_RESTRICT dst = (uint8_t*)glyph.fImage;
-
+
for (int y = 0; y < glyph.fHeight; y++) {
for (int i = 0; i < width; ++i) {
dst[i] = rgb_to_a8<APPLY_PREBLEND>(cgPixels[i], table8);
@@ -1156,7 +1156,7 @@ static void rgb_to_lcd16(const CGRGBPixel* SK_RESTRICT cgPixels, size_t cgRowByt
const int width = glyph.fWidth;
size_t dstRB = glyph.rowBytes();
uint16_t* SK_RESTRICT dst = (uint16_t*)glyph.fImage;
-
+
for (int y = 0; y < glyph.fHeight; y++) {
for (int i = 0; i < width; i++) {
dst[i] = rgb_to_lcd16<APPLY_PREBLEND>(cgPixels[i], tableR, tableG, tableB);
@@ -1203,7 +1203,7 @@ void SkScalerContext_Mac::generateImage(const SkGlyph& glyph, SkMaskGamma::PreBl
if (cgPixels == NULL) {
return;
}
-
+
//TODO: see if drawing black on white and inverting is faster (at least in
//lcd case) as core graphics appears to have special case code for drawing
//black text.
@@ -1229,7 +1229,7 @@ void SkScalerContext_Mac::generateImage(const SkGlyph& glyph, SkMaskGamma::PreBl
addr = SkTAddByteOffset(addr, cgRowBytes);
}
}
-
+
// Must be careful not to use these if maskPreBlend == NULL
const uint8_t* tableR = NULL;
const uint8_t* tableG = NULL;
@@ -1239,7 +1239,7 @@ void SkScalerContext_Mac::generateImage(const SkGlyph& glyph, SkMaskGamma::PreBl
tableG = maskPreBlend->fG;
tableB = maskPreBlend->fB;
}
-
+
// Convert glyph to mask
switch (glyph.fMaskFormat) {
case SkMask::kLCD32_Format: {
@@ -1322,7 +1322,7 @@ void SkScalerContext_Mac::generatePath(const SkGlyph& glyph, SkPath* path) {
// need to release font when we're done
font = CTFontCreateCopyWithAttributes(fCTFont, 1, &xform, NULL);
}
-
+
CGGlyph cgGlyph = (CGGlyph)glyph.getGlyphID(fBaseGlyphCount);
CGPathRef cgPath = CTFontCreatePathForGlyph(font, cgGlyph, NULL);
@@ -1423,7 +1423,7 @@ class AutoCGDataProviderRelease : SkNoncopyable {
public:
AutoCGDataProviderRelease(CGDataProviderRef provider) : fProvider(provider) {}
~AutoCGDataProviderRelease() { CGDataProviderRelease(fProvider); }
-
+
private:
CGDataProviderRef fProvider;
};
@@ -1550,13 +1550,13 @@ SkAdvancedTypefaceMetrics* SkFontHost::GetAdvancedTypefaceMetrics(
ctFont = CTFontCreateCopyWithAttributes(ctFont, CTFontGetUnitsPerEm(ctFont),
NULL, NULL);
SkAdvancedTypefaceMetrics* info = new SkAdvancedTypefaceMetrics;
-
+
{
CFStringRef fontName = CTFontCopyPostScriptName(ctFont);
CFStringToSkString(fontName, &info->fFontName);
CFRelease(fontName);
}
-
+
info->fMultiMaster = false;
CFIndex glyphCount = CTFontGetGlyphCount(ctFont);
info->fLastGlyphID = SkToU16(glyphCount - 1);
@@ -1571,7 +1571,7 @@ SkAdvancedTypefaceMetrics* SkFontHost::GetAdvancedTypefaceMetrics(
// If it's not a truetype font, mark it as 'other'. Assume that TrueType
// fonts always have both glyf and loca tables. At the least, this is what
// sfntly needs to subset the font. CTFontCopyAttribute() does not always
- // succeed in determining this directly.
+ // succeed in determining this directly.
if (!GetTableSize(fontID, 'glyf') || !GetTableSize(fontID, 'loca')) {
info->fType = SkAdvancedTypefaceMetrics::kOther_Font;
info->fItalicAngle = 0;
@@ -1768,7 +1768,7 @@ void SkFontHost::Serialize(const SkTypeface* face, SkWStream* stream) {
desc.setPostscriptName(get_str(CTFontCopyPostScriptName(ctFont), &tmpStr));
desc.serialize(stream);
-
+
// by convention, we also write out the actual sfnt data, preceeded by
// a packed-length. For now we skip that, so we just write the zero.
stream->writePackedUInt(0);
@@ -1815,7 +1815,7 @@ void SkFontHost::FilterRec(SkScalerContext::Rec* rec) {
h = SkPaint::kNormal_Hinting;
}
rec->setHinting(h);
-
+
bool lcdSupport = supports_LCD();
if (isLCDFormat(rec->fMaskFormat)) {
if (lcdSupport) {
@@ -1825,7 +1825,7 @@ void SkFontHost::FilterRec(SkScalerContext::Rec* rec) {
rec->fMaskFormat = SkMask::kA8_Format;
}
}
-
+
if (lcdSupport) {
//CoreGraphics dialates smoothed text as needed.
rec->setContrast(0);
@@ -1845,7 +1845,7 @@ int SkFontHost::CountTables(SkFontID fontID) {
if (NULL == cfArray) {
return 0;
}
-
+
AutoCFRelease ar(cfArray);
return CFArrayGetCount(cfArray);
}
diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp
index 7ea3d49681..b9f1cdc7e7 100755
--- a/src/ports/SkFontHost_win.cpp
+++ b/src/ports/SkFontHost_win.cpp
@@ -1514,7 +1514,7 @@ SK_COMPILE_ASSERT(BASE64_GUID_ID_LEN < LF_FACESIZE, GUID_longer_than_facesize);
The following need not be any standard base64 encoding.
The encoded value is never decoded.
*/
-static const char postscript_safe_base64_encode[] =
+static const char postscript_safe_base64_encode[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789-_=";
@@ -1576,7 +1576,7 @@ SkTypeface* SkFontHost::CreateTypefaceFromStream(SkStream* stream) {
if (FAILED(create_unique_font_name(familyName, familyNameSize))) {
return NULL;
}
-
+
// Change the name of the font.
SkAutoTUnref<SkData> rewrittenFontData(SkOTUtils::RenameFont(stream, familyName, familyNameSize-1));
if (NULL == rewrittenFontData.get()) {
diff --git a/src/ports/SkFontHost_win_dw.cpp b/src/ports/SkFontHost_win_dw.cpp
index c3a13a020e..288ee4ce05 100644
--- a/src/ports/SkFontHost_win_dw.cpp
+++ b/src/ports/SkFontHost_win_dw.cpp
@@ -90,7 +90,7 @@ static HRESULT get_dwrite_factory(IDWriteFactory** factory) {
GetProcAddress(LoadLibraryW(L"dwrite.dll"), "DWriteCreateFactory")
)
;
-
+
if (!dWriteCreateFactoryProc) {
return E_UNEXPECTED;
}
@@ -99,7 +99,7 @@ static HRESULT get_dwrite_factory(IDWriteFactory** factory) {
__uuidof(IDWriteFactory),
reinterpret_cast<IUnknown**>(&gDWriteFactory)),
"Could not create DirectWrite factory.");
-
+
*factory = gDWriteFactory;
return S_OK;
}
@@ -162,7 +162,7 @@ const void* DWriteOffscreen::draw(const SkGlyph& glyph, bool isBW) {
0.0f, // baselineOriginY,
&glyphRunAnalysis),
"Could not create glyph run analysis.");
-
+
//NOTE: this assumes that the glyph has already been measured
//with an exact same glyph run analysis.
RECT bbox;
@@ -296,7 +296,7 @@ static HRESULT get_default_font(IDWriteFont** font) {
SkDEBUGF(("The hard coded font family does not exist."));
return E_UNEXPECTED;
}
-
+
SkTScopedComPtr<IDWriteFontFamily> fontFamily;
HRM(sysFonts->GetFontFamily(index, &fontFamily),
"Could not load the requested font family.");
@@ -518,7 +518,7 @@ void SkScalerContext_Windows::generateAdvance(SkGlyph* glyph) {
//DirectWrite does not provide this information.
glyph->fRsbDelta = 0;
glyph->fLsbDelta = 0;
-
+
glyph->fAdvanceX = 0;
glyph->fAdvanceY = 0;
@@ -533,7 +533,7 @@ void SkScalerContext_Windows::generateAdvance(SkGlyph* glyph) {
SkScalar advanceX = SkScalarMulDiv(fRec.fTextSize,
SkIntToScalar(gm.advanceWidth),
SkIntToScalar(dwfm.designUnitsPerEm));
-
+
if (!(fRec.fFlags & kSubpixelPositioning_Flag)) {
advanceX = SkScalarRoundToScalar(advanceX);
}
@@ -600,7 +600,7 @@ void SkScalerContext_Windows::generateMetrics(SkGlyph* glyph) {
0.0f, // baselineOriginY,
&glyphRunAnalysis),
"Could not create glyph run analysis.");
-
+
RECT bbox;
HRVM(glyphRunAnalysis->GetAlphaTextureBounds(textureType, &bbox),
"Could not get texture bounds.");
@@ -1236,7 +1236,7 @@ void SkFontHost::FilterRec(SkScalerContext::Rec* rec) {
float gamma = defaultRenderingParams->GetGamma();
rec->setDeviceGamma(SkFloatToScalar(gamma));
rec->setPaintGamma(SkFloatToScalar(gamma));
-
+
rec->setContrast(SkFloatToScalar(defaultRenderingParams->GetEnhancedContrast()));
}
}
@@ -1491,7 +1491,7 @@ SkAdvancedTypefaceMetrics* SkFontHost::GetAdvancedTypefaceMetrics(
}
}
*/
-
+
// If Restricted, the font may not be embedded in a document.
// If not Restricted, the font can be embedded.
// If PreviewPrint, the embedding is read-only.
diff --git a/src/ports/SkGlobalInitialization_default.cpp b/src/ports/SkGlobalInitialization_default.cpp
index c0dfd39149..e9235a8375 100644
--- a/src/ports/SkGlobalInitialization_default.cpp
+++ b/src/ports/SkGlobalInitialization_default.cpp
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#include "SkTypes.h"
#if !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
diff --git a/src/ports/SkImageDecoder_CG.cpp b/src/ports/SkImageDecoder_CG.cpp
index 4e2bcc96f0..26f574494f 100644
--- a/src/ports/SkImageDecoder_CG.cpp
+++ b/src/ports/SkImageDecoder_CG.cpp
@@ -31,7 +31,7 @@ static CGDataProviderRef SkStreamToDataProvider(SkStream* stream) {
size_t len = stream->getLength();
void* data = sk_malloc_throw(len);
stream->read(data, len);
-
+
return CGDataProviderCreateWithData(data, data, len, malloc_release_proc);
}
@@ -56,24 +56,24 @@ bool SkImageDecoder_CG::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
return false;
}
SkAutoTCallVProc<const void, CFRelease> arsrc(imageSrc);
-
+
CGImageRef image = CGImageSourceCreateImageAtIndex(imageSrc, 0, NULL);
if (NULL == image) {
return false;
}
SkAutoTCallVProc<CGImage, CGImageRelease> arimage(image);
-
+
const int width = CGImageGetWidth(image);
const int height = CGImageGetHeight(image);
bm->setConfig(SkBitmap::kARGB_8888_Config, width, height);
if (SkImageDecoder::kDecodeBounds_Mode == mode) {
return true;
}
-
+
if (!this->allocPixelRef(bm, NULL)) {
return false;
}
-
+
bm->lockPixels();
bm->eraseColor(0);
@@ -127,7 +127,7 @@ static CGImageDestinationRef SkStreamToImageDestination(SkWStream* stream,
return NULL;
}
SkAutoTCallVProc<const void, CFRelease> arconsumer(consumer);
-
+
return CGImageDestinationCreateWithDataConsumer(consumer, type, 1, NULL);
}
@@ -137,7 +137,7 @@ public:
protected:
virtual bool onEncode(SkWStream* stream, const SkBitmap& bm, int quality);
-
+
private:
Type fType;
};
@@ -159,7 +159,7 @@ bool SkImageEncoder_CG::onEncode(SkWStream* stream, const SkBitmap& bm,
default:
return false;
}
-
+
CGImageDestinationRef dst = SkStreamToImageDestination(stream, type);
if (NULL == dst) {
return false;
diff --git a/src/ports/SkImageDecoder_WIC.cpp b/src/ports/SkImageDecoder_WIC.cpp
index a69ed4a0f1..79d107adec 100644
--- a/src/ports/SkImageDecoder_WIC.cpp
+++ b/src/ports/SkImageDecoder_WIC.cpp
@@ -29,9 +29,9 @@ bool SkImageDecoder_WIC::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
if (!scopedCo.succeeded()) {
return false;
}
-
+
HRESULT hr = S_OK;
-
+
//Create Windows Imaging Component ImagingFactory.
SkTScopedComPtr<IWICImagingFactory> piImagingFactory;
if (SUCCEEDED(hr)) {
@@ -42,19 +42,19 @@ bool SkImageDecoder_WIC::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
, IID_PPV_ARGS(&piImagingFactory)
);
}
-
+
//Convert SkStream to IStream.
SkTScopedComPtr<IStream> piStream;
if (SUCCEEDED(hr)) {
hr = SkIStream::CreateFromSkStream(stream, false, &piStream);
}
-
+
//Make sure we're at the beginning of the stream.
if (SUCCEEDED(hr)) {
LARGE_INTEGER liBeginning = { 0 };
hr = piStream->Seek(liBeginning, STREAM_SEEK_SET, NULL);
}
-
+
//Create the decoder from the stream content.
SkTScopedComPtr<IWICBitmapDecoder> piBitmapDecoder;
if (SUCCEEDED(hr)) {
@@ -65,13 +65,13 @@ bool SkImageDecoder_WIC::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
, &piBitmapDecoder //Pointer to the decoder
);
}
-
+
//Get the first frame from the decoder.
SkTScopedComPtr<IWICBitmapFrameDecode> piBitmapFrameDecode;
if (SUCCEEDED(hr)) {
hr = piBitmapDecoder->GetFrame(0, &piBitmapFrameDecode);
}
-
+
//Get the BitmapSource interface of the frame.
SkTScopedComPtr<IWICBitmapSource> piBitmapSourceOriginal;
if (SUCCEEDED(hr)) {
@@ -79,14 +79,14 @@ bool SkImageDecoder_WIC::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
IID_PPV_ARGS(&piBitmapSourceOriginal)
);
}
-
+
//Get the size of the bitmap.
UINT width;
UINT height;
if (SUCCEEDED(hr)) {
hr = piBitmapSourceOriginal->GetSize(&width, &height);
}
-
+
//Exit early if we're only looking for the bitmap bounds.
if (SUCCEEDED(hr)) {
bm->setConfig(SkBitmap::kARGB_8888_Config, width, height);
@@ -97,13 +97,13 @@ bool SkImageDecoder_WIC::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
return false;
}
}
-
+
//Create a format converter.
SkTScopedComPtr<IWICFormatConverter> piFormatConverter;
if (SUCCEEDED(hr)) {
hr = piImagingFactory->CreateFormatConverter(&piFormatConverter);
}
-
+
if (SUCCEEDED(hr)) {
hr = piFormatConverter->Initialize(
piBitmapSourceOriginal.get() //Input bitmap to convert
@@ -114,7 +114,7 @@ bool SkImageDecoder_WIC::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
, WICBitmapPaletteTypeCustom //Palette translation type
);
}
-
+
//Get the BitmapSource interface of the format converter.
SkTScopedComPtr<IWICBitmapSource> piBitmapSourceConverted;
if (SUCCEEDED(hr)) {
@@ -122,7 +122,7 @@ bool SkImageDecoder_WIC::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
IID_PPV_ARGS(&piBitmapSourceConverted)
);
}
-
+
//Copy the pixels into the bitmap.
if (SUCCEEDED(hr)) {
SkAutoLockPixels alp(*bm);
@@ -135,7 +135,7 @@ bool SkImageDecoder_WIC::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
reinterpret_cast<BYTE *>(bm->getPixels())
);
}
-
+
return SUCCEEDED(hr);
}
@@ -197,9 +197,9 @@ bool SkImageEncoder_WIC::onEncode(SkWStream* stream
if (!scopedCo.succeeded()) {
return false;
}
-
+
HRESULT hr = S_OK;
-
+
//Create Windows Imaging Component ImagingFactory.
SkTScopedComPtr<IWICImagingFactory> piImagingFactory;
if (SUCCEEDED(hr)) {
@@ -210,41 +210,41 @@ bool SkImageEncoder_WIC::onEncode(SkWStream* stream
, IID_PPV_ARGS(&piImagingFactory)
);
}
-
+
//Convert the SkWStream to an IStream.
SkTScopedComPtr<IStream> piStream;
if (SUCCEEDED(hr)) {
hr = SkWIStream::CreateFromSkWStream(stream, &piStream);
}
-
+
//Create an encode of the appropriate type.
SkTScopedComPtr<IWICBitmapEncoder> piEncoder;
if (SUCCEEDED(hr)) {
hr = piImagingFactory->CreateEncoder(type, NULL, &piEncoder);
}
-
+
if (SUCCEEDED(hr)) {
hr = piEncoder->Initialize(piStream.get(), WICBitmapEncoderNoCache);
}
-
+
//Create a the frame.
SkTScopedComPtr<IWICBitmapFrameEncode> piBitmapFrameEncode;
SkTScopedComPtr<IPropertyBag2> piPropertybag;
if (SUCCEEDED(hr)) {
hr = piEncoder->CreateNewFrame(&piBitmapFrameEncode, &piPropertybag);
}
-
+
if (SUCCEEDED(hr)) {
PROPBAG2 name = { 0 };
name.dwType = PROPBAG2_TYPE_DATA;
name.vt = VT_R4;
name.pstrName = L"ImageQuality";
-
+
VARIANT value;
VariantInit(&value);
value.vt = VT_R4;
value.fltVal = (FLOAT)(quality / 100.0);
-
+
//Ignore result code.
// This returns E_FAIL if the named property is not in the bag.
//TODO(bungeman) enumerate the properties,
@@ -254,14 +254,14 @@ bool SkImageEncoder_WIC::onEncode(SkWStream* stream
if (SUCCEEDED(hr)) {
hr = piBitmapFrameEncode->Initialize(piPropertybag.get());
}
-
+
//Set the size of the frame.
const UINT width = bitmap->width();
const UINT height = bitmap->height();
if (SUCCEEDED(hr)) {
hr = piBitmapFrameEncode->SetSize(width, height);
}
-
+
//Set the pixel format of the frame.
const WICPixelFormatGUID formatDesired = GUID_WICPixelFormat32bppBGRA;
WICPixelFormatGUID formatGUID = formatDesired;
@@ -272,7 +272,7 @@ bool SkImageEncoder_WIC::onEncode(SkWStream* stream
//Be sure the image format is the one requested.
hr = IsEqualGUID(formatGUID, formatDesired) ? S_OK : E_FAIL;
}
-
+
//Write the pixels into the frame.
if (SUCCEEDED(hr)) {
SkAutoLockPixels alp(*bitmap);
@@ -282,15 +282,15 @@ bool SkImageEncoder_WIC::onEncode(SkWStream* stream
, bitmap->rowBytes()*height
, reinterpret_cast<BYTE*>(bitmap->getPixels()));
}
-
+
if (SUCCEEDED(hr)) {
hr = piBitmapFrameEncode->Commit();
}
-
+
if (SUCCEEDED(hr)) {
hr = piEncoder->Commit();
}
-
+
return SUCCEEDED(hr);
}
diff --git a/src/ports/SkImageRef_ashmem.cpp b/src/ports/SkImageRef_ashmem.cpp
index 81f24dd630..01b950e576 100644
--- a/src/ports/SkImageRef_ashmem.cpp
+++ b/src/ports/SkImageRef_ashmem.cpp
@@ -34,14 +34,14 @@ SkImageRef_ashmem::SkImageRef_ashmem(SkStream* stream,
SkBitmap::Config config,
int sampleSize)
: SkImageRef(stream, config, sampleSize) {
-
+
fRec.fFD = -1;
fRec.fAddr = NULL;
fRec.fSize = 0;
fRec.fPinned = false;
-
+
fCT = NULL;
-
+
this->useDefaultMutex(); // we don't need/want the shared imageref mutex
}
@@ -80,7 +80,7 @@ public:
if (-1 == fd) {
SkASSERT(NULL == addr);
SkASSERT(0 == fRec->fSize);
-
+
fd = ashmem_create_region(fName, size);
#ifdef DUMP_ASHMEM_LIFECYCLE
SkDebugf("=== ashmem_create_region %s size=%d fd=%d\n", fName, size, fd);
@@ -90,7 +90,7 @@ public:
fName, size);
return false;
}
-
+
int err = ashmem_set_prot_region(fd, PROT_READ | PROT_WRITE);
if (err) {
SkDebugf("------ ashmem_set_prot_region(%d) failed %d\n",
@@ -98,7 +98,7 @@ public:
close(fd);
return false;
}
-
+
addr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
if (-1 == (long)addr) {
SkDebugf("---------- mmap failed for imageref_ashmem size=%d\n",
@@ -106,7 +106,7 @@ public:
close(fd);
return false;
}
-
+
fRec->fFD = fd;
fRec->fAddr = addr;
fRec->fSize = size;
@@ -120,7 +120,7 @@ public:
fRec->fPinned = true;
return true;
}
-
+
private:
// we just point to our caller's memory, these are not copies
SkAshmemRec* fRec;
@@ -130,13 +130,13 @@ private:
bool SkImageRef_ashmem::onDecode(SkImageDecoder* codec, SkStream* stream,
SkBitmap* bitmap, SkBitmap::Config config,
SkImageDecoder::Mode mode) {
-
+
if (SkImageDecoder::kDecodeBounds_Mode == mode) {
return this->INHERITED::onDecode(codec, stream, bitmap, config, mode);
}
AshmemAllocator alloc(&fRec, this->getURI());
-
+
codec->setAllocator(&alloc);
bool success = this->INHERITED::onDecode(codec, stream, bitmap, config,
mode);
@@ -192,21 +192,21 @@ void* SkImageRef_ashmem::onLockPixels(SkColorTable** ct) {
} else {
// no FD, will create an ashmem region in allocator
}
-
+
return this->INHERITED::onLockPixels(ct);
}
void SkImageRef_ashmem::onUnlockPixels() {
this->INHERITED::onUnlockPixels();
-
+
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/src/ports/SkImageRef_ashmem.h b/src/ports/SkImageRef_ashmem.h
index 5b4e8142dc..f98507aabc 100644
--- a/src/ports/SkImageRef_ashmem.h
+++ b/src/ports/SkImageRef_ashmem.h
@@ -21,7 +21,7 @@ class SkImageRef_ashmem : public SkImageRef {
public:
SkImageRef_ashmem(SkStream*, SkBitmap::Config, int sampleSize = 1);
virtual ~SkImageRef_ashmem();
-
+
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkImageRef_ashmem)
protected:
@@ -31,10 +31,10 @@ protected:
virtual bool onDecode(SkImageDecoder* codec, SkStream* stream,
SkBitmap* bitmap, SkBitmap::Config config,
SkImageDecoder::Mode mode);
-
+
virtual void* onLockPixels(SkColorTable**);
virtual void onUnlockPixels();
-
+
private:
void closeFD();
diff --git a/src/ports/SkThread_pthread.cpp b/src/ports/SkThread_pthread.cpp
index ad243b9e3a..b430dd9551 100644
--- a/src/ports/SkThread_pthread.cpp
+++ b/src/ports/SkThread_pthread.cpp
@@ -15,7 +15,7 @@
/**
We prefer the GCC intrinsic implementation of the atomic operations over the
- SkMutex-based implementation. The SkMutex version suffers from static
+ SkMutex-based implementation. The SkMutex version suffers from static
destructor ordering problems.
Note clang also defines the GCC version macros and implements the intrinsics.
TODO: Verify that gcc-style __sync_* intrinsics work on ARM
@@ -82,7 +82,7 @@ int32_t sk_atomic_inc(int32_t* addr)
int32_t sk_atomic_add(int32_t* addr, int32_t inc)
{
SkAutoMutexAcquire ac(gAtomicMutex);
-
+
int32_t value = *addr;
*addr = value + inc;
return value;
@@ -166,7 +166,7 @@ SkMutex::SkMutex() {
status = pthread_mutexattr_init(&attr);
print_pthread_error(status);
SkASSERT(0 == status);
-
+
status = pthread_mutex_init((pthread_mutex_t*)fStorage, &attr);
print_pthread_error(status);
SkASSERT(0 == status);
diff --git a/src/ports/SkXMLParser_expat.cpp b/src/ports/SkXMLParser_expat.cpp
index c78dc35073..8c1c2bfd1c 100644
--- a/src/ports/SkXMLParser_expat.cpp
+++ b/src/ports/SkXMLParser_expat.cpp
@@ -28,7 +28,7 @@ inline size_t sk_wcslen(const short* char16) {
inline const char* ConvertUnicodeToChar(const short* ch16, size_t len, SkAutoMalloc& ch8Malloc) {
char* ch8 = (char*) ch8Malloc.get();
int index;
- for (index = 0; index < len; index++)
+ for (index = 0; index < len; index++)
ch8[index] = (char) ch16[index];
ch8[index] = '\0';
return ch8;
diff --git a/src/ports/SkXMLParser_tinyxml.cpp b/src/ports/SkXMLParser_tinyxml.cpp
index 2e308aa45b..de1fbe57bc 100644
--- a/src/ports/SkXMLParser_tinyxml.cpp
+++ b/src/ports/SkXMLParser_tinyxml.cpp
@@ -22,12 +22,12 @@ static void walk_elem(SkXMLParser* parser, const TiXmlElement* elem)
while (attr)
{
//printf("walk_elem_attr(%s=\"%s\") ", attr->Name(), attr->Value());
-
+
parser->addAttribute(attr->Name(), attr->Value());
attr = attr->Next();
}
//printf("\n");
-
+
const TiXmlNode* node = elem->FirstChild();
while (node)
{
@@ -37,7 +37,7 @@ static void walk_elem(SkXMLParser* parser, const TiXmlElement* elem)
parser->text(node->Value(), strlen(node->Value()));
node = node->NextSibling();
}
-
+
parser->endElement(elem->Value());
}
@@ -51,7 +51,7 @@ static bool load_buf(SkXMLParser* parser, const char buf[])
printf("tinyxml error: <%s> row[%d] col[%d]\n", doc.ErrorDesc(), doc.ErrorRow(), doc.ErrorCol());
return false;
}
-
+
walk_elem(parser, doc.RootElement());
return true;
}
@@ -59,13 +59,13 @@ static bool load_buf(SkXMLParser* parser, const char buf[])
bool SkXMLParser::parse(SkStream& stream)
{
size_t size = stream.read(NULL, 0);
-
+
SkAutoMalloc buffer(size + 1);
char* buf = (char*)buffer.get();
-
+
stream.read(buf, size);
buf[size] = 0;
-
+
return load_buf(this, buf);
}
@@ -73,10 +73,10 @@ bool SkXMLParser::parse(const char doc[], size_t len)
{
SkAutoMalloc buffer(len + 1);
char* buf = (char*)buffer.get();
-
+
memcpy(buf, doc, len);
buf[len] = 0;
-
+
return load_buf(this, buf);
}
diff --git a/src/ports/SkXMLPullParser_expat.cpp b/src/ports/SkXMLPullParser_expat.cpp
index 825ca68d4e..5fcdff372c 100644
--- a/src/ports/SkXMLPullParser_expat.cpp
+++ b/src/ports/SkXMLPullParser_expat.cpp
@@ -18,8 +18,8 @@ static inline char* dupstr(SkChunkAlloc& chunk, const char src[], size_t len)
{
SkASSERT(src);
char* dst = (char*)chunk.alloc(len + 1, SkChunkAlloc::kThrow_AllocFailType);
-
- memcpy(dst, src, len);
+
+ memcpy(dst, src, len);
dst[len] = 0;
return dst;
}
@@ -37,11 +37,11 @@ static inline int count_pairs(const char** p)
struct Data {
Data() : fAlloc(2048), fState(NORMAL) {}
-
+
XML_Parser fParser;
SkXMLPullParser::Curr* fCurr;
SkChunkAlloc fAlloc;
-
+
enum State {
NORMAL,
MISSED_START_TAG,
@@ -58,7 +58,7 @@ static void XMLCALL start_proc(void *data, const char *el, const char **attr)
SkChunkAlloc& alloc = p->fAlloc;
c->fName = dupstr(alloc, el, strlen(el));
-
+
int n = count_pairs(attr);
SkXMLPullParser::AttrInfo* info = (SkXMLPullParser::AttrInfo*)alloc.alloc(n * sizeof(SkXMLPullParser::AttrInfo),
SkChunkAlloc::kThrow_AllocFailType);
@@ -88,7 +88,7 @@ static void XMLCALL end_proc(void *data, const char *el)
so we set a flag to notify them of the missed start_tag
*/
p->fState = Data::MISSED_START_TAG;
-
+
SkASSERT(c->fName != NULL);
SkASSERT(strcmp(c->fName, el) == 0);
}
@@ -134,7 +134,7 @@ static void reportError(XML_Parser parser)
XML_Error code = XML_GetErrorCode(parser);
int lineNumber = XML_GetCurrentLineNumber(parser);
const char* msg = XML_ErrorString(code);
-
+
printf("-------- XML error [%d] on line %d, %s\n", code, lineNumber, msg);
}
@@ -183,7 +183,7 @@ SkXMLPullParser::EventType SkXMLPullParser::onNextToken()
XML_Status status;
status = XML_ResumeParser(p);
-
+
CHECK_STATUS:
switch (status) {
case XML_STATUS_OK:
@@ -204,7 +204,7 @@ CHECK_STATUS:
// return a start_tag, and clear the flag so we return end_tag next
SkASSERT(SkXMLPullParser::END_TAG == fCurr.fEventType);
fImpl->fData.fState = Data::RETURN_END_TAG;
- fImpl->fData.fEndTag = fCurr.fName; // save this pointer
+ fImpl->fData.fEndTag = fCurr.fName; // save this pointer
return SkXMLPullParser::START_TAG;
}
break;
diff --git a/src/sfnt/SkOTUtils.cpp b/src/sfnt/SkOTUtils.cpp
index 61edabd02d..6e94437e2a 100644
--- a/src/sfnt/SkOTUtils.cpp
+++ b/src/sfnt/SkOTUtils.cpp
@@ -73,7 +73,7 @@ SkData* SkOTUtils::RenameFont(SkStream* fontData,
//originalDataSize is the size of the original data without the name table.
size_t originalDataSize = fontData->getLength() - oldNameTablePhysicalSize;
size_t newDataSize = originalDataSize + nameTablePhysicalSize;
-
+
SK_OT_BYTE* data = static_cast<SK_OT_BYTE*>(sk_malloc_throw(newDataSize));
SkAutoTUnref<SkData> rewrittenFontData(SkData::NewFromMalloc(data, newDataSize));
diff --git a/src/sfnt/SkTypedEnum.h b/src/sfnt/SkTypedEnum.h
index ce1a93996c..73d7314885 100644
--- a/src/sfnt/SkTypedEnum.h
+++ b/src/sfnt/SkTypedEnum.h
@@ -40,7 +40,7 @@
SK_PAIR_FIRST(elem) = SK_PAIR_SECOND(elem),
#define SK_TYPED_ENUM_IDS(data, elem) \
- elem,
+ elem,
#define SK_TYPED_ENUM_IDS_L(data, elem) \
elem
diff --git a/src/svg/SkSVGClipPath.cpp b/src/svg/SkSVGClipPath.cpp
index 0a41764f84..fa3a79918d 100644
--- a/src/svg/SkSVGClipPath.cpp
+++ b/src/svg/SkSVGClipPath.cpp
@@ -32,7 +32,7 @@ void SkSVGClipPath::translate(SkSVGParser& parser, bool defState) {
const char* refStr = &use->f_xlink_href.c_str()[1];
SkASSERT(parser.getIDs().find(refStr, &ref));
SkASSERT(ref);
- if (ref->getType() == SkSVGType_Rect)
+ if (ref->getType() == SkSVGType_Rect)
parser._addAttribute("rectangle", refStr);
else
parser._addAttribute("path", refStr);
diff --git a/src/svg/SkSVGElements.cpp b/src/svg/SkSVGElements.cpp
index 0096fc055e..66dcd4e9c9 100644
--- a/src/svg/SkSVGElements.cpp
+++ b/src/svg/SkSVGElements.cpp
@@ -13,7 +13,7 @@
SkSVGBase::~SkSVGBase() {
}
-void SkSVGBase::addAttribute(SkSVGParser& parser, int attrIndex,
+void SkSVGBase::addAttribute(SkSVGParser& parser, int attrIndex,
const char* attrValue, size_t attrLength) {
SkString* first = (SkString*) ((char*) this + sizeof(SkSVGElement));
first += attrIndex;
@@ -82,7 +82,7 @@ void SkSVGElement::setIsDef() {
//}
void SkSVGElement::write(SkSVGParser& , SkString& ) {
- SkASSERT(0);
+ SkASSERT(0);
}
diff --git a/src/svg/SkSVGGradient.cpp b/src/svg/SkSVGGradient.cpp
index 27964e7328..d5f76394eb 100644
--- a/src/svg/SkSVGGradient.cpp
+++ b/src/svg/SkSVGGradient.cpp
@@ -84,7 +84,7 @@ void SkSVGGradient::write(SkSVGParser& parser, SkString& baseColor) {
parser.fSuppressPaint = true;
SkString originalID(f_id);
f_id.set("mask"); // write out gradient named given name + color (less initial #)
- f_id.append(baseColor.c_str() + 1);
+ f_id.append(baseColor.c_str() + 1);
SkString originalColors;
for (SkSVGElement** ptr = fChildren.begin(); ptr < fChildren.end(); ptr++) {
SkSVGStop* colorElement = (SkSVGStop*) *ptr;
diff --git a/src/svg/SkSVGPaintState.cpp b/src/svg/SkSVGPaintState.cpp
index 1a30cb8a24..db3090074c 100644
--- a/src/svg/SkSVGPaintState.cpp
+++ b/src/svg/SkSVGPaintState.cpp
@@ -49,7 +49,7 @@ SkString* SkSVGPaint::operator[](int index) {
return result;
}
-void SkSVGPaint::addAttribute(SkSVGParser& parser, int attrIndex,
+void SkSVGPaint::addAttribute(SkSVGParser& parser, int attrIndex,
const char* attrValue, size_t attrLength) {
SkString* attr = (*this)[attrIndex];
switch(attrIndex) {
@@ -221,7 +221,7 @@ void SkSVGPaint::setSave(SkSVGParser& parser) {
sum.setConcat(matrix, sum);
continue;
}
- if ( index == kClipPath)
+ if ( index == kClipPath)
*clips.insert(0) = lastAttr;
}
walking = walking->fNext;
@@ -267,7 +267,7 @@ void SkSVGPaint::setSave(SkSVGParser& parser) {
#endif
}
-bool SkSVGPaint::writeChangedAttributes(SkSVGParser& parser,
+bool SkSVGPaint::writeChangedAttributes(SkSVGParser& parser,
SkSVGPaint& current, bool* changed) {
SkSVGPaint& lastState = parser.fLastFlush;
for (int index = kInitial + 1; index < kTerminal; index++) {
@@ -285,7 +285,7 @@ bool SkSVGPaint::writeChangedAttributes(SkSVGParser& parser,
case kEnableBackground:
break;
case kFill:
- if (topAttr->equals("none") == false && lastAttr->equals("none") == true)
+ if (topAttr->equals("none") == false && lastAttr->equals("none") == true)
parser._addAttribute("stroke", "false");
goto fillStrokeAttrCommon;
case kFillRule:
@@ -307,7 +307,7 @@ bool SkSVGPaint::writeChangedAttributes(SkSVGParser& parser,
case kStopOpacity:
break;
case kStroke:
- if (topAttr->equals("none") == false && lastAttr->equals("none") == true)
+ if (topAttr->equals("none") == false && lastAttr->equals("none") == true)
parser._addAttribute("stroke", "true");
fillStrokeAttrCommon:
if (strncmp(attrValue, "url(", 4) == 0) {
@@ -442,7 +442,7 @@ addColor:
}
return true;
}
-
+
void SkSVGPaint::Push(SkSVGPaint** head, SkSVGPaint* newRecord) {
newRecord->fNext = *head;
*head = newRecord;
diff --git a/src/svg/SkSVGParser.cpp b/src/svg/SkSVGParser.cpp
index c8712b4796..74ea0236e0 100644
--- a/src/svg/SkSVGParser.cpp
+++ b/src/svg/SkSVGParser.cpp
@@ -35,9 +35,9 @@
static int gGeneratedMatrixID = 0;
-SkSVGParser::SkSVGParser(SkXMLParserError* errHandler) :
- SkXMLParser(errHandler),
- fHead(&fEmptyPaint), fIDs(256),
+SkSVGParser::SkSVGParser(SkXMLParserError* errHandler) :
+ SkXMLParser(errHandler),
+ fHead(&fEmptyPaint), fIDs(256),
fXMLWriter(&fStream), fCurrElement(NULL), fInSVG(false), fSuppressPaint(false) {
fLastTransform.reset();
fEmptyPaint.f_fill.set("black");
@@ -72,7 +72,7 @@ int SkSVGParser::findAttribute(SkSVGBase* element, const char* attrValue,
size_t result = 0;
while (result < count) {
if (strncmp(attributes->fName, attrValue, len) == 0 && strlen(attributes->fName) == len) {
- SkASSERT(result == (attributes->fOffset -
+ SkASSERT(result == (attributes->fOffset -
(isPaint ? sizeof(SkString) : sizeof(SkSVGElement))) / sizeof(SkString));
return result;
}
@@ -199,9 +199,9 @@ bool SkSVGParser::onStartElementLen(const char name[], size_t len) {
SkSVGTypes type = GetType(name, len);
// SkASSERT(type >= 0);
if (type < 0) {
- type = SkSVGType_G;
+ type = SkSVGType_G;
// return true;
- }
+ }
SkSVGElement* parent = fParents.count() > 0 ? fParents.top() : NULL;
SkSVGElement* element = CreateElement(type, parent);
bool result = false;
@@ -219,7 +219,7 @@ bool SkSVGParser::onStartElementLen(const char name[], size_t len) {
bool SkSVGParser::onText(const char text[], int len) {
if (fInSVG == false)
return false;
- SkSVGTypes type = fCurrElement->getType();
+ SkSVGTypes type = fCurrElement->getType();
if (type != SkSVGType_Text && type != SkSVGType_Tspan)
return false;
SkSVGText* textElement = (SkSVGText*) fCurrElement;
@@ -310,7 +310,7 @@ void SkSVGParser::translateMatrix(SkString& string, SkString* stringID) {
string.append(elems[index], end - elems[index] + 1);
}
string.remove(string.size() - 1, 1);
- string.append(",0,0,1]");
+ string.append(",0,0,1]");
_addAttribute("matrix", string);
_endElement(); // matrix
}
@@ -434,8 +434,8 @@ const SkSVGTypeName gSVGTypeNames[] = {
const int kSVGTypeNamesSize = SK_ARRAY_COUNT(gSVGTypeNames);
SkSVGTypes SkSVGParser::GetType(const char match[], size_t len ) {
- int index = SkStrSearch(&gSVGTypeNames[0].fName, kSVGTypeNamesSize, match,
+ int index = SkStrSearch(&gSVGTypeNames[0].fName, kSVGTypeNamesSize, match,
len, sizeof(gSVGTypeNames[0]));
- return index >= 0 && index < kSVGTypeNamesSize ? gSVGTypeNames[index].fType :
+ return index >= 0 && index < kSVGTypeNamesSize ? gSVGTypeNames[index].fType :
(SkSVGTypes) -1;
}
diff --git a/src/svg/SkSVGPath.cpp b/src/svg/SkSVGPath.cpp
index 92f5b14887..ab18a65a7b 100644
--- a/src/svg/SkSVGPath.cpp
+++ b/src/svg/SkSVGPath.cpp
@@ -29,7 +29,7 @@ void SkSVGPath::translate(SkSVGParser& parser, bool defState) {
}
if (hasMultiplePaths) {
SkString& fillRule = parser.getPaintLast(SkSVGPaint::kFillRule);
- if (fillRule.size() > 0)
+ if (fillRule.size() > 0)
parser._addAttribute("fillType", fillRule.equals("evenodd") ? "evenOdd" : "winding");
}
SVG_ADD_ATTRIBUTE(d);
diff --git a/src/svg/SkSVGPolygon.cpp b/src/svg/SkSVGPolygon.cpp
index 97cf5e06b5..4b458db9e7 100644
--- a/src/svg/SkSVGPolygon.cpp
+++ b/src/svg/SkSVGPolygon.cpp
@@ -18,7 +18,7 @@ const SkSVGAttribute SkSVGPolygon::gAttributes[] = {
DEFINE_SVG_INFO(Polygon)
-void SkSVGPolygon::addAttribute(SkSVGParser& parser, int attrIndex,
+void SkSVGPolygon::addAttribute(SkSVGParser& parser, int attrIndex,
const char* attrValue, size_t attrLength) {
INHERITED::addAttribute(parser, attrIndex, attrValue, attrLength);
}
@@ -27,7 +27,7 @@ void SkSVGPolygon::translate(SkSVGParser& parser, bool defState) {
parser._startElement("polygon");
SkSVGElement::translate(parser, defState);
SVG_ADD_ATTRIBUTE(points);
- if (f_fillRule.size() > 0)
+ if (f_fillRule.size() > 0)
parser._addAttribute("fillType", f_fillRule.equals("evenodd") ? "evenOdd" : "winding");
parser._endElement();
}
diff --git a/src/svg/SkSVGPolygon.h b/src/svg/SkSVGPolygon.h
index d353764896..b2848d064b 100644
--- a/src/svg/SkSVGPolygon.h
+++ b/src/svg/SkSVGPolygon.h
@@ -14,7 +14,7 @@
class SkSVGPolygon : public SkSVGPolyline {
DECLARE_SVG_INFO(Polygon);
- virtual void addAttribute(SkSVGParser& , int attrIndex,
+ virtual void addAttribute(SkSVGParser& , int attrIndex,
const char* attrValue, size_t attrLength);
private:
typedef SkSVGPolyline INHERITED;
diff --git a/src/svg/SkSVGPolyline.cpp b/src/svg/SkSVGPolyline.cpp
index fe83c04655..83dad488a5 100644
--- a/src/svg/SkSVGPolyline.cpp
+++ b/src/svg/SkSVGPolyline.cpp
@@ -24,7 +24,7 @@ const SkSVGAttribute SkSVGPolyline::gAttributes[] = {
DEFINE_SVG_INFO(Polyline)
-void SkSVGPolyline::addAttribute(SkSVGParser& , int attrIndex,
+void SkSVGPolyline::addAttribute(SkSVGParser& , int attrIndex,
const char* attrValue, size_t attrLength) {
if (attrIndex != kPoints)
return;
@@ -37,7 +37,7 @@ void SkSVGPolyline::translate(SkSVGParser& parser, bool defState) {
parser._startElement("polyline");
INHERITED::translate(parser, defState);
SVG_ADD_ATTRIBUTE(points);
- if (f_fillRule.size() > 0)
+ if (f_fillRule.size() > 0)
parser._addAttribute("fillType", f_fillRule.equals("evenodd") ? "evenOdd" : "winding");
parser._endElement();
}
diff --git a/src/svg/SkSVGPolyline.h b/src/svg/SkSVGPolyline.h
index 62dc417427..b8d5af45a8 100644
--- a/src/svg/SkSVGPolyline.h
+++ b/src/svg/SkSVGPolyline.h
@@ -15,7 +15,7 @@
class SkSVGPolyline : public SkSVGElement {
DECLARE_SVG_INFO(Polyline);
- virtual void addAttribute(SkSVGParser& , int attrIndex,
+ virtual void addAttribute(SkSVGParser& , int attrIndex,
const char* attrValue, size_t attrLength);
protected:
SkString f_clipRule;
diff --git a/src/svg/SkSVGSVG.cpp b/src/svg/SkSVGSVG.cpp
index a072d09f69..fcce62de9e 100644
--- a/src/svg/SkSVGSVG.cpp
+++ b/src/svg/SkSVGSVG.cpp
@@ -48,8 +48,8 @@ void SkSVGSVG::translate(SkSVGParser& parser, bool defState) {
box.fTop = SkScalarDiv(viewBox[1], height);
box.fRight = SkScalarDiv(viewBox[2], width);
box.fBottom = SkScalarDiv(viewBox[3], height);
- if (box.fLeft == 0 && box.fTop == 0 &&
- box.fRight == SK_Scalar1 && box.fBottom == SK_Scalar1)
+ if (box.fLeft == 0 && box.fTop == 0 &&
+ box.fRight == SK_Scalar1 && box.fBottom == SK_Scalar1)
return;
parser._startElement("matrix");
if (box.fLeft != 0) {
@@ -72,5 +72,5 @@ void SkSVGSVG::translate(SkSVGParser& parser, bool defState) {
y.appendScalar(box.fBottom);
parser._addAttributeLen("scaleY", y.c_str(), y.size());
}
- parser._endElement();
+ parser._endElement();
}
diff --git a/src/svg/SkSVGSVG.h b/src/svg/SkSVGSVG.h
index 7d1e16ad41..155f9a9bab 100644
--- a/src/svg/SkSVGSVG.h
+++ b/src/svg/SkSVGSVG.h
@@ -22,11 +22,11 @@ private:
SkString f_width;
SkString f_version;
SkString f_viewBox;
- SkString f_x;
+ SkString f_x;
SkString f_xml_space;
SkString f_xmlns;
SkString f_xml_xlink;
- SkString f_y;
+ SkString f_y;
typedef SkSVGElement INHERITED;
};
diff --git a/src/svg/SkSVGSymbol.cpp b/src/svg/SkSVGSymbol.cpp
index a98846719a..ce341e6492 100644
--- a/src/svg/SkSVGSymbol.cpp
+++ b/src/svg/SkSVGSymbol.cpp
@@ -18,5 +18,5 @@ DEFINE_SVG_INFO(Symbol)
void SkSVGSymbol::translate(SkSVGParser& parser, bool defState) {
INHERITED::translate(parser, defState);
- // !!! children need to be written into document
+ // !!! children need to be written into document
}
diff --git a/src/utils/SkBase64.cpp b/src/utils/SkBase64.cpp
index a8d4e8727f..8e1f2237ac 100644
--- a/src/utils/SkBase64.cpp
+++ b/src/utils/SkBase64.cpp
@@ -12,7 +12,7 @@
#define DecodePad -2
#define EncodePad 64
-static const char default_encode[] =
+static const char default_encode[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789+/=";
@@ -55,7 +55,7 @@ SkBase64::Error SkBase64::decode(const void* srcPtr, size_t size, bool writeDest
signed char decoded = decodeData[srcByte - '+'];
bytes[byte] = decoded;
if (decoded < 0) {
- if (decoded == DecodePad)
+ if (decoded == DecodePad)
goto handlePad;
return kBadCharError;
} else
@@ -89,7 +89,7 @@ handlePad:
*dst = (unsigned char) one;
}
dst++;
- if (padTwo)
+ if (padTwo)
break;
if (writeDestination)
*dst = (unsigned char) two;
@@ -105,7 +105,7 @@ goHome:
return kNoError;
}
-#if defined _WIN32 && _MSC_VER >= 1300
+#if defined _WIN32 && _MSC_VER >= 1300
#pragma warning ( pop )
#endif
@@ -126,7 +126,7 @@ size_t SkBase64::Encode(const void* srcPtr, size_t length, void* dstPtr, const c
unsigned b = *src++;
unsigned c = *src++;
int d = c & 0x3F;
- c = (c >> 6 | b << 2) & 0x3F;
+ c = (c >> 6 | b << 2) & 0x3F;
b = (b >> 4 | a << 4) & 0x3F;
a = a >> 2;
*dst++ = encode[a];
diff --git a/src/utils/SkBoundaryPatch.cpp b/src/utils/SkBoundaryPatch.cpp
index c305c8b7f5..afc76b5c70 100644
--- a/src/utils/SkBoundaryPatch.cpp
+++ b/src/utils/SkBoundaryPatch.cpp
@@ -50,7 +50,7 @@ bool SkBoundaryPatch::evalPatch(SkPoint verts[], int rows, int cols) {
const SkScalar invR = SkScalarInvert(SkIntToScalar(rows - 1));
const SkScalar invC = SkScalarInvert(SkIntToScalar(cols - 1));
-
+
for (int y = 0; y < cols; y++) {
SkScalar yy = y * invC;
for (int x = 0; x < rows; x++) {
diff --git a/src/utils/SkCamera.cpp b/src/utils/SkCamera.cpp
index ac6fa0fb83..7d6963ce9a 100644
--- a/src/utils/SkCamera.cpp
+++ b/src/utils/SkCamera.cpp
@@ -369,7 +369,7 @@ void Sk3DView::setCameraLocation(SkScalar x, SkScalar y, SkScalar z) {
fCamera.fLocation.set(x * SkFloatToScalar(72.0f), y * SkFloatToScalar(72.0f), lz);
fCamera.fObserver.set(0, 0, lz);
fCamera.update();
-
+
}
SkScalar Sk3DView::getCameraLocationX() {
@@ -419,7 +419,7 @@ void Sk3DView::getMatrix(SkMatrix* matrix) const {
void Sk3DView::applyToCanvas(SkCanvas* canvas) const {
SkMatrix matrix;
-
+
this->getMatrix(&matrix);
canvas->concat(matrix);
}
diff --git a/src/utils/SkCubicInterval.cpp b/src/utils/SkCubicInterval.cpp
index 6c6b0a96e5..904f26bd23 100644
--- a/src/utils/SkCubicInterval.cpp
+++ b/src/utils/SkCubicInterval.cpp
@@ -59,7 +59,7 @@ SkScalar SkEvalCubicInterval(SkScalar x1, SkScalar y1,
// now search for t given unitX
SkScalar t = find_cubic_t(x1, x2 - 2*x1, x1 - x2 + SK_Scalar1, unitX);
-
+
// now evaluate the cubic in Y
y1 *= 3;
y2 *= 3;
diff --git a/src/utils/SkCullPoints.cpp b/src/utils/SkCullPoints.cpp
index 3e3082f0c0..e76679daaa 100644
--- a/src/utils/SkCullPoints.cpp
+++ b/src/utils/SkCullPoints.cpp
@@ -15,7 +15,7 @@ static bool cross_product_is_neg(const SkIPoint& v, int dx, int dy) {
return v.fX * dy - v.fY * dx < 0;
#else
Sk64 tmp0, tmp1;
-
+
tmp0.setMul(v.fX, dy);
tmp1.setMul(dx, v.fY);
tmp0.sub(tmp1);
@@ -33,7 +33,7 @@ bool SkCullPoints::sect_test(int x0, int y0, int x1, int y1) const {
return false;
}
- // since the crossprod test is a little expensive, check for easy-in cases first
+ // since the crossprod test is a little expensive, check for easy-in cases first
if (r.contains(x0, y0) || r.contains(x1, y1)) {
return true;
}
@@ -41,7 +41,7 @@ bool SkCullPoints::sect_test(int x0, int y0, int x1, int y1) const {
// At this point we're not sure, so we do a crossprod test
SkIPoint vec;
const SkIPoint* rAsQuad = fAsQuad;
-
+
vec.set(x1 - x0, y1 - y0);
bool isNeg = cross_product_is_neg(vec, x0 - rAsQuad[0].fX, y0 - rAsQuad[0].fY);
for (int i = 1; i < 4; i++) {
@@ -89,14 +89,14 @@ SkCullPoints::LineToResult SkCullPoints::lineTo(int x, int y, SkIPoint line[]) {
LineToResult result = kNo_Result;
int x0 = fPrevPt.fX;
int y0 = fPrevPt.fY;
-
+
// need to upgrade sect_test to chop the result
// and to correctly return kLineTo_Result when the result is connected
// to the previous call-out
if (this->sect_test(x0, y0, x, y)) {
line[0].set(x0, y0);
line[1].set(x, y);
-
+
if (fPrevResult != kNo_Result && fPrevPt.equals(x0, y0)) {
result = kLineTo_Result;
} else {
@@ -133,7 +133,7 @@ void SkCullPointsPath::moveTo(int x, int y) {
void SkCullPointsPath::lineTo(int x, int y) {
SkIPoint pts[2];
-
+
switch (fCP.lineTo(x, y, pts)) {
case SkCullPoints::kMoveToLineTo_Result:
fPath->moveTo(SkIntToScalar(pts[0].fX), SkIntToScalar(pts[0].fY));
@@ -184,7 +184,7 @@ bool SkHitTestPath(const SkPath& path, SkRect& target, bool hires) {
if (hires) {
const SkScalar coordLimit = SkIntToScalar(16384);
const SkRect limit = { 0, 0, coordLimit, coordLimit };
-
+
SkMatrix matrix;
matrix.setRectToRect(bounds, limit, SkMatrix::kFill_ScaleToFit);
diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp
index 661e017bfa..81ebcbdc80 100644
--- a/src/utils/SkDeferredCanvas.cpp
+++ b/src/utils/SkDeferredCanvas.cpp
@@ -35,7 +35,7 @@ bool shouldDrawImmediately(const SkBitmap* bitmap, const SkPaint* paint) {
// code may need to be revised if that assumption is ever broken.
if (shader && !shader->asAGradient(NULL)) {
SkBitmap bm;
- if (shader->asABitmap(&bm, NULL, NULL) &&
+ if (shader->asABitmap(&bm, NULL, NULL) &&
NULL != bm.getTexture()) {
return true;
}
@@ -47,7 +47,7 @@ bool shouldDrawImmediately(const SkBitmap* bitmap, const SkPaint* paint) {
class AutoImmediateDrawIfNeeded {
public:
- AutoImmediateDrawIfNeeded(SkDeferredCanvas& canvas, const SkBitmap* bitmap,
+ AutoImmediateDrawIfNeeded(SkDeferredCanvas& canvas, const SkBitmap* bitmap,
const SkPaint* paint) {
this->init(canvas, bitmap, paint);
}
@@ -77,7 +77,7 @@ private:
namespace {
-bool isPaintOpaque(const SkPaint* paint,
+bool isPaintOpaque(const SkPaint* paint,
const SkBitmap* bmpReplacesShader = NULL) {
// TODO: SkXfermode should have a virtual isOpaque method, which would
// make it possible to test modes that do not have a Coeff representation.
@@ -102,7 +102,7 @@ bool isPaintOpaque(const SkPaint* paint,
} else if (paint->getShader() && !paint->getShader()->isOpaque()) {
break;
}
- if (paint->getColorFilter() &&
+ if (paint->getColorFilter() &&
((paint->getColorFilter()->getFlags() &
SkColorFilter::kAlphaUnchanged_Flag) == 0)) {
break;
@@ -112,7 +112,7 @@ bool isPaintOpaque(const SkPaint* paint,
if (paint->getAlpha() != 0) {
break;
}
- if (paint->getColorFilter() &&
+ if (paint->getColorFilter() &&
((paint->getColorFilter()->getFlags() &
SkColorFilter::kAlphaUnchanged_Flag) == 0)) {
break;
@@ -203,7 +203,7 @@ void DeferredPipeController::notifyWritten(size_t bytes) {
}
void DeferredPipeController::playback() {
-
+
for (int currentBlock = 0; currentBlock < fBlockList.count(); currentBlock++ ) {
fReader.playback(fBlockList[currentBlock].fBlock, fBlockList[currentBlock].fSize);
}
@@ -376,10 +376,10 @@ void DeferredDevice::endRecording() {
void DeferredDevice::beginRecording() {
SkASSERT(NULL == fRecordingCanvas);
- fRecordingCanvas = fPipeWriter.startRecording(&fPipeController, 0,
+ fRecordingCanvas = fPipeWriter.startRecording(&fPipeController, 0,
fImmediateDevice->width(), fImmediateDevice->height());
}
-
+
void DeferredDevice::setNotificationClient(
SkDeferredCanvas::NotificationClient* notificationClient) {
fNotificationClient = notificationClient;
@@ -409,7 +409,7 @@ void DeferredDevice::contentsCleared() {
// Restore pre-purge state
if (!clipRegion.isEmpty()) {
- fRecordingCanvas->clipRegion(clipRegion,
+ fRecordingCanvas->clipRegion(clipRegion,
SkRegion::kReplace_Op);
}
if (!matrix.isIdentity()) {
@@ -475,7 +475,7 @@ void DeferredDevice::recordedDrawCommand() {
storageAllocated = this->storageAllocatedForRecording();
}
- if (fNotificationClient &&
+ if (fNotificationClient &&
storageAllocated != fPreviousStorageAllocated) {
fPreviousStorageAllocated = storageAllocated;
fNotificationClient->storageAllocatedForRecordingChanged(storageAllocated);
@@ -486,16 +486,16 @@ SkCanvas* DeferredDevice::recordingCanvas() {
return fRecordingCanvas;
}
-uint32_t DeferredDevice::getDeviceCapabilities() {
+uint32_t DeferredDevice::getDeviceCapabilities() {
return fImmediateDevice->getDeviceCapabilities();
}
-int DeferredDevice::width() const {
+int DeferredDevice::width() const {
return fImmediateDevice->width();
}
int DeferredDevice::height() const {
- return fImmediateDevice->height();
+ return fImmediateDevice->height();
}
SkGpuRenderTarget* DeferredDevice::accessRenderTarget() {
@@ -661,7 +661,7 @@ bool SkDeferredCanvas::isFullFrame(const SkRect* rect,
if (paint) {
SkPaint::Style paintStyle = paint->getStyle();
- if (!(paintStyle == SkPaint::kFill_Style ||
+ if (!(paintStyle == SkPaint::kFill_Style ||
paintStyle == SkPaint::kStrokeAndFill_Style)) {
return false;
}
@@ -673,8 +673,8 @@ bool SkDeferredCanvas::isFullFrame(const SkRect* rect,
// The following test holds with AA enabled, and is conservative
// by a 0.5 pixel margin with AA disabled
- if (transformedRect.fLeft > SkIntToScalar(0) ||
- transformedRect.fTop > SkIntToScalar(0) ||
+ if (transformedRect.fLeft > SkIntToScalar(0) ||
+ transformedRect.fTop > SkIntToScalar(0) ||
transformedRect.fRight < SkIntToScalar(canvasSize.fWidth) ||
transformedRect.fBottom < SkIntToScalar(canvasSize.fHeight)) {
return false;
@@ -686,8 +686,8 @@ bool SkDeferredCanvas::isFullFrame(const SkRect* rect,
{
SkIRect bounds;
canvas->getClipDeviceBounds(&bounds);
- if (bounds.fLeft > 0 || bounds.fTop > 0 ||
- bounds.fRight < canvasSize.fWidth ||
+ if (bounds.fLeft > 0 || bounds.fTop > 0 ||
+ bounds.fRight < canvasSize.fWidth ||
bounds.fBottom < canvasSize.fHeight)
return false;
}
@@ -808,7 +808,7 @@ void SkDeferredCanvas::clear(SkColor color) {
}
void SkDeferredCanvas::drawPaint(const SkPaint& paint) {
- if (fDeferredDrawing && this->isFullFrame(NULL, &paint) &&
+ if (fDeferredDrawing && this->isFullFrame(NULL, &paint) &&
isPaintOpaque(&paint)) {
this->getDeferredDevice()->contentsCleared();
}
@@ -825,7 +825,7 @@ void SkDeferredCanvas::drawPoints(PointMode mode, size_t count,
}
void SkDeferredCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
- if (fDeferredDrawing && this->isFullFrame(&rect, &paint) &&
+ if (fDeferredDrawing && this->isFullFrame(&rect, &paint) &&
isPaintOpaque(&paint)) {
this->getDeferredDevice()->contentsCleared();
}
@@ -845,7 +845,7 @@ void SkDeferredCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar left,
SkScalar top, const SkPaint* paint) {
SkRect bitmapRect = SkRect::MakeXYWH(left, top,
SkIntToScalar(bitmap.width()), SkIntToScalar(bitmap.height()));
- if (fDeferredDrawing &&
+ if (fDeferredDrawing &&
this->isFullFrame(&bitmapRect, paint) &&
isPaintOpaque(paint, &bitmap)) {
this->getDeferredDevice()->contentsCleared();
@@ -856,11 +856,11 @@ void SkDeferredCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar left,
this->recordedDrawCommand();
}
-void SkDeferredCanvas::drawBitmapRect(const SkBitmap& bitmap,
+void SkDeferredCanvas::drawBitmapRect(const SkBitmap& bitmap,
const SkIRect* src,
const SkRect& dst,
const SkPaint* paint) {
- if (fDeferredDrawing &&
+ if (fDeferredDrawing &&
this->isFullFrame(&dst, paint) &&
isPaintOpaque(paint, &bitmap)) {
this->getDeferredDevice()->contentsCleared();
@@ -896,10 +896,10 @@ void SkDeferredCanvas::drawSprite(const SkBitmap& bitmap, int left, int top,
const SkPaint* paint) {
SkRect bitmapRect = SkRect::MakeXYWH(
SkIntToScalar(left),
- SkIntToScalar(top),
+ SkIntToScalar(top),
SkIntToScalar(bitmap.width()),
SkIntToScalar(bitmap.height()));
- if (fDeferredDrawing &&
+ if (fDeferredDrawing &&
this->isFullFrame(&bitmapRect, paint) &&
isPaintOpaque(paint, &bitmap)) {
this->getDeferredDevice()->contentsCleared();
@@ -966,10 +966,10 @@ SkBounder* SkDeferredCanvas::setBounder(SkBounder* bounder) {
}
SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) {
- this->drawingCanvas()->setDrawFilter(filter);
+ this->drawingCanvas()->setDrawFilter(filter);
this->INHERITED::setDrawFilter(filter);
this->recordedDrawCommand();
- return filter;
+ return filter;
}
SkCanvas* SkDeferredCanvas::canvasForDrawIter() {
diff --git a/src/utils/SkInterpolator.cpp b/src/utils/SkInterpolator.cpp
index d43792f77b..2ef27020d6 100644
--- a/src/utils/SkInterpolator.cpp
+++ b/src/utils/SkInterpolator.cpp
@@ -165,7 +165,7 @@ static const SkScalar gIdentityBlend[4] = {
bool SkInterpolator::setKeyFrame(int index, SkMSec time,
const SkScalar values[], const SkScalar blend[4]) {
SkASSERT(values != NULL);
-
+
if (blend == NULL) {
blend = gIdentityBlend;
}
@@ -237,13 +237,13 @@ SkScalar SkUnitCubicInterp(SkScalar value, SkScalar bx, SkScalar by,
SkScalar cx, SkScalar cy) {
// pin to the unit-square, and convert to 2.14
Dot14 x = pin_and_convert(value);
-
+
if (x == 0) return 0;
if (x == Dot14_ONE) return SK_Scalar1;
-
+
Dot14 b = pin_and_convert(bx);
Dot14 c = pin_and_convert(cx);
-
+
// Now compute our coefficients from the control points
// t -> 3b
// t^2 -> 3c - 6b
@@ -264,7 +264,7 @@ SkScalar SkUnitCubicInterp(SkScalar value, SkScalar bx, SkScalar by,
t += dt;
}
}
-
+
// Now we have t, so compute the coeff for Y and evaluate
b = pin_and_convert(by);
c = pin_and_convert(cy);
diff --git a/src/utils/SkJSON.cpp b/src/utils/SkJSON.cpp
index c55d46483e..06989f3148 100644
--- a/src/utils/SkJSON.cpp
+++ b/src/utils/SkJSON.cpp
@@ -56,7 +56,7 @@ struct SkJSON::Object::Slot {
SkASSERT(name);
fNext = NULL;
-
+
size_t len = strlen(name);
// extra 1 for str[0] which stores the type
char* str = alloc_string(1 + len);
@@ -64,14 +64,14 @@ struct SkJSON::Object::Slot {
// str[1] skips the type, len+1 includes the terminating 0 byte.
memcpy(&str[1], name, len + 1);
fName = str;
-
+
// fValue is uninitialized
}
~Slot();
-
+
Type type() const { return (Type)fName[0]; }
const char* name() const { return &fName[1]; }
-
+
Slot* fNext;
char* fName; // fName[0] is the type, &fName[1] is the "name"
union {
@@ -378,7 +378,7 @@ void SkJSON::Object::toDebugf() const {
void SkJSON::Object::dumpLevel(int level) const {
for (Slot* slot = fHead; slot; slot = slot->fNext) {
- Type t = slot->type();
+ Type t = slot->type();
tabForLevel(level + 1);
SkDebugf("\"%s\" : ", slot->name());
switch (slot->type()) {
@@ -507,11 +507,11 @@ static const uint8_t gBytesPerType[] = {
};
typedef void* (*DupProc)(const void*);
-
+
static void* dup_object(const void* src) {
return SkNEW_ARGS(SkJSON::Object, (*(SkJSON::Object*)src));
}
-
+
static void* dup_array(const void* src) {
return SkNEW_ARGS(SkJSON::Array, (*(SkJSON::Array*)src));
}
@@ -561,7 +561,7 @@ SkJSON::Array::Array(Type type, int count) {
SkJSON::Array::Array(const int32_t values[], int count) {
this->init(kInt, count, values);
}
-
+
SkJSON::Array::Array(const float values[], int count) {
this->init(kFloat, count, values);
}
diff --git a/src/utils/SkMeshUtils.cpp b/src/utils/SkMeshUtils.cpp
index f7af3834d5..7970ba1af4 100644
--- a/src/utils/SkMeshUtils.cpp
+++ b/src/utils/SkMeshUtils.cpp
@@ -55,11 +55,11 @@ bool SkMeshIndices::init(SkPoint tex[], uint16_t indices[],
*idx++ = index;
*idx++ = index + rows + 1;
*idx++ = index + 1;
-
+
*idx++ = index + 1;
*idx++ = index + rows + 1;
*idx++ = index + rows + 2;
-
+
index += 1;
}
index += 1;
@@ -89,7 +89,7 @@ void SkMeshUtils::Draw(SkCanvas* canvas, const SkBitmap& bitmap,
int rows, int cols, const SkPoint verts[],
const SkColor colors[], const SkPaint& paint) {
SkMeshIndices idx;
-
+
if (idx.init(bitmap.width(), bitmap.height(), rows, cols)) {
SkPaint p(paint);
p.setShader(SkShader::CreateBitmapShader(bitmap,
diff --git a/src/utils/SkNinePatch.cpp b/src/utils/SkNinePatch.cpp
index 26ae8ebe65..9dc8bd26cd 100644
--- a/src/utils/SkNinePatch.cpp
+++ b/src/utils/SkNinePatch.cpp
@@ -15,11 +15,11 @@ static const uint16_t g3x3Indices[] = {
0, 5, 1, 0, 4, 5,
1, 6, 2, 1, 5, 6,
2, 7, 3, 2, 6, 7,
-
+
4, 9, 5, 4, 8, 9,
5, 10, 6, 5, 9, 10,
6, 11, 7, 6, 10, 11,
-
+
8, 13, 9, 8, 12, 13,
9, 14, 10, 9, 13, 14,
10, 15, 11, 10, 14, 15
@@ -27,18 +27,18 @@ static const uint16_t g3x3Indices[] = {
static int fillIndices(uint16_t indices[], int xCount, int yCount) {
uint16_t* startIndices = indices;
-
+
int n = 0;
for (int y = 0; y < yCount; y++) {
for (int x = 0; x < xCount; x++) {
*indices++ = n;
*indices++ = n + xCount + 2;
*indices++ = n + 1;
-
+
*indices++ = n;
*indices++ = n + xCount + 1;
*indices++ = n + xCount + 2;
-
+
n += 1;
}
n += 1;
@@ -108,14 +108,14 @@ void SkNinePatch::DrawMesh(SkCanvas* canvas, const SkRect& bounds,
if (bounds.isEmpty() || bitmap.width() == 0 || bitmap.height() == 0) {
return;
}
-
+
// should try a quick-reject test before calling lockPixels
SkAutoLockPixels alp(bitmap);
// after the lock, it is valid to check
if (!bitmap.readyToDraw()) {
return;
}
-
+
// check for degenerate divs (just an optimization, not required)
{
int i;
@@ -129,17 +129,17 @@ void SkNinePatch::DrawMesh(SkCanvas* canvas, const SkRect& bounds,
numYDivs -= 1;
}
}
-
+
Mesh mesh;
-
+
const int numXStretch = (numXDivs + 1) >> 1;
const int numYStretch = (numYDivs + 1) >> 1;
-
+
if (numXStretch < 1 && numYStretch < 1) {
canvas->drawBitmapRect(bitmap, NULL, bounds, paint);
return;
}
-
+
if (false) {
int i;
for (i = 0; i < numXDivs; i++) {
@@ -149,9 +149,9 @@ void SkNinePatch::DrawMesh(SkCanvas* canvas, const SkRect& bounds,
SkDebugf("--- ydivs[%d] %d\n", i, yDivs[i]);
}
}
-
+
SkScalar stretchX = 0, stretchY = 0;
-
+
if (numXStretch > 0) {
int stretchSize = 0;
for (int i = 1; i < numXDivs; i += 2) {
@@ -163,7 +163,7 @@ void SkNinePatch::DrawMesh(SkCanvas* canvas, const SkRect& bounds,
else // reuse stretchX, but keep it negative as a signal
stretchX = SkScalarDiv(-bounds.width(), fixed);
}
-
+
if (numYStretch > 0) {
int stretchSize = 0;
for (int i = 1; i < numYDivs; i += 2) {
@@ -175,7 +175,7 @@ void SkNinePatch::DrawMesh(SkCanvas* canvas, const SkRect& bounds,
else // reuse stretchX, but keep it negative as a signal
stretchY = SkScalarDiv(-bounds.height(), fixed);
}
-
+
#if 0
SkDebugf("---- drawasamesh [%d %d] -> [%g %g] <%d %d> (%g %g)\n",
bitmap.width(), bitmap.height(),
@@ -193,12 +193,12 @@ void SkNinePatch::DrawMesh(SkCanvas* canvas, const SkRect& bounds,
SkPoint* verts = (SkPoint*)storage.get();
SkPoint* texs = verts + vCount;
uint16_t* indices = (uint16_t*)(texs + vCount);
-
+
mesh.fVerts = verts;
mesh.fTexs = texs;
mesh.fColors = NULL;
mesh.fIndices = NULL;
-
+
// we use <= for YDivs, since the prebuild indices work for 3x2 and 3x1 too
if (numXDivs == 2 && numYDivs <= 2) {
mesh.fIndices = g3x3Indices;
@@ -207,7 +207,7 @@ void SkNinePatch::DrawMesh(SkCanvas* canvas, const SkRect& bounds,
SkASSERT(n == indexCount);
mesh.fIndices = indices;
}
-
+
SkScalar vy = bounds.fTop;
fillRow(verts, texs, vy, 0, bounds, xDivs, numXDivs,
stretchX, bitmap.width());
@@ -235,7 +235,7 @@ void SkNinePatch::DrawMesh(SkCanvas* canvas, const SkRect& bounds,
}
fillRow(verts, texs, bounds.fBottom, SkIntToScalar(bitmap.height()),
bounds, xDivs, numXDivs, stretchX, bitmap.width());
-
+
SkShader* shader = SkShader::CreateBitmapShader(bitmap,
SkShader::kClamp_TileMode,
SkShader::kClamp_TileMode);
@@ -310,7 +310,7 @@ void SkNinePatch::DrawNine(SkCanvas* canvas, const SkRect& bounds,
if (false /* is our canvas backed by a gpu?*/) {
int32_t xDivs[2];
int32_t yDivs[2];
-
+
xDivs[0] = margins.fLeft;
xDivs[1] = bitmap.width() - margins.fRight;
yDivs[0] = margins.fTop;
@@ -326,7 +326,7 @@ void SkNinePatch::DrawNine(SkCanvas* canvas, const SkRect& bounds,
(margins.fTop + margins.fBottom);
yDivs[1] = yDivs[0];
}
-
+
SkNinePatch::DrawMesh(canvas, bounds, bitmap,
xDivs, 2, yDivs, 2, paint);
} else {
diff --git a/src/utils/SkParse.cpp b/src/utils/SkParse.cpp
index cb265c383f..9609ddc568 100644
--- a/src/utils/SkParse.cpp
+++ b/src/utils/SkParse.cpp
@@ -62,7 +62,7 @@ static const char* skip_sep(const char str[])
return str;
}
-int SkParse::Count(const char str[])
+int SkParse::Count(const char str[])
{
char c;
int count = 0;
@@ -83,7 +83,7 @@ goHome:
return count;
}
-int SkParse::Count(const char str[], char separator)
+int SkParse::Count(const char str[], char separator)
{
char c;
int count = 0;
@@ -234,7 +234,7 @@ const char* SkParse::FindScalar(const char str[], SkScalar* value) {
if (*str == '.')
{
- static const int gFractions[] = { (1 << 24) / 10, (1 << 24) / 100, (1 << 24) / 1000,
+ static const int gFractions[] = { (1 << 24) / 10, (1 << 24) / 100, (1 << 24) / 1000,
(1 << 24) / 10000, (1 << 24) / 100000 };
str += 1;
int d = 0;
@@ -330,7 +330,7 @@ int SkParse::FindList(const char target[], const char list[])
}
#ifdef SK_SUPPORT_UNITTEST
-void SkParse::UnitTest()
+void SkParse::UnitTest()
{
// !!! additional parse tests go here
SkParse::TestColor();
diff --git a/src/utils/SkParsePath.cpp b/src/utils/SkParsePath.cpp
index 22433e6b7d..18ea5e023b 100644
--- a/src/utils/SkParsePath.cpp
+++ b/src/utils/SkParsePath.cpp
@@ -58,7 +58,7 @@ static const char* find_points(const char str[], SkPoint value[], int count,
return str;
}
-static const char* find_scalar(const char str[], SkScalar* value,
+static const char* find_scalar(const char str[], SkScalar* value,
bool isRelative, SkScalar relative) {
str = SkParse::FindScalar(str, value);
if (isRelative) {
@@ -103,7 +103,7 @@ bool SkParsePath::FromSVGString(const char data[], SkPath* result) {
op = 'L';
c = points[0];
break;
- case 'L':
+ case 'L':
data = find_points(data, points, 1, relative, &c);
path.lineTo(points[0]);
c = points[0];
@@ -120,10 +120,10 @@ bool SkParsePath::FromSVGString(const char data[], SkPath* result) {
path.lineTo(c.fX, y);
c.fY = y;
} break;
- case 'C':
+ case 'C':
data = find_points(data, points, 3, relative, &c);
goto cubicCommon;
- case 'S':
+ case 'S':
data = find_points(data, &points[1], 2, relative, &c);
points[0] = c;
if (previousOp == 'C' || previousOp == 'S') {
@@ -191,7 +191,7 @@ static void write_scalar(SkWStream* stream, SkScalar value) {
#ifdef SK_SCALAR_IS_FLOAT
char buffer[64];
#ifdef SK_BUILD_FOR_WIN32
- int len = _snprintf(buffer, sizeof(buffer), "%g", value);
+ int len = _snprintf(buffer, sizeof(buffer), "%g", value);
#else
int len = snprintf(buffer, sizeof(buffer), "%g", value);
#endif
diff --git a/src/utils/SkThreadUtils.h b/src/utils/SkThreadUtils.h
index b0c5044618..8963981596 100644
--- a/src/utils/SkThreadUtils.h
+++ b/src/utils/SkThreadUtils.h
@@ -13,32 +13,32 @@
class SkThread : SkNoncopyable {
public:
typedef void (*entryPointProc)(void*);
-
+
SkThread(entryPointProc entryPoint, void* data = NULL);
-
+
/**
* Non-virtual, do not subclass.
*/
~SkThread();
-
+
/**
* Starts the thread. Returns false if the thread could not be started.
*/
bool start();
-
+
/**
* Waits for the thread to finish.
* If the thread has not started, returns immediately.
*/
void join();
-
+
/**
* SkThreads with an affinity for the same processor will attempt to run cache
* locally with each other. SkThreads with an affinity for different processors
* will attempt to run on different cores. Returns false if the request failed.
*/
bool setProcessorAffinity(unsigned int processor);
-
+
private:
void* fData;
};
diff --git a/src/utils/mac/SkBitmap_Mac.cpp b/src/utils/mac/SkBitmap_Mac.cpp
index a99513135d..1f73f0f423 100644
--- a/src/utils/mac/SkBitmap_Mac.cpp
+++ b/src/utils/mac/SkBitmap_Mac.cpp
@@ -20,7 +20,7 @@
static void convertGL32_to_Mac32(uint32_t dst[], const SkBitmap& bm) {
memcpy(dst, bm.getPixels(), bm.getSize());
return;
-
+
uint32_t* stop = dst + (bm.getSize() >> 2);
const uint8_t* src = (const uint8_t*)bm.getPixels();
while (dst < stop) {
@@ -38,7 +38,7 @@ static void convert565_to_32(uint32_t dst[], const SkBitmap& bm) {
unsigned r = SkPacked16ToR32(c);
unsigned g = SkPacked16ToG32(c);
unsigned b = SkPacked16ToB32(c);
-
+
*dst++ = (b << 24) | (g << 16) | (r << 8) | 0xFF;
}
}
@@ -47,11 +47,11 @@ static void convert565_to_32(uint32_t dst[], const SkBitmap& bm) {
static void convert4444_to_555(uint16_t dst[], const uint16_t src[], int count)
{
const uint16_t* stop = src + count;
-
+
while (src < stop)
{
unsigned c = *src++;
-
+
unsigned r = SkGetPackedR4444(c);
unsigned g = SkGetPackedG4444(c);
unsigned b = SkGetPackedB4444(c);
@@ -61,7 +61,7 @@ static void convert4444_to_555(uint16_t dst[], const uint16_t src[], int count)
b = (b << 1) | (b >> 3);
// build the 555
c = (r << 10) | (g << 5) | b;
-
+
#ifdef SWAP_16BIT
c = (c >> 8) | (c << 8);
#endif
@@ -111,10 +111,10 @@ static CGImageRef bitmap2imageref(const SkBitmap& bm) {
}
void SkBitmap::drawToPort(WindowRef wind, CGContextRef cg) const {
- if (fPixels == NULL || fWidth == 0 || fHeight == 0) {
- return;
+ if (fPixels == NULL || fWidth == 0 || fHeight == 0) {
+ return;
}
-
+
bool useQD = false;
if (NULL == cg) {
SetPortWindowPort(wind);
@@ -136,7 +136,7 @@ void SkBitmap::drawToPort(WindowRef wind, CGContextRef cg) const {
rect.origin.x = rect.origin.y = 0;
rect.size.width = bm.width();
rect.size.height = bm.height();
-
+
CGContextDrawImage(cg, rect, image);
CGImageRelease(image);
}
diff --git a/src/utils/mac/SkCreateCGImageRef.cpp b/src/utils/mac/SkCreateCGImageRef.cpp
index e5f7c69cb8..df20ba930d 100644
--- a/src/utils/mac/SkCreateCGImageRef.cpp
+++ b/src/utils/mac/SkCreateCGImageRef.cpp
@@ -18,14 +18,14 @@ static void SkBitmap_ReleaseInfo(void* info, const void* pixelData, size_t size)
(SK_A32_SHIFT == (a) && SK_R32_SHIFT == (r) \
&& SK_G32_SHIFT == (g) && SK_B32_SHIFT == (b))
-static bool getBitmapInfo(const SkBitmap& bm,
+static bool getBitmapInfo(const SkBitmap& bm,
size_t* bitsPerComponent,
CGBitmapInfo* info,
bool* upscaleTo32) {
if (upscaleTo32) {
*upscaleTo32 = false;
}
-
+
switch (bm.config()) {
case SkBitmap::kRGB_565_Config:
if (upscaleTo32) {
@@ -105,11 +105,11 @@ CGImageRef SkCreateCGImageRefWithColorspace(const SkBitmap& bm,
const size_t s = bitmap->getSize();
// our provider "owns" the bitmap*, and will take care of deleting it
- // we initially lock it, so we can access the pixels. The bitmap will be deleted in the release
- // proc, which will in turn unlock the pixels
- bitmap->lockPixels();
+ // we initially lock it, so we can access the pixels. The bitmap will be deleted in the release
+ // proc, which will in turn unlock the pixels
+ bitmap->lockPixels();
CGDataProviderRef dataRef = CGDataProviderCreateWithData(bitmap, bitmap->getPixels(), s,
- SkBitmap_ReleaseInfo);
+ SkBitmap_ReleaseInfo);
bool releaseColorSpace = false;
if (NULL == colorSpace) {
@@ -177,7 +177,7 @@ bool SkPDFDocumentToBitmap(SkStream* stream, SkBitmap* output) {
if (NULL == data) {
return false;
}
-
+
CGPDFDocumentRef pdf = CGPDFDocumentCreateWithProvider(data);
CGDataProviderRelease(data);
if (NULL == pdf) {
@@ -189,12 +189,12 @@ bool SkPDFDocumentToBitmap(SkStream* stream, SkBitmap* output) {
if (NULL == page) {
return false;
}
-
+
CGRect bounds = CGPDFPageGetBoxRect(page, kCGPDFMediaBox);
-
+
int w = (int)CGRectGetWidth(bounds);
int h = (int)CGRectGetHeight(bounds);
-
+
SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config, w, h);
bitmap.allocPixels();
@@ -202,7 +202,7 @@ bool SkPDFDocumentToBitmap(SkStream* stream, SkBitmap* output) {
size_t bitsPerComponent;
CGBitmapInfo info;
- getBitmapInfo(bitmap, &bitsPerComponent, &info, NULL);
+ getBitmapInfo(bitmap, &bitsPerComponent, &info, NULL);
CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB();
CGContextRef ctx = CGBitmapContextCreate(bitmap.getPixels(), w, h,
diff --git a/src/utils/win/SkDWriteFontFileStream.h b/src/utils/win/SkDWriteFontFileStream.h
index cd5787eb4f..b214858e57 100644
--- a/src/utils/win/SkDWriteFontFileStream.h
+++ b/src/utils/win/SkDWriteFontFileStream.h
@@ -23,7 +23,7 @@ class SkDWriteFontFileStream : public SkStream {
public:
explicit SkDWriteFontFileStream(IDWriteFontFileStream* fontFileStream);
virtual ~SkDWriteFontFileStream();
-
+
virtual bool rewind() SK_OVERRIDE;
virtual size_t read(void* buffer, size_t size) SK_OVERRIDE;
virtual const void* getMemoryBase() SK_OVERRIDE;
diff --git a/src/utils/win/SkDWriteGeometrySink.cpp b/src/utils/win/SkDWriteGeometrySink.cpp
index 4aec3bb778..5455e669ef 100644
--- a/src/utils/win/SkDWriteGeometrySink.cpp
+++ b/src/utils/win/SkDWriteGeometrySink.cpp
@@ -28,7 +28,7 @@ HRESULT STDMETHODCALLTYPE SkDWriteGeometrySink::QueryInterface(REFIID iid, void
return S_OK;
} else {
*object = NULL;
- return E_NOINTERFACE;
+ return E_NOINTERFACE;
}
}
diff --git a/src/utils/win/SkHRESULT.cpp b/src/utils/win/SkHRESULT.cpp
index 3d463f8607..8b6b79f61d 100644
--- a/src/utils/win/SkHRESULT.cpp
+++ b/src/utils/win/SkHRESULT.cpp
@@ -13,7 +13,7 @@ void SkTraceHR(const char* file, unsigned long line,
HRESULT hr, const char* msg) {
SkDEBUGCODE(if (NULL != msg) SkDEBUGF(("%s\n", msg)));
SkDEBUGF(("%s(%lu) : error 0x%x: ", file, line, hr));
-
+
LPSTR errorText = NULL;
FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
@@ -25,7 +25,7 @@ void SkTraceHR(const char* file, unsigned long line,
0,
NULL
);
-
+
if (NULL == errorText) {
SkDEBUGF(("<unknown>\n"));
} else {
diff --git a/src/utils/win/SkIStream.cpp b/src/utils/win/SkIStream.cpp
index fce015cf21..1d00611f79 100644
--- a/src/utils/win/SkIStream.cpp
+++ b/src/utils/win/SkIStream.cpp
@@ -34,7 +34,7 @@ HRESULT STDMETHODCALLTYPE SkBaseIStream::QueryInterface(REFIID iid
return S_OK;
} else {
*ppvObject = NULL;
- return E_NOINTERFACE;
+ return E_NOINTERFACE;
}
}
@@ -62,7 +62,7 @@ HRESULT STDMETHODCALLTYPE SkBaseIStream::Write(void const* pv
{ return E_NOTIMPL; }
// IStream Interface
-HRESULT STDMETHODCALLTYPE SkBaseIStream::SetSize(ULARGE_INTEGER)
+HRESULT STDMETHODCALLTYPE SkBaseIStream::SetSize(ULARGE_INTEGER)
{ return E_NOTIMPL; }
HRESULT STDMETHODCALLTYPE SkBaseIStream::CopyTo(IStream*
@@ -190,7 +190,7 @@ HRESULT STDMETHODCALLTYPE SkIStream::Seek(LARGE_INTEGER liDistanceToMove
hr = STG_E_INVALIDFUNCTION;
break;
}
-
+
if (NULL != lpNewFilePointer) {
lpNewFilePointer->QuadPart = this->fLocation.QuadPart;
}
diff --git a/src/views/SkBGViewArtist.cpp b/src/views/SkBGViewArtist.cpp
index d9a45b8ffb..ffc410aea6 100644
--- a/src/views/SkBGViewArtist.cpp
+++ b/src/views/SkBGViewArtist.cpp
@@ -11,7 +11,7 @@
SkBGViewArtist::SkBGViewArtist(SkColor c)
{
- fPaint.setColor(c);
+ fPaint.setColor(c);
}
SkBGViewArtist::~SkBGViewArtist()
@@ -20,12 +20,12 @@ SkBGViewArtist::~SkBGViewArtist()
void SkBGViewArtist::onDraw(SkView*, SkCanvas* canvas)
{
- // only works for views that are clipped their bounds.
- canvas->drawPaint(fPaint);
+ // only works for views that are clipped their bounds.
+ canvas->drawPaint(fPaint);
}
void SkBGViewArtist::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- SkPaint_Inflate(&fPaint, dom, node);
+ SkPaint_Inflate(&fPaint, dom, node);
}
diff --git a/src/views/SkEvent.cpp b/src/views/SkEvent.cpp
index 0149215b2c..151317039b 100644
--- a/src/views/SkEvent.cpp
+++ b/src/views/SkEvent.cpp
@@ -59,9 +59,9 @@ static size_t makeCharArray(char* buffer, size_t compact)
return strlen(buffer);
}
-void SkEvent::getType(SkString* str) const
-{
- if (str)
+void SkEvent::getType(SkString* str) const
+{
+ if (str)
{
if ((size_t) fType & 1) // not a pointer
{
@@ -74,13 +74,13 @@ void SkEvent::getType(SkString* str) const
}
}
-bool SkEvent::isType(const SkString& str) const
+bool SkEvent::isType(const SkString& str) const
{
- return this->isType(str.c_str(), str.size());
+ return this->isType(str.c_str(), str.size());
}
-bool SkEvent::isType(const char type[], size_t typeLen) const
-{
+bool SkEvent::isType(const char type[], size_t typeLen) const
+{
if (typeLen == 0)
typeLen = strlen(type);
if ((size_t) fType & 1) { // not a pointer
@@ -88,7 +88,7 @@ bool SkEvent::isType(const char type[], size_t typeLen) const
size_t len = makeCharArray(chars, (size_t) fType);
return len == typeLen && strncmp(chars, type, typeLen) == 0;
}
- return strncmp(fType, type, typeLen) == 0 && fType[typeLen] == 0;
+ return strncmp(fType, type, typeLen) == 0 && fType[typeLen] == 0;
}
void SkEvent::setType(const char type[], size_t typeLen)
@@ -183,7 +183,7 @@ void SkEvent::inflate(const SkDOM& dom, const SkDOM::Node* node)
{
if (title)
SkDebugf("%s ", title);
-
+
SkString etype;
this->getType(&etype);
SkDebugf("event<%s> fast32=%d", etype.c_str(), this->getFast32());
@@ -193,7 +193,7 @@ void SkEvent::inflate(const SkDOM& dom, const SkDOM::Node* node)
SkMetaData::Type mtype;
int count;
const char* name;
-
+
while ((name = iter.next(&mtype, &count)) != NULL)
{
SkASSERT(count > 0);
@@ -296,7 +296,7 @@ void SkEvent::postDelay(SkMSec delay) {
delete this;
return;
}
-
+
if (delay) {
this->postTime(SkTime::GetMSecs() + delay);
return;
@@ -307,7 +307,7 @@ void SkEvent::postDelay(SkMSec delay) {
globals.fEventMutex.acquire();
bool wasEmpty = SkEvent::Enqueue(this);
globals.fEventMutex.release();
-
+
// call outside of us holding the mutex
if (wasEmpty) {
SkEvent::SignalNonEmptyQueue();
@@ -321,11 +321,11 @@ void SkEvent::postTime(SkMSec time) {
}
SkEvent_Globals& globals = getGlobals();
-
+
globals.fEventMutex.acquire();
SkMSec queueDelay = SkEvent::EnqueueTime(this, time);
globals.fEventMutex.release();
-
+
// call outside of us holding the mutex
if ((int32_t)queueDelay != ~0) {
SkEvent::SignalQueueTimer(queueDelay);
@@ -473,7 +473,7 @@ void SkEvent::ServiceQueueTimer()
int SkEvent::CountEventsOnQueue() {
SkEvent_Globals& globals = getGlobals();
globals.fEventMutex.acquire();
-
+
int count = 0;
const SkEvent* evt = globals.fEventQHead;
while (evt) {
diff --git a/src/views/SkEventSink.cpp b/src/views/SkEventSink.cpp
index 8f39156c51..b6a3a6ee82 100644
--- a/src/views/SkEventSink.cpp
+++ b/src/views/SkEventSink.cpp
@@ -163,7 +163,7 @@ void SkEventSink::addListenerID(SkEventSinkID id)
this->addTagList(next);
}
-void SkEventSink::copyListeners(const SkEventSink& sink)
+void SkEventSink::copyListeners(const SkEventSink& sink)
{
SkListenersTagList* sinkList = (SkListenersTagList*)sink.findTagList(kListeners_SkTagList);
if (sinkList == NULL)
@@ -226,7 +226,7 @@ SkEventSink::EventResult SkEventSink::DoEvent(const SkEvent& evt) {
if (proc) {
return proc(evt) ? kHandled_EventResult : kNotHandled_EventResult;
}
-
+
SkEventSink* sink = SkEventSink::FindSink(evt.getTargetID());
if (sink) {
return sink->doEvent(evt) ? kHandled_EventResult : kNotHandled_EventResult;
diff --git a/src/views/SkOSMenu.cpp b/src/views/SkOSMenu.cpp
index ed37541438..3de0a9eb77 100644
--- a/src/views/SkOSMenu.cpp
+++ b/src/views/SkOSMenu.cpp
@@ -11,7 +11,7 @@
static int gOSMenuCmd = 7000;
SkOSMenu::SkOSMenu(const char title[]) {
- fTitle.set(title);
+ fTitle.set(title);
}
SkOSMenu::~SkOSMenu() {
@@ -46,7 +46,7 @@ void SkOSMenu::assignKeyEquivalentToItem(int itemID, SkUnichar key) {
}
}
-bool SkOSMenu::handleKeyEquivalent(SkUnichar key) {
+bool SkOSMenu::handleKeyEquivalent(SkUnichar key) {
int value = 0, size = 0;
bool state;
SkOSMenu::TriState tristate;
@@ -89,7 +89,7 @@ bool SkOSMenu::handleKeyEquivalent(SkUnichar key) {
////////////////////////////////////////////////////////////////////////////////
-SkOSMenu::Item::Item(const char label[], SkOSMenu::Type type,
+SkOSMenu::Item::Item(const char label[], SkOSMenu::Type type,
const char slotName[], SkEvent* evt) {
fLabel.set(label);
fSlotName.set(slotName);
@@ -133,7 +133,7 @@ static const char* gDelimiter = "|";
static const char* gList_Items_Str = "SkOSMenuList_Items";
static const char* gList_ItemCount_S32 = "SkOSMenuList_ItemCount";
-int SkOSMenu::appendItem(const char label[], Type type, const char slotName[],
+int SkOSMenu::appendItem(const char label[], Type type, const char slotName[],
SkEvent* evt) {
SkOSMenu::Item* item = new Item(label, type, slotName, evt);
fItems.append(1, &item);
@@ -147,7 +147,7 @@ int SkOSMenu::appendAction(const char label[], SkEventSinkID target) {
return appendItem(label, SkOSMenu::kAction_Type, "", evt);
}
-int SkOSMenu::appendList(const char label[], const char slotName[],
+int SkOSMenu::appendList(const char label[], const char slotName[],
SkEventSinkID target, int index, const char option[], ...) {
SkEvent* evt = new SkEvent(gMenuEventType, target);
va_list args;
@@ -168,8 +168,8 @@ int SkOSMenu::appendList(const char label[], const char slotName[],
return appendItem(label, SkOSMenu::kList_Type, slotName, evt);
}
-int SkOSMenu::appendSlider(const char label[], const char slotName[],
- SkEventSinkID target, SkScalar min, SkScalar max,
+int SkOSMenu::appendSlider(const char label[], const char slotName[],
+ SkEventSinkID target, SkScalar min, SkScalar max,
SkScalar defaultValue) {
SkEvent* evt = new SkEvent(gMenuEventType, target);
evt->setScalar(gSlider_Min_Scalar, min);
@@ -178,7 +178,7 @@ int SkOSMenu::appendSlider(const char label[], const char slotName[],
return appendItem(label, SkOSMenu::kSlider_Type, slotName, evt);
}
-int SkOSMenu::appendSwitch(const char label[], const char slotName[],
+int SkOSMenu::appendSwitch(const char label[], const char slotName[],
SkEventSinkID target, bool defaultState) {
SkEvent* evt = new SkEvent(gMenuEventType, target);
evt->setBool(slotName, defaultState);
@@ -192,7 +192,7 @@ int SkOSMenu::appendTriState(const char label[], const char slotName[],
return appendItem(label, SkOSMenu::kTriState_Type, slotName, evt);
}
-int SkOSMenu::appendTextField(const char label[], const char slotName[],
+int SkOSMenu::appendTextField(const char label[], const char slotName[],
SkEventSinkID target, const char placeholder[]) {
SkEvent* evt = new SkEvent(gMenuEventType, target);
evt->setString(slotName, placeholder);
@@ -234,7 +234,7 @@ bool SkOSMenu::FindAction(const SkEvent& evt, const char label[]) {
}
bool SkOSMenu::FindListIndex(const SkEvent& evt, const char slotName[], int* value) {
- return evt.isType(gMenuEventType) && evt.findS32(slotName, value);
+ return evt.isType(gMenuEventType) && evt.findS32(slotName, value);
}
bool SkOSMenu::FindSliderValue(const SkEvent& evt, const char slotName[], SkScalar* value) {
diff --git a/src/views/SkParsePaint.cpp b/src/views/SkParsePaint.cpp
index 4839439bb8..7a305f2867 100644
--- a/src/views/SkParsePaint.cpp
+++ b/src/views/SkParsePaint.cpp
@@ -13,98 +13,98 @@
static SkShader* inflate_shader(const SkDOM& dom, const SkDOM::Node* node)
{
- if ((node = dom.getFirstChild(node, "shader")) == NULL)
- return NULL;
-
- const char* str;
-
- if (dom.hasAttr(node, "type", "linear-gradient"))
- {
- SkColor colors[2];
- SkPoint pts[2];
-
- colors[0] = colors[1] = SK_ColorBLACK; // need to initialized the alpha to opaque, since FindColor doesn't set it
- if ((str = dom.findAttr(node, "c0")) != NULL &&
- SkParse::FindColor(str, &colors[0]) &&
- (str = dom.findAttr(node, "c1")) != NULL &&
- SkParse::FindColor(str, &colors[1]) &&
- dom.findScalars(node, "p0", &pts[0].fX, 2) &&
- dom.findScalars(node, "p1", &pts[1].fX, 2))
- {
- SkShader::TileMode mode = SkShader::kClamp_TileMode;
- int index;
-
- if ((index = dom.findList(node, "tile-mode", "clamp,repeat,mirror")) >= 0)
- mode = (SkShader::TileMode)index;
- return SkGradientShader::CreateLinear(pts, colors, NULL, 2, mode);
- }
- }
- else if (dom.hasAttr(node, "type", "bitmap"))
- {
- if ((str = dom.findAttr(node, "src")) == NULL)
- return NULL;
-
- SkBitmap bm;
-
- if (SkImageDecoder::DecodeFile(str, &bm))
- {
- SkShader::TileMode mode = SkShader::kRepeat_TileMode;
- int index;
-
- if ((index = dom.findList(node, "tile-mode", "clamp,repeat,mirror")) >= 0)
- mode = (SkShader::TileMode)index;
-
- return SkShader::CreateBitmapShader(bm, mode, mode);
- }
- }
- return NULL;
+ if ((node = dom.getFirstChild(node, "shader")) == NULL)
+ return NULL;
+
+ const char* str;
+
+ if (dom.hasAttr(node, "type", "linear-gradient"))
+ {
+ SkColor colors[2];
+ SkPoint pts[2];
+
+ colors[0] = colors[1] = SK_ColorBLACK; // need to initialized the alpha to opaque, since FindColor doesn't set it
+ if ((str = dom.findAttr(node, "c0")) != NULL &&
+ SkParse::FindColor(str, &colors[0]) &&
+ (str = dom.findAttr(node, "c1")) != NULL &&
+ SkParse::FindColor(str, &colors[1]) &&
+ dom.findScalars(node, "p0", &pts[0].fX, 2) &&
+ dom.findScalars(node, "p1", &pts[1].fX, 2))
+ {
+ SkShader::TileMode mode = SkShader::kClamp_TileMode;
+ int index;
+
+ if ((index = dom.findList(node, "tile-mode", "clamp,repeat,mirror")) >= 0)
+ mode = (SkShader::TileMode)index;
+ return SkGradientShader::CreateLinear(pts, colors, NULL, 2, mode);
+ }
+ }
+ else if (dom.hasAttr(node, "type", "bitmap"))
+ {
+ if ((str = dom.findAttr(node, "src")) == NULL)
+ return NULL;
+
+ SkBitmap bm;
+
+ if (SkImageDecoder::DecodeFile(str, &bm))
+ {
+ SkShader::TileMode mode = SkShader::kRepeat_TileMode;
+ int index;
+
+ if ((index = dom.findList(node, "tile-mode", "clamp,repeat,mirror")) >= 0)
+ mode = (SkShader::TileMode)index;
+
+ return SkShader::CreateBitmapShader(bm, mode, mode);
+ }
+ }
+ return NULL;
}
void SkPaint_Inflate(SkPaint* paint, const SkDOM& dom, const SkDOM::Node* node)
{
- SkASSERT(paint);
- SkASSERT(&dom);
- SkASSERT(node);
-
- SkScalar x;
-
- if (dom.findScalar(node, "stroke-width", &x))
- paint->setStrokeWidth(x);
- if (dom.findScalar(node, "text-size", &x))
- paint->setTextSize(x);
-
- bool b;
-
- SkASSERT("legacy: use is-stroke" && !dom.findBool(node, "is-frame", &b));
-
- if (dom.findBool(node, "is-stroke", &b))
- paint->setStyle(b ? SkPaint::kStroke_Style : SkPaint::kFill_Style);
- if (dom.findBool(node, "is-antialias", &b))
- paint->setAntiAlias(b);
- if (dom.findBool(node, "is-lineartext", &b))
- paint->setLinearText(b);
-
- const char* str = dom.findAttr(node, "color");
- if (str)
- {
- SkColor c = paint->getColor();
- if (SkParse::FindColor(str, &c))
- paint->setColor(c);
- }
-
- // do this AFTER parsing for the color
- if (dom.findScalar(node, "opacity", &x))
- {
- x = SkMaxScalar(0, SkMinScalar(x, SK_Scalar1));
- paint->setAlpha(SkScalarRound(x * 255));
- }
-
- int index = dom.findList(node, "text-anchor", "left,center,right");
- if (index >= 0)
- paint->setTextAlign((SkPaint::Align)index);
-
- SkShader* shader = inflate_shader(dom, node);
- if (shader)
- paint->setShader(shader)->unref();
+ SkASSERT(paint);
+ SkASSERT(&dom);
+ SkASSERT(node);
+
+ SkScalar x;
+
+ if (dom.findScalar(node, "stroke-width", &x))
+ paint->setStrokeWidth(x);
+ if (dom.findScalar(node, "text-size", &x))
+ paint->setTextSize(x);
+
+ bool b;
+
+ SkASSERT("legacy: use is-stroke" && !dom.findBool(node, "is-frame", &b));
+
+ if (dom.findBool(node, "is-stroke", &b))
+ paint->setStyle(b ? SkPaint::kStroke_Style : SkPaint::kFill_Style);
+ if (dom.findBool(node, "is-antialias", &b))
+ paint->setAntiAlias(b);
+ if (dom.findBool(node, "is-lineartext", &b))
+ paint->setLinearText(b);
+
+ const char* str = dom.findAttr(node, "color");
+ if (str)
+ {
+ SkColor c = paint->getColor();
+ if (SkParse::FindColor(str, &c))
+ paint->setColor(c);
+ }
+
+ // do this AFTER parsing for the color
+ if (dom.findScalar(node, "opacity", &x))
+ {
+ x = SkMaxScalar(0, SkMinScalar(x, SK_Scalar1));
+ paint->setAlpha(SkScalarRound(x * 255));
+ }
+
+ int index = dom.findList(node, "text-anchor", "left,center,right");
+ if (index >= 0)
+ paint->setTextAlign((SkPaint::Align)index);
+
+ SkShader* shader = inflate_shader(dom, node);
+ if (shader)
+ paint->setShader(shader)->unref();
}
diff --git a/src/views/SkProgressView.cpp b/src/views/SkProgressView.cpp
index d82b48ee24..edb78bdcf6 100644
--- a/src/views/SkProgressView.cpp
+++ b/src/views/SkProgressView.cpp
@@ -14,120 +14,120 @@
SkProgressView::SkProgressView(uint32_t flags) : SkView(flags), fOnShader(NULL), fOffShader(NULL)
{
- fValue = 0;
- fMax = 0;
- fInterp = NULL;
- fDoInterp = false;
+ fValue = 0;
+ fMax = 0;
+ fInterp = NULL;
+ fDoInterp = false;
}
SkProgressView::~SkProgressView()
{
- delete fInterp;
- SkSafeUnref(fOnShader);
- SkSafeUnref(fOffShader);
+ delete fInterp;
+ SkSafeUnref(fOnShader);
+ SkSafeUnref(fOffShader);
}
void SkProgressView::setMax(U16CPU max)
{
- if (fMax != max)
- {
- fMax = SkToU16(max);
- if (fValue > 0)
- this->inval(NULL);
- }
+ if (fMax != max)
+ {
+ fMax = SkToU16(max);
+ if (fValue > 0)
+ this->inval(NULL);
+ }
}
void SkProgressView::setValue(U16CPU value)
{
- if (fValue != value)
- {
- if (fDoInterp)
- {
- if (fInterp)
- delete fInterp;
- fInterp = new SkInterpolator(1, 2);
- SkScalar x = (SkScalar)(fValue << 8);
- fInterp->setKeyFrame(0, SkTime::GetMSecs(), &x, 0);
- x = (SkScalar)(value << 8);
- fInterp->setKeyFrame(1, SkTime::GetMSecs() + 333, &x);
- }
- fValue = SkToU16(value);
- this->inval(NULL);
- }
+ if (fValue != value)
+ {
+ if (fDoInterp)
+ {
+ if (fInterp)
+ delete fInterp;
+ fInterp = new SkInterpolator(1, 2);
+ SkScalar x = (SkScalar)(fValue << 8);
+ fInterp->setKeyFrame(0, SkTime::GetMSecs(), &x, 0);
+ x = (SkScalar)(value << 8);
+ fInterp->setKeyFrame(1, SkTime::GetMSecs() + 333, &x);
+ }
+ fValue = SkToU16(value);
+ this->inval(NULL);
+ }
}
void SkProgressView::onDraw(SkCanvas* canvas)
{
- if (fMax == 0)
- return;
-
- SkFixed percent;
-
- if (fInterp)
- {
- SkScalar x;
- if (fInterp->timeToValues(SkTime::GetMSecs(), &x) == SkInterpolator::kFreezeEnd_Result)
- {
- delete fInterp;
- fInterp = NULL;
- }
- percent = (SkFixed)x; // now its 16.8
- percent = SkMax32(0, SkMin32(percent, fMax << 8)); // now its pinned
- percent = SkFixedDiv(percent, fMax << 8); // now its 0.16
- this->inval(NULL);
- }
- else
- {
- U16CPU value = SkMax32(0, SkMin32(fValue, fMax));
- percent = SkFixedDiv(value, fMax);
- }
-
-
- SkRect r;
- SkPaint p;
-
- r.set(0, 0, this->width(), this->height());
- p.setAntiAlias(true);
-
- r.fRight = r.fLeft + SkScalarMul(r.width(), SkFixedToScalar(percent));
- p.setStyle(SkPaint::kFill_Style);
-
- p.setColor(SK_ColorDKGRAY);
- p.setShader(fOnShader);
- canvas->drawRect(r, p);
-
- p.setColor(SK_ColorWHITE);
- p.setShader(fOffShader);
- r.fLeft = r.fRight;
- r.fRight = this->width() - SK_Scalar1;
- if (r.width() > 0)
- canvas->drawRect(r, p);
+ if (fMax == 0)
+ return;
+
+ SkFixed percent;
+
+ if (fInterp)
+ {
+ SkScalar x;
+ if (fInterp->timeToValues(SkTime::GetMSecs(), &x) == SkInterpolator::kFreezeEnd_Result)
+ {
+ delete fInterp;
+ fInterp = NULL;
+ }
+ percent = (SkFixed)x; // now its 16.8
+ percent = SkMax32(0, SkMin32(percent, fMax << 8)); // now its pinned
+ percent = SkFixedDiv(percent, fMax << 8); // now its 0.16
+ this->inval(NULL);
+ }
+ else
+ {
+ U16CPU value = SkMax32(0, SkMin32(fValue, fMax));
+ percent = SkFixedDiv(value, fMax);
+ }
+
+
+ SkRect r;
+ SkPaint p;
+
+ r.set(0, 0, this->width(), this->height());
+ p.setAntiAlias(true);
+
+ r.fRight = r.fLeft + SkScalarMul(r.width(), SkFixedToScalar(percent));
+ p.setStyle(SkPaint::kFill_Style);
+
+ p.setColor(SK_ColorDKGRAY);
+ p.setShader(fOnShader);
+ canvas->drawRect(r, p);
+
+ p.setColor(SK_ColorWHITE);
+ p.setShader(fOffShader);
+ r.fLeft = r.fRight;
+ r.fRight = this->width() - SK_Scalar1;
+ if (r.width() > 0)
+ canvas->drawRect(r, p);
}
#include "SkImageDecoder.h"
static SkShader* inflate_shader(const char file[])
{
- SkBitmap bm;
+ SkBitmap bm;
- return SkImageDecoder::DecodeFile(file, &bm) ?
- SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode) :
- NULL;
+ return SkImageDecoder::DecodeFile(file, &bm) ?
+ SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode) :
+ NULL;
}
void SkProgressView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- this->INHERITED::onInflate(dom, node);
+ this->INHERITED::onInflate(dom, node);
- const char* s;
+ const char* s;
- SkASSERT(fOnShader == NULL);
- SkASSERT(fOffShader == NULL);
+ SkASSERT(fOnShader == NULL);
+ SkASSERT(fOffShader == NULL);
- if ((s = dom.findAttr(node, "src-on")) != NULL)
- fOnShader = inflate_shader(s);
- if ((s = dom.findAttr(node, "src-off")) != NULL)
- fOffShader = inflate_shader(s);
- (void)dom.findBool(node, "do-interp", &fDoInterp);
+ if ((s = dom.findAttr(node, "src-on")) != NULL)
+ fOnShader = inflate_shader(s);
+ if ((s = dom.findAttr(node, "src-off")) != NULL)
+ fOffShader = inflate_shader(s);
+ (void)dom.findBool(node, "do-interp", &fDoInterp);
}
diff --git a/src/views/SkStackViewLayout.cpp b/src/views/SkStackViewLayout.cpp
index bf6f36339e..e4fbb80ea8 100644
--- a/src/views/SkStackViewLayout.cpp
+++ b/src/views/SkStackViewLayout.cpp
@@ -9,51 +9,51 @@
SkStackViewLayout::SkStackViewLayout()
{
- fMargin.set(0, 0, 0, 0);
- fSpacer = 0;
- fOrient = kHorizontal_Orient;
- fPack = kStart_Pack;
- fAlign = kStart_Align;
- fRound = false;
+ fMargin.set(0, 0, 0, 0);
+ fSpacer = 0;
+ fOrient = kHorizontal_Orient;
+ fPack = kStart_Pack;
+ fAlign = kStart_Align;
+ fRound = false;
}
void SkStackViewLayout::setOrient(Orient ori)
{
- SkASSERT((unsigned)ori < kOrientCount);
- fOrient = SkToU8(ori);
+ SkASSERT((unsigned)ori < kOrientCount);
+ fOrient = SkToU8(ori);
}
void SkStackViewLayout::getMargin(SkRect* margin) const
{
- if (margin)
- *margin = fMargin;
+ if (margin)
+ *margin = fMargin;
}
void SkStackViewLayout::setMargin(const SkRect& margin)
{
- fMargin = margin;
+ fMargin = margin;
}
void SkStackViewLayout::setSpacer(SkScalar spacer)
{
- fSpacer = spacer;
+ fSpacer = spacer;
}
void SkStackViewLayout::setPack(Pack pack)
{
- SkASSERT((unsigned)pack < kPackCount);
- fPack = SkToU8(pack);
+ SkASSERT((unsigned)pack < kPackCount);
+ fPack = SkToU8(pack);
}
void SkStackViewLayout::setAlign(Align align)
{
- SkASSERT((unsigned)align < kAlignCount);
- fAlign = SkToU8(align);
+ SkASSERT((unsigned)align < kAlignCount);
+ fAlign = SkToU8(align);
}
void SkStackViewLayout::setRound(bool r)
{
- fRound = SkToU8(r);
+ fRound = SkToU8(r);
}
////////////////////////////////////////////////////////////////////////////////
@@ -68,170 +68,170 @@ static SkScalar center_align_proc(SkScalar childLimit, SkScalar parentLimit) { r
static SkScalar right_align_proc(SkScalar childLimit, SkScalar parentLimit) { return parentLimit - childLimit; }
static SkScalar fill_align_proc(SkScalar childLimit, SkScalar parentLimit) { return 0; }
-/* Measure the main-dimension for all the children. If a child is marked flex in that direction
- ignore its current value but increment the counter for flexChildren
+/* Measure the main-dimension for all the children. If a child is marked flex in that direction
+ ignore its current value but increment the counter for flexChildren
*/
static SkScalar compute_children_limit(SkView* parent, GetSizeProc sizeProc, int* count,
- uint32_t flexMask, int* flexCount)
+ uint32_t flexMask, int* flexCount)
{
- SkView::B2FIter iter(parent);
- SkView* child;
- SkScalar limit = 0;
- int n = 0, flex = 0;
-
- while ((child = iter.next()) != NULL)
- {
- n += 1;
- if (child->getFlags() & flexMask)
- flex += 1;
- else
- limit += (child->*sizeProc)();
- }
- if (count)
- *count = n;
- if (flexCount)
- *flexCount = flex;
- return limit;
+ SkView::B2FIter iter(parent);
+ SkView* child;
+ SkScalar limit = 0;
+ int n = 0, flex = 0;
+
+ while ((child = iter.next()) != NULL)
+ {
+ n += 1;
+ if (child->getFlags() & flexMask)
+ flex += 1;
+ else
+ limit += (child->*sizeProc)();
+ }
+ if (count)
+ *count = n;
+ if (flexCount)
+ *flexCount = flex;
+ return limit;
}
void SkStackViewLayout::onLayoutChildren(SkView* parent)
{
- static AlignProc gAlignProcs[] = {
- left_align_proc,
- center_align_proc,
- right_align_proc,
- fill_align_proc
- };
-
- SkScalar startM, endM, crossStartM, crossLimit;
- GetSizeProc mainGetSizeP, crossGetSizeP;
- SetLocProc mainLocP, crossLocP;
- SetSizeProc mainSetSizeP, crossSetSizeP;
- SkView::Flag_Mask flexMask;
-
- if (fOrient == kHorizontal_Orient)
- {
- startM = fMargin.fLeft;
- endM = fMargin.fRight;
- crossStartM = fMargin.fTop;
- crossLimit = -fMargin.fTop - fMargin.fBottom;
-
- mainGetSizeP = &SkView::width;
- crossGetSizeP = &SkView::height;
- mainLocP = &SkView::setLocX;
- crossLocP = &SkView::setLocY;
-
- mainSetSizeP = &SkView::setWidth;
- crossSetSizeP = &SkView::setHeight;
-
- flexMask = SkView::kFlexH_Mask;
- }
- else
- {
- startM = fMargin.fTop;
- endM = fMargin.fBottom;
- crossStartM = fMargin.fLeft;
- crossLimit = -fMargin.fLeft - fMargin.fRight;
-
- mainGetSizeP = &SkView::height;
- crossGetSizeP = &SkView::width;
- mainLocP = &SkView::setLocY;
- crossLocP = &SkView::setLocX;
-
- mainSetSizeP = &SkView::setHeight;
- crossSetSizeP = &SkView::setWidth;
-
- flexMask = SkView::kFlexV_Mask;
- }
- crossLimit += (parent->*crossGetSizeP)();
- if (fAlign != kStretch_Align)
- crossSetSizeP = NULL;
-
- int childCount, flexCount;
- SkScalar childLimit = compute_children_limit(parent, mainGetSizeP, &childCount, flexMask, &flexCount);
-
- if (childCount == 0)
- return;
-
- childLimit += (childCount - 1) * fSpacer;
-
- SkScalar parentLimit = (parent->*mainGetSizeP)() - startM - endM;
- SkScalar pos = startM + gAlignProcs[fPack](childLimit, parentLimit);
- SkScalar flexAmount = 0;
- SkView::B2FIter iter(parent);
- SkView* child;
-
- if (flexCount > 0 && parentLimit > childLimit)
- flexAmount = (parentLimit - childLimit) / flexCount;
-
- while ((child = iter.next()) != NULL)
- {
- if (fRound)
- pos = SkIntToScalar(SkScalarRound(pos));
- (child->*mainLocP)(pos);
- SkScalar crossLoc = crossStartM + gAlignProcs[fAlign]((child->*crossGetSizeP)(), crossLimit);
- if (fRound)
- crossLoc = SkIntToScalar(SkScalarRound(crossLoc));
- (child->*crossLocP)(crossLoc);
-
- if (crossSetSizeP)
- (child->*crossSetSizeP)(crossLimit);
- if (child->getFlags() & flexMask)
- (child->*mainSetSizeP)(flexAmount);
- pos += (child->*mainGetSizeP)() + fSpacer;
- }
+ static AlignProc gAlignProcs[] = {
+ left_align_proc,
+ center_align_proc,
+ right_align_proc,
+ fill_align_proc
+ };
+
+ SkScalar startM, endM, crossStartM, crossLimit;
+ GetSizeProc mainGetSizeP, crossGetSizeP;
+ SetLocProc mainLocP, crossLocP;
+ SetSizeProc mainSetSizeP, crossSetSizeP;
+ SkView::Flag_Mask flexMask;
+
+ if (fOrient == kHorizontal_Orient)
+ {
+ startM = fMargin.fLeft;
+ endM = fMargin.fRight;
+ crossStartM = fMargin.fTop;
+ crossLimit = -fMargin.fTop - fMargin.fBottom;
+
+ mainGetSizeP = &SkView::width;
+ crossGetSizeP = &SkView::height;
+ mainLocP = &SkView::setLocX;
+ crossLocP = &SkView::setLocY;
+
+ mainSetSizeP = &SkView::setWidth;
+ crossSetSizeP = &SkView::setHeight;
+
+ flexMask = SkView::kFlexH_Mask;
+ }
+ else
+ {
+ startM = fMargin.fTop;
+ endM = fMargin.fBottom;
+ crossStartM = fMargin.fLeft;
+ crossLimit = -fMargin.fLeft - fMargin.fRight;
+
+ mainGetSizeP = &SkView::height;
+ crossGetSizeP = &SkView::width;
+ mainLocP = &SkView::setLocY;
+ crossLocP = &SkView::setLocX;
+
+ mainSetSizeP = &SkView::setHeight;
+ crossSetSizeP = &SkView::setWidth;
+
+ flexMask = SkView::kFlexV_Mask;
+ }
+ crossLimit += (parent->*crossGetSizeP)();
+ if (fAlign != kStretch_Align)
+ crossSetSizeP = NULL;
+
+ int childCount, flexCount;
+ SkScalar childLimit = compute_children_limit(parent, mainGetSizeP, &childCount, flexMask, &flexCount);
+
+ if (childCount == 0)
+ return;
+
+ childLimit += (childCount - 1) * fSpacer;
+
+ SkScalar parentLimit = (parent->*mainGetSizeP)() - startM - endM;
+ SkScalar pos = startM + gAlignProcs[fPack](childLimit, parentLimit);
+ SkScalar flexAmount = 0;
+ SkView::B2FIter iter(parent);
+ SkView* child;
+
+ if (flexCount > 0 && parentLimit > childLimit)
+ flexAmount = (parentLimit - childLimit) / flexCount;
+
+ while ((child = iter.next()) != NULL)
+ {
+ if (fRound)
+ pos = SkIntToScalar(SkScalarRound(pos));
+ (child->*mainLocP)(pos);
+ SkScalar crossLoc = crossStartM + gAlignProcs[fAlign]((child->*crossGetSizeP)(), crossLimit);
+ if (fRound)
+ crossLoc = SkIntToScalar(SkScalarRound(crossLoc));
+ (child->*crossLocP)(crossLoc);
+
+ if (crossSetSizeP)
+ (child->*crossSetSizeP)(crossLimit);
+ if (child->getFlags() & flexMask)
+ (child->*mainSetSizeP)(flexAmount);
+ pos += (child->*mainGetSizeP)() + fSpacer;
+ }
}
//////////////////////////////////////////////////////////////////////////////////////
#ifdef SK_DEBUG
- static void assert_no_attr(const SkDOM& dom, const SkDOM::Node* node, const char attr[])
- {
- const char* value = dom.findAttr(node, attr);
- if (value)
- SkDebugf("unknown attribute %s=\"%s\"\n", attr, value);
- }
+ static void assert_no_attr(const SkDOM& dom, const SkDOM::Node* node, const char attr[])
+ {
+ const char* value = dom.findAttr(node, attr);
+ if (value)
+ SkDebugf("unknown attribute %s=\"%s\"\n", attr, value);
+ }
#else
- #define assert_no_attr(dom, node, attr)
+ #define assert_no_attr(dom, node, attr)
#endif
void SkStackViewLayout::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- int index;
- SkScalar value[4];
+ int index;
+ SkScalar value[4];
- if ((index = dom.findList(node, "orient", "horizontal,vertical")) >= 0)
- this->setOrient((Orient)index);
- else {
- assert_no_attr(dom, node, "orient");
+ if ((index = dom.findList(node, "orient", "horizontal,vertical")) >= 0)
+ this->setOrient((Orient)index);
+ else {
+ assert_no_attr(dom, node, "orient");
}
- if (dom.findScalars(node, "margin", value, 4))
- {
- SkRect margin;
- margin.set(value[0], value[1], value[2], value[3]);
- this->setMargin(margin);
- }
- else {
- assert_no_attr(dom, node, "margin");
+ if (dom.findScalars(node, "margin", value, 4))
+ {
+ SkRect margin;
+ margin.set(value[0], value[1], value[2], value[3]);
+ this->setMargin(margin);
+ }
+ else {
+ assert_no_attr(dom, node, "margin");
}
- if (dom.findScalar(node, "spacer", value))
- this->setSpacer(value[0]);
- else {
- assert_no_attr(dom, node, "spacer");
+ if (dom.findScalar(node, "spacer", value))
+ this->setSpacer(value[0]);
+ else {
+ assert_no_attr(dom, node, "spacer");
}
- if ((index = dom.findList(node, "pack", "start,center,end")) >= 0)
- this->setPack((Pack)index);
- else {
- assert_no_attr(dom, node, "pack");
+ if ((index = dom.findList(node, "pack", "start,center,end")) >= 0)
+ this->setPack((Pack)index);
+ else {
+ assert_no_attr(dom, node, "pack");
}
- if ((index = dom.findList(node, "align", "start,center,end,stretch")) >= 0)
- this->setAlign((Align)index);
- else {
- assert_no_attr(dom, node, "align");
+ if ((index = dom.findList(node, "align", "start,center,end,stretch")) >= 0)
+ this->setAlign((Align)index);
+ else {
+ assert_no_attr(dom, node, "align");
}
}
@@ -239,36 +239,36 @@ void SkStackViewLayout::onInflate(const SkDOM& dom, const SkDOM::Node* node)
SkFillViewLayout::SkFillViewLayout()
{
- fMargin.setEmpty();
+ fMargin.setEmpty();
}
void SkFillViewLayout::getMargin(SkRect* r) const
{
- if (r)
- *r = fMargin;
+ if (r)
+ *r = fMargin;
}
void SkFillViewLayout::setMargin(const SkRect& margin)
{
- fMargin = margin;
+ fMargin = margin;
}
void SkFillViewLayout::onLayoutChildren(SkView* parent)
{
- SkView::B2FIter iter(parent);
- SkView* child;
-
- while ((child = iter.next()) != NULL)
- {
- child->setLoc(fMargin.fLeft, fMargin.fTop);
- child->setSize( parent->width() - fMargin.fRight - fMargin.fLeft,
- parent->height() - fMargin.fBottom - fMargin.fTop);
- }
+ SkView::B2FIter iter(parent);
+ SkView* child;
+
+ while ((child = iter.next()) != NULL)
+ {
+ child->setLoc(fMargin.fLeft, fMargin.fTop);
+ child->setSize( parent->width() - fMargin.fRight - fMargin.fLeft,
+ parent->height() - fMargin.fBottom - fMargin.fTop);
+ }
}
void SkFillViewLayout::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- this->INHERITED::onInflate(dom, node);
- (void)dom.findScalars(node, "margin", (SkScalar*)&fMargin, 4);
+ this->INHERITED::onInflate(dom, node);
+ (void)dom.findScalars(node, "margin", (SkScalar*)&fMargin, 4);
}
diff --git a/src/views/SkTextBox.cpp b/src/views/SkTextBox.cpp
index 47237a905e..355944aef1 100644
--- a/src/views/SkTextBox.cpp
+++ b/src/views/SkTextBox.cpp
@@ -156,7 +156,7 @@ void SkTextBox::draw(SkCanvas* canvas, const char text[], size_t len, const SkPa
y += scaledSpacing;
if (y + metrics.fAscent >= height)
break;
- }
+ }
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/views/SkTouchGesture.cpp b/src/views/SkTouchGesture.cpp
index 1828f0390b..afda8c15cd 100644
--- a/src/views/SkTouchGesture.cpp
+++ b/src/views/SkTouchGesture.cpp
@@ -191,7 +191,7 @@ static const float MIN_ZOOM_SCALE = 0.25f;
float SkTouchGesture::limitTotalZoom(float scale) const {
// this query works 'cause we know that we're square-scale w/ no skew/rotation
const float curr = SkScalarToFloat(fGlobalM[0]);
-
+
if (scale > 1 && curr * scale > MAX_ZOOM_SCALE) {
scale = MAX_ZOOM_SCALE / curr;
} else if (scale < 1 && curr * scale < MIN_ZOOM_SCALE) {
@@ -239,7 +239,7 @@ void SkTouchGesture::touchMoved(void* owner, float x, float y) {
SkASSERT(kZoom_State == fState);
const Rec& rec0 = fTouches[0];
const Rec& rec1 = fTouches[1];
-
+
float scale = this->computePinch(rec0, rec1);
scale = this->limitTotalZoom(scale);
diff --git a/src/views/SkView.cpp b/src/views/SkView.cpp
index eb93198240..94eb490a0b 100644
--- a/src/views/SkView.cpp
+++ b/src/views/SkView.cpp
@@ -95,7 +95,7 @@ void SkView::offset(SkScalar dx, SkScalar dy)
this->setLoc(fLoc.fX + dx, fLoc.fY + dy);
}
-void SkView::setLocalMatrix(const SkMatrix& matrix)
+void SkView::setLocalMatrix(const SkMatrix& matrix)
{
this->inval(NULL);
fMatrix = matrix;
@@ -106,22 +106,22 @@ void SkView::draw(SkCanvas* canvas)
{
if (fWidth && fHeight && this->isVisible())
{
- SkRect r;
+ SkRect r;
r.set(fLoc.fX, fLoc.fY, fLoc.fX + fWidth, fLoc.fY + fHeight);
if (this->isClipToBounds() &&
canvas->quickReject(r)) {
return;
}
- SkAutoCanvasRestore as(canvas, true);
+ SkAutoCanvasRestore as(canvas, true);
if (this->isClipToBounds()) {
canvas->clipRect(r);
}
-
- canvas->translate(fLoc.fX, fLoc.fY);
+
+ canvas->translate(fLoc.fX, fLoc.fY);
canvas->concat(fMatrix);
-
+
if (fParent) {
fParent->beforeChild(this, canvas);
}
@@ -133,21 +133,21 @@ void SkView::draw(SkCanvas* canvas)
if (fParent) {
fParent->afterChild(this, canvas);
}
-
- B2FIter iter(this);
- SkView* child;
+
+ B2FIter iter(this);
+ SkView* child;
SkCanvas* childCanvas = this->beforeChildren(canvas);
while ((child = iter.next()) != NULL)
child->draw(childCanvas);
-
+
this->afterChildren(canvas);
}
}
void SkView::inval(SkRect* rect) {
- SkView* view = this;
+ SkView* view = this;
SkRect storage;
for (;;) {
@@ -184,7 +184,7 @@ void SkView::inval(SkRect* rect) {
bool SkView::setFocusView(SkView* fv)
{
SkView* view = this;
-
+
do {
if (view->onSetFocusView(fv))
return true;
@@ -194,8 +194,8 @@ bool SkView::setFocusView(SkView* fv)
SkView* SkView::getFocusView() const
{
- SkView* focus = NULL;
- const SkView* view = this;
+ SkView* focus = NULL;
+ const SkView* view = this;
do {
if (view->onGetFocusView(&focus))
break;
@@ -223,16 +223,16 @@ SkView* SkView::acceptFocus(FocusDirection dir)
if (this->acceptFocus())
return this;
- B2FIter iter(this);
- SkView* child, *focus;
+ B2FIter iter(this);
+ SkView* child, *focus;
while ((child = iter.next()) != NULL)
if ((focus = child->acceptFocus(dir)) != NULL)
return focus;
}
else // prev
{
- F2BIter iter(this);
- SkView* child, *focus;
+ F2BIter iter(this);
+ SkView* child, *focus;
while ((child = iter.next()) != NULL)
if ((focus = child->acceptFocus(dir)) != NULL)
return focus;
@@ -249,13 +249,13 @@ SkView* SkView::moveFocus(FocusDirection dir)
SkView* focus = this->getFocusView();
if (focus == NULL)
- { // start with the root
+ { // start with the root
focus = this;
while (focus->fParent)
focus = focus->fParent;
}
- SkView* child, *parent;
+ SkView* child, *parent;
if (dir == kNext_FocusDirection)
{
@@ -279,10 +279,10 @@ SkView* SkView::moveFocus(FocusDirection dir)
parent = parent->fParent;
} while (parent != NULL);
}
- else // prevfocus
+ else // prevfocus
{
parent = focus->fParent;
- if (parent == NULL) // we're the root
+ if (parent == NULL) // we're the root
return focus->acceptFocus(dir);
else
{
@@ -364,7 +364,7 @@ void SkView::Click::copyType(const char type[])
this->resetType();
if (type)
{
- size_t len = strlen(type) + 1;
+ size_t len = strlen(type) + 1;
fType = (char*)sk_malloc_throw(len);
memcpy(fType, type, len);
fWeOwnTheType = true;
@@ -379,8 +379,8 @@ SkView::Click* SkView::findClickHandler(SkScalar x, SkScalar y)
}
if (this->onSendClickToChildren(x, y)) {
- F2BIter iter(this);
- SkView* child;
+ F2BIter iter(this);
+ SkView* child;
while ((child = iter.next()) != NULL)
{
@@ -526,9 +526,9 @@ void SkView::detachFromParent_NoLayout()
this->inval(NULL);
- SkView* next = NULL;
+ SkView* next = NULL;
- if (fNextSibling != this) // do we have any siblings
+ if (fNextSibling != this) // do we have any siblings
{
fNextSibling->fPrevSibling = fPrevSibling;
fPrevSibling->fNextSibling = fNextSibling;
@@ -657,7 +657,7 @@ bool SkView::globalToLocal(SkScalar x, SkScalar y, SkPoint* local) const
//////////////////////////////////////////////////////////////////
-/* Even if the subclass overrides onInflate, they should always be
+/* Even if the subclass overrides onInflate, they should always be
sure to call the inherited method, so that we get called.
*/
void SkView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
@@ -705,8 +705,8 @@ void SkView::postInflate(const SkTDict<SkView*>& dict)
{
this->onPostInflate(dict);
- B2FIter iter(this);
- SkView* child;
+ B2FIter iter(this);
+ SkView* child;
while ((child = iter.next()) != NULL)
child->postInflate(dict);
}
@@ -716,7 +716,7 @@ void SkView::postInflate(const SkTDict<SkView*>& dict)
SkView* SkView::sendEventToParents(const SkEvent& evt)
{
SkView* parent = fParent;
-
+
while (parent)
{
if (parent->doEvent(evt))
@@ -728,7 +728,7 @@ SkView* SkView::sendEventToParents(const SkEvent& evt)
SkView* SkView::sendQueryToParents(SkEvent* evt) {
SkView* parent = fParent;
-
+
while (parent) {
if (parent->doQuery(evt)) {
return parent;
@@ -747,7 +747,7 @@ SkView::F2BIter::F2BIter(const SkView* parent)
fChild = fFirstChild ? fFirstChild->fPrevSibling : NULL;
}
-SkView* SkView::F2BIter::next()
+SkView* SkView::F2BIter::next()
{
SkView* curr = fChild;
@@ -767,7 +767,7 @@ SkView::B2FIter::B2FIter(const SkView* parent)
fChild = fFirstChild;
}
-SkView* SkView::B2FIter::next()
+SkView* SkView::B2FIter::next()
{
SkView* curr = fChild;
@@ -810,9 +810,9 @@ static void dumpview(const SkView* view, int level, bool recurse)
if (recurse)
{
- SkView::B2FIter iter(view);
- SkView* child;
- bool noChildren = true;
+ SkView::B2FIter iter(view);
+ SkView* child;
+ bool noChildren = true;
while ((child = iter.next()) != NULL)
{
diff --git a/src/views/SkViewInflate.cpp b/src/views/SkViewInflate.cpp
index 184e54021a..4d7de0483c 100644
--- a/src/views/SkViewInflate.cpp
+++ b/src/views/SkViewInflate.cpp
@@ -19,128 +19,128 @@ SkViewInflate::~SkViewInflate()
void SkViewInflate::rInflate(const SkDOM& dom, const SkDOM::Node* node, SkView* parent)
{
- const char* str = dom.findAttr(node, "id");
- if (str)
- fIDs.set(str, parent);
-
- const SkDOM::Node* child = dom.getFirstChild(node);
- while (child)
- {
- SkView* view = this->createView(dom, child);
- if (view)
- {
- this->rInflate(dom, child, view);
- parent->attachChildToFront(view)->unref();
- }
- else
- {
- const char* name = dom.getName(child);
- const char* target;
-
- if (!strcmp(name, "listenTo") && (target = dom.findAttr(child, "target")) != NULL)
- this->addIDStr(&fListenTo, parent, target);
-
- if (!strcmp(name, "broadcastTo") && (target = dom.findAttr(child, "target")) != NULL)
- this->addIDStr(&fBroadcastTo, parent, target);
- }
- child = dom.getNextSibling(child);
- }
-
- parent->setVisibleP(true);
- this->inflateView(parent, dom, node);
+ const char* str = dom.findAttr(node, "id");
+ if (str)
+ fIDs.set(str, parent);
+
+ const SkDOM::Node* child = dom.getFirstChild(node);
+ while (child)
+ {
+ SkView* view = this->createView(dom, child);
+ if (view)
+ {
+ this->rInflate(dom, child, view);
+ parent->attachChildToFront(view)->unref();
+ }
+ else
+ {
+ const char* name = dom.getName(child);
+ const char* target;
+
+ if (!strcmp(name, "listenTo") && (target = dom.findAttr(child, "target")) != NULL)
+ this->addIDStr(&fListenTo, parent, target);
+
+ if (!strcmp(name, "broadcastTo") && (target = dom.findAttr(child, "target")) != NULL)
+ this->addIDStr(&fBroadcastTo, parent, target);
+ }
+ child = dom.getNextSibling(child);
+ }
+
+ parent->setVisibleP(true);
+ this->inflateView(parent, dom, node);
}
void SkViewInflate::inflateView(SkView* view, const SkDOM& dom, const SkDOM::Node* node)
{
- // called after all of view's children have been instantiated.
- // this may be overridden by a subclass, to load in layout or other helpers
- // they should call through to us (INHERITED) before or after their patch
- view->inflate(dom, node);
+ // called after all of view's children have been instantiated.
+ // this may be overridden by a subclass, to load in layout or other helpers
+ // they should call through to us (INHERITED) before or after their patch
+ view->inflate(dom, node);
}
SkView* SkViewInflate::inflate(const SkDOM& dom, const SkDOM::Node* node, SkView* root)
{
- fIDs.reset();
-
- if (root == NULL)
- {
- root = this->createView(dom, node);
- if (root == NULL)
- {
- printf("createView returned NULL on <%s>\n", dom.getName(node));
- return NULL;
- }
- }
- this->rInflate(dom, node, root);
-
- // resolve listeners and broadcasters
- {
- SkView* target;
- const IDStr* iter = fListenTo.begin();
- const IDStr* stop = fListenTo.end();
- for (; iter < stop; iter++)
- {
- if (fIDs.find(iter->fStr, &target))
- target->addListenerID(iter->fView->getSinkID());
- }
-
- iter = fBroadcastTo.begin();
- stop = fBroadcastTo.end();
- for (; iter < stop; iter++)
- {
- if (fIDs.find(iter->fStr, &target))
- iter->fView->addListenerID(target->getSinkID());
- }
- }
-
- // now that the tree is built, give everyone a shot at the ID dict
- root->postInflate(fIDs);
- return root;
+ fIDs.reset();
+
+ if (root == NULL)
+ {
+ root = this->createView(dom, node);
+ if (root == NULL)
+ {
+ printf("createView returned NULL on <%s>\n", dom.getName(node));
+ return NULL;
+ }
+ }
+ this->rInflate(dom, node, root);
+
+ // resolve listeners and broadcasters
+ {
+ SkView* target;
+ const IDStr* iter = fListenTo.begin();
+ const IDStr* stop = fListenTo.end();
+ for (; iter < stop; iter++)
+ {
+ if (fIDs.find(iter->fStr, &target))
+ target->addListenerID(iter->fView->getSinkID());
+ }
+
+ iter = fBroadcastTo.begin();
+ stop = fBroadcastTo.end();
+ for (; iter < stop; iter++)
+ {
+ if (fIDs.find(iter->fStr, &target))
+ iter->fView->addListenerID(target->getSinkID());
+ }
+ }
+
+ // now that the tree is built, give everyone a shot at the ID dict
+ root->postInflate(fIDs);
+ return root;
}
SkView* SkViewInflate::inflate(const char xml[], size_t len, SkView* root)
{
- SkDOM dom;
- const SkDOM::Node* node = dom.build(xml, len);
+ SkDOM dom;
+ const SkDOM::Node* node = dom.build(xml, len);
- return node ? this->inflate(dom, node, root) : NULL;
+ return node ? this->inflate(dom, node, root) : NULL;
}
SkView* SkViewInflate::findViewByID(const char id[]) const
{
- SkASSERT(id);
- SkView* view;
- return fIDs.find(id, &view) ? view : NULL;
+ SkASSERT(id);
+ SkView* view;
+ return fIDs.find(id, &view) ? view : NULL;
}
SkView* SkViewInflate::createView(const SkDOM& dom, const SkDOM::Node* node)
{
- if (!strcmp(dom.getName(node), "view"))
- return new SkView;
- return NULL;
+ if (!strcmp(dom.getName(node), "view"))
+ return new SkView;
+ return NULL;
}
void SkViewInflate::addIDStr(SkTDArray<IDStr>* list, SkView* view, const char* str)
{
- size_t len = strlen(str) + 1;
- IDStr* pair = list->append();
- pair->fView = view;
- pair->fStr = (char*)fStrings.alloc(len, SkChunkAlloc::kThrow_AllocFailType);
- memcpy(pair->fStr, str, len);
+ size_t len = strlen(str) + 1;
+ IDStr* pair = list->append();
+ pair->fView = view;
+ pair->fStr = (char*)fStrings.alloc(len, SkChunkAlloc::kThrow_AllocFailType);
+ memcpy(pair->fStr, str, len);
}
#ifdef SK_DEBUG
void SkViewInflate::dump() const
{
- const IDStr* iter = fListenTo.begin();
- const IDStr* stop = fListenTo.end();
- for (; iter < stop; iter++)
- SkDebugf("inflate: listenTo(\"%s\")\n", iter->fStr);
-
- iter = fBroadcastTo.begin();
- stop = fBroadcastTo.end();
- for (; iter < stop; iter++)
- SkDebugf("inflate: broadcastFrom(\"%s\")\n", iter->fStr);
+ const IDStr* iter = fListenTo.begin();
+ const IDStr* stop = fListenTo.end();
+ for (; iter < stop; iter++)
+ SkDebugf("inflate: listenTo(\"%s\")\n", iter->fStr);
+
+ iter = fBroadcastTo.begin();
+ stop = fBroadcastTo.end();
+ for (; iter < stop; iter++)
+ SkDebugf("inflate: broadcastFrom(\"%s\")\n", iter->fStr);
}
#endif
diff --git a/src/views/SkViewPriv.cpp b/src/views/SkViewPriv.cpp
index ad15f3fdb4..ba40c1e360 100644
--- a/src/views/SkViewPriv.cpp
+++ b/src/views/SkViewPriv.cpp
@@ -11,94 +11,94 @@
void SkView::Artist::draw(SkView* view, SkCanvas* canvas)
{
- SkASSERT(view && canvas);
- this->onDraw(view, canvas);
+ SkASSERT(view && canvas);
+ this->onDraw(view, canvas);
}
void SkView::Artist::inflate(const SkDOM& dom, const SkDOM::Node* node)
{
- SkASSERT(&dom && node);
- this->onInflate(dom, node);
+ SkASSERT(&dom && node);
+ this->onInflate(dom, node);
}
void SkView::Artist::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- // subclass should override this as needed
+ // subclass should override this as needed
}
SkView::Artist* SkView::getArtist() const
{
- Artist_SkTagList* rec = (Artist_SkTagList*)this->findTagList(kViewArtist_SkTagList);
- SkASSERT(rec == NULL || rec->fArtist != NULL);
+ Artist_SkTagList* rec = (Artist_SkTagList*)this->findTagList(kViewArtist_SkTagList);
+ SkASSERT(rec == NULL || rec->fArtist != NULL);
- return rec ? rec->fArtist : NULL;
+ return rec ? rec->fArtist : NULL;
}
SkView::Artist* SkView::setArtist(Artist* obj)
{
- if (obj == NULL)
- {
- this->removeTagList(kViewArtist_SkTagList);
- }
- else // add/replace
- {
- Artist_SkTagList* rec = (Artist_SkTagList*)this->findTagList(kViewArtist_SkTagList);
-
- if (rec)
- SkRefCnt_SafeAssign(rec->fArtist, obj);
- else
- this->addTagList(new Artist_SkTagList(obj));
- }
- return obj;
+ if (obj == NULL)
+ {
+ this->removeTagList(kViewArtist_SkTagList);
+ }
+ else // add/replace
+ {
+ Artist_SkTagList* rec = (Artist_SkTagList*)this->findTagList(kViewArtist_SkTagList);
+
+ if (rec)
+ SkRefCnt_SafeAssign(rec->fArtist, obj);
+ else
+ this->addTagList(new Artist_SkTagList(obj));
+ }
+ return obj;
}
////////////////////////////////////////////////////////////////////////////////
void SkView::Layout::layoutChildren(SkView* parent)
{
- SkASSERT(parent);
- if (parent->width() > 0 && parent->height() > 0)
- this->onLayoutChildren(parent);
+ SkASSERT(parent);
+ if (parent->width() > 0 && parent->height() > 0)
+ this->onLayoutChildren(parent);
}
void SkView::Layout::inflate(const SkDOM& dom, const SkDOM::Node* node)
{
- SkASSERT(&dom && node);
- this->onInflate(dom, node);
+ SkASSERT(&dom && node);
+ this->onInflate(dom, node);
}
void SkView::Layout::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- // subclass should override this as needed
+ // subclass should override this as needed
}
SkView::Layout* SkView::getLayout() const
{
- Layout_SkTagList* rec = (Layout_SkTagList*)this->findTagList(kViewLayout_SkTagList);
- SkASSERT(rec == NULL || rec->fLayout != NULL);
+ Layout_SkTagList* rec = (Layout_SkTagList*)this->findTagList(kViewLayout_SkTagList);
+ SkASSERT(rec == NULL || rec->fLayout != NULL);
- return rec ? rec->fLayout : NULL;
+ return rec ? rec->fLayout : NULL;
}
SkView::Layout* SkView::setLayout(Layout* obj, bool invokeLayoutNow)
{
- if (obj == NULL)
- {
- this->removeTagList(kViewLayout_SkTagList);
- }
- else // add/replace
- {
- Layout_SkTagList* rec = (Layout_SkTagList*)this->findTagList(kViewLayout_SkTagList);
-
- if (rec)
- SkRefCnt_SafeAssign(rec->fLayout, obj);
- else
- this->addTagList(new Layout_SkTagList(obj));
- }
-
- if (invokeLayoutNow)
- this->invokeLayout();
-
- return obj;
+ if (obj == NULL)
+ {
+ this->removeTagList(kViewLayout_SkTagList);
+ }
+ else // add/replace
+ {
+ Layout_SkTagList* rec = (Layout_SkTagList*)this->findTagList(kViewLayout_SkTagList);
+
+ if (rec)
+ SkRefCnt_SafeAssign(rec->fLayout, obj);
+ else
+ this->addTagList(new Layout_SkTagList(obj));
+ }
+
+ if (invokeLayoutNow)
+ this->invokeLayout();
+
+ return obj;
}
diff --git a/src/views/SkViewPriv.h b/src/views/SkViewPriv.h
index d8cf966ce9..8a9c0b7e9a 100644
--- a/src/views/SkViewPriv.h
+++ b/src/views/SkViewPriv.h
@@ -12,33 +12,33 @@
#include "SkTagList.h"
struct Layout_SkTagList : SkTagList {
- SkView::Layout* fLayout;
-
- Layout_SkTagList(SkView::Layout* layout)
- : SkTagList(kViewLayout_SkTagList), fLayout(layout)
- {
- SkASSERT(layout);
- layout->ref();
- }
- virtual ~Layout_SkTagList()
- {
- fLayout->unref();
- }
+ SkView::Layout* fLayout;
+
+ Layout_SkTagList(SkView::Layout* layout)
+ : SkTagList(kViewLayout_SkTagList), fLayout(layout)
+ {
+ SkASSERT(layout);
+ layout->ref();
+ }
+ virtual ~Layout_SkTagList()
+ {
+ fLayout->unref();
+ }
};
struct Artist_SkTagList : SkTagList {
- SkView::Artist* fArtist;
-
- Artist_SkTagList(SkView::Artist* artist)
- : SkTagList(kViewArtist_SkTagList), fArtist(artist)
- {
- SkASSERT(artist);
- artist->ref();
- }
- virtual ~Artist_SkTagList()
- {
- fArtist->unref();
- }
+ SkView::Artist* fArtist;
+
+ Artist_SkTagList(SkView::Artist* artist)
+ : SkTagList(kViewArtist_SkTagList), fArtist(artist)
+ {
+ SkASSERT(artist);
+ artist->ref();
+ }
+ virtual ~Artist_SkTagList()
+ {
+ fArtist->unref();
+ }
};
#endif
diff --git a/src/views/SkWidget.cpp b/src/views/SkWidget.cpp
index 104429da57..e7de522107 100644
--- a/src/views/SkWidget.cpp
+++ b/src/views/SkWidget.cpp
@@ -22,7 +22,7 @@ SkWidgetView::~SkWidgetView()
const char* SkWidgetView::GetEventType()
{
- return "SkWidgetView";
+ return "SkWidgetView";
}
/////////////////////////////////////////////////////////////////////////////
@@ -30,300 +30,300 @@ const char* SkWidgetView::GetEventType()
class SkTextView::Interp {
public:
- Interp(const SkString& old, SkMSec now, SkMSec dur, AnimaDir dir) : fOldText(old), fInterp(1, 2)
- {
- SkScalar x = 0;
- fInterp.setKeyFrame(0, now, &x, 0);
- x = SK_Scalar1;
- if (dir == kBackward_AnimDir)
- x = -x;
- fInterp.setKeyFrame(1, now + dur, &x);
- }
- bool draw(SkCanvas* canvas, const SkString& newText, SkScalar x, SkScalar y, SkPaint& paint)
- {
- SkScalar scale;
-
- if (fInterp.timeToValues(SkTime::GetMSecs(), &scale) == SkInterpolator::kFreezeEnd_Result)
- {
- canvas->drawText(newText.c_str(), newText.size(), x, y, paint);
- return false;
- }
- else
- {
- U8 alpha = paint.getAlpha();
- SkScalar above, below;
- (void)paint.measureText(NULL, 0, &above, &below);
- SkScalar height = below - above;
- SkScalar dy = SkScalarMul(height, scale);
- if (scale < 0)
- height = -height;
-
- // draw the old
- paint.setAlpha((U8)SkScalarMul(alpha, SK_Scalar1 - SkScalarAbs(scale)));
- canvas->drawText(fOldText.c_str(), fOldText.size(), x, y - dy, paint);
- // draw the new
- paint.setAlpha((U8)SkScalarMul(alpha, SkScalarAbs(scale)));
- canvas->drawText(newText.c_str(), newText.size(), x, y + height - dy, paint);
- // restore the paint
- paint.setAlpha(alpha);
- return true;
- }
- }
+ Interp(const SkString& old, SkMSec now, SkMSec dur, AnimaDir dir) : fOldText(old), fInterp(1, 2)
+ {
+ SkScalar x = 0;
+ fInterp.setKeyFrame(0, now, &x, 0);
+ x = SK_Scalar1;
+ if (dir == kBackward_AnimDir)
+ x = -x;
+ fInterp.setKeyFrame(1, now + dur, &x);
+ }
+ bool draw(SkCanvas* canvas, const SkString& newText, SkScalar x, SkScalar y, SkPaint& paint)
+ {
+ SkScalar scale;
+
+ if (fInterp.timeToValues(SkTime::GetMSecs(), &scale) == SkInterpolator::kFreezeEnd_Result)
+ {
+ canvas->drawText(newText.c_str(), newText.size(), x, y, paint);
+ return false;
+ }
+ else
+ {
+ U8 alpha = paint.getAlpha();
+ SkScalar above, below;
+ (void)paint.measureText(NULL, 0, &above, &below);
+ SkScalar height = below - above;
+ SkScalar dy = SkScalarMul(height, scale);
+ if (scale < 0)
+ height = -height;
+
+ // draw the old
+ paint.setAlpha((U8)SkScalarMul(alpha, SK_Scalar1 - SkScalarAbs(scale)));
+ canvas->drawText(fOldText.c_str(), fOldText.size(), x, y - dy, paint);
+ // draw the new
+ paint.setAlpha((U8)SkScalarMul(alpha, SkScalarAbs(scale)));
+ canvas->drawText(newText.c_str(), newText.size(), x, y + height - dy, paint);
+ // restore the paint
+ paint.setAlpha(alpha);
+ return true;
+ }
+ }
private:
- SkString fOldText;
- SkInterpolator fInterp;
+ SkString fOldText;
+ SkInterpolator fInterp;
};
SkTextView::SkTextView(U32 flags) : SkView(flags), fInterp(NULL), fDoInterp(false)
{
- fMargin.set(0, 0);
+ fMargin.set(0, 0);
}
SkTextView::~SkTextView()
{
- delete fInterp;
+ delete fInterp;
}
void SkTextView::getText(SkString* str) const
{
- if (str)
- str->set(fText);
+ if (str)
+ str->set(fText);
}
void SkTextView::setText(const char text[], AnimaDir dir)
{
- if (!fText.equals(text))
- {
- SkString tmp(text);
- this->privSetText(tmp, dir);
- }
+ if (!fText.equals(text))
+ {
+ SkString tmp(text);
+ this->privSetText(tmp, dir);
+ }
}
void SkTextView::setText(const char text[], size_t len, AnimaDir dir)
{
- if (!fText.equals(text))
- {
- SkString tmp(text, len);
- this->privSetText(tmp, dir);
- }
+ if (!fText.equals(text))
+ {
+ SkString tmp(text, len);
+ this->privSetText(tmp, dir);
+ }
}
void SkTextView::setText(const SkString& src, AnimaDir dir)
{
- if (fText != src)
- this->privSetText(src, dir);
+ if (fText != src)
+ this->privSetText(src, dir);
}
void SkTextView::privSetText(const SkString& src, AnimaDir dir)
{
- SkASSERT(fText != src);
-
- if (fDoInterp)
- {
- if (fInterp)
- delete fInterp;
- fInterp = new Interp(fText, SkTime::GetMSecs(), 500, dir);
- }
- fText = src;
- this->inval(NULL);
+ SkASSERT(fText != src);
+
+ if (fDoInterp)
+ {
+ if (fInterp)
+ delete fInterp;
+ fInterp = new Interp(fText, SkTime::GetMSecs(), 500, dir);
+ }
+ fText = src;
+ this->inval(NULL);
}
/////////////////////////////////////////////////////////////////
void SkTextView::getMargin(SkPoint* margin) const
{
- if (margin)
- *margin = fMargin;
+ if (margin)
+ *margin = fMargin;
}
void SkTextView::setMargin(const SkPoint& margin)
{
- if (fMargin != margin)
- {
- fMargin = margin;
- this->inval(NULL);
- }
+ if (fMargin != margin)
+ {
+ fMargin = margin;
+ this->inval(NULL);
+ }
}
void SkTextView::onDraw(SkCanvas* canvas)
{
- this->INHERITED::onDraw(canvas);
-
- if (fText.size() == 0)
- return;
-
- SkPaint::Align align = fPaint.getTextAlign();
- SkScalar x, y;
-
- switch (align) {
- case SkPaint::kLeft_Align:
- x = fMargin.fX;
- break;
- case SkPaint::kCenter_Align:
- x = SkScalarHalf(this->width());
- break;
- default:
- SkASSERT(align == SkPaint::kRight_Align);
- x = this->width() - fMargin.fX;
- break;
- }
-
- fPaint.measureText(NULL, 0, &y, NULL);
- y = fMargin.fY - y;
-
- if (fInterp)
- {
- if (fInterp->draw(canvas, fText, x, y, fPaint))
- this->inval(NULL);
- else
- {
- delete fInterp;
- fInterp = NULL;
- }
- }
- else
- canvas->drawText(fText.c_str(), fText.size(), x, y, fPaint);
+ this->INHERITED::onDraw(canvas);
+
+ if (fText.size() == 0)
+ return;
+
+ SkPaint::Align align = fPaint.getTextAlign();
+ SkScalar x, y;
+
+ switch (align) {
+ case SkPaint::kLeft_Align:
+ x = fMargin.fX;
+ break;
+ case SkPaint::kCenter_Align:
+ x = SkScalarHalf(this->width());
+ break;
+ default:
+ SkASSERT(align == SkPaint::kRight_Align);
+ x = this->width() - fMargin.fX;
+ break;
+ }
+
+ fPaint.measureText(NULL, 0, &y, NULL);
+ y = fMargin.fY - y;
+
+ if (fInterp)
+ {
+ if (fInterp->draw(canvas, fText, x, y, fPaint))
+ this->inval(NULL);
+ else
+ {
+ delete fInterp;
+ fInterp = NULL;
+ }
+ }
+ else
+ canvas->drawText(fText.c_str(), fText.size(), x, y, fPaint);
}
//////////////////////////////////////////////////////////////////////////////////////
void SkTextView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- this->INHERITED::onInflate(dom, node);
+ this->INHERITED::onInflate(dom, node);
- const char* text = dom.findAttr(node, "text");
- if (text)
- this->setText(text);
+ const char* text = dom.findAttr(node, "text");
+ if (text)
+ this->setText(text);
- SkPoint margin;
- if (dom.findScalars(node, "margin", (SkScalar*)&margin, 2))
- this->setMargin(margin);
- (void)dom.findBool(node, "do-interp", &fDoInterp);
+ SkPoint margin;
+ if (dom.findScalars(node, "margin", (SkScalar*)&margin, 2))
+ this->setMargin(margin);
+ (void)dom.findBool(node, "do-interp", &fDoInterp);
- SkPaint_Inflate(&fPaint, dom, node);
+ SkPaint_Inflate(&fPaint, dom, node);
}
//////////////////////////////////////////////////////////////////////////////////////
SkSliderView::SkSliderView(U32 flags) : SkWidgetView(flags)
{
- fValue = 0;
- fMax = 0;
+ fValue = 0;
+ fMax = 0;
}
static U16 actual_value(U16CPU value, U16CPU max)
{
- return SkToU16(SkMax32(0, SkMin32(value, max)));
+ return SkToU16(SkMax32(0, SkMin32(value, max)));
}
void SkSliderView::setMax(U16CPU max)
{
- if (fMax != max)
- {
- fMax = SkToU16(max);
- if (fValue > 0)
- this->inval(NULL);
- }
+ if (fMax != max)
+ {
+ fMax = SkToU16(max);
+ if (fValue > 0)
+ this->inval(NULL);
+ }
}
void SkSliderView::setValue(U16CPU value)
{
- if (fValue != value)
- {
- U16 prev = actual_value(fValue, fMax);
- U16 next = actual_value(value, fMax);
-
- fValue = SkToU16(value);
- if (prev != next)
- {
- this->inval(NULL);
-
- if (this->hasListeners())
- {
- SkEvent evt;
-
- evt.setType(SkWidgetView::GetEventType());
- evt.setFast32(this->getSinkID());
- evt.setS32("sliderValue", next);
- this->postToListeners(evt);
- }
- }
- }
+ if (fValue != value)
+ {
+ U16 prev = actual_value(fValue, fMax);
+ U16 next = actual_value(value, fMax);
+
+ fValue = SkToU16(value);
+ if (prev != next)
+ {
+ this->inval(NULL);
+
+ if (this->hasListeners())
+ {
+ SkEvent evt;
+
+ evt.setType(SkWidgetView::GetEventType());
+ evt.setFast32(this->getSinkID());
+ evt.setS32("sliderValue", next);
+ this->postToListeners(evt);
+ }
+ }
+ }
}
#include "SkGradientShader.h"
static void setgrad(SkPaint* paint, const SkRect& r)
{
- SkPoint pts[2];
- SkColor colors[2];
+ SkPoint pts[2];
+ SkColor colors[2];
#if 0
- pts[0].set(r.fLeft, r.fTop);
- pts[1].set(r.fLeft + r.height(), r.fBottom);
+ pts[0].set(r.fLeft, r.fTop);
+ pts[1].set(r.fLeft + r.height(), r.fBottom);
#else
- pts[0].set(r.fRight, r.fBottom);
- pts[1].set(r.fRight - r.height(), r.fTop);
+ pts[0].set(r.fRight, r.fBottom);
+ pts[1].set(r.fRight - r.height(), r.fTop);
#endif
- colors[0] = SK_ColorBLUE;
- colors[1] = SK_ColorWHITE;
+ colors[0] = SK_ColorBLUE;
+ colors[1] = SK_ColorWHITE;
- paint->setShader(SkGradientShader::CreateLinear(pts, colors, NULL, 2, SkShader::kMirror_TileMode))->unref();
+ paint->setShader(SkGradientShader::CreateLinear(pts, colors, NULL, 2, SkShader::kMirror_TileMode))->unref();
}
void SkSliderView::onDraw(SkCanvas* canvas)
{
- this->INHERITED::onDraw(canvas);
+ this->INHERITED::onDraw(canvas);
- U16CPU value = SkMax32(0, SkMin32(fValue, fMax));
+ U16CPU value = SkMax32(0, SkMin32(fValue, fMax));
- SkRect r;
- SkPaint p;
+ SkRect r;
+ SkPaint p;
- r.set(0, 0, this->width(), this->height());
+ r.set(0, 0, this->width(), this->height());
- p.setAntiAliasOn(true);
- p.setStyle(SkPaint::kStroke_Style);
- p.setStrokeWidth(SK_Scalar1);
- r.inset(SK_Scalar1/2, SK_Scalar1/2);
- canvas->drawRect(r, p);
+ p.setAntiAliasOn(true);
+ p.setStyle(SkPaint::kStroke_Style);
+ p.setStrokeWidth(SK_Scalar1);
+ r.inset(SK_Scalar1/2, SK_Scalar1/2);
+ canvas->drawRect(r, p);
- if (fMax)
- {
- SkFixed percent = SkFixedDiv(value, fMax);
-
- r.inset(SK_Scalar1/2, SK_Scalar1/2);
- r.fRight = r.fLeft + SkScalarMul(r.width(), SkFixedToScalar(percent));
- p.setStyle(SkPaint::kFill_Style);
- setgrad(&p, r);
- canvas->drawRect(r, p);
- }
+ if (fMax)
+ {
+ SkFixed percent = SkFixedDiv(value, fMax);
+
+ r.inset(SK_Scalar1/2, SK_Scalar1/2);
+ r.fRight = r.fLeft + SkScalarMul(r.width(), SkFixedToScalar(percent));
+ p.setStyle(SkPaint::kFill_Style);
+ setgrad(&p, r);
+ canvas->drawRect(r, p);
+ }
#if 0
- r.set(0, 0, this->width(), this->height());
- r.inset(SK_Scalar1, SK_Scalar1);
- r.inset(r.width()/2, 0);
- p.setColor(SK_ColorBLACK);
- canvas->drawLine(*(SkPoint*)&r.fLeft, *(SkPoint*)&r.fRight, p);
+ r.set(0, 0, this->width(), this->height());
+ r.inset(SK_Scalar1, SK_Scalar1);
+ r.inset(r.width()/2, 0);
+ p.setColor(SK_ColorBLACK);
+ canvas->drawLine(*(SkPoint*)&r.fLeft, *(SkPoint*)&r.fRight, p);
#endif
}
SkView::Click* SkSliderView::onFindClickHandler(SkScalar x, SkScalar y)
{
- return new Click(this);
+ return new Click(this);
}
bool SkSliderView::onClick(Click* click)
{
- if (fMax)
- {
- SkScalar percent = SkScalarDiv(click->fCurr.fX + SK_Scalar1, this->width() - SK_Scalar1*2);
- percent = SkMaxScalar(0, SkMinScalar(percent, SK_Scalar1));
- this->setValue(SkScalarRound(percent * fMax));
- return true;
- }
- return false;
+ if (fMax)
+ {
+ SkScalar percent = SkScalarDiv(click->fCurr.fX + SK_Scalar1, this->width() - SK_Scalar1*2);
+ percent = SkMaxScalar(0, SkMinScalar(percent, SK_Scalar1));
+ this->setValue(SkScalarRound(percent * fMax));
+ return true;
+ }
+ return false;
}
#endif
diff --git a/src/views/SkWidgets.cpp b/src/views/SkWidgets.cpp
index 69d755bd8b..1693a31239 100644
--- a/src/views/SkWidgets.cpp
+++ b/src/views/SkWidgets.cpp
@@ -15,14 +15,14 @@
#if 0
#ifdef SK_DEBUG
- static void assert_no_attr(const SkDOM& dom, const SkDOM::Node* node, const char attr[])
- {
- const char* value = dom.findAttr(node, attr);
- if (value)
- SkDebugf("unknown attribute %s=\"%s\"\n", attr, value);
- }
+ static void assert_no_attr(const SkDOM& dom, const SkDOM::Node* node, const char attr[])
+ {
+ const char* value = dom.findAttr(node, attr);
+ if (value)
+ SkDebugf("unknown attribute %s=\"%s\"\n", attr, value);
+ }
#else
- #define assert_no_attr(dom, node, attr)
+ #define assert_no_attr(dom, node, attr)
#endif
#include "SkAnimator.h"
@@ -31,56 +31,56 @@
///////////////////////////////////////////////////////////////////////////////
enum SkinType {
- kPushButton_SkinType,
- kStaticText_SkinType,
+ kPushButton_SkinType,
+ kStaticText_SkinType,
- kSkinTypeCount
+ kSkinTypeCount
};
struct SkinSuite {
- SkinSuite();
- ~SkinSuite()
- {
- for (int i = 0; i < kSkinTypeCount; i++)
- delete fAnimators[i];
- }
+ SkinSuite();
+ ~SkinSuite()
+ {
+ for (int i = 0; i < kSkinTypeCount; i++)
+ delete fAnimators[i];
+ }
- SkAnimator* get(SkinType);
+ SkAnimator* get(SkinType);
private:
- SkAnimator* fAnimators[kSkinTypeCount];
+ SkAnimator* fAnimators[kSkinTypeCount];
};
SkinSuite::SkinSuite()
{
- static const char kSkinPath[] = "skins/";
+ static const char kSkinPath[] = "skins/";
- static const char* gSkinNames[] = {
- "pushbutton_skin.xml",
- "statictext_skin.xml"
- };
+ static const char* gSkinNames[] = {
+ "pushbutton_skin.xml",
+ "statictext_skin.xml"
+ };
- for (unsigned i = 0; i < SK_ARRAY_COUNT(gSkinNames); i++)
- {
- size_t len = strlen(gSkinNames[i]);
- SkString path(sizeof(kSkinPath) - 1 + len);
+ for (unsigned i = 0; i < SK_ARRAY_COUNT(gSkinNames); i++)
+ {
+ size_t len = strlen(gSkinNames[i]);
+ SkString path(sizeof(kSkinPath) - 1 + len);
- memcpy(path.writable_str(), kSkinPath, sizeof(kSkinPath) - 1);
- memcpy(path.writable_str() + sizeof(kSkinPath) - 1, gSkinNames[i], len);
+ memcpy(path.writable_str(), kSkinPath, sizeof(kSkinPath) - 1);
+ memcpy(path.writable_str() + sizeof(kSkinPath) - 1, gSkinNames[i], len);
- fAnimators[i] = new SkAnimator;
- if (!fAnimators[i]->decodeURI(path.c_str()))
- {
- delete fAnimators[i];
- fAnimators[i] = NULL;
- }
- }
+ fAnimators[i] = new SkAnimator;
+ if (!fAnimators[i]->decodeURI(path.c_str()))
+ {
+ delete fAnimators[i];
+ fAnimators[i] = NULL;
+ }
+ }
}
SkAnimator* SkinSuite::get(SkinType st)
{
- SkASSERT((unsigned)st < kSkinTypeCount);
- return fAnimators[st];
+ SkASSERT((unsigned)st < kSkinTypeCount);
+ return fAnimators[st];
}
static SkinSuite* gSkinSuite;
@@ -88,11 +88,11 @@ static SkinSuite* gSkinSuite;
static SkAnimator* get_skin_animator(SkinType st)
{
#if 0
- if (gSkinSuite == NULL)
- gSkinSuite = new SkinSuite;
- return gSkinSuite->get(st);
+ if (gSkinSuite == NULL)
+ gSkinSuite = new SkinSuite;
+ return gSkinSuite->get(st);
#else
- return NULL;
+ return NULL;
#endif
}
@@ -104,134 +104,134 @@ void SkWidget::Init()
void SkWidget::Term()
{
- delete gSkinSuite;
+ delete gSkinSuite;
}
void SkWidget::onEnabledChange()
{
- this->inval(NULL);
+ this->inval(NULL);
}
void SkWidget::postWidgetEvent()
{
- if (!fEvent.isType("") && this->hasListeners())
- {
- this->prepareWidgetEvent(&fEvent);
- this->postToListeners(fEvent);
- }
+ if (!fEvent.isType("") && this->hasListeners())
+ {
+ this->prepareWidgetEvent(&fEvent);
+ this->postToListeners(fEvent);
+ }
}
void SkWidget::prepareWidgetEvent(SkEvent*)
{
- // override in subclass to add any additional fields before posting
+ // override in subclass to add any additional fields before posting
}
void SkWidget::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- this->INHERITED::onInflate(dom, node);
+ this->INHERITED::onInflate(dom, node);
- if ((node = dom.getFirstChild(node, "event")) != NULL)
- fEvent.inflate(dom, node);
+ if ((node = dom.getFirstChild(node, "event")) != NULL)
+ fEvent.inflate(dom, node);
}
///////////////////////////////////////////////////////////////////////////////
size_t SkHasLabelWidget::getLabel(SkString* str) const
{
- if (str)
- *str = fLabel;
- return fLabel.size();
+ if (str)
+ *str = fLabel;
+ return fLabel.size();
}
size_t SkHasLabelWidget::getLabel(char buffer[]) const
{
- if (buffer)
- memcpy(buffer, fLabel.c_str(), fLabel.size());
- return fLabel.size();
+ if (buffer)
+ memcpy(buffer, fLabel.c_str(), fLabel.size());
+ return fLabel.size();
}
void SkHasLabelWidget::setLabel(const SkString& str)
{
- this->setLabel(str.c_str(), str.size());
+ this->setLabel(str.c_str(), str.size());
}
void SkHasLabelWidget::setLabel(const char label[])
{
- this->setLabel(label, strlen(label));
+ this->setLabel(label, strlen(label));
}
void SkHasLabelWidget::setLabel(const char label[], size_t len)
{
- if (!fLabel.equals(label, len))
- {
- fLabel.set(label, len);
- this->onLabelChange();
- }
+ if (!fLabel.equals(label, len))
+ {
+ fLabel.set(label, len);
+ this->onLabelChange();
+ }
}
void SkHasLabelWidget::onLabelChange()
{
- // override in subclass
+ // override in subclass
}
void SkHasLabelWidget::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- this->INHERITED::onInflate(dom, node);
+ this->INHERITED::onInflate(dom, node);
- const char* text = dom.findAttr(node, "label");
- if (text)
- this->setLabel(text);
+ const char* text = dom.findAttr(node, "label");
+ if (text)
+ this->setLabel(text);
}
/////////////////////////////////////////////////////////////////////////////////////
void SkButtonWidget::setButtonState(State state)
{
- if (fState != state)
- {
- fState = state;
- this->onButtonStateChange();
- }
+ if (fState != state)
+ {
+ fState = state;
+ this->onButtonStateChange();
+ }
}
void SkButtonWidget::onButtonStateChange()
{
- this->inval(NULL);
+ this->inval(NULL);
}
void SkButtonWidget::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- this->INHERITED::onInflate(dom, node);
+ this->INHERITED::onInflate(dom, node);
- int index;
- if ((index = dom.findList(node, "buttonState", "off,on,unknown")) >= 0)
- this->setButtonState((State)index);
+ int index;
+ if ((index = dom.findList(node, "buttonState", "off,on,unknown")) >= 0)
+ this->setButtonState((State)index);
}
/////////////////////////////////////////////////////////////////////////////////////
bool SkPushButtonWidget::onEvent(const SkEvent& evt)
{
- if (evt.isType(SK_EventType_Key) && evt.getFast32() == kOK_SkKey)
- {
- this->postWidgetEvent();
- return true;
- }
- return this->INHERITED::onEvent(evt);
+ if (evt.isType(SK_EventType_Key) && evt.getFast32() == kOK_SkKey)
+ {
+ this->postWidgetEvent();
+ return true;
+ }
+ return this->INHERITED::onEvent(evt);
}
static const char* computeAnimatorState(int enabled, int focused, SkButtonWidget::State state)
{
- if (!enabled)
- return "disabled";
- if (state == SkButtonWidget::kOn_State)
- {
- SkASSERT(focused);
- return "enabled-pressed";
- }
- if (focused)
- return "enabled-focused";
- return "enabled";
+ if (!enabled)
+ return "disabled";
+ if (state == SkButtonWidget::kOn_State)
+ {
+ SkASSERT(focused);
+ return "enabled-pressed";
+ }
+ if (focused)
+ return "enabled-focused";
+ return "enabled";
}
#include "SkBlurMaskFilter.h"
@@ -239,106 +239,106 @@ static const char* computeAnimatorState(int enabled, int focused, SkButtonWidget
static void create_emboss(SkPaint* paint, SkScalar radius, bool focus, bool pressed)
{
- SkEmbossMaskFilter::Light light;
+ SkEmbossMaskFilter::Light light;
- light.fDirection[0] = SK_Scalar1/2;
- light.fDirection[1] = SK_Scalar1/2;
- light.fDirection[2] = SK_Scalar1/3;
- light.fAmbient = 0x48;
- light.fSpecular = 0x80;
+ light.fDirection[0] = SK_Scalar1/2;
+ light.fDirection[1] = SK_Scalar1/2;
+ light.fDirection[2] = SK_Scalar1/3;
+ light.fAmbient = 0x48;
+ light.fSpecular = 0x80;
- if (pressed)
- {
- light.fDirection[0] = -light.fDirection[0];
- light.fDirection[1] = -light.fDirection[1];
- }
- if (focus)
- light.fDirection[2] += SK_Scalar1/4;
+ if (pressed)
+ {
+ light.fDirection[0] = -light.fDirection[0];
+ light.fDirection[1] = -light.fDirection[1];
+ }
+ if (focus)
+ light.fDirection[2] += SK_Scalar1/4;
- paint->setMaskFilter(new SkEmbossMaskFilter(light, radius))->unref();
+ paint->setMaskFilter(new SkEmbossMaskFilter(light, radius))->unref();
}
void SkPushButtonWidget::onDraw(SkCanvas* canvas)
{
- this->INHERITED::onDraw(canvas);
+ this->INHERITED::onDraw(canvas);
- SkString label;
- this->getLabel(&label);
+ SkString label;
+ this->getLabel(&label);
- SkAnimator* anim = get_skin_animator(kPushButton_SkinType);
+ SkAnimator* anim = get_skin_animator(kPushButton_SkinType);
- if (anim)
- {
- SkEvent evt("user");
+ if (anim)
+ {
+ SkEvent evt("user");
- evt.setString("id", "prime");
- evt.setScalar("prime-width", this->width());
- evt.setScalar("prime-height", this->height());
- evt.setString("prime-text", label);
- evt.setString("prime-state", computeAnimatorState(this->isEnabled(), this->hasFocus(), this->getButtonState()));
+ evt.setString("id", "prime");
+ evt.setScalar("prime-width", this->width());
+ evt.setScalar("prime-height", this->height());
+ evt.setString("prime-text", label);
+ evt.setString("prime-state", computeAnimatorState(this->isEnabled(), this->hasFocus(), this->getButtonState()));
- (void)anim->doUserEvent(evt);
- SkPaint paint;
- anim->draw(canvas, &paint, SkTime::GetMSecs());
- }
- else
- {
- SkRect r;
- SkPaint p;
+ (void)anim->doUserEvent(evt);
+ SkPaint paint;
+ anim->draw(canvas, &paint, SkTime::GetMSecs());
+ }
+ else
+ {
+ SkRect r;
+ SkPaint p;
- r.set(0, 0, this->width(), this->height());
- p.setAntiAliasOn(true);
- p.setColor(SK_ColorBLUE);
- create_emboss(&p, SkIntToScalar(12)/5, this->hasFocus(), this->getButtonState() == kOn_State);
- canvas->drawRoundRect(r, SkScalarHalf(this->height()), SkScalarHalf(this->height()), p);
- p.setMaskFilter(NULL);
+ r.set(0, 0, this->width(), this->height());
+ p.setAntiAliasOn(true);
+ p.setColor(SK_ColorBLUE);
+ create_emboss(&p, SkIntToScalar(12)/5, this->hasFocus(), this->getButtonState() == kOn_State);
+ canvas->drawRoundRect(r, SkScalarHalf(this->height()), SkScalarHalf(this->height()), p);
+ p.setMaskFilter(NULL);
- p.setTextAlign(SkPaint::kCenter_Align);
+ p.setTextAlign(SkPaint::kCenter_Align);
- SkTextBox box;
- box.setMode(SkTextBox::kOneLine_Mode);
- box.setSpacingAlign(SkTextBox::kCenter_SpacingAlign);
- box.setBox(0, 0, this->width(), this->height());
+ SkTextBox box;
+ box.setMode(SkTextBox::kOneLine_Mode);
+ box.setSpacingAlign(SkTextBox::kCenter_SpacingAlign);
+ box.setBox(0, 0, this->width(), this->height());
-// if (this->getButtonState() == kOn_State)
-// p.setColor(SK_ColorRED);
-// else
- p.setColor(SK_ColorWHITE);
+// if (this->getButtonState() == kOn_State)
+// p.setColor(SK_ColorRED);
+// else
+ p.setColor(SK_ColorWHITE);
- box.draw(canvas, label.c_str(), label.size(), p);
- }
+ box.draw(canvas, label.c_str(), label.size(), p);
+ }
}
SkView::Click* SkPushButtonWidget::onFindClickHandler(SkScalar x, SkScalar y)
{
- this->acceptFocus();
- return new Click(this);
+ this->acceptFocus();
+ return new Click(this);
}
bool SkPushButtonWidget::onClick(Click* click)
{
- SkRect r;
- State state = kOff_State;
+ SkRect r;
+ State state = kOff_State;
- this->getLocalBounds(&r);
- if (r.contains(click->fCurr))
- {
- if (click->fState == Click::kUp_State)
- this->postWidgetEvent();
- else
- state = kOn_State;
- }
- this->setButtonState(state);
- return true;
+ this->getLocalBounds(&r);
+ if (r.contains(click->fCurr))
+ {
+ if (click->fState == Click::kUp_State)
+ this->postWidgetEvent();
+ else
+ state = kOn_State;
+ }
+ this->setButtonState(state);
+ return true;
}
//////////////////////////////////////////////////////////////////////////////////////////
SkStaticTextView::SkStaticTextView(U32 flags) : SkView(flags)
{
- fMargin.set(0, 0);
- fMode = kFixedSize_Mode;
- fSpacingAlign = SkTextBox::kStart_SpacingAlign;
+ fMargin.set(0, 0);
+ fMode = kFixedSize_Mode;
+ fSpacingAlign = SkTextBox::kStart_SpacingAlign;
}
SkStaticTextView::~SkStaticTextView()
@@ -347,148 +347,148 @@ SkStaticTextView::~SkStaticTextView()
void SkStaticTextView::computeSize()
{
- if (fMode == kAutoWidth_Mode)
- {
- SkScalar width = fPaint.measureText(fText.c_str(), fText.size(), NULL, NULL);
- this->setWidth(width + fMargin.fX * 2);
- }
- else if (fMode == kAutoHeight_Mode)
- {
- SkScalar width = this->width() - fMargin.fX * 2;
- int lines = width > 0 ? SkTextLineBreaker::CountLines(fText.c_str(), fText.size(), fPaint, width) : 0;
+ if (fMode == kAutoWidth_Mode)
+ {
+ SkScalar width = fPaint.measureText(fText.c_str(), fText.size(), NULL, NULL);
+ this->setWidth(width + fMargin.fX * 2);
+ }
+ else if (fMode == kAutoHeight_Mode)
+ {
+ SkScalar width = this->width() - fMargin.fX * 2;
+ int lines = width > 0 ? SkTextLineBreaker::CountLines(fText.c_str(), fText.size(), fPaint, width) : 0;
- SkScalar before, after;
- (void)fPaint.measureText(0, NULL, &before, &after);
+ SkScalar before, after;
+ (void)fPaint.measureText(0, NULL, &before, &after);
- this->setHeight(lines * (after - before) + fMargin.fY * 2);
- }
+ this->setHeight(lines * (after - before) + fMargin.fY * 2);
+ }
}
void SkStaticTextView::setMode(Mode mode)
{
- SkASSERT((unsigned)mode < kModeCount);
+ SkASSERT((unsigned)mode < kModeCount);
- if (fMode != mode)
- {
- fMode = SkToU8(mode);
- this->computeSize();
- }
+ if (fMode != mode)
+ {
+ fMode = SkToU8(mode);
+ this->computeSize();
+ }
}
void SkStaticTextView::setSpacingAlign(SkTextBox::SpacingAlign align)
{
- fSpacingAlign = SkToU8(align);
- this->inval(NULL);
+ fSpacingAlign = SkToU8(align);
+ this->inval(NULL);
}
void SkStaticTextView::getMargin(SkPoint* margin) const
{
- if (margin)
- *margin = fMargin;
+ if (margin)
+ *margin = fMargin;
}
void SkStaticTextView::setMargin(SkScalar dx, SkScalar dy)
{
- if (fMargin.fX != dx || fMargin.fY != dy)
- {
- fMargin.set(dx, dy);
- this->computeSize();
- this->inval(NULL);
- }
+ if (fMargin.fX != dx || fMargin.fY != dy)
+ {
+ fMargin.set(dx, dy);
+ this->computeSize();
+ this->inval(NULL);
+ }
}
size_t SkStaticTextView::getText(SkString* text) const
{
- if (text)
- *text = fText;
- return fText.size();
+ if (text)
+ *text = fText;
+ return fText.size();
}
size_t SkStaticTextView::getText(char text[]) const
{
- if (text)
- memcpy(text, fText.c_str(), fText.size());
- return fText.size();
+ if (text)
+ memcpy(text, fText.c_str(), fText.size());
+ return fText.size();
}
void SkStaticTextView::setText(const SkString& text)
{
- this->setText(text.c_str(), text.size());
+ this->setText(text.c_str(), text.size());
}
void SkStaticTextView::setText(const char text[])
{
- this->setText(text, strlen(text));
+ this->setText(text, strlen(text));
}
void SkStaticTextView::setText(const char text[], size_t len)
{
- if (!fText.equals(text, len))
- {
- fText.set(text, len);
- this->computeSize();
- this->inval(NULL);
- }
+ if (!fText.equals(text, len))
+ {
+ fText.set(text, len);
+ this->computeSize();
+ this->inval(NULL);
+ }
}
void SkStaticTextView::getPaint(SkPaint* paint) const
{
- if (paint)
- *paint = fPaint;
+ if (paint)
+ *paint = fPaint;
}
void SkStaticTextView::setPaint(const SkPaint& paint)
{
- if (fPaint != paint)
- {
- fPaint = paint;
- this->computeSize();
- this->inval(NULL);
- }
+ if (fPaint != paint)
+ {
+ fPaint = paint;
+ this->computeSize();
+ this->inval(NULL);
+ }
}
void SkStaticTextView::onDraw(SkCanvas* canvas)
{
- this->INHERITED::onDraw(canvas);
+ this->INHERITED::onDraw(canvas);
- if (fText.isEmpty())
- return;
+ if (fText.isEmpty())
+ return;
- SkTextBox box;
+ SkTextBox box;
- box.setMode(fMode == kAutoWidth_Mode ? SkTextBox::kOneLine_Mode : SkTextBox::kLineBreak_Mode);
- box.setSpacingAlign(this->getSpacingAlign());
- box.setBox(fMargin.fX, fMargin.fY, this->width() - fMargin.fX, this->height() - fMargin.fY);
- box.draw(canvas, fText.c_str(), fText.size(), fPaint);
+ box.setMode(fMode == kAutoWidth_Mode ? SkTextBox::kOneLine_Mode : SkTextBox::kLineBreak_Mode);
+ box.setSpacingAlign(this->getSpacingAlign());
+ box.setBox(fMargin.fX, fMargin.fY, this->width() - fMargin.fX, this->height() - fMargin.fY);
+ box.draw(canvas, fText.c_str(), fText.size(), fPaint);
}
void SkStaticTextView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- this->INHERITED::onInflate(dom, node);
+ this->INHERITED::onInflate(dom, node);
- int index;
- if ((index = dom.findList(node, "mode", "fixed,auto-width,auto-height")) >= 0)
- this->setMode((Mode)index);
- else
- assert_no_attr(dom, node, "mode");
+ int index;
+ if ((index = dom.findList(node, "mode", "fixed,auto-width,auto-height")) >= 0)
+ this->setMode((Mode)index);
+ else
+ assert_no_attr(dom, node, "mode");
- if ((index = dom.findList(node, "spacing-align", "start,center,end")) >= 0)
- this->setSpacingAlign((SkTextBox::SpacingAlign)index);
- else
- assert_no_attr(dom, node, "mode");
+ if ((index = dom.findList(node, "spacing-align", "start,center,end")) >= 0)
+ this->setSpacingAlign((SkTextBox::SpacingAlign)index);
+ else
+ assert_no_attr(dom, node, "mode");
- SkScalar s[2];
- if (dom.findScalars(node, "margin", s, 2))
- this->setMargin(s[0], s[1]);
- else
- assert_no_attr(dom, node, "margin");
+ SkScalar s[2];
+ if (dom.findScalars(node, "margin", s, 2))
+ this->setMargin(s[0], s[1]);
+ else
+ assert_no_attr(dom, node, "margin");
- const char* text = dom.findAttr(node, "text");
- if (text)
- this->setText(text);
+ const char* text = dom.findAttr(node, "text");
+ if (text)
+ this->setText(text);
- if ((node = dom.getFirstChild(node, "paint")) != NULL)
- SkPaint_Inflate(&fPaint, dom, node);
+ if ((node = dom.getFirstChild(node, "paint")) != NULL)
+ SkPaint_Inflate(&fPaint, dom, node);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -505,56 +505,56 @@ SkBitmapView::~SkBitmapView()
bool SkBitmapView::getBitmap(SkBitmap* bitmap) const
{
- if (bitmap)
- *bitmap = fBitmap;
- return fBitmap.getConfig() != SkBitmap::kNo_Config;
+ if (bitmap)
+ *bitmap = fBitmap;
+ return fBitmap.getConfig() != SkBitmap::kNo_Config;
}
void SkBitmapView::setBitmap(const SkBitmap* bitmap, bool viewOwnsPixels)
{
- if (bitmap)
- {
- fBitmap = *bitmap;
- fBitmap.setOwnsPixels(viewOwnsPixels);
- }
+ if (bitmap)
+ {
+ fBitmap = *bitmap;
+ fBitmap.setOwnsPixels(viewOwnsPixels);
+ }
}
bool SkBitmapView::loadBitmapFromFile(const char path[])
{
- SkBitmap bitmap;
+ SkBitmap bitmap;
- if (SkImageDecoder::DecodeFile(path, &bitmap))
- {
- this->setBitmap(&bitmap, true);
- bitmap.setOwnsPixels(false);
- return true;
- }
- return false;
+ if (SkImageDecoder::DecodeFile(path, &bitmap))
+ {
+ this->setBitmap(&bitmap, true);
+ bitmap.setOwnsPixels(false);
+ return true;
+ }
+ return false;
}
void SkBitmapView::onDraw(SkCanvas* canvas)
{
- if (fBitmap.getConfig() != SkBitmap::kNo_Config &&
- fBitmap.width() && fBitmap.height())
- {
- SkAutoCanvasRestore restore(canvas, true);
- SkPaint p;
+ if (fBitmap.getConfig() != SkBitmap::kNo_Config &&
+ fBitmap.width() && fBitmap.height())
+ {
+ SkAutoCanvasRestore restore(canvas, true);
+ SkPaint p;
- p.setFilterType(SkPaint::kBilinear_FilterType);
- canvas->scale( this->width() / fBitmap.width(),
- this->height() / fBitmap.height(),
- 0, 0);
- canvas->drawBitmap(fBitmap, 0, 0, p);
- }
+ p.setFilterType(SkPaint::kBilinear_FilterType);
+ canvas->scale( this->width() / fBitmap.width(),
+ this->height() / fBitmap.height(),
+ 0, 0);
+ canvas->drawBitmap(fBitmap, 0, 0, p);
+ }
}
void SkBitmapView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- this->INHERITED::onInflate(dom, node);
+ this->INHERITED::onInflate(dom, node);
- const char* src = dom.findAttr(node, "src");
- if (src)
- (void)this->loadBitmapFromFile(src);
+ const char* src = dom.findAttr(node, "src");
+ if (src)
+ (void)this->loadBitmapFromFile(src);
}
#endif
diff --git a/src/views/SkWindow.cpp b/src/views/SkWindow.cpp
index c952a61b6d..85b3803c59 100644
--- a/src/views/SkWindow.cpp
+++ b/src/views/SkWindow.cpp
@@ -19,31 +19,31 @@
#include "SkBounder.h"
class test_bounder : public SkBounder {
public:
- test_bounder(const SkBitmap& bm) : fCanvas(bm) {}
+ test_bounder(const SkBitmap& bm) : fCanvas(bm) {}
protected:
- virtual bool onIRect(const SkIRect& r)
- {
- SkRect rr;
+ virtual bool onIRect(const SkIRect& r)
+ {
+ SkRect rr;
- rr.set(SkIntToScalar(r.fLeft), SkIntToScalar(r.fTop),
- SkIntToScalar(r.fRight), SkIntToScalar(r.fBottom));
+ rr.set(SkIntToScalar(r.fLeft), SkIntToScalar(r.fTop),
+ SkIntToScalar(r.fRight), SkIntToScalar(r.fBottom));
- SkPaint p;
+ SkPaint p;
- p.setStyle(SkPaint::kStroke_Style);
- p.setColor(SK_ColorYELLOW);
+ p.setStyle(SkPaint::kStroke_Style);
+ p.setColor(SK_ColorYELLOW);
#if 0
- rr.inset(SK_ScalarHalf, SK_ScalarHalf);
+ rr.inset(SK_ScalarHalf, SK_ScalarHalf);
#else
- rr.inset(-SK_ScalarHalf, -SK_ScalarHalf);
+ rr.inset(-SK_ScalarHalf, -SK_ScalarHalf);
#endif
- fCanvas.drawRect(rr, p);
- return true;
- }
+ fCanvas.drawRect(rr, p);
+ return true;
+ }
private:
- SkCanvas fCanvas;
+ SkCanvas fCanvas;
};
SkWindow::SkWindow() : fFocusView(NULL)
@@ -87,39 +87,39 @@ void SkWindow::postConcat(const SkMatrix& matrix) {
void SkWindow::setConfig(SkBitmap::Config config)
{
- this->resize(fBitmap.width(), fBitmap.height(), config);
+ this->resize(fBitmap.width(), fBitmap.height(), config);
}
void SkWindow::resize(int width, int height, SkBitmap::Config config)
{
- if (config == SkBitmap::kNo_Config)
- config = fConfig;
-
- if (width != fBitmap.width() || height != fBitmap.height() || config != fConfig)
- {
- fConfig = config;
- fBitmap.setConfig(config, width, height);
- fBitmap.allocPixels();
+ if (config == SkBitmap::kNo_Config)
+ config = fConfig;
+
+ if (width != fBitmap.width() || height != fBitmap.height() || config != fConfig)
+ {
+ fConfig = config;
+ fBitmap.setConfig(config, width, height);
+ fBitmap.allocPixels();
fBitmap.setIsOpaque(true);
- this->setSize(SkIntToScalar(width), SkIntToScalar(height));
- this->inval(NULL);
- }
+ this->setSize(SkIntToScalar(width), SkIntToScalar(height));
+ this->inval(NULL);
+ }
}
void SkWindow::eraseARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
{
- fBitmap.eraseARGB(a, r, g, b);
+ fBitmap.eraseARGB(a, r, g, b);
}
void SkWindow::eraseRGB(U8CPU r, U8CPU g, U8CPU b)
{
- fBitmap.eraseRGB(r, g, b);
+ fBitmap.eraseRGB(r, g, b);
}
bool SkWindow::handleInval(const SkRect* localR)
{
- SkIRect ir;
+ SkIRect ir;
if (localR) {
SkRect devR;
@@ -131,13 +131,13 @@ bool SkWindow::handleInval(const SkRect* localR)
devR.round(&ir);
} else {
ir.set(0, 0,
- SkScalarRound(this->width()),
- SkScalarRound(this->height()));
+ SkScalarRound(this->width()),
+ SkScalarRound(this->height()));
}
- fDirtyRgn.op(ir, SkRegion::kUnion_Op);
+ fDirtyRgn.op(ir, SkRegion::kUnion_Op);
- this->onHandleInval(ir);
- return true;
+ this->onHandleInval(ir);
+ return true;
}
void SkWindow::forceInvalAll() {
@@ -147,9 +147,9 @@ void SkWindow::forceInvalAll() {
}
#if defined(SK_BUILD_FOR_WINCE) && defined(USE_GX_SCREEN)
- #include <windows.h>
- #include <gx.h>
- extern GXDisplayProperties gDisplayProps;
+ #include <windows.h>
+ #include <gx.h>
+ extern GXDisplayProperties gDisplayProps;
#endif
#ifdef SK_SIMULATE_FAILED_MALLOC
@@ -158,128 +158,128 @@ extern bool gEnableControlledThrow;
bool SkWindow::update(SkIRect* updateArea, SkCanvas* canvas)
{
- if (!fDirtyRgn.isEmpty())
- {
- SkBitmap bm = this->getBitmap();
+ if (!fDirtyRgn.isEmpty())
+ {
+ SkBitmap bm = this->getBitmap();
#if defined(SK_BUILD_FOR_WINCE) && defined(USE_GX_SCREEN)
- char* buffer = (char*)GXBeginDraw();
- SkASSERT(buffer);
+ char* buffer = (char*)GXBeginDraw();
+ SkASSERT(buffer);
- RECT rect;
- GetWindowRect((HWND)((SkOSWindow*)this)->getHWND(), &rect);
- buffer += rect.top * gDisplayProps.cbyPitch + rect.left * gDisplayProps.cbxPitch;
+ RECT rect;
+ GetWindowRect((HWND)((SkOSWindow*)this)->getHWND(), &rect);
+ buffer += rect.top * gDisplayProps.cbyPitch + rect.left * gDisplayProps.cbxPitch;
- bm.setPixels(buffer);
+ bm.setPixels(buffer);
#endif
- SkCanvas rasterCanvas;
+ SkCanvas rasterCanvas;
if (NULL == canvas) {
canvas = &rasterCanvas;
}
canvas->setBitmapDevice(bm);
- canvas->clipRegion(fDirtyRgn);
- if (updateArea)
- *updateArea = fDirtyRgn.getBounds();
+ canvas->clipRegion(fDirtyRgn);
+ if (updateArea)
+ *updateArea = fDirtyRgn.getBounds();
SkAutoCanvasRestore acr(canvas, true);
canvas->concat(fMatrix);
- // empty this now, so we can correctly record any inval calls that
- // might be made during the draw call.
- fDirtyRgn.setEmpty();
+ // empty this now, so we can correctly record any inval calls that
+ // might be made during the draw call.
+ fDirtyRgn.setEmpty();
#ifdef TEST_BOUNDER
- test_bounder b(bm);
- canvas->setBounder(&b);
+ test_bounder b(bm);
+ canvas->setBounder(&b);
#endif
#ifdef SK_SIMULATE_FAILED_MALLOC
- gEnableControlledThrow = true;
+ gEnableControlledThrow = true;
#endif
#ifdef SK_BUILD_FOR_WIN32
- //try {
- this->draw(canvas);
- //}
- //catch (...) {
- //}
+ //try {
+ this->draw(canvas);
+ //}
+ //catch (...) {
+ //}
#else
- this->draw(canvas);
+ this->draw(canvas);
#endif
#ifdef SK_SIMULATE_FAILED_MALLOC
- gEnableControlledThrow = false;
+ gEnableControlledThrow = false;
#endif
#ifdef TEST_BOUNDER
- canvas->setBounder(NULL);
+ canvas->setBounder(NULL);
#endif
#if defined(SK_BUILD_FOR_WINCE) && defined(USE_GX_SCREEN)
- GXEndDraw();
+ GXEndDraw();
#endif
- return true;
- }
- return false;
+ return true;
+ }
+ return false;
}
bool SkWindow::handleChar(SkUnichar uni)
{
- if (this->onHandleChar(uni))
- return true;
+ if (this->onHandleChar(uni))
+ return true;
- SkView* focus = this->getFocusView();
- if (focus == NULL)
- focus = this;
+ SkView* focus = this->getFocusView();
+ if (focus == NULL)
+ focus = this;
- SkEvent evt(SK_EventType_Unichar);
- evt.setFast32(uni);
- return focus->doEvent(evt);
+ SkEvent evt(SK_EventType_Unichar);
+ evt.setFast32(uni);
+ return focus->doEvent(evt);
}
bool SkWindow::handleKey(SkKey key)
{
- if (key == kNONE_SkKey)
- return false;
-
- if (this->onHandleKey(key))
- return true;
-
- // send an event to the focus-view
- {
- SkView* focus = this->getFocusView();
- if (focus == NULL)
- focus = this;
-
- SkEvent evt(SK_EventType_Key);
- evt.setFast32(key);
- if (focus->doEvent(evt))
- return true;
- }
-
- if (key == kUp_SkKey || key == kDown_SkKey)
- {
- if (this->moveFocus(key == kUp_SkKey ? kPrev_FocusDirection : kNext_FocusDirection) == NULL)
- this->onSetFocusView(NULL);
- return true;
- }
- return false;
+ if (key == kNONE_SkKey)
+ return false;
+
+ if (this->onHandleKey(key))
+ return true;
+
+ // send an event to the focus-view
+ {
+ SkView* focus = this->getFocusView();
+ if (focus == NULL)
+ focus = this;
+
+ SkEvent evt(SK_EventType_Key);
+ evt.setFast32(key);
+ if (focus->doEvent(evt))
+ return true;
+ }
+
+ if (key == kUp_SkKey || key == kDown_SkKey)
+ {
+ if (this->moveFocus(key == kUp_SkKey ? kPrev_FocusDirection : kNext_FocusDirection) == NULL)
+ this->onSetFocusView(NULL);
+ return true;
+ }
+ return false;
}
bool SkWindow::handleKeyUp(SkKey key)
{
if (key == kNONE_SkKey)
return false;
-
+
if (this->onHandleKeyUp(key))
return true;
-
+
//send an event to the focus-view
{
SkView* focus = this->getFocusView();
if (focus == NULL)
focus = this;
-
+
//should this one be the same?
SkEvent evt(SK_EventType_KeyUp);
evt.setFast32(key);
@@ -290,8 +290,8 @@ bool SkWindow::handleKeyUp(SkKey key)
}
void SkWindow::addMenu(SkOSMenu* menu) {
- *fMenus.append() = menu;
- this->onAddMenu(menu);
+ *fMenus.append() = menu;
+ this->onAddMenu(menu);
}
void SkWindow::setTitle(const char title[]) {
@@ -306,36 +306,36 @@ void SkWindow::setTitle(const char title[]) {
bool SkWindow::onEvent(const SkEvent& evt)
{
- if (evt.isType(SK_EventDelayInval))
- {
- SkRegion::Iterator iter(fDirtyRgn);
-
- for (; !iter.done(); iter.next())
- this->onHandleInval(iter.rect());
- fWaitingOnInval = false;
- return true;
- }
- return this->INHERITED::onEvent(evt);
+ if (evt.isType(SK_EventDelayInval))
+ {
+ SkRegion::Iterator iter(fDirtyRgn);
+
+ for (; !iter.done(); iter.next())
+ this->onHandleInval(iter.rect());
+ fWaitingOnInval = false;
+ return true;
+ }
+ return this->INHERITED::onEvent(evt);
}
bool SkWindow::onGetFocusView(SkView** focus) const
{
- if (focus)
- *focus = fFocusView;
- return true;
+ if (focus)
+ *focus = fFocusView;
+ return true;
}
bool SkWindow::onSetFocusView(SkView* focus)
{
- if (fFocusView != focus)
- {
- if (fFocusView)
- fFocusView->onFocusChange(false);
- fFocusView = focus;
- if (focus)
- focus->onFocusChange(true);
- }
- return true;
+ if (fFocusView != focus)
+ {
+ if (fFocusView)
+ fFocusView->onFocusChange(false);
+ fFocusView = focus;
+ if (focus)
+ focus->onFocusChange(true);
+ }
+ return true;
}
//////////////////////////////////////////////////////////////////////
@@ -346,12 +346,12 @@ void SkWindow::onHandleInval(const SkIRect&)
bool SkWindow::onHandleChar(SkUnichar)
{
- return false;
+ return false;
}
bool SkWindow::onHandleKey(SkKey key)
{
- return false;
+ return false;
}
bool SkWindow::onHandleKeyUp(SkKey key)
@@ -365,7 +365,7 @@ bool SkWindow::handleClick(int x, int y, Click::State state, void *owner) {
bool SkWindow::onDispatchClick(int x, int y, Click::State state,
void* owner) {
- bool handled = false;
+ bool handled = false;
// First, attempt to find an existing click with this owner.
int index = -1;
@@ -376,7 +376,7 @@ bool SkWindow::onDispatchClick(int x, int y, Click::State state,
}
}
- switch (state) {
+ switch (state) {
case Click::kDown_State: {
if (index != -1) {
delete fClicks[index];
@@ -410,7 +410,7 @@ bool SkWindow::onDispatchClick(int x, int y, Click::State state,
default:
// Do nothing
break;
- }
- return handled;
+ }
+ return handled;
}
diff --git a/src/views/animated/SkBorderView.cpp b/src/views/animated/SkBorderView.cpp
index cc1c08bc79..3eff6056f9 100644
--- a/src/views/animated/SkBorderView.cpp
+++ b/src/views/animated/SkBorderView.cpp
@@ -17,80 +17,80 @@ SkBorderView::SkBorderView() : fLeft(SkIntToScalar(0)),
fTop(SkIntToScalar(0)),
fBottom(SkIntToScalar(0))
{
- fAnim.setHostEventSink(this);
- init_skin_anim(kBorder_SkinEnum, &fAnim);
+ fAnim.setHostEventSink(this);
+ init_skin_anim(kBorder_SkinEnum, &fAnim);
}
SkBorderView::~SkBorderView()
{
-
+
}
void SkBorderView::setSkin(const char skin[])
{
- init_skin_anim(skin, &fAnim);
+ init_skin_anim(skin, &fAnim);
}
/* virtual */ void SkBorderView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- this->INHERITED::onInflate(dom, node);
+ this->INHERITED::onInflate(dom, node);
}
/*virtual*/ void SkBorderView::onSizeChange()
{
- this->INHERITED::onSizeChange();
- SkEvent evt("user");
- evt.setString("id", "setDim");
- evt.setScalar("dimX", this->width());
- evt.setScalar("dimY", this->height());
- fAnim.doUserEvent(evt);
+ this->INHERITED::onSizeChange();
+ SkEvent evt("user");
+ evt.setString("id", "setDim");
+ evt.setScalar("dimX", this->width());
+ evt.setScalar("dimY", this->height());
+ fAnim.doUserEvent(evt);
}
/*virtual*/ void SkBorderView::onDraw(SkCanvas* canvas)
{
- SkPaint paint;
- SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs());
-
- if (diff == SkAnimator::kDifferent)
- this->inval(NULL);
- else if (diff == SkAnimator::kPartiallyDifferent)
- {
- SkRect bounds;
- fAnim.getInvalBounds(&bounds);
- this->inval(&bounds);
- }
+ SkPaint paint;
+ SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs());
+
+ if (diff == SkAnimator::kDifferent)
+ this->inval(NULL);
+ else if (diff == SkAnimator::kPartiallyDifferent)
+ {
+ SkRect bounds;
+ fAnim.getInvalBounds(&bounds);
+ this->inval(&bounds);
+ }
}
/*virtual*/ bool SkBorderView::onEvent(const SkEvent& evt)
{
- if (evt.isType(SK_EventType_Inval))
- {
- this->inval(NULL);
- return true;
- }
- if (evt.isType("recommendDim"))
- {
- evt.findScalar("leftMargin", &fLeft);
- evt.findScalar("rightMargin", &fRight);
- evt.findScalar("topMargin", &fTop);
- evt.findScalar("bottomMargin", &fBottom);
-
- //setup_views.cpp uses SkView::Layout instead of SkStackViewLayout
- //but that gives me an error
- SkStackViewLayout* layout;
- fMargin.set(fLeft, fTop, fRight, fBottom);
- if (this->getLayout())
- {
- layout = (SkStackViewLayout*)this->getLayout();
- layout->setMargin(fMargin);
- }
- else
- {
- layout = new SkStackViewLayout;
- layout->setMargin(fMargin);
- this->setLayout(layout)->unref();
- }
- this->invokeLayout();
- }
- return this->INHERITED::onEvent(evt);
+ if (evt.isType(SK_EventType_Inval))
+ {
+ this->inval(NULL);
+ return true;
+ }
+ if (evt.isType("recommendDim"))
+ {
+ evt.findScalar("leftMargin", &fLeft);
+ evt.findScalar("rightMargin", &fRight);
+ evt.findScalar("topMargin", &fTop);
+ evt.findScalar("bottomMargin", &fBottom);
+
+ //setup_views.cpp uses SkView::Layout instead of SkStackViewLayout
+ //but that gives me an error
+ SkStackViewLayout* layout;
+ fMargin.set(fLeft, fTop, fRight, fBottom);
+ if (this->getLayout())
+ {
+ layout = (SkStackViewLayout*)this->getLayout();
+ layout->setMargin(fMargin);
+ }
+ else
+ {
+ layout = new SkStackViewLayout;
+ layout->setMargin(fMargin);
+ this->setLayout(layout)->unref();
+ }
+ this->invokeLayout();
+ }
+ return this->INHERITED::onEvent(evt);
}
diff --git a/src/views/animated/SkImageView.cpp b/src/views/animated/SkImageView.cpp
index 8924dd32fb..a75aa73d1b 100644
--- a/src/views/animated/SkImageView.cpp
+++ b/src/views/animated/SkImageView.cpp
@@ -16,288 +16,288 @@
SkImageView::SkImageView()
{
- fMatrix = NULL;
- fScaleType = kMatrix_ScaleType;
+ fMatrix = NULL;
+ fScaleType = kMatrix_ScaleType;
- fData.fAnim = NULL; // handles initializing the other union values
- fDataIsAnim = true;
-
- fUriIsValid = false; // an empty string is not valid
+ fData.fAnim = NULL; // handles initializing the other union values
+ fDataIsAnim = true;
+
+ fUriIsValid = false; // an empty string is not valid
}
SkImageView::~SkImageView()
{
- if (fMatrix)
- sk_free(fMatrix);
-
- this->freeData();
+ if (fMatrix)
+ sk_free(fMatrix);
+
+ this->freeData();
}
void SkImageView::getUri(SkString* uri) const
{
- if (uri)
- *uri = fUri;
+ if (uri)
+ *uri = fUri;
}
void SkImageView::setUri(const char uri[])
{
- if (!fUri.equals(uri))
- {
- fUri.set(uri);
- this->onUriChange();
- }
+ if (!fUri.equals(uri))
+ {
+ fUri.set(uri);
+ this->onUriChange();
+ }
}
void SkImageView::setUri(const SkString& uri)
{
- if (fUri != uri)
- {
- fUri = uri;
- this->onUriChange();
- }
+ if (fUri != uri)
+ {
+ fUri = uri;
+ this->onUriChange();
+ }
}
void SkImageView::setScaleType(ScaleType st)
{
- SkASSERT((unsigned)st <= kFitEnd_ScaleType);
-
- if ((ScaleType)fScaleType != st)
- {
- fScaleType = SkToU8(st);
- if (fUriIsValid)
- this->inval(NULL);
- }
+ SkASSERT((unsigned)st <= kFitEnd_ScaleType);
+
+ if ((ScaleType)fScaleType != st)
+ {
+ fScaleType = SkToU8(st);
+ if (fUriIsValid)
+ this->inval(NULL);
+ }
}
bool SkImageView::getImageMatrix(SkMatrix* matrix) const
{
- if (fMatrix)
- {
- SkASSERT(!fMatrix->isIdentity());
- if (matrix)
- *matrix = *fMatrix;
- return true;
- }
- else
- {
- if (matrix)
- matrix->reset();
- return false;
- }
+ if (fMatrix)
+ {
+ SkASSERT(!fMatrix->isIdentity());
+ if (matrix)
+ *matrix = *fMatrix;
+ return true;
+ }
+ else
+ {
+ if (matrix)
+ matrix->reset();
+ return false;
+ }
}
void SkImageView::setImageMatrix(const SkMatrix* matrix)
{
- bool changed = false;
-
- if (matrix && !matrix->isIdentity())
- {
- if (fMatrix == NULL)
- fMatrix = (SkMatrix*)sk_malloc_throw(sizeof(SkMatrix));
- *fMatrix = *matrix;
- changed = true;
- }
- else // set us to identity
- {
- if (fMatrix)
- {
- SkASSERT(!fMatrix->isIdentity());
- sk_free(fMatrix);
- fMatrix = NULL;
- changed = true;
- }
- }
-
- // only redraw if we changed our matrix and we're not in scaleToFit mode
- if (changed && this->getScaleType() == kMatrix_ScaleType && fUriIsValid)
- this->inval(NULL);
+ bool changed = false;
+
+ if (matrix && !matrix->isIdentity())
+ {
+ if (fMatrix == NULL)
+ fMatrix = (SkMatrix*)sk_malloc_throw(sizeof(SkMatrix));
+ *fMatrix = *matrix;
+ changed = true;
+ }
+ else // set us to identity
+ {
+ if (fMatrix)
+ {
+ SkASSERT(!fMatrix->isIdentity());
+ sk_free(fMatrix);
+ fMatrix = NULL;
+ changed = true;
+ }
+ }
+
+ // only redraw if we changed our matrix and we're not in scaleToFit mode
+ if (changed && this->getScaleType() == kMatrix_ScaleType && fUriIsValid)
+ this->inval(NULL);
}
///////////////////////////////////////////////////////////////////////////////////////////////
bool SkImageView::onEvent(const SkEvent& evt)
{
- if (evt.isType(SK_EventType_Inval))
- {
- if (fUriIsValid)
- this->inval(NULL);
- return true;
- }
- return this->INHERITED::onEvent(evt);
+ if (evt.isType(SK_EventType_Inval))
+ {
+ if (fUriIsValid)
+ this->inval(NULL);
+ return true;
+ }
+ return this->INHERITED::onEvent(evt);
}
static inline SkMatrix::ScaleToFit scaleTypeToScaleToFit(SkImageView::ScaleType st)
{
- SkASSERT(st != SkImageView::kMatrix_ScaleType);
- SkASSERT((unsigned)st <= SkImageView::kFitEnd_ScaleType);
-
- SkASSERT(SkImageView::kFitXY_ScaleType - 1 == SkMatrix::kFill_ScaleToFit);
- SkASSERT(SkImageView::kFitStart_ScaleType - 1 == SkMatrix::kStart_ScaleToFit);
- SkASSERT(SkImageView::kFitCenter_ScaleType - 1 == SkMatrix::kCenter_ScaleToFit);
- SkASSERT(SkImageView::kFitEnd_ScaleType - 1 == SkMatrix::kEnd_ScaleToFit);
-
- return (SkMatrix::ScaleToFit)(st - 1);
+ SkASSERT(st != SkImageView::kMatrix_ScaleType);
+ SkASSERT((unsigned)st <= SkImageView::kFitEnd_ScaleType);
+
+ SkASSERT(SkImageView::kFitXY_ScaleType - 1 == SkMatrix::kFill_ScaleToFit);
+ SkASSERT(SkImageView::kFitStart_ScaleType - 1 == SkMatrix::kStart_ScaleToFit);
+ SkASSERT(SkImageView::kFitCenter_ScaleType - 1 == SkMatrix::kCenter_ScaleToFit);
+ SkASSERT(SkImageView::kFitEnd_ScaleType - 1 == SkMatrix::kEnd_ScaleToFit);
+
+ return (SkMatrix::ScaleToFit)(st - 1);
}
void SkImageView::onDraw(SkCanvas* canvas)
{
- SkRect src;
- if (!this->getDataBounds(&src))
- {
- SkDEBUGCODE(canvas->drawColor(SK_ColorRED);)
- return; // nothing to draw
- }
-
- SkAutoCanvasRestore restore(canvas, true);
- SkMatrix matrix;
-
- if (this->getScaleType() == kMatrix_ScaleType)
- (void)this->getImageMatrix(&matrix);
- else
- {
- SkRect dst;
- dst.set(0, 0, this->width(), this->height());
- matrix.setRectToRect(src, dst, scaleTypeToScaleToFit(this->getScaleType()));
- }
- canvas->concat(matrix);
-
- SkPaint paint;
-
- paint.setAntiAlias(true);
-
- if (fDataIsAnim)
- {
- SkMSec now = SkTime::GetMSecs();
-
- SkAnimator::DifferenceType diff = fData.fAnim->draw(canvas, &paint, now);
-
+ SkRect src;
+ if (!this->getDataBounds(&src))
+ {
+ SkDEBUGCODE(canvas->drawColor(SK_ColorRED);)
+ return; // nothing to draw
+ }
+
+ SkAutoCanvasRestore restore(canvas, true);
+ SkMatrix matrix;
+
+ if (this->getScaleType() == kMatrix_ScaleType)
+ (void)this->getImageMatrix(&matrix);
+ else
+ {
+ SkRect dst;
+ dst.set(0, 0, this->width(), this->height());
+ matrix.setRectToRect(src, dst, scaleTypeToScaleToFit(this->getScaleType()));
+ }
+ canvas->concat(matrix);
+
+ SkPaint paint;
+
+ paint.setAntiAlias(true);
+
+ if (fDataIsAnim)
+ {
+ SkMSec now = SkTime::GetMSecs();
+
+ SkAnimator::DifferenceType diff = fData.fAnim->draw(canvas, &paint, now);
+
SkDEBUGF(("SkImageView : now = %X[%12.3f], diff = %d\n", now, now/1000., diff));
- if (diff == SkAnimator::kDifferent)
- this->inval(NULL);
- else if (diff == SkAnimator::kPartiallyDifferent)
- {
- SkRect bounds;
- fData.fAnim->getInvalBounds(&bounds);
- matrix.mapRect(&bounds); // get the bounds into view coordinates
- this->inval(&bounds);
- }
- }
- else
- canvas->drawBitmap(*fData.fBitmap, 0, 0, &paint);
+ if (diff == SkAnimator::kDifferent)
+ this->inval(NULL);
+ else if (diff == SkAnimator::kPartiallyDifferent)
+ {
+ SkRect bounds;
+ fData.fAnim->getInvalBounds(&bounds);
+ matrix.mapRect(&bounds); // get the bounds into view coordinates
+ this->inval(&bounds);
+ }
+ }
+ else
+ canvas->drawBitmap(*fData.fBitmap, 0, 0, &paint);
}
void SkImageView::onInflate(const SkDOM& dom, const SkDOMNode* node)
{
- this->INHERITED::onInflate(dom, node);
-
- const char* src = dom.findAttr(node, "src");
- if (src)
- this->setUri(src);
-
- int index = dom.findList(node, "scaleType", "matrix,fitXY,fitStart,fitCenter,fitEnd");
- if (index >= 0)
- this->setScaleType((ScaleType)index);
-
- // need inflate syntax/reader for matrix
+ this->INHERITED::onInflate(dom, node);
+
+ const char* src = dom.findAttr(node, "src");
+ if (src)
+ this->setUri(src);
+
+ int index = dom.findList(node, "scaleType", "matrix,fitXY,fitStart,fitCenter,fitEnd");
+ if (index >= 0)
+ this->setScaleType((ScaleType)index);
+
+ // need inflate syntax/reader for matrix
}
/////////////////////////////////////////////////////////////////////////////////////
void SkImageView::onUriChange()
{
- if (this->freeData())
- this->inval(NULL);
- fUriIsValid = true; // give ensureUriIsLoaded() a shot at the new uri
+ if (this->freeData())
+ this->inval(NULL);
+ fUriIsValid = true; // give ensureUriIsLoaded() a shot at the new uri
}
bool SkImageView::freeData()
{
- if (fData.fAnim) // test is valid for all union values
- {
- if (fDataIsAnim)
- delete fData.fAnim;
- else
- delete fData.fBitmap;
-
- fData.fAnim = NULL; // valid for all union values
- return true;
- }
- return false;
+ if (fData.fAnim) // test is valid for all union values
+ {
+ if (fDataIsAnim)
+ delete fData.fAnim;
+ else
+ delete fData.fBitmap;
+
+ fData.fAnim = NULL; // valid for all union values
+ return true;
+ }
+ return false;
}
bool SkImageView::getDataBounds(SkRect* bounds)
{
- SkASSERT(bounds);
-
- if (this->ensureUriIsLoaded())
- {
- SkScalar width, height;
-
- if (fDataIsAnim)
- {
- if (SkScalarIsNaN(width = fData.fAnim->getScalar("dimensions", "x")) ||
- SkScalarIsNaN(height = fData.fAnim->getScalar("dimensions", "y")))
- {
- // cons up fake bounds
- width = this->width();
- height = this->height();
- }
- }
- else
- {
- width = SkIntToScalar(fData.fBitmap->width());
- height = SkIntToScalar(fData.fBitmap->height());
- }
- bounds->set(0, 0, width, height);
- return true;
- }
- return false;
+ SkASSERT(bounds);
+
+ if (this->ensureUriIsLoaded())
+ {
+ SkScalar width, height;
+
+ if (fDataIsAnim)
+ {
+ if (SkScalarIsNaN(width = fData.fAnim->getScalar("dimensions", "x")) ||
+ SkScalarIsNaN(height = fData.fAnim->getScalar("dimensions", "y")))
+ {
+ // cons up fake bounds
+ width = this->width();
+ height = this->height();
+ }
+ }
+ else
+ {
+ width = SkIntToScalar(fData.fBitmap->width());
+ height = SkIntToScalar(fData.fBitmap->height());
+ }
+ bounds->set(0, 0, width, height);
+ return true;
+ }
+ return false;
}
bool SkImageView::ensureUriIsLoaded()
{
- if (fData.fAnim) // test is valid for all union values
- {
- SkASSERT(fUriIsValid);
- return true;
- }
- if (!fUriIsValid)
- return false;
-
- // try to load the url
- if (fUri.endsWith(".xml")) // assume it is screenplay
- {
- SkAnimator* anim = new SkAnimator;
-
- if (!anim->decodeURI(fUri.c_str()))
- {
- delete anim;
- fUriIsValid = false;
- return false;
- }
- anim->setHostEventSink(this);
-
- fData.fAnim = anim;
- fDataIsAnim = true;
- }
- else // assume it is an image format
- {
+ if (fData.fAnim) // test is valid for all union values
+ {
+ SkASSERT(fUriIsValid);
+ return true;
+ }
+ if (!fUriIsValid)
+ return false;
+
+ // try to load the url
+ if (fUri.endsWith(".xml")) // assume it is screenplay
+ {
+ SkAnimator* anim = new SkAnimator;
+
+ if (!anim->decodeURI(fUri.c_str()))
+ {
+ delete anim;
+ fUriIsValid = false;
+ return false;
+ }
+ anim->setHostEventSink(this);
+
+ fData.fAnim = anim;
+ fDataIsAnim = true;
+ }
+ else // assume it is an image format
+ {
#if 0
- SkBitmap* bitmap = new SkBitmap;
-
- if (!SkImageDecoder::DecodeURL(fUri.c_str(), bitmap))
- {
- delete bitmap;
- fUriIsValid = false;
- return false;
- }
- fData.fBitmap = bitmap;
- fDataIsAnim = false;
+ SkBitmap* bitmap = new SkBitmap;
+
+ if (!SkImageDecoder::DecodeURL(fUri.c_str(), bitmap))
+ {
+ delete bitmap;
+ fUriIsValid = false;
+ return false;
+ }
+ fData.fBitmap = bitmap;
+ fDataIsAnim = false;
#else
return false;
#endif
- }
- return true;
+ }
+ return true;
}
diff --git a/src/views/animated/SkListView.cpp b/src/views/animated/SkListView.cpp
index 20747a285a..ec9d2ee7b0 100644
--- a/src/views/animated/SkListView.cpp
+++ b/src/views/animated/SkListView.cpp
@@ -16,192 +16,192 @@
SkEvent* SkListSource::getEvent(int index)
{
- return NULL;
+ return NULL;
}
#include "SkOSFile.h"
class SkDirListSource : public SkListSource {
public:
- SkDirListSource(const char path[], const char suffix[], const char target[])
- : fPath(path), fSuffix(suffix), fTarget(target)
- {
- fCount = -1;
- }
- virtual int countRows()
- {
- if (fCount < 0)
- {
- fCount = 0;
- fIter.reset(fPath.c_str(), fSuffix.c_str());
- while (fIter.next(NULL))
- fCount += 1;
- fIter.reset(fPath.c_str(), fSuffix.c_str());
- fIndex = 0;
- }
- return fCount;
- }
- virtual void getRow(int index, SkString* left, SkString* right)
- {
- (void)this->countRows();
- SkASSERT((unsigned)index < (unsigned)fCount);
-
- if (fIndex > index)
- {
- fIter.reset(fPath.c_str(), fSuffix.c_str());
- fIndex = 0;
- }
-
- while (fIndex < index)
- {
- fIter.next(NULL);
- fIndex += 1;
- }
-
- if (fIter.next(left))
- {
- if (left)
- left->remove(left->size() - fSuffix.size(), fSuffix.size());
- }
- else
- {
- if (left)
- left->reset();
- }
- if (right) // only set to ">" if we know we're on a sub-directory
- right->reset();
-
- fIndex += 1;
- }
- virtual SkEvent* getEvent(int index)
- {
- SkASSERT((unsigned)index < (unsigned)fCount);
-
- SkEvent* evt = new SkEvent();
- SkString label;
-
- this->getRow(index, &label, NULL);
- evt->setString("name", label.c_str());
-
- int c = fPath.c_str()[fPath.size() - 1];
- if (c != '/' && c != '\\')
- label.prepend("/");
- label.prepend(fPath);
- label.append(fSuffix);
- evt->setString("path", label.c_str());
- evt->setS32("index", index);
- evt->setS32("duration", 22);
- evt->setType(fTarget);
- return evt;
- }
+ SkDirListSource(const char path[], const char suffix[], const char target[])
+ : fPath(path), fSuffix(suffix), fTarget(target)
+ {
+ fCount = -1;
+ }
+ virtual int countRows()
+ {
+ if (fCount < 0)
+ {
+ fCount = 0;
+ fIter.reset(fPath.c_str(), fSuffix.c_str());
+ while (fIter.next(NULL))
+ fCount += 1;
+ fIter.reset(fPath.c_str(), fSuffix.c_str());
+ fIndex = 0;
+ }
+ return fCount;
+ }
+ virtual void getRow(int index, SkString* left, SkString* right)
+ {
+ (void)this->countRows();
+ SkASSERT((unsigned)index < (unsigned)fCount);
+
+ if (fIndex > index)
+ {
+ fIter.reset(fPath.c_str(), fSuffix.c_str());
+ fIndex = 0;
+ }
+
+ while (fIndex < index)
+ {
+ fIter.next(NULL);
+ fIndex += 1;
+ }
+
+ if (fIter.next(left))
+ {
+ if (left)
+ left->remove(left->size() - fSuffix.size(), fSuffix.size());
+ }
+ else
+ {
+ if (left)
+ left->reset();
+ }
+ if (right) // only set to ">" if we know we're on a sub-directory
+ right->reset();
+
+ fIndex += 1;
+ }
+ virtual SkEvent* getEvent(int index)
+ {
+ SkASSERT((unsigned)index < (unsigned)fCount);
+
+ SkEvent* evt = new SkEvent();
+ SkString label;
+
+ this->getRow(index, &label, NULL);
+ evt->setString("name", label.c_str());
+
+ int c = fPath.c_str()[fPath.size() - 1];
+ if (c != '/' && c != '\\')
+ label.prepend("/");
+ label.prepend(fPath);
+ label.append(fSuffix);
+ evt->setString("path", label.c_str());
+ evt->setS32("index", index);
+ evt->setS32("duration", 22);
+ evt->setType(fTarget);
+ return evt;
+ }
private:
- SkString fPath, fSuffix;
- SkString fTarget;
- SkOSFile::Iter fIter;
- int fCount;
- int fIndex;
+ SkString fPath, fSuffix;
+ SkString fTarget;
+ SkOSFile::Iter fIter;
+ int fCount;
+ int fIndex;
};
SkListSource* SkListSource::CreateFromDir(const char path[], const char suffix[], const char target[])
{
- return new SkDirListSource(path, suffix, target);
+ return new SkDirListSource(path, suffix, target);
}
//////////////////////////////////////////////////////////////////
class SkDOMListSource : public SkListSource {
public:
- enum Type {
- kUnknown_Type,
- kDir_Type,
- kToggle_Type
- };
- struct ItemRec {
- SkString fLabel;
- SkString fTail, fAltTail;
- SkString fTarget;
- Type fType;
- };
-
- SkDOMListSource(const SkDOM& dom, const SkDOM::Node* node) : fDirTail(">")
- {
- const SkDOM::Node* child = dom.getFirstChild(node, "item");
- int count = 0;
-
- while (child)
- {
- count += 1;
- child = dom.getNextSibling(child, "item");
- }
-
- fCount = count;
- fList = NULL;
- if (count)
- {
- ItemRec* rec = fList = new ItemRec[count];
-
- child = dom.getFirstChild(node, "item");
- while (child)
- {
- rec->fLabel.set(dom.findAttr(child, "label"));
- rec->fTail.set(dom.findAttr(child, "tail"));
- rec->fAltTail.set(dom.findAttr(child, "alt-tail"));
- rec->fTarget.set(dom.findAttr(child, "target"));
- rec->fType = kUnknown_Type;
-
- int index = dom.findList(child, "type", "dir,toggle");
- if (index >= 0)
- rec->fType = (Type)(index + 1);
-
- child = dom.getNextSibling(child, "item");
- rec += 1;
- }
- }
- }
- virtual ~SkDOMListSource()
- {
- delete[] fList;
- }
- virtual int countRows()
- {
- return fCount;
- }
- virtual void getRow(int index, SkString* left, SkString* right)
- {
- SkASSERT((unsigned)index < (unsigned)fCount);
-
- if (left)
- *left = fList[index].fLabel;
- if (right)
- *right = fList[index].fType == kDir_Type ? fDirTail : fList[index].fTail;
- }
- virtual SkEvent* getEvent(int index)
- {
- SkASSERT((unsigned)index < (unsigned)fCount);
-
- if (fList[index].fType == kDir_Type)
- {
- SkEvent* evt = new SkEvent();
- evt->setType(fList[index].fTarget);
- evt->setFast32(index);
- return evt;
- }
- if (fList[index].fType == kToggle_Type)
- fList[index].fTail.swap(fList[index].fAltTail);
-
- return NULL;
- }
+ enum Type {
+ kUnknown_Type,
+ kDir_Type,
+ kToggle_Type
+ };
+ struct ItemRec {
+ SkString fLabel;
+ SkString fTail, fAltTail;
+ SkString fTarget;
+ Type fType;
+ };
+
+ SkDOMListSource(const SkDOM& dom, const SkDOM::Node* node) : fDirTail(">")
+ {
+ const SkDOM::Node* child = dom.getFirstChild(node, "item");
+ int count = 0;
+
+ while (child)
+ {
+ count += 1;
+ child = dom.getNextSibling(child, "item");
+ }
+
+ fCount = count;
+ fList = NULL;
+ if (count)
+ {
+ ItemRec* rec = fList = new ItemRec[count];
+
+ child = dom.getFirstChild(node, "item");
+ while (child)
+ {
+ rec->fLabel.set(dom.findAttr(child, "label"));
+ rec->fTail.set(dom.findAttr(child, "tail"));
+ rec->fAltTail.set(dom.findAttr(child, "alt-tail"));
+ rec->fTarget.set(dom.findAttr(child, "target"));
+ rec->fType = kUnknown_Type;
+
+ int index = dom.findList(child, "type", "dir,toggle");
+ if (index >= 0)
+ rec->fType = (Type)(index + 1);
+
+ child = dom.getNextSibling(child, "item");
+ rec += 1;
+ }
+ }
+ }
+ virtual ~SkDOMListSource()
+ {
+ delete[] fList;
+ }
+ virtual int countRows()
+ {
+ return fCount;
+ }
+ virtual void getRow(int index, SkString* left, SkString* right)
+ {
+ SkASSERT((unsigned)index < (unsigned)fCount);
+
+ if (left)
+ *left = fList[index].fLabel;
+ if (right)
+ *right = fList[index].fType == kDir_Type ? fDirTail : fList[index].fTail;
+ }
+ virtual SkEvent* getEvent(int index)
+ {
+ SkASSERT((unsigned)index < (unsigned)fCount);
+
+ if (fList[index].fType == kDir_Type)
+ {
+ SkEvent* evt = new SkEvent();
+ evt->setType(fList[index].fTarget);
+ evt->setFast32(index);
+ return evt;
+ }
+ if (fList[index].fType == kToggle_Type)
+ fList[index].fTail.swap(fList[index].fAltTail);
+
+ return NULL;
+ }
private:
- int fCount;
- ItemRec* fList;
- SkString fDirTail;
+ int fCount;
+ ItemRec* fList;
+ SkString fDirTail;
};
SkListSource* SkListSource::CreateFromDOM(const SkDOM& dom, const SkDOM::Node* node)
{
- return new SkDOMListSource(dom, node);
+ return new SkDOMListSource(dom, node);
}
//////////////////////////////////////////////////////////////////
@@ -209,304 +209,304 @@ SkListSource* SkListSource::CreateFromDOM(const SkDOM& dom, const SkDOM::Node* n
SkListView::SkListView(U32 flags) : SkWidgetView(flags)
{
- fSource = NULL;
- fScrollIndex = 0;
- fCurrIndex = -1;
- fRowHeight = SkIntToScalar(16);
- fVisibleRowCount = 0;
- fStrCache = NULL;
+ fSource = NULL;
+ fScrollIndex = 0;
+ fCurrIndex = -1;
+ fRowHeight = SkIntToScalar(16);
+ fVisibleRowCount = 0;
+ fStrCache = NULL;
- fPaint[kBG_Attr].setColor(0);
- fPaint[kNormalText_Attr].setTextSize(SkIntToScalar(14));
- fPaint[kHiliteText_Attr].setTextSize(SkIntToScalar(14));
- fPaint[kHiliteText_Attr].setColor(SK_ColorWHITE);
- fPaint[kHiliteCell_Attr].setColor(SK_ColorBLUE);
+ fPaint[kBG_Attr].setColor(0);
+ fPaint[kNormalText_Attr].setTextSize(SkIntToScalar(14));
+ fPaint[kHiliteText_Attr].setTextSize(SkIntToScalar(14));
+ fPaint[kHiliteText_Attr].setColor(SK_ColorWHITE);
+ fPaint[kHiliteCell_Attr].setColor(SK_ColorBLUE);
}
SkListView::~SkListView()
{
- delete[] fStrCache;
- fSource->safeUnref();
+ delete[] fStrCache;
+ fSource->safeUnref();
}
void SkListView::setRowHeight(SkScalar height)
{
- SkASSERT(height >= 0);
+ SkASSERT(height >= 0);
- if (fRowHeight != height)
- {
- fRowHeight = height;
- this->inval(NULL);
- this->onSizeChange();
- }
+ if (fRowHeight != height)
+ {
+ fRowHeight = height;
+ this->inval(NULL);
+ this->onSizeChange();
+ }
}
void SkListView::setSelection(int index)
{
- if (fCurrIndex != index)
- {
- this->invalSelection();
- fCurrIndex = index;
- this->invalSelection();
- this->ensureSelectionIsVisible();
+ if (fCurrIndex != index)
+ {
+ this->invalSelection();
+ fCurrIndex = index;
+ this->invalSelection();
+ this->ensureSelectionIsVisible();
- {
- SkEvent evt;
- evt.setType("listview-selection");
- evt.setFast32(index);
- this->sendEventToParents(evt);
- }
- }
+ {
+ SkEvent evt;
+ evt.setType("listview-selection");
+ evt.setFast32(index);
+ this->sendEventToParents(evt);
+ }
+ }
}
void SkListView::moveSelectionUp()
{
- if (fSource)
- {
- int index = fCurrIndex;
- if (index < 0) // no selection
- index = fSource->countRows() - 1;
- else
- index = SkMax32(index - 1, 0);
- this->setSelection(index);
- }
+ if (fSource)
+ {
+ int index = fCurrIndex;
+ if (index < 0) // no selection
+ index = fSource->countRows() - 1;
+ else
+ index = SkMax32(index - 1, 0);
+ this->setSelection(index);
+ }
}
void SkListView::moveSelectionDown()
{
- if (fSource)
- {
- int index = fCurrIndex;
- if (index < 0) // no selection
- index = 0;
- else
- index = SkMin32(index + 1, fSource->countRows() - 1);
- this->setSelection(index);
- }
+ if (fSource)
+ {
+ int index = fCurrIndex;
+ if (index < 0) // no selection
+ index = 0;
+ else
+ index = SkMin32(index + 1, fSource->countRows() - 1);
+ this->setSelection(index);
+ }
}
void SkListView::invalSelection()
{
- SkRect r;
- if (this->getRowRect(fCurrIndex, &r))
- this->inval(&r);
+ SkRect r;
+ if (this->getRowRect(fCurrIndex, &r))
+ this->inval(&r);
}
void SkListView::ensureSelectionIsVisible()
{
- if (fSource == NULL)
- return;
+ if (fSource == NULL)
+ return;
- if ((unsigned)fCurrIndex < (unsigned)fSource->countRows())
- {
- int index = this->logicalToVisualIndex(fCurrIndex);
+ if ((unsigned)fCurrIndex < (unsigned)fSource->countRows())
+ {
+ int index = this->logicalToVisualIndex(fCurrIndex);
- if ((unsigned)index >= (unsigned)fVisibleRowCount) // need to scroll
- {
- if (index < 0) // too high
- fScrollIndex = fCurrIndex;
- else
- fScrollIndex = fCurrIndex - fVisibleRowCount + 1;
- SkASSERT((unsigned)fScrollIndex < (unsigned)fSource->countRows());
+ if ((unsigned)index >= (unsigned)fVisibleRowCount) // need to scroll
+ {
+ if (index < 0) // too high
+ fScrollIndex = fCurrIndex;
+ else
+ fScrollIndex = fCurrIndex - fVisibleRowCount + 1;
+ SkASSERT((unsigned)fScrollIndex < (unsigned)fSource->countRows());
- this->dirtyStrCache();
- this->inval(NULL);
- }
- }
+ this->dirtyStrCache();
+ this->inval(NULL);
+ }
+ }
}
bool SkListView::getRowRect(int index, SkRect* r) const
{
- SkASSERT(r);
- index = this->logicalToVisualIndex(index);
- if (index >= 0)
- {
- SkScalar top = index * fRowHeight;
+ SkASSERT(r);
+ index = this->logicalToVisualIndex(index);
+ if (index >= 0)
+ {
+ SkScalar top = index * fRowHeight;
- if (top < this->height())
- {
- if (r)
- r->set(0, top, this->width(), top + fRowHeight);
- return true;
- }
- }
- return false;
+ if (top < this->height())
+ {
+ if (r)
+ r->set(0, top, this->width(), top + fRowHeight);
+ return true;
+ }
+ }
+ return false;
}
SkPaint& SkListView::paint(Attr attr)
{
- SkASSERT((unsigned)attr < kAttrCount);
- return fPaint[attr];
+ SkASSERT((unsigned)attr < kAttrCount);
+ return fPaint[attr];
}
SkListSource* SkListView::setListSource(SkListSource* src)
{
- if (fSource != src)
- {
- SkRefCnt_SafeAssign(fSource, src);
- this->dirtyStrCache();
- this->ensureSelectionIsVisible();
- this->inval(NULL);
- }
- return src;
+ if (fSource != src)
+ {
+ SkRefCnt_SafeAssign(fSource, src);
+ this->dirtyStrCache();
+ this->ensureSelectionIsVisible();
+ this->inval(NULL);
+ }
+ return src;
}
void SkListView::onDraw(SkCanvas* canvas)
{
- this->INHERITED::onDraw(canvas);
+ this->INHERITED::onDraw(canvas);
- canvas->drawPaint(fPaint[kBG_Attr]);
+ canvas->drawPaint(fPaint[kBG_Attr]);
- int visibleCount = SkMin32(fVisibleRowCount, fSource->countRows() - fScrollIndex);
- if (visibleCount == 0)
- return;
+ int visibleCount = SkMin32(fVisibleRowCount, fSource->countRows() - fScrollIndex);
+ if (visibleCount == 0)
+ return;
- this->ensureStrCache(visibleCount);
- int currIndex = this->logicalToVisualIndex(fCurrIndex);
+ this->ensureStrCache(visibleCount);
+ int currIndex = this->logicalToVisualIndex(fCurrIndex);
- if ((unsigned)currIndex < (unsigned)visibleCount)
- {
- SkAutoCanvasRestore restore(canvas, true);
- SkRect r;
+ if ((unsigned)currIndex < (unsigned)visibleCount)
+ {
+ SkAutoCanvasRestore restore(canvas, true);
+ SkRect r;
- canvas->translate(0, currIndex * fRowHeight);
- (void)this->getRowRect(fScrollIndex, &r);
- canvas->drawRect(r, fPaint[kHiliteCell_Attr]);
- }
+ canvas->translate(0, currIndex * fRowHeight);
+ (void)this->getRowRect(fScrollIndex, &r);
+ canvas->drawRect(r, fPaint[kHiliteCell_Attr]);
+ }
- SkPaint* p;
- SkScalar y, x = SkIntToScalar(6);
- SkScalar rite = this->width() - x;
+ SkPaint* p;
+ SkScalar y, x = SkIntToScalar(6);
+ SkScalar rite = this->width() - x;
- {
- SkScalar ascent, descent;
- fPaint[kNormalText_Attr].measureText(0, NULL, &ascent, &descent);
- y = SkScalarHalf(fRowHeight - descent + ascent) - ascent;
- }
+ {
+ SkScalar ascent, descent;
+ fPaint[kNormalText_Attr].measureText(0, NULL, &ascent, &descent);
+ y = SkScalarHalf(fRowHeight - descent + ascent) - ascent;
+ }
- for (int i = 0; i < visibleCount; i++)
- {
- if (i == currIndex)
- p = &fPaint[kHiliteText_Attr];
- else
- p = &fPaint[kNormalText_Attr];
+ for (int i = 0; i < visibleCount; i++)
+ {
+ if (i == currIndex)
+ p = &fPaint[kHiliteText_Attr];
+ else
+ p = &fPaint[kNormalText_Attr];
- p->setTextAlign(SkPaint::kLeft_Align);
- canvas->drawText(fStrCache[i].c_str(), fStrCache[i].size(), x, y, *p);
- p->setTextAlign(SkPaint::kRight_Align);
- canvas->drawText(fStrCache[i + visibleCount].c_str(), fStrCache[i + visibleCount].size(), rite, y, *p);
- canvas->translate(0, fRowHeight);
- }
+ p->setTextAlign(SkPaint::kLeft_Align);
+ canvas->drawText(fStrCache[i].c_str(), fStrCache[i].size(), x, y, *p);
+ p->setTextAlign(SkPaint::kRight_Align);
+ canvas->drawText(fStrCache[i + visibleCount].c_str(), fStrCache[i + visibleCount].size(), rite, y, *p);
+ canvas->translate(0, fRowHeight);
+ }
}
void SkListView::onSizeChange()
{
- SkScalar count = SkScalarDiv(this->height(), fRowHeight);
- int n = SkScalarFloor(count);
+ SkScalar count = SkScalarDiv(this->height(), fRowHeight);
+ int n = SkScalarFloor(count);
- // only want to show rows that are mostly visible
- if (n == 0 || count - SkIntToScalar(n) > SK_Scalar1*75/100)
- n += 1;
+ // only want to show rows that are mostly visible
+ if (n == 0 || count - SkIntToScalar(n) > SK_Scalar1*75/100)
+ n += 1;
- if (fVisibleRowCount != n)
- {
- fVisibleRowCount = n;
- this->ensureSelectionIsVisible();
- this->dirtyStrCache();
- }
+ if (fVisibleRowCount != n)
+ {
+ fVisibleRowCount = n;
+ this->ensureSelectionIsVisible();
+ this->dirtyStrCache();
+ }
}
void SkListView::dirtyStrCache()
{
- if (fStrCache)
- {
- delete[] fStrCache;
- fStrCache = NULL;
- }
+ if (fStrCache)
+ {
+ delete[] fStrCache;
+ fStrCache = NULL;
+ }
}
void SkListView::ensureStrCache(int count)
{
- if (fStrCache == NULL)
- {
- fStrCache = new SkString[count << 1];
+ if (fStrCache == NULL)
+ {
+ fStrCache = new SkString[count << 1];
- if (fSource)
- for (int i = 0; i < count; i++)
- fSource->getRow(i + fScrollIndex, &fStrCache[i], &fStrCache[i + count]);
- }
+ if (fSource)
+ for (int i = 0; i < count; i++)
+ fSource->getRow(i + fScrollIndex, &fStrCache[i], &fStrCache[i + count]);
+ }
}
bool SkListView::onEvent(const SkEvent& evt)
{
- if (evt.isType(SK_EventType_Key))
- {
- switch (evt.getFast32()) {
- case kUp_SkKey:
- this->moveSelectionUp();
- return true;
- case kDown_SkKey:
- this->moveSelectionDown();
- return true;
- case kRight_SkKey:
- case kOK_SkKey:
- if (fSource && fCurrIndex >= 0)
- {
- SkEvent* evt = fSource->getEvent(fCurrIndex);
- if (evt)
- {
- SkView* view = this->sendEventToParents(*evt);
- delete evt;
- return view != NULL;
- }
- else // hack to make toggle work
- {
- this->dirtyStrCache();
- this->inval(NULL);
- }
- }
- break;
- }
- }
- return this->INHERITED::onEvent(evt);
+ if (evt.isType(SK_EventType_Key))
+ {
+ switch (evt.getFast32()) {
+ case kUp_SkKey:
+ this->moveSelectionUp();
+ return true;
+ case kDown_SkKey:
+ this->moveSelectionDown();
+ return true;
+ case kRight_SkKey:
+ case kOK_SkKey:
+ if (fSource && fCurrIndex >= 0)
+ {
+ SkEvent* evt = fSource->getEvent(fCurrIndex);
+ if (evt)
+ {
+ SkView* view = this->sendEventToParents(*evt);
+ delete evt;
+ return view != NULL;
+ }
+ else // hack to make toggle work
+ {
+ this->dirtyStrCache();
+ this->inval(NULL);
+ }
+ }
+ break;
+ }
+ }
+ return this->INHERITED::onEvent(evt);
}
void SkListView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- this->INHERITED::onInflate(dom, node);
+ this->INHERITED::onInflate(dom, node);
- SkScalar x;
- const SkDOM::Node* child;
+ SkScalar x;
+ const SkDOM::Node* child;
- if (dom.findScalar(node, "row-height", &x))
- this->setRowHeight(x);
+ if (dom.findScalar(node, "row-height", &x))
+ this->setRowHeight(x);
- if ((child = dom.getFirstChild(node, "hilite-paint")) != NULL)
- SkPaint_Inflate(&this->paint(kHiliteCell_Attr), dom, child);
+ if ((child = dom.getFirstChild(node, "hilite-paint")) != NULL)
+ SkPaint_Inflate(&this->paint(kHiliteCell_Attr), dom, child);
- // look for a listsource
- {
- SkListSource* src = NULL;
+ // look for a listsource
+ {
+ SkListSource* src = NULL;
- if ((child = dom.getFirstChild(node, "file-listsource")) != NULL)
- {
- const char* path = dom.findAttr(child, "path");
- if (path)
- src = SkListSource::CreateFromDir( path,
- dom.findAttr(child, "filter"),
- dom.findAttr(child, "target"));
- }
- else if ((child = dom.getFirstChild(node, "xml-listsource")) != NULL)
- {
- src = SkListSource::CreateFromDOM(dom, child);
- }
+ if ((child = dom.getFirstChild(node, "file-listsource")) != NULL)
+ {
+ const char* path = dom.findAttr(child, "path");
+ if (path)
+ src = SkListSource::CreateFromDir( path,
+ dom.findAttr(child, "filter"),
+ dom.findAttr(child, "target"));
+ }
+ else if ((child = dom.getFirstChild(node, "xml-listsource")) != NULL)
+ {
+ src = SkListSource::CreateFromDOM(dom, child);
+ }
- if (src)
- {
- this->setListSource(src)->unref();
- this->setSelection(0);
- }
- }
+ if (src)
+ {
+ this->setListSource(src)->unref();
+ this->setSelection(0);
+ }
+ }
}
///////////////////////////////////////////////////////////////////////////////////////////
@@ -517,386 +517,386 @@ void SkListView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
class SkScrollBarView : public SkView {
public:
- SkScrollBarView(const char bg[], const char fg[])
- {
- fBGRef = SkBitmapRef::Decode(bg, true);
- fFGRef = SkBitmapRef::Decode(fg, true);
-
- if (fBGRef)
- this->setWidth(SkIntToScalar(fBGRef->bitmap().width()));
- }
- ~SkScrollBarView()
- {
- delete fBGRef;
- delete fFGRef;
- }
+ SkScrollBarView(const char bg[], const char fg[])
+ {
+ fBGRef = SkBitmapRef::Decode(bg, true);
+ fFGRef = SkBitmapRef::Decode(fg, true);
+
+ if (fBGRef)
+ this->setWidth(SkIntToScalar(fBGRef->bitmap().width()));
+ }
+ ~SkScrollBarView()
+ {
+ delete fBGRef;
+ delete fFGRef;
+ }
protected:
- virtual void onDraw(SkCanvas* canvas)
- {
- if (fBGRef == NULL) return;
+ virtual void onDraw(SkCanvas* canvas)
+ {
+ if (fBGRef == NULL) return;
- SkPaint paint;
+ SkPaint paint;
- SkShader* shader = SkShader::CreateBitmapShader(fBGRef->bitmap(), false, SkPaint::kNo_FilterType, SkShader::kClamp_TileMode);
- paint.setShader(shader)->unref();
+ SkShader* shader = SkShader::CreateBitmapShader(fBGRef->bitmap(), false, SkPaint::kNo_FilterType, SkShader::kClamp_TileMode);
+ paint.setShader(shader)->unref();
- canvas->drawPaint(paint);
- }
+ canvas->drawPaint(paint);
+ }
private:
- SkBitmapRef* fBGRef, *fFGRef;
+ SkBitmapRef* fBGRef, *fFGRef;
};
SkGridView::SkGridView(U32 flags) : SkWidgetView(flags)
{
- fSource = NULL;
- fCurrIndex = -1;
- fVisibleCount.set(0, 0);
+ fSource = NULL;
+ fCurrIndex = -1;
+ fVisibleCount.set(0, 0);
- fPaint[kBG_Attr].setColor(SK_ColorWHITE);
- fPaint[kHiliteCell_Attr].setColor(SK_ColorYELLOW);
- fPaint[kHiliteCell_Attr].setStyle(SkPaint::kStroke_Style);
- fPaint[kHiliteCell_Attr].setAntiAliasOn(true);
- fPaint[kHiliteCell_Attr].setStrokeWidth(SK_Scalar1*3);
+ fPaint[kBG_Attr].setColor(SK_ColorWHITE);
+ fPaint[kHiliteCell_Attr].setColor(SK_ColorYELLOW);
+ fPaint[kHiliteCell_Attr].setStyle(SkPaint::kStroke_Style);
+ fPaint[kHiliteCell_Attr].setAntiAliasOn(true);
+ fPaint[kHiliteCell_Attr].setStrokeWidth(SK_Scalar1*3);
- fScrollBar = new SkScrollBarView("icons/scrollbarGrey.jpg", "icons/scrollbarBlue.jpg");
- this->attachChildToFront(fScrollBar)->unref();
- fScrollBar->setVisibleP(true);
+ fScrollBar = new SkScrollBarView("icons/scrollbarGrey.jpg", "icons/scrollbarBlue.jpg");
+ this->attachChildToFront(fScrollBar)->unref();
+ fScrollBar->setVisibleP(true);
}
SkGridView::~SkGridView()
{
- fSource->safeUnref();
+ fSource->safeUnref();
}
void SkGridView::getCellSize(SkPoint* size) const
{
- if (size)
- *size = fCellSize;
+ if (size)
+ *size = fCellSize;
}
void SkGridView::setCellSize(SkScalar x, SkScalar y)
{
- SkASSERT(x >= 0 && y >= 0);
+ SkASSERT(x >= 0 && y >= 0);
- if (!fCellSize.equals(x, y))
- {
- fCellSize.set(x, y);
- this->inval(NULL);
- }
+ if (!fCellSize.equals(x, y))
+ {
+ fCellSize.set(x, y);
+ this->inval(NULL);
+ }
}
void SkGridView::setSelection(int index)
{
- if (fCurrIndex != index)
- {
- this->invalSelection();
- fCurrIndex = index;
- this->invalSelection();
- this->ensureSelectionIsVisible();
+ if (fCurrIndex != index)
+ {
+ this->invalSelection();
+ fCurrIndex = index;
+ this->invalSelection();
+ this->ensureSelectionIsVisible();
- // this generates the click
- {
- SkEvent evt;
- evt.setType("listview-selection");
- evt.setFast32(index);
- this->sendEventToParents(evt);
- }
- }
+ // this generates the click
+ {
+ SkEvent evt;
+ evt.setType("listview-selection");
+ evt.setFast32(index);
+ this->sendEventToParents(evt);
+ }
+ }
}
void SkGridView::moveSelectionUp()
{
- if (fSource)
- {
- int index = fCurrIndex;
- if (index < 0) // no selection
- index = fSource->countRows() - 1;
- else
- index = SkMax32(index - 1, 0);
- this->setSelection(index);
- }
+ if (fSource)
+ {
+ int index = fCurrIndex;
+ if (index < 0) // no selection
+ index = fSource->countRows() - 1;
+ else
+ index = SkMax32(index - 1, 0);
+ this->setSelection(index);
+ }
}
void SkGridView::moveSelectionDown()
{
- if (fSource)
- {
- int index = fCurrIndex;
- if (index < 0) // no selection
- index = 0;
- else
- index = SkMin32(index + 1, fSource->countRows() - 1);
- this->setSelection(index);
- }
+ if (fSource)
+ {
+ int index = fCurrIndex;
+ if (index < 0) // no selection
+ index = 0;
+ else
+ index = SkMin32(index + 1, fSource->countRows() - 1);
+ this->setSelection(index);
+ }
}
void SkGridView::invalSelection()
{
- SkRect r;
- if (this->getCellRect(fCurrIndex, &r))
- {
- SkScalar inset = 0;
- if (fPaint[kHiliteCell_Attr].getStyle() != SkPaint::kFill_Style)
- inset += fPaint[kHiliteCell_Attr].getStrokeWidth() / 2;
- if (fPaint[kHiliteCell_Attr].isAntiAliasOn())
- inset += SK_Scalar1;
- r.inset(-inset, -inset);
- this->inval(&r);
- }
+ SkRect r;
+ if (this->getCellRect(fCurrIndex, &r))
+ {
+ SkScalar inset = 0;
+ if (fPaint[kHiliteCell_Attr].getStyle() != SkPaint::kFill_Style)
+ inset += fPaint[kHiliteCell_Attr].getStrokeWidth() / 2;
+ if (fPaint[kHiliteCell_Attr].isAntiAliasOn())
+ inset += SK_Scalar1;
+ r.inset(-inset, -inset);
+ this->inval(&r);
+ }
}
void SkGridView::ensureSelectionIsVisible()
{
- if (fSource == NULL)
- return;
+ if (fSource == NULL)
+ return;
#if 0
- if ((unsigned)fCurrIndex < (unsigned)fSource->countRows())
- {
- int index = this->logicalToVisualIndex(fCurrIndex);
-
- if ((unsigned)index >= (unsigned)fVisibleRowCount) // need to scroll
- {
- if (index < 0) // too high
- fScrollIndex = fCurrIndex;
- else
- fScrollIndex = fCurrIndex - fVisibleRowCount + 1;
- SkASSERT((unsigned)fScrollIndex < (unsigned)fSource->countRows());
-
- this->dirtyStrCache();
- this->inval(NULL);
- }
- }
+ if ((unsigned)fCurrIndex < (unsigned)fSource->countRows())
+ {
+ int index = this->logicalToVisualIndex(fCurrIndex);
+
+ if ((unsigned)index >= (unsigned)fVisibleRowCount) // need to scroll
+ {
+ if (index < 0) // too high
+ fScrollIndex = fCurrIndex;
+ else
+ fScrollIndex = fCurrIndex - fVisibleRowCount + 1;
+ SkASSERT((unsigned)fScrollIndex < (unsigned)fSource->countRows());
+
+ this->dirtyStrCache();
+ this->inval(NULL);
+ }
+ }
#endif
}
bool SkGridView::getCellRect(int index, SkRect* r) const
{
- if (fVisibleCount.fY == 0)
- return false;
+ if (fVisibleCount.fY == 0)
+ return false;
- index = this->logicalToVisualIndex(index);
- if (index >= 0)
- {
- SkRect bounds;
- int row = index / fVisibleCount.fY;
- int col = index % fVisibleCount.fY;
+ index = this->logicalToVisualIndex(index);
+ if (index >= 0)
+ {
+ SkRect bounds;
+ int row = index / fVisibleCount.fY;
+ int col = index % fVisibleCount.fY;
- bounds.set(0, 0, fCellSize.fX, fCellSize.fY);
- bounds.offset(col * (fCellSize.fX + SkIntToScalar(col > 0)),
- row * (fCellSize.fY + SkIntToScalar(row > 0)));
+ bounds.set(0, 0, fCellSize.fX, fCellSize.fY);
+ bounds.offset(col * (fCellSize.fX + SkIntToScalar(col > 0)),
+ row * (fCellSize.fY + SkIntToScalar(row > 0)));
- if (bounds.fTop < this->height())
- {
- if (r)
- *r = bounds;
- return true;
- }
- }
- return false;
+ if (bounds.fTop < this->height())
+ {
+ if (r)
+ *r = bounds;
+ return true;
+ }
+ }
+ return false;
}
SkPaint& SkGridView::paint(Attr attr)
{
- SkASSERT((unsigned)attr < kAttrCount);
- return fPaint[attr];
+ SkASSERT((unsigned)attr < kAttrCount);
+ return fPaint[attr];
}
SkListSource* SkGridView::setListSource(SkListSource* src)
{
- if (fSource != src)
- {
- SkRefCnt_SafeAssign(fSource, src);
- // this->dirtyStrCache();
- this->ensureSelectionIsVisible();
- this->inval(NULL);
- }
- return src;
+ if (fSource != src)
+ {
+ SkRefCnt_SafeAssign(fSource, src);
+ // this->dirtyStrCache();
+ this->ensureSelectionIsVisible();
+ this->inval(NULL);
+ }
+ return src;
}
#include "SkShader.h"
static void copybits(SkCanvas* canvas, const SkBitmap& bm, const SkRect& dst, const SkPaint& paint)
{
- SkRect src;
- SkMatrix matrix;
+ SkRect src;
+ SkMatrix matrix;
- src.set(0, 0, SkIntToScalar(bm.width()), SkIntToScalar(bm.height()));
- if (matrix.setRectToRect(src, dst))
- {
- SkPaint p(paint);
- SkShader* shader = SkShader::CreateBitmapShader(bm, false, SkPaint::kNo_FilterType, SkShader::kClamp_TileMode);
- p.setShader(shader)->unref();
+ src.set(0, 0, SkIntToScalar(bm.width()), SkIntToScalar(bm.height()));
+ if (matrix.setRectToRect(src, dst))
+ {
+ SkPaint p(paint);
+ SkShader* shader = SkShader::CreateBitmapShader(bm, false, SkPaint::kNo_FilterType, SkShader::kClamp_TileMode);
+ p.setShader(shader)->unref();
- shader->setLocalMatrix(matrix);
- canvas->drawRect(dst, p);
- }
+ shader->setLocalMatrix(matrix);
+ canvas->drawRect(dst, p);
+ }
}
#include "SkImageDecoder.h"
void SkGridView::onDraw(SkCanvas* canvas)
{
- this->INHERITED::onDraw(canvas);
+ this->INHERITED::onDraw(canvas);
- canvas->drawPaint(fPaint[kBG_Attr]);
+ canvas->drawPaint(fPaint[kBG_Attr]);
- if (fSource == NULL)
- return;
+ if (fSource == NULL)
+ return;
#if 0
- int visibleCount = SkMin32(fVisibleRowCount, fSource->countRows() - fScrollIndex);
- if (visibleCount == 0)
- return;
+ int visibleCount = SkMin32(fVisibleRowCount, fSource->countRows() - fScrollIndex);
+ if (visibleCount == 0)
+ return;
- this->ensureStrCache(visibleCount);
- int currIndex = this->logicalToVisualIndex(fCurrIndex);
+ this->ensureStrCache(visibleCount);
+ int currIndex = this->logicalToVisualIndex(fCurrIndex);
#endif
- SkPaint p;
- for (int i = 0; i < fSource->countRows(); i++)
- {
- bool forced = false;
- SkEvent* evt = fSource->getEvent(i);
- SkASSERT(evt);
- SkString path(evt->findString("path"));
- delete evt;
-
- SkBitmapRef* bmr = SkBitmapRef::Decode(path.c_str(), false);
- if (bmr == NULL)
- {
- bmr = SkBitmapRef::Decode(path.c_str(), true);
- if (bmr)
- forced = true;
- }
-
- if (bmr)
- {
- SkAutoTDelete<SkBitmapRef> autoRef(bmr);
- SkRect r;
- if (!this->getCellRect(i, &r))
- break;
- copybits(canvas, bmr->bitmap(), r, p);
- }
- // only draw one forced bitmap at a time
- if (forced)
- {
- this->inval(NULL); // could inval only the remaining visible cells...
- break;
- }
- }
-
- // draw the hilite
- {
- SkRect r;
- if (fCurrIndex >= 0 && this->getCellRect(fCurrIndex, &r))
- canvas->drawRect(r, fPaint[kHiliteCell_Attr]);
- }
+ SkPaint p;
+ for (int i = 0; i < fSource->countRows(); i++)
+ {
+ bool forced = false;
+ SkEvent* evt = fSource->getEvent(i);
+ SkASSERT(evt);
+ SkString path(evt->findString("path"));
+ delete evt;
+
+ SkBitmapRef* bmr = SkBitmapRef::Decode(path.c_str(), false);
+ if (bmr == NULL)
+ {
+ bmr = SkBitmapRef::Decode(path.c_str(), true);
+ if (bmr)
+ forced = true;
+ }
+
+ if (bmr)
+ {
+ SkAutoTDelete<SkBitmapRef> autoRef(bmr);
+ SkRect r;
+ if (!this->getCellRect(i, &r))
+ break;
+ copybits(canvas, bmr->bitmap(), r, p);
+ }
+ // only draw one forced bitmap at a time
+ if (forced)
+ {
+ this->inval(NULL); // could inval only the remaining visible cells...
+ break;
+ }
+ }
+
+ // draw the hilite
+ {
+ SkRect r;
+ if (fCurrIndex >= 0 && this->getCellRect(fCurrIndex, &r))
+ canvas->drawRect(r, fPaint[kHiliteCell_Attr]);
+ }
}
static int check_count(int n, SkScalar s)
{
- // only want to show cells that are mostly visible
- if (n == 0 || s - SkIntToScalar(n) > SK_Scalar1*75/100)
- n += 1;
- return n;
+ // only want to show cells that are mostly visible
+ if (n == 0 || s - SkIntToScalar(n) > SK_Scalar1*75/100)
+ n += 1;
+ return n;
}
void SkGridView::onSizeChange()
{
- fScrollBar->setHeight(this->height());
- fScrollBar->setLoc(this->locX() + this->width() - fScrollBar->width(), 0);
+ fScrollBar->setHeight(this->height());
+ fScrollBar->setLoc(this->locX() + this->width() - fScrollBar->width(), 0);
- if (fCellSize.equals(0, 0))
- {
- fVisibleCount.set(0, 0);
- return;
- }
+ if (fCellSize.equals(0, 0))
+ {
+ fVisibleCount.set(0, 0);
+ return;
+ }
- SkScalar rows = SkScalarDiv(this->height(), fCellSize.fY);
- SkScalar cols = SkScalarDiv(this->width(), fCellSize.fX);
- int y = SkScalarFloor(rows);
- int x = SkScalarFloor(cols);
+ SkScalar rows = SkScalarDiv(this->height(), fCellSize.fY);
+ SkScalar cols = SkScalarDiv(this->width(), fCellSize.fX);
+ int y = SkScalarFloor(rows);
+ int x = SkScalarFloor(cols);
- y = check_count(y, rows);
- x = check_count(x, cols);
+ y = check_count(y, rows);
+ x = check_count(x, cols);
- if (!fVisibleCount.equals(x, y))
- {
- fVisibleCount.set(x, y);
- this->ensureSelectionIsVisible();
- // this->dirtyStrCache();
- }
+ if (!fVisibleCount.equals(x, y))
+ {
+ fVisibleCount.set(x, y);
+ this->ensureSelectionIsVisible();
+ // this->dirtyStrCache();
+ }
}
bool SkGridView::onEvent(const SkEvent& evt)
{
- if (evt.isType(SK_EventType_Key))
- {
- switch (evt.getFast32()) {
- case kUp_SkKey:
- this->moveSelectionUp();
- return true;
- case kDown_SkKey:
- this->moveSelectionDown();
- return true;
- case kRight_SkKey:
- case kOK_SkKey:
- if (fSource && fCurrIndex >= 0)
- {
- SkEvent* evt = fSource->getEvent(fCurrIndex);
- if (evt)
- {
- // augment the event with our local rect
- (void)this->getCellRect(fCurrIndex, (SkRect*)evt->setScalars("local-rect", 4, NULL));
-
- SkView* view = this->sendEventToParents(*evt);
- delete evt;
- return view != NULL;
- }
- }
- break;
- }
- }
- return this->INHERITED::onEvent(evt);
+ if (evt.isType(SK_EventType_Key))
+ {
+ switch (evt.getFast32()) {
+ case kUp_SkKey:
+ this->moveSelectionUp();
+ return true;
+ case kDown_SkKey:
+ this->moveSelectionDown();
+ return true;
+ case kRight_SkKey:
+ case kOK_SkKey:
+ if (fSource && fCurrIndex >= 0)
+ {
+ SkEvent* evt = fSource->getEvent(fCurrIndex);
+ if (evt)
+ {
+ // augment the event with our local rect
+ (void)this->getCellRect(fCurrIndex, (SkRect*)evt->setScalars("local-rect", 4, NULL));
+
+ SkView* view = this->sendEventToParents(*evt);
+ delete evt;
+ return view != NULL;
+ }
+ }
+ break;
+ }
+ }
+ return this->INHERITED::onEvent(evt);
}
void SkGridView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- this->INHERITED::onInflate(dom, node);
-
- SkScalar x[2];
- const SkDOM::Node* child;
-
- if (dom.findScalars(node, "cell-size", x, 2))
- this->setCellSize(x[0], x[1]);
-
- if ((child = dom.getFirstChild(node, "hilite-paint")) != NULL)
- SkPaint_Inflate(&this->paint(kHiliteCell_Attr), dom, child);
-
- // look for a listsource
- {
- SkListSource* src = NULL;
-
- if ((child = dom.getFirstChild(node, "file-listsource")) != NULL)
- {
- const char* path = dom.findAttr(child, "path");
- if (path)
- src = SkListSource::CreateFromDir( path,
- dom.findAttr(child, "filter"),
- dom.findAttr(child, "target"));
- }
- else if ((child = dom.getFirstChild(node, "xml-listsource")) != NULL)
- {
- src = SkListSource::CreateFromDOM(dom, child);
- }
-
- if (src)
- {
- this->setListSource(src)->unref();
- this->setSelection(0);
- }
- }
- this->onSizeChange();
+ this->INHERITED::onInflate(dom, node);
+
+ SkScalar x[2];
+ const SkDOM::Node* child;
+
+ if (dom.findScalars(node, "cell-size", x, 2))
+ this->setCellSize(x[0], x[1]);
+
+ if ((child = dom.getFirstChild(node, "hilite-paint")) != NULL)
+ SkPaint_Inflate(&this->paint(kHiliteCell_Attr), dom, child);
+
+ // look for a listsource
+ {
+ SkListSource* src = NULL;
+
+ if ((child = dom.getFirstChild(node, "file-listsource")) != NULL)
+ {
+ const char* path = dom.findAttr(child, "path");
+ if (path)
+ src = SkListSource::CreateFromDir( path,
+ dom.findAttr(child, "filter"),
+ dom.findAttr(child, "target"));
+ }
+ else if ((child = dom.getFirstChild(node, "xml-listsource")) != NULL)
+ {
+ src = SkListSource::CreateFromDOM(dom, child);
+ }
+
+ if (src)
+ {
+ this->setListSource(src)->unref();
+ this->setSelection(0);
+ }
+ }
+ this->onSizeChange();
}
#endif
diff --git a/src/views/animated/SkListWidget.cpp b/src/views/animated/SkListWidget.cpp
index 4d95e0fc46..f91c6843b7 100644
--- a/src/views/animated/SkListWidget.cpp
+++ b/src/views/animated/SkListWidget.cpp
@@ -13,320 +13,320 @@
extern void init_skin_anim(const char name[], SkAnimator*);
struct SkListView::BindingRec {
- SkString fSlotName;
- int fFieldIndex;
+ SkString fSlotName;
+ int fFieldIndex;
};
SkListView::SkListView()
{
- fSource = NULL; // our list-source
- fScrollBar = NULL;
- fAnims = NULL; // array of animators[fVisibleRowCount]
- fBindings = NULL; // our fields->slot array
- fBindingCount = 0; // number of entries in fSlots array
- fScrollIndex = 0; // number of cells to skip before first visible cell
- fCurrIndex = -1; // index of "selected" cell
- fVisibleRowCount = 0; // number of cells that can fit in our bounds
- fAnimContentDirty = true; // true if fAnims[] have their correct content
- fAnimFocusDirty = true;
-
- fHeights[kNormal_Height] = SkIntToScalar(16);
- fHeights[kSelected_Height] = SkIntToScalar(16);
-
- this->setFlags(this->getFlags() | kFocusable_Mask);
+ fSource = NULL; // our list-source
+ fScrollBar = NULL;
+ fAnims = NULL; // array of animators[fVisibleRowCount]
+ fBindings = NULL; // our fields->slot array
+ fBindingCount = 0; // number of entries in fSlots array
+ fScrollIndex = 0; // number of cells to skip before first visible cell
+ fCurrIndex = -1; // index of "selected" cell
+ fVisibleRowCount = 0; // number of cells that can fit in our bounds
+ fAnimContentDirty = true; // true if fAnims[] have their correct content
+ fAnimFocusDirty = true;
+
+ fHeights[kNormal_Height] = SkIntToScalar(16);
+ fHeights[kSelected_Height] = SkIntToScalar(16);
+
+ this->setFlags(this->getFlags() | kFocusable_Mask);
}
SkListView::~SkListView()
{
- SkSafeUnref(fScrollBar);
- SkSafeUnref(fSource);
- delete[] fAnims;
- delete[] fBindings;
+ SkSafeUnref(fScrollBar);
+ SkSafeUnref(fSource);
+ delete[] fAnims;
+ delete[] fBindings;
}
void SkListView::setHasScrollBar(bool hasSB)
{
- if (hasSB != this->hasScrollBar())
- {
- if (hasSB)
- {
- SkASSERT(fScrollBar == NULL);
- fScrollBar = (SkScrollBarView*)SkWidgetFactory(kScroll_WidgetEnum);
- fScrollBar->setVisibleP(true);
- this->attachChildToFront(fScrollBar);
- fScrollBar->setHeight(this->height()); // assume it auto-sets its width
- // fScrollBar->setLoc(this->getContentWidth(), 0);
- fScrollBar->setLoc(this->width()-SkIntToScalar(10), 0);
- }
- else
- {
- SkASSERT(fScrollBar);
- fScrollBar->detachFromParent();
- fScrollBar->unref();
- fScrollBar = NULL;
- }
- this->dirtyCache(kAnimContent_DirtyFlag);
- }
+ if (hasSB != this->hasScrollBar())
+ {
+ if (hasSB)
+ {
+ SkASSERT(fScrollBar == NULL);
+ fScrollBar = (SkScrollBarView*)SkWidgetFactory(kScroll_WidgetEnum);
+ fScrollBar->setVisibleP(true);
+ this->attachChildToFront(fScrollBar);
+ fScrollBar->setHeight(this->height()); // assume it auto-sets its width
+ // fScrollBar->setLoc(this->getContentWidth(), 0);
+ fScrollBar->setLoc(this->width()-SkIntToScalar(10), 0);
+ }
+ else
+ {
+ SkASSERT(fScrollBar);
+ fScrollBar->detachFromParent();
+ fScrollBar->unref();
+ fScrollBar = NULL;
+ }
+ this->dirtyCache(kAnimContent_DirtyFlag);
+ }
}
void SkListView::setSelection(int index)
{
- if (fCurrIndex != index)
- {
- fAnimFocusDirty = true;
- this->inval(NULL);
-
- this->invalSelection();
- fCurrIndex = index;
- this->invalSelection();
- this->ensureSelectionIsVisible();
- }
+ if (fCurrIndex != index)
+ {
+ fAnimFocusDirty = true;
+ this->inval(NULL);
+
+ this->invalSelection();
+ fCurrIndex = index;
+ this->invalSelection();
+ this->ensureSelectionIsVisible();
+ }
}
bool SkListView::moveSelectionUp()
{
- if (fSource)
- {
- int index = fCurrIndex;
- if (index < 0) // no selection
- index = fSource->countRecords() - 1;
- else
- index = SkMax32(index - 1, 0);
-
- if (fCurrIndex != index)
- {
- this->setSelection(index);
- return true;
- }
- }
- return false;
+ if (fSource)
+ {
+ int index = fCurrIndex;
+ if (index < 0) // no selection
+ index = fSource->countRecords() - 1;
+ else
+ index = SkMax32(index - 1, 0);
+
+ if (fCurrIndex != index)
+ {
+ this->setSelection(index);
+ return true;
+ }
+ }
+ return false;
}
bool SkListView::moveSelectionDown()
{
- if (fSource)
- {
- int index = fCurrIndex;
- if (index < 0) // no selection
- index = 0;
- else
- index = SkMin32(index + 1, fSource->countRecords() - 1);
-
- if (fCurrIndex != index)
- {
- this->setSelection(index);
- return true;
- }
- }
- return false;
+ if (fSource)
+ {
+ int index = fCurrIndex;
+ if (index < 0) // no selection
+ index = 0;
+ else
+ index = SkMin32(index + 1, fSource->countRecords() - 1);
+
+ if (fCurrIndex != index)
+ {
+ this->setSelection(index);
+ return true;
+ }
+ }
+ return false;
}
void SkListView::invalSelection()
{
- SkRect r;
- if (this->getRowRect(fCurrIndex, &r))
- this->inval(&r);
+ SkRect r;
+ if (this->getRowRect(fCurrIndex, &r))
+ this->inval(&r);
}
void SkListView::ensureSelectionIsVisible()
{
- if (fSource && (unsigned)fCurrIndex < (unsigned)fSource->countRecords())
- {
- int index = this->logicalToVisualIndex(fCurrIndex);
-
- if ((unsigned)index >= (unsigned)fVisibleRowCount) // need to scroll
- {
- int newIndex;
-
- if (index < 0) // too high
- newIndex = fCurrIndex;
- else
- newIndex = fCurrIndex - fVisibleRowCount + 1;
- SkASSERT((unsigned)newIndex < (unsigned)fSource->countRecords());
- this->inval(NULL);
-
- if (fScrollIndex != newIndex)
- {
- fScrollIndex = newIndex;
- if (fScrollBar)
- fScrollBar->setStart(newIndex);
- this->dirtyCache(kAnimContent_DirtyFlag);
- }
- }
- }
+ if (fSource && (unsigned)fCurrIndex < (unsigned)fSource->countRecords())
+ {
+ int index = this->logicalToVisualIndex(fCurrIndex);
+
+ if ((unsigned)index >= (unsigned)fVisibleRowCount) // need to scroll
+ {
+ int newIndex;
+
+ if (index < 0) // too high
+ newIndex = fCurrIndex;
+ else
+ newIndex = fCurrIndex - fVisibleRowCount + 1;
+ SkASSERT((unsigned)newIndex < (unsigned)fSource->countRecords());
+ this->inval(NULL);
+
+ if (fScrollIndex != newIndex)
+ {
+ fScrollIndex = newIndex;
+ if (fScrollBar)
+ fScrollBar->setStart(newIndex);
+ this->dirtyCache(kAnimContent_DirtyFlag);
+ }
+ }
+ }
}
SkScalar SkListView::getContentWidth() const
{
- SkScalar width = this->width();
-
- if (fScrollBar)
- {
- width -= fScrollBar->width();
- if (width < 0)
- width = 0;
- }
- return width;
+ SkScalar width = this->width();
+
+ if (fScrollBar)
+ {
+ width -= fScrollBar->width();
+ if (width < 0)
+ width = 0;
+ }
+ return width;
}
bool SkListView::getRowRect(int index, SkRect* r) const
{
- SkASSERT(r);
-
- index = this->logicalToVisualIndex(index);
- if (index >= 0)
- {
- int selection = this->logicalToVisualIndex(fCurrIndex);
-
- SkScalar height = fHeights[index == selection ? kSelected_Height : kNormal_Height];
- SkScalar top = index * fHeights[kNormal_Height];
-
- if (index > selection && selection >= 0)
- top += fHeights[kSelected_Height] - fHeights[kNormal_Height];
-
- if (top < this->height())
- {
- if (r)
- r->set(0, top, this->getContentWidth(), top + height);
- return true;
- }
- }
- return false;
+ SkASSERT(r);
+
+ index = this->logicalToVisualIndex(index);
+ if (index >= 0)
+ {
+ int selection = this->logicalToVisualIndex(fCurrIndex);
+
+ SkScalar height = fHeights[index == selection ? kSelected_Height : kNormal_Height];
+ SkScalar top = index * fHeights[kNormal_Height];
+
+ if (index > selection && selection >= 0)
+ top += fHeights[kSelected_Height] - fHeights[kNormal_Height];
+
+ if (top < this->height())
+ {
+ if (r)
+ r->set(0, top, this->getContentWidth(), top + height);
+ return true;
+ }
+ }
+ return false;
}
SkListSource* SkListView::setListSource(SkListSource* src)
{
- if (fSource != src)
- {
- SkRefCnt_SafeAssign(fSource, src);
- this->ensureSelectionIsVisible();
- this->inval(NULL);
-
- if (fScrollBar)
- fScrollBar->setTotal(fSource->countRecords());
- }
- return src;
+ if (fSource != src)
+ {
+ SkRefCnt_SafeAssign(fSource, src);
+ this->ensureSelectionIsVisible();
+ this->inval(NULL);
+
+ if (fScrollBar)
+ fScrollBar->setTotal(fSource->countRecords());
+ }
+ return src;
}
void SkListView::dirtyCache(unsigned dirtyFlags)
{
- if (dirtyFlags & kAnimCount_DirtyFlag)
- {
- delete fAnims;
- fAnims = NULL;
- fAnimContentDirty = true;
- fAnimFocusDirty = true;
- }
- if (dirtyFlags & kAnimContent_DirtyFlag)
- {
- if (!fAnimContentDirty)
- {
- this->inval(NULL);
- fAnimContentDirty = true;
- }
- fAnimFocusDirty = true;
- }
+ if (dirtyFlags & kAnimCount_DirtyFlag)
+ {
+ delete fAnims;
+ fAnims = NULL;
+ fAnimContentDirty = true;
+ fAnimFocusDirty = true;
+ }
+ if (dirtyFlags & kAnimContent_DirtyFlag)
+ {
+ if (!fAnimContentDirty)
+ {
+ this->inval(NULL);
+ fAnimContentDirty = true;
+ }
+ fAnimFocusDirty = true;
+ }
}
bool SkListView::ensureCache()
{
- if (fSkinName.size() == 0)
- return false;
-
- if (fAnims == NULL)
- {
- int n = SkMax32(1, fVisibleRowCount);
-
- SkASSERT(fAnimContentDirty);
- fAnims = new SkAnimator[n];
- for (int i = 0; i < n; i++)
- {
- fAnims[i].setHostEventSink(this);
- init_skin_anim(fSkinName.c_str(), &fAnims[i]);
- }
-
- fHeights[kNormal_Height] = fAnims[0].getScalar("idleHeight", "value");
- fHeights[kSelected_Height] = fAnims[0].getScalar("focusedHeight", "value");
-
- fAnimFocusDirty = true;
- }
-
- if (fAnimContentDirty && fSource)
- {
- fAnimContentDirty = false;
-
- SkString str;
- SkEvent evt("user");
- evt.setString("id", "setFields");
- evt.setS32("rowCount", fVisibleRowCount);
-
- SkEvent dimEvt("user");
- dimEvt.setString("id", "setDim");
- dimEvt.setScalar("dimX", this->getContentWidth());
- dimEvt.setScalar("dimY", this->height());
-
- for (int i = fScrollIndex; i < fScrollIndex + fVisibleRowCount; i++)
- {
- evt.setS32("relativeIndex", i - fScrollIndex);
- for (int j = 0; j < fBindingCount; j++)
- {
- fSource->getRecord(i, fBindings[j].fFieldIndex, &str);
+ if (fSkinName.size() == 0)
+ return false;
+
+ if (fAnims == NULL)
+ {
+ int n = SkMax32(1, fVisibleRowCount);
+
+ SkASSERT(fAnimContentDirty);
+ fAnims = new SkAnimator[n];
+ for (int i = 0; i < n; i++)
+ {
+ fAnims[i].setHostEventSink(this);
+ init_skin_anim(fSkinName.c_str(), &fAnims[i]);
+ }
+
+ fHeights[kNormal_Height] = fAnims[0].getScalar("idleHeight", "value");
+ fHeights[kSelected_Height] = fAnims[0].getScalar("focusedHeight", "value");
+
+ fAnimFocusDirty = true;
+ }
+
+ if (fAnimContentDirty && fSource)
+ {
+ fAnimContentDirty = false;
+
+ SkString str;
+ SkEvent evt("user");
+ evt.setString("id", "setFields");
+ evt.setS32("rowCount", fVisibleRowCount);
+
+ SkEvent dimEvt("user");
+ dimEvt.setString("id", "setDim");
+ dimEvt.setScalar("dimX", this->getContentWidth());
+ dimEvt.setScalar("dimY", this->height());
+
+ for (int i = fScrollIndex; i < fScrollIndex + fVisibleRowCount; i++)
+ {
+ evt.setS32("relativeIndex", i - fScrollIndex);
+ for (int j = 0; j < fBindingCount; j++)
+ {
+ fSource->getRecord(i, fBindings[j].fFieldIndex, &str);
//SkDEBUGF(("getRecord(%d,%d,%s) slot(%s)\n", i, fBindings[j].fFieldIndex, str.c_str(), fBindings[j].fSlotName.c_str()));
- evt.setString(fBindings[j].fSlotName.c_str(), str.c_str());
- }
- (void)fAnims[i % fVisibleRowCount].doUserEvent(evt);
- (void)fAnims[i % fVisibleRowCount].doUserEvent(dimEvt);
- }
- fAnimFocusDirty = true;
- }
-
- if (fAnimFocusDirty)
- {
+ evt.setString(fBindings[j].fSlotName.c_str(), str.c_str());
+ }
+ (void)fAnims[i % fVisibleRowCount].doUserEvent(evt);
+ (void)fAnims[i % fVisibleRowCount].doUserEvent(dimEvt);
+ }
+ fAnimFocusDirty = true;
+ }
+
+ if (fAnimFocusDirty)
+ {
//SkDEBUGF(("service fAnimFocusDirty\n"));
- fAnimFocusDirty = false;
+ fAnimFocusDirty = false;
- SkEvent focusEvt("user");
- focusEvt.setString("id", "setFocus");
+ SkEvent focusEvt("user");
+ focusEvt.setString("id", "setFocus");
- for (int i = fScrollIndex; i < fScrollIndex + fVisibleRowCount; i++)
- {
- focusEvt.setS32("FOCUS", i == fCurrIndex);
- (void)fAnims[i % fVisibleRowCount].doUserEvent(focusEvt);
- }
- }
+ for (int i = fScrollIndex; i < fScrollIndex + fVisibleRowCount; i++)
+ {
+ focusEvt.setS32("FOCUS", i == fCurrIndex);
+ (void)fAnims[i % fVisibleRowCount].doUserEvent(focusEvt);
+ }
+ }
- return true;
+ return true;
}
void SkListView::ensureVisibleRowCount()
{
- SkScalar height = this->height();
- int n = 0;
-
- if (height > 0)
- {
- n = 1;
- height -= fHeights[kSelected_Height];
- if (height > 0)
- {
- SkScalar count = SkScalarDiv(height, fHeights[kNormal_Height]);
- n += SkScalarFloor(count);
- if (count - SkIntToScalar(n) > SK_Scalar1*3/4)
- n += 1;
-
- // SkDebugf("count %g, n %d\n", count/65536., n);
- }
- }
-
- if (fVisibleRowCount != n)
- {
- if (fScrollBar)
- fScrollBar->setShown(n);
-
- fVisibleRowCount = n;
- this->ensureSelectionIsVisible();
- this->dirtyCache(kAnimCount_DirtyFlag | kAnimContent_DirtyFlag);
- }
+ SkScalar height = this->height();
+ int n = 0;
+
+ if (height > 0)
+ {
+ n = 1;
+ height -= fHeights[kSelected_Height];
+ if (height > 0)
+ {
+ SkScalar count = SkScalarDiv(height, fHeights[kNormal_Height]);
+ n += SkScalarFloor(count);
+ if (count - SkIntToScalar(n) > SK_Scalar1*3/4)
+ n += 1;
+
+ // SkDebugf("count %g, n %d\n", count/65536., n);
+ }
+ }
+
+ if (fVisibleRowCount != n)
+ {
+ if (fScrollBar)
+ fScrollBar->setShown(n);
+
+ fVisibleRowCount = n;
+ this->ensureSelectionIsVisible();
+ this->dirtyCache(kAnimCount_DirtyFlag | kAnimContent_DirtyFlag);
+ }
}
///////////////////////////////////////////////////////////////////////////////////////////////
@@ -336,76 +336,76 @@ void SkListView::ensureVisibleRowCount()
void SkListView::onSizeChange()
{
- this->INHERITED::onSizeChange();
+ this->INHERITED::onSizeChange();
- if (fScrollBar)
- fScrollBar->setLoc(this->width()-SkIntToScalar(10), 0);
+ if (fScrollBar)
+ fScrollBar->setLoc(this->width()-SkIntToScalar(10), 0);
- this->ensureVisibleRowCount();
+ this->ensureVisibleRowCount();
}
void SkListView::onDraw(SkCanvas* canvas)
{
- this->INHERITED::onDraw(canvas);
+ this->INHERITED::onDraw(canvas);
- this->ensureVisibleRowCount();
+ this->ensureVisibleRowCount();
- int visibleCount = SkMin32(fVisibleRowCount, fSource->countRecords() - fScrollIndex);
- if (visibleCount == 0 || !this->ensureCache())
- return;
+ int visibleCount = SkMin32(fVisibleRowCount, fSource->countRecords() - fScrollIndex);
+ if (visibleCount == 0 || !this->ensureCache())
+ return;
//SkDebugf("visibleCount %d scrollIndex %d currIndex %d\n", visibleCount, fScrollIndex, fCurrIndex);
- SkAutoCanvasRestore ar(canvas, true);
- SkMSec now = SkTime::GetMSecs();
- SkRect bounds;
-
- bounds.fLeft = 0;
- bounds.fRight = this->getContentWidth();
- bounds.fBottom = 0;
- // assign bounds.fTop inside the loop
-
- // hack to reveal our bounds for debugging
- if (this->hasFocus())
- canvas->drawARGB(0x11, 0, 0, 0xFF);
- else
- canvas->drawARGB(0x11, 0x88, 0x88, 0x88);
-
- for (int i = fScrollIndex; i < fScrollIndex + visibleCount; i++)
- {
- SkPaint paint;
- SkScalar height = fHeights[i == fCurrIndex ? kSelected_Height : kNormal_Height];
-
- bounds.fTop = bounds.fBottom;
- bounds.fBottom += height;
-
- canvas->save();
- if (fAnims[i % fVisibleRowCount].draw(canvas, &paint, now) != SkAnimator::kNotDifferent)
- this->inval(&bounds);
- canvas->restore();
-
- canvas->translate(0, height);
- }
+ SkAutoCanvasRestore ar(canvas, true);
+ SkMSec now = SkTime::GetMSecs();
+ SkRect bounds;
+
+ bounds.fLeft = 0;
+ bounds.fRight = this->getContentWidth();
+ bounds.fBottom = 0;
+ // assign bounds.fTop inside the loop
+
+ // hack to reveal our bounds for debugging
+ if (this->hasFocus())
+ canvas->drawARGB(0x11, 0, 0, 0xFF);
+ else
+ canvas->drawARGB(0x11, 0x88, 0x88, 0x88);
+
+ for (int i = fScrollIndex; i < fScrollIndex + visibleCount; i++)
+ {
+ SkPaint paint;
+ SkScalar height = fHeights[i == fCurrIndex ? kSelected_Height : kNormal_Height];
+
+ bounds.fTop = bounds.fBottom;
+ bounds.fBottom += height;
+
+ canvas->save();
+ if (fAnims[i % fVisibleRowCount].draw(canvas, &paint, now) != SkAnimator::kNotDifferent)
+ this->inval(&bounds);
+ canvas->restore();
+
+ canvas->translate(0, height);
+ }
}
bool SkListView::onEvent(const SkEvent& evt)
{
- if (evt.isType(SK_EventType_Key))
- {
- switch (evt.getFast32()) {
- case kUp_SkKey:
- return this->moveSelectionUp();
- case kDown_SkKey:
- return this->moveSelectionDown();
- case kRight_SkKey:
- case kOK_SkKey:
- this->postWidgetEvent();
- return true;
- default:
- break;
- }
- }
- return this->INHERITED::onEvent(evt);
+ if (evt.isType(SK_EventType_Key))
+ {
+ switch (evt.getFast32()) {
+ case kUp_SkKey:
+ return this->moveSelectionUp();
+ case kDown_SkKey:
+ return this->moveSelectionDown();
+ case kRight_SkKey:
+ case kOK_SkKey:
+ this->postWidgetEvent();
+ return true;
+ default:
+ break;
+ }
+ }
+ return this->INHERITED::onEvent(evt);
}
///////////////////////////////////////////////////////////////////////////////////////////////
@@ -414,78 +414,78 @@ static const char gListViewEventSlot[] = "sk-listview-slot-name";
/*virtual*/ bool SkListView::onPrepareWidgetEvent(SkEvent* evt)
{
- if (fSource && fCurrIndex >= 0 && this->INHERITED::onPrepareWidgetEvent(evt) &&
- fSource->prepareWidgetEvent(evt, fCurrIndex))
- {
- evt->setS32(gListViewEventSlot, fCurrIndex);
- return true;
- }
- return false;
+ if (fSource && fCurrIndex >= 0 && this->INHERITED::onPrepareWidgetEvent(evt) &&
+ fSource->prepareWidgetEvent(evt, fCurrIndex))
+ {
+ evt->setS32(gListViewEventSlot, fCurrIndex);
+ return true;
+ }
+ return false;
}
int SkListView::GetWidgetEventListIndex(const SkEvent& evt)
{
- int32_t index;
+ int32_t index;
- return evt.findS32(gListViewEventSlot, &index) ? index : -1;
+ return evt.findS32(gListViewEventSlot, &index) ? index : -1;
}
///////////////////////////////////////////////////////////////////////////////////////////////
void SkListView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- this->INHERITED::onInflate(dom, node);
-
- {
- bool hasScrollBar;
- if (dom.findBool(node, "scrollBar", &hasScrollBar))
- this->setHasScrollBar(hasScrollBar);
- }
-
- const SkDOM::Node* child;
-
- if ((child = dom.getFirstChild(node, "bindings")) != NULL)
- {
- delete[] fBindings;
- fBindings = NULL;
- fBindingCount = 0;
-
- SkListSource* listSrc = SkListSource::Factory(dom.findAttr(child, "data-fields"));
- SkASSERT(listSrc);
- fSkinName.set(dom.findAttr(child, "skin-slots"));
- SkASSERT(fSkinName.size());
-
- this->setListSource(listSrc)->unref();
-
- int count = dom.countChildren(child, "bind");
- if (count > 0)
- {
- fBindings = new BindingRec[count];
- count = 0; // reuse this to count up to the number of valid bindings
-
- child = dom.getFirstChild(child, "bind");
- SkASSERT(child);
- do {
- const char* fieldName = dom.findAttr(child, "field");
- const char* slotName = dom.findAttr(child, "slot");
- if (fieldName && slotName)
- {
- fBindings[count].fFieldIndex = listSrc->findFieldIndex(fieldName);
- if (fBindings[count].fFieldIndex >= 0)
- fBindings[count++].fSlotName.set(slotName);
- }
- } while ((child = dom.getNextSibling(child, "bind")) != NULL);
-
- fBindingCount = SkToU16(count);
- if (count == 0)
- {
- SkDEBUGF(("SkListView::onInflate: no valid <bind> elements in <listsource>\n"));
- delete[] fBindings;
- }
- }
- this->dirtyCache(kAnimCount_DirtyFlag);
- this->setSelection(0);
- }
+ this->INHERITED::onInflate(dom, node);
+
+ {
+ bool hasScrollBar;
+ if (dom.findBool(node, "scrollBar", &hasScrollBar))
+ this->setHasScrollBar(hasScrollBar);
+ }
+
+ const SkDOM::Node* child;
+
+ if ((child = dom.getFirstChild(node, "bindings")) != NULL)
+ {
+ delete[] fBindings;
+ fBindings = NULL;
+ fBindingCount = 0;
+
+ SkListSource* listSrc = SkListSource::Factory(dom.findAttr(child, "data-fields"));
+ SkASSERT(listSrc);
+ fSkinName.set(dom.findAttr(child, "skin-slots"));
+ SkASSERT(fSkinName.size());
+
+ this->setListSource(listSrc)->unref();
+
+ int count = dom.countChildren(child, "bind");
+ if (count > 0)
+ {
+ fBindings = new BindingRec[count];
+ count = 0; // reuse this to count up to the number of valid bindings
+
+ child = dom.getFirstChild(child, "bind");
+ SkASSERT(child);
+ do {
+ const char* fieldName = dom.findAttr(child, "field");
+ const char* slotName = dom.findAttr(child, "slot");
+ if (fieldName && slotName)
+ {
+ fBindings[count].fFieldIndex = listSrc->findFieldIndex(fieldName);
+ if (fBindings[count].fFieldIndex >= 0)
+ fBindings[count++].fSlotName.set(slotName);
+ }
+ } while ((child = dom.getNextSibling(child, "bind")) != NULL);
+
+ fBindingCount = SkToU16(count);
+ if (count == 0)
+ {
+ SkDEBUGF(("SkListView::onInflate: no valid <bind> elements in <listsource>\n"));
+ delete[] fBindings;
+ }
+ }
+ this->dirtyCache(kAnimCount_DirtyFlag);
+ this->setSelection(0);
+ }
}
/////////////////////////////////////////////////////////////////////////////////////////////
@@ -493,137 +493,137 @@ void SkListView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
class SkXMLListSource : public SkListSource {
public:
- SkXMLListSource(const char doc[], size_t len);
- virtual ~SkXMLListSource()
- {
- delete[] fFields;
- delete[] fRecords;
- }
-
- virtual int countFields() { return fFieldCount; }
- virtual void getFieldName(int index, SkString* field)
- {
- SkASSERT((unsigned)index < (unsigned)fFieldCount);
- if (field)
- *field = fFields[index];
- }
- virtual int findFieldIndex(const char field[])
- {
- for (int i = 0; i < fFieldCount; i++)
- if (fFields[i].equals(field))
- return i;
- return -1;
- }
-
- virtual int countRecords() { return fRecordCount; }
- virtual void getRecord(int rowIndex, int fieldIndex, SkString* data)
- {
- SkASSERT((unsigned)rowIndex < (unsigned)fRecordCount);
- SkASSERT((unsigned)fieldIndex < (unsigned)fFieldCount);
- if (data)
- *data = fRecords[rowIndex * fFieldCount + fieldIndex];
- }
-
- virtual bool prepareWidgetEvent(SkEvent* evt, int rowIndex)
- {
- // hack, for testing right now. Need the xml to tell us what to jam in and where
- SkString data;
-
- this->getRecord(rowIndex, 0, &data);
- evt->setString("xml-listsource", data.c_str());
- return true;
- }
-
+ SkXMLListSource(const char doc[], size_t len);
+ virtual ~SkXMLListSource()
+ {
+ delete[] fFields;
+ delete[] fRecords;
+ }
+
+ virtual int countFields() { return fFieldCount; }
+ virtual void getFieldName(int index, SkString* field)
+ {
+ SkASSERT((unsigned)index < (unsigned)fFieldCount);
+ if (field)
+ *field = fFields[index];
+ }
+ virtual int findFieldIndex(const char field[])
+ {
+ for (int i = 0; i < fFieldCount; i++)
+ if (fFields[i].equals(field))
+ return i;
+ return -1;
+ }
+
+ virtual int countRecords() { return fRecordCount; }
+ virtual void getRecord(int rowIndex, int fieldIndex, SkString* data)
+ {
+ SkASSERT((unsigned)rowIndex < (unsigned)fRecordCount);
+ SkASSERT((unsigned)fieldIndex < (unsigned)fFieldCount);
+ if (data)
+ *data = fRecords[rowIndex * fFieldCount + fieldIndex];
+ }
+
+ virtual bool prepareWidgetEvent(SkEvent* evt, int rowIndex)
+ {
+ // hack, for testing right now. Need the xml to tell us what to jam in and where
+ SkString data;
+
+ this->getRecord(rowIndex, 0, &data);
+ evt->setString("xml-listsource", data.c_str());
+ return true;
+ }
+
private:
- SkString* fFields; // [fFieldCount]
- SkString* fRecords; // [fRecordCount][fFieldCount]
- int fFieldCount, fRecordCount;
+ SkString* fFields; // [fFieldCount]
+ SkString* fRecords; // [fRecordCount][fFieldCount]
+ int fFieldCount, fRecordCount;
};
#include "SkDOM.h"
SkXMLListSource::SkXMLListSource(const char doc[], size_t len)
{
- fFieldCount = fRecordCount = 0;
- fFields = fRecords = NULL;
-
- SkDOM dom;
-
- const SkDOM::Node* node = dom.build(doc, len);
- SkASSERT(node);
- const SkDOM::Node* child;
-
- child = dom.getFirstChild(node, "fields");
- if (child)
- {
- fFieldCount = dom.countChildren(child, "field");
- fFields = new SkString[fFieldCount];
-
- int n = 0;
- child = dom.getFirstChild(child, "field");
- while (child)
- {
- fFields[n].set(dom.findAttr(child, "name"));
- child = dom.getNextSibling(child, "field");
- n += 1;
- }
- SkASSERT(n == fFieldCount);
- }
-
- child = dom.getFirstChild(node, "records");
- if (child)
- {
- fRecordCount = dom.countChildren(child, "record");
- fRecords = new SkString[fRecordCount * fFieldCount];
-
- int n = 0;
- child = dom.getFirstChild(child, "record");
- while (child)
- {
- for (int i = 0; i < fFieldCount; i++)
- fRecords[n * fFieldCount + i].set(dom.findAttr(child, fFields[i].c_str()));
- child = dom.getNextSibling(child, "record");
- n += 1;
- }
- SkASSERT(n == fRecordCount);
- }
+ fFieldCount = fRecordCount = 0;
+ fFields = fRecords = NULL;
+
+ SkDOM dom;
+
+ const SkDOM::Node* node = dom.build(doc, len);
+ SkASSERT(node);
+ const SkDOM::Node* child;
+
+ child = dom.getFirstChild(node, "fields");
+ if (child)
+ {
+ fFieldCount = dom.countChildren(child, "field");
+ fFields = new SkString[fFieldCount];
+
+ int n = 0;
+ child = dom.getFirstChild(child, "field");
+ while (child)
+ {
+ fFields[n].set(dom.findAttr(child, "name"));
+ child = dom.getNextSibling(child, "field");
+ n += 1;
+ }
+ SkASSERT(n == fFieldCount);
+ }
+
+ child = dom.getFirstChild(node, "records");
+ if (child)
+ {
+ fRecordCount = dom.countChildren(child, "record");
+ fRecords = new SkString[fRecordCount * fFieldCount];
+
+ int n = 0;
+ child = dom.getFirstChild(child, "record");
+ while (child)
+ {
+ for (int i = 0; i < fFieldCount; i++)
+ fRecords[n * fFieldCount + i].set(dom.findAttr(child, fFields[i].c_str()));
+ child = dom.getNextSibling(child, "record");
+ n += 1;
+ }
+ SkASSERT(n == fRecordCount);
+ }
}
/////////////////////////////////////////////////////////////////////////////////////////////
SkListSource* SkListSource::Factory(const char name[])
{
- static const char gDoc[] =
- "<db name='contacts.db'>"
- "<fields>"
- "<field name='name'/>"
- "<field name='work-num'/>"
- "<field name='home-num'/>"
- "<field name='type'/>"
- "</fields>"
- "<records>"
- "<record name='Andy McFadden' work-num='919 357-1234' home-num='919 123-4567' type='0'/>"
- "<record name='Brian Swetland' work-num='919 123-1234' home-num='929 123-4567' type='1' />"
- "<record name='Chris Desalvo' work-num='919 345-1234' home-num='949 123-4567' type='1' />"
- "<record name='Chris White' work-num='919 234-1234' home-num='939 123-4567' type='2' />"
- "<record name='Dan Bornstein' work-num='919 357-1234' home-num='919 123-4567' type='0' />"
- "<record name='Don Cung' work-num='919 123-1234' home-num='929 123-4567' type='2' />"
- "<record name='Eric Fischer' work-num='919 345-1234' home-num='949 123-4567' type='2' />"
- "<record name='Ficus Kirkpatric' work-num='919 234-1234' home-num='939 123-4567' type='1' />"
- "<record name='Jack Veenstra' work-num='919 234-1234' home-num='939 123-4567' type='2' />"
- "<record name='Jeff Yaksick' work-num='919 234-1234' home-num='939 123-4567' type='0' />"
- "<record name='Joe Onorato' work-num='919 234-1234' home-num='939 123-4567' type='0' />"
- "<record name='Mathias Agopian' work-num='919 234-1234' home-num='939 123-4567' type='1' />"
- "<record name='Mike Fleming' work-num='919 234-1234' home-num='939 123-4567' type='2' />"
- "<record name='Nick Sears' work-num='919 234-1234' home-num='939 123-4567' type='1' />"
- "<record name='Rich Miner' work-num='919 234-1234' home-num='939 123-4567' type='1' />"
- "<record name='Tracey Cole' work-num='919 234-1234' home-num='939 123-4567' type='0' />"
- "<record name='Wei Huang' work-num='919 234-1234' home-num='939 123-4567' type='0' />"
- "</records>"
- "</db>";
-
+ static const char gDoc[] =
+ "<db name='contacts.db'>"
+ "<fields>"
+ "<field name='name'/>"
+ "<field name='work-num'/>"
+ "<field name='home-num'/>"
+ "<field name='type'/>"
+ "</fields>"
+ "<records>"
+ "<record name='Andy McFadden' work-num='919 357-1234' home-num='919 123-4567' type='0'/>"
+ "<record name='Brian Swetland' work-num='919 123-1234' home-num='929 123-4567' type='1' />"
+ "<record name='Chris Desalvo' work-num='919 345-1234' home-num='949 123-4567' type='1' />"
+ "<record name='Chris White' work-num='919 234-1234' home-num='939 123-4567' type='2' />"
+ "<record name='Dan Bornstein' work-num='919 357-1234' home-num='919 123-4567' type='0' />"
+ "<record name='Don Cung' work-num='919 123-1234' home-num='929 123-4567' type='2' />"
+ "<record name='Eric Fischer' work-num='919 345-1234' home-num='949 123-4567' type='2' />"
+ "<record name='Ficus Kirkpatric' work-num='919 234-1234' home-num='939 123-4567' type='1' />"
+ "<record name='Jack Veenstra' work-num='919 234-1234' home-num='939 123-4567' type='2' />"
+ "<record name='Jeff Yaksick' work-num='919 234-1234' home-num='939 123-4567' type='0' />"
+ "<record name='Joe Onorato' work-num='919 234-1234' home-num='939 123-4567' type='0' />"
+ "<record name='Mathias Agopian' work-num='919 234-1234' home-num='939 123-4567' type='1' />"
+ "<record name='Mike Fleming' work-num='919 234-1234' home-num='939 123-4567' type='2' />"
+ "<record name='Nick Sears' work-num='919 234-1234' home-num='939 123-4567' type='1' />"
+ "<record name='Rich Miner' work-num='919 234-1234' home-num='939 123-4567' type='1' />"
+ "<record name='Tracey Cole' work-num='919 234-1234' home-num='939 123-4567' type='0' />"
+ "<record name='Wei Huang' work-num='919 234-1234' home-num='939 123-4567' type='0' />"
+ "</records>"
+ "</db>";
+
//SkDebugf("doc size %d\n", sizeof(gDoc)-1);
- return new SkXMLListSource(gDoc, sizeof(gDoc) - 1);
+ return new SkXMLListSource(gDoc, sizeof(gDoc) - 1);
}
diff --git a/src/views/animated/SkProgressBarView.cpp b/src/views/animated/SkProgressBarView.cpp
index ce26ac4ed8..e7754eb612 100644
--- a/src/views/animated/SkProgressBarView.cpp
+++ b/src/views/animated/SkProgressBarView.cpp
@@ -13,97 +13,97 @@
SkProgressBarView::SkProgressBarView()
{
- init_skin_anim(kProgress_SkinEnum, &fAnim);
- fAnim.setHostEventSink(this);
- fProgress = 0;
- fMax = 100;
-
+ init_skin_anim(kProgress_SkinEnum, &fAnim);
+ fAnim.setHostEventSink(this);
+ fProgress = 0;
+ fMax = 100;
+
}
void SkProgressBarView::changeProgress(int diff)
{
- int newProg = fProgress + diff;
- if (newProg > 0 && newProg < fMax)
- this->setProgress(newProg);
- //otherwise i'll just leave it as it is
- //this implies that if a new max and progress are set, max must be set first
+ int newProg = fProgress + diff;
+ if (newProg > 0 && newProg < fMax)
+ this->setProgress(newProg);
+ //otherwise i'll just leave it as it is
+ //this implies that if a new max and progress are set, max must be set first
}
/*virtual*/ void SkProgressBarView::onDraw(SkCanvas* canvas)
{
- SkPaint paint;
- SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs());
-
- if (diff == SkAnimator::kDifferent)
- this->inval(NULL);
- else if (diff == SkAnimator::kPartiallyDifferent)
- {
- SkRect bounds;
- fAnim.getInvalBounds(&bounds);
- this->inval(&bounds);
- }
+ SkPaint paint;
+ SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs());
+
+ if (diff == SkAnimator::kDifferent)
+ this->inval(NULL);
+ else if (diff == SkAnimator::kPartiallyDifferent)
+ {
+ SkRect bounds;
+ fAnim.getInvalBounds(&bounds);
+ this->inval(&bounds);
+ }
}
-
+
/*virtual*/ bool SkProgressBarView::onEvent(const SkEvent& evt)
{
- if (evt.isType(SK_EventType_Inval))
- {
- this->inval(NULL);
- return true;
- }
- if (evt.isType("recommendDim"))
- {
- SkScalar height;
-
- if (evt.findScalar("y", &height))
- this->setHeight(height);
- return true;
- }
- return this->INHERITED::onEvent(evt);
+ if (evt.isType(SK_EventType_Inval))
+ {
+ this->inval(NULL);
+ return true;
+ }
+ if (evt.isType("recommendDim"))
+ {
+ SkScalar height;
+
+ if (evt.findScalar("y", &height))
+ this->setHeight(height);
+ return true;
+ }
+ return this->INHERITED::onEvent(evt);
}
/*virtual*/ void SkProgressBarView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- this->INHERITED::onInflate(dom, node);
- int32_t temp;
- if (dom.findS32(node, "max", &temp))
- this->setMax(temp);
- if (dom.findS32(node, "progress", &temp))
- this->setProgress(temp);
+ this->INHERITED::onInflate(dom, node);
+ int32_t temp;
+ if (dom.findS32(node, "max", &temp))
+ this->setMax(temp);
+ if (dom.findS32(node, "progress", &temp))
+ this->setProgress(temp);
}
/*virtual*/ void SkProgressBarView::onSizeChange()
{
- this->INHERITED::onSizeChange();
- SkEvent evt("user");
- evt.setString("id", "setDim");
- evt.setScalar("dimX", this->width());
- evt.setScalar("dimY", this->height());
- fAnim.doUserEvent(evt);
+ this->INHERITED::onSizeChange();
+ SkEvent evt("user");
+ evt.setString("id", "setDim");
+ evt.setScalar("dimX", this->width());
+ evt.setScalar("dimY", this->height());
+ fAnim.doUserEvent(evt);
}
void SkProgressBarView::reset()
{
- fProgress = 0;
- SkEvent e("user");
- e.setString("id", "reset");
- fAnim.doUserEvent(e);
+ fProgress = 0;
+ SkEvent e("user");
+ e.setString("id", "reset");
+ fAnim.doUserEvent(e);
}
void SkProgressBarView::setMax(int max)
{
- fMax = max;
- SkEvent e("user");
- e.setString("id", "setMax");
- e.setS32("newMax", max);
- fAnim.doUserEvent(e);
+ fMax = max;
+ SkEvent e("user");
+ e.setString("id", "setMax");
+ e.setS32("newMax", max);
+ fAnim.doUserEvent(e);
}
void SkProgressBarView::setProgress(int progress)
{
- fProgress = progress;
- SkEvent e("user");
- e.setString("id", "setProgress");
- e.setS32("newProgress", progress);
- fAnim.doUserEvent(e);
+ fProgress = progress;
+ SkEvent e("user");
+ e.setString("id", "setProgress");
+ e.setS32("newProgress", progress);
+ fAnim.doUserEvent(e);
}
diff --git a/src/views/animated/SkScrollBarView.cpp b/src/views/animated/SkScrollBarView.cpp
index 98288f5b74..0d937750be 100644
--- a/src/views/animated/SkScrollBarView.cpp
+++ b/src/views/animated/SkScrollBarView.cpp
@@ -16,131 +16,131 @@
SkScrollBarView::SkScrollBarView()
{
- fAnim.setHostEventSink(this);
- init_skin_anim(kScroll_SkinEnum, &fAnim);
+ fAnim.setHostEventSink(this);
+ init_skin_anim(kScroll_SkinEnum, &fAnim);
- fTotalLength = 0;
- fStartPoint = 0;
- fShownLength = 0;
+ fTotalLength = 0;
+ fStartPoint = 0;
+ fShownLength = 0;
- this->adjust();
+ this->adjust();
}
void SkScrollBarView::setStart(unsigned start)
{
- if ((int)start < 0)
- start = 0;
-
- if (fStartPoint != start)
- {
- fStartPoint = start;
- this->adjust();
- }
+ if ((int)start < 0)
+ start = 0;
+
+ if (fStartPoint != start)
+ {
+ fStartPoint = start;
+ this->adjust();
+ }
}
void SkScrollBarView::setShown(unsigned shown)
{
- if ((int)shown < 0)
- shown = 0;
-
- if (fShownLength != shown)
- {
- fShownLength = shown;
- this->adjust();
- }
+ if ((int)shown < 0)
+ shown = 0;
+
+ if (fShownLength != shown)
+ {
+ fShownLength = shown;
+ this->adjust();
+ }
}
void SkScrollBarView::setTotal(unsigned total)
{
- if ((int)total < 0)
- total = 0;
-
- if (fTotalLength != total)
- {
- fTotalLength = total;
- this->adjust();
- }
+ if ((int)total < 0)
+ total = 0;
+
+ if (fTotalLength != total)
+ {
+ fTotalLength = total;
+ this->adjust();
+ }
}
/* virtual */ void SkScrollBarView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- this->INHERITED::onInflate(dom, node);
-
- int32_t value;
- if (dom.findS32(node, "total", &value))
- this->setTotal(value);
- if (dom.findS32(node, "shown", &value))
- this->setShown(value);
+ this->INHERITED::onInflate(dom, node);
+
+ int32_t value;
+ if (dom.findS32(node, "total", &value))
+ this->setTotal(value);
+ if (dom.findS32(node, "shown", &value))
+ this->setShown(value);
}
/*virtual*/ void SkScrollBarView::onSizeChange()
{
- this->INHERITED::onSizeChange();
- SkEvent evt("user");
- evt.setString("id", "setDim");
- evt.setScalar("dimX", this->width());
- evt.setScalar("dimY", this->height());
- fAnim.doUserEvent(evt);
+ this->INHERITED::onSizeChange();
+ SkEvent evt("user");
+ evt.setString("id", "setDim");
+ evt.setScalar("dimX", this->width());
+ evt.setScalar("dimY", this->height());
+ fAnim.doUserEvent(evt);
}
/*virtual*/ void SkScrollBarView::onDraw(SkCanvas* canvas)
{
- SkPaint paint;
- SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs());
-
- if (diff == SkAnimator::kDifferent)
- this->inval(NULL);
- else if (diff == SkAnimator::kPartiallyDifferent)
- {
- SkRect bounds;
- fAnim.getInvalBounds(&bounds);
- this->inval(&bounds);
- }
+ SkPaint paint;
+ SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs());
+
+ if (diff == SkAnimator::kDifferent)
+ this->inval(NULL);
+ else if (diff == SkAnimator::kPartiallyDifferent)
+ {
+ SkRect bounds;
+ fAnim.getInvalBounds(&bounds);
+ this->inval(&bounds);
+ }
}
/*virtual*/ bool SkScrollBarView::onEvent(const SkEvent& evt)
{
- if (evt.isType(SK_EventType_Inval))
- {
- this->inval(NULL);
- return true;
- }
- if (evt.isType("recommendDim"))
- {
- SkScalar width;
-
- if (evt.findScalar("x", &width))
- this->setWidth(width);
- return true;
- }
-
- return this->INHERITED::onEvent(evt);
+ if (evt.isType(SK_EventType_Inval))
+ {
+ this->inval(NULL);
+ return true;
+ }
+ if (evt.isType("recommendDim"))
+ {
+ SkScalar width;
+
+ if (evt.findScalar("x", &width))
+ this->setWidth(width);
+ return true;
+ }
+
+ return this->INHERITED::onEvent(evt);
}
void SkScrollBarView::adjust()
{
- int total = fTotalLength;
- int start = fStartPoint;
- int shown = fShownLength;
- int hideBar = 0;
-
- if (total <= 0 || shown <= 0 || shown >= total) // no bar to show
- {
- total = 1; // avoid divide-by-zero. should be done by skin/script
- hideBar = 1; // signal we don't want a thumb
- }
- else
- {
- if (start + shown > total)
- start = total - shown;
- }
-
- SkEvent e("user");
- e.setString("id", "adjustScrollBar");
- e.setScalar("_totalLength", SkIntToScalar(total));
- e.setScalar("_startPoint", SkIntToScalar(start));
- e.setScalar("_shownLength", SkIntToScalar(shown));
-// e.setS32("hideBar", hideBar);
- fAnim.doUserEvent(e);
+ int total = fTotalLength;
+ int start = fStartPoint;
+ int shown = fShownLength;
+ int hideBar = 0;
+
+ if (total <= 0 || shown <= 0 || shown >= total) // no bar to show
+ {
+ total = 1; // avoid divide-by-zero. should be done by skin/script
+ hideBar = 1; // signal we don't want a thumb
+ }
+ else
+ {
+ if (start + shown > total)
+ start = total - shown;
+ }
+
+ SkEvent e("user");
+ e.setString("id", "adjustScrollBar");
+ e.setScalar("_totalLength", SkIntToScalar(total));
+ e.setScalar("_startPoint", SkIntToScalar(start));
+ e.setScalar("_shownLength", SkIntToScalar(shown));
+// e.setS32("hideBar", hideBar);
+ fAnim.doUserEvent(e);
}
diff --git a/src/views/animated/SkStaticTextView.cpp b/src/views/animated/SkStaticTextView.cpp
index 79eecd6cbd..8ab11835d7 100644
--- a/src/views/animated/SkStaticTextView.cpp
+++ b/src/views/animated/SkStaticTextView.cpp
@@ -21,11 +21,11 @@ static void assert_no_attr(const SkDOM& dom, const SkDOM::Node* node, const char
SkStaticTextView::SkStaticTextView()
{
- fMargin.set(0, 0);
- fMode = kFixedSize_Mode;
- fSpacingAlign = SkTextBox::kStart_SpacingAlign;
-
-// init_skin_paint(kStaticText_SkinEnum, &fPaint);
+ fMargin.set(0, 0);
+ fMode = kFixedSize_Mode;
+ fSpacingAlign = SkTextBox::kStart_SpacingAlign;
+
+// init_skin_paint(kStaticText_SkinEnum, &fPaint);
}
SkStaticTextView::~SkStaticTextView()
@@ -34,155 +34,155 @@ SkStaticTextView::~SkStaticTextView()
void SkStaticTextView::computeSize()
{
- if (fMode == kAutoWidth_Mode)
- {
- SkScalar width = fPaint.measureText(fText.c_str(), fText.size());
- this->setWidth(width + fMargin.fX * 2);
- }
- else if (fMode == kAutoHeight_Mode)
- {
- SkScalar width = this->width() - fMargin.fX * 2;
- int lines = width > 0 ? SkTextLineBreaker::CountLines(fText.c_str(), fText.size(), fPaint, width) : 0;
+ if (fMode == kAutoWidth_Mode)
+ {
+ SkScalar width = fPaint.measureText(fText.c_str(), fText.size());
+ this->setWidth(width + fMargin.fX * 2);
+ }
+ else if (fMode == kAutoHeight_Mode)
+ {
+ SkScalar width = this->width() - fMargin.fX * 2;
+ int lines = width > 0 ? SkTextLineBreaker::CountLines(fText.c_str(), fText.size(), fPaint, width) : 0;
- this->setHeight(lines * fPaint.getFontSpacing() + fMargin.fY * 2);
- }
+ this->setHeight(lines * fPaint.getFontSpacing() + fMargin.fY * 2);
+ }
}
void SkStaticTextView::setMode(Mode mode)
{
- SkASSERT((unsigned)mode < kModeCount);
+ SkASSERT((unsigned)mode < kModeCount);
- if (fMode != mode)
- {
- fMode = SkToU8(mode);
- this->computeSize();
- }
+ if (fMode != mode)
+ {
+ fMode = SkToU8(mode);
+ this->computeSize();
+ }
}
void SkStaticTextView::setSpacingAlign(SkTextBox::SpacingAlign align)
{
- fSpacingAlign = SkToU8(align);
- this->inval(NULL);
+ fSpacingAlign = SkToU8(align);
+ this->inval(NULL);
}
void SkStaticTextView::getMargin(SkPoint* margin) const
{
- if (margin)
- *margin = fMargin;
+ if (margin)
+ *margin = fMargin;
}
void SkStaticTextView::setMargin(SkScalar dx, SkScalar dy)
{
- if (fMargin.fX != dx || fMargin.fY != dy)
- {
- fMargin.set(dx, dy);
- this->computeSize();
- this->inval(NULL);
- }
+ if (fMargin.fX != dx || fMargin.fY != dy)
+ {
+ fMargin.set(dx, dy);
+ this->computeSize();
+ this->inval(NULL);
+ }
}
size_t SkStaticTextView::getText(SkString* text) const
{
- if (text)
- *text = fText;
- return fText.size();
+ if (text)
+ *text = fText;
+ return fText.size();
}
size_t SkStaticTextView::getText(char text[]) const
{
- if (text)
- memcpy(text, fText.c_str(), fText.size());
- return fText.size();
+ if (text)
+ memcpy(text, fText.c_str(), fText.size());
+ return fText.size();
}
void SkStaticTextView::setText(const SkString& text)
{
- this->setText(text.c_str(), text.size());
+ this->setText(text.c_str(), text.size());
}
void SkStaticTextView::setText(const char text[])
{
- if (text == NULL)
- text = "";
- this->setText(text, strlen(text));
+ if (text == NULL)
+ text = "";
+ this->setText(text, strlen(text));
}
void SkStaticTextView::setText(const char text[], size_t len)
{
- if (!fText.equals(text, len))
- {
- fText.set(text, len);
- this->computeSize();
- this->inval(NULL);
- }
+ if (!fText.equals(text, len))
+ {
+ fText.set(text, len);
+ this->computeSize();
+ this->inval(NULL);
+ }
}
void SkStaticTextView::getPaint(SkPaint* paint) const
{
- if (paint)
- *paint = fPaint;
+ if (paint)
+ *paint = fPaint;
}
void SkStaticTextView::setPaint(const SkPaint& paint)
{
- if (fPaint != paint)
- {
- fPaint = paint;
- this->computeSize();
- this->inval(NULL);
- }
+ if (fPaint != paint)
+ {
+ fPaint = paint;
+ this->computeSize();
+ this->inval(NULL);
+ }
}
void SkStaticTextView::onDraw(SkCanvas* canvas)
{
- this->INHERITED::onDraw(canvas);
+ this->INHERITED::onDraw(canvas);
- if (fText.isEmpty())
- return;
+ if (fText.isEmpty())
+ return;
- SkTextBox box;
+ SkTextBox box;
- box.setMode(fMode == kAutoWidth_Mode ? SkTextBox::kOneLine_Mode : SkTextBox::kLineBreak_Mode);
- box.setSpacingAlign(this->getSpacingAlign());
- box.setBox(fMargin.fX, fMargin.fY, this->width() - fMargin.fX, this->height() - fMargin.fY);
- box.draw(canvas, fText.c_str(), fText.size(), fPaint);
+ box.setMode(fMode == kAutoWidth_Mode ? SkTextBox::kOneLine_Mode : SkTextBox::kLineBreak_Mode);
+ box.setSpacingAlign(this->getSpacingAlign());
+ box.setBox(fMargin.fX, fMargin.fY, this->width() - fMargin.fX, this->height() - fMargin.fY);
+ box.draw(canvas, fText.c_str(), fText.size(), fPaint);
}
void SkStaticTextView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
if (false) { // avoid bit rot, suppress warning
- this->INHERITED::onInflate(dom, node);
-
- int index;
- if ((index = dom.findList(node, "mode", "fixed,auto-width,auto-height")) >= 0)
- this->setMode((Mode)index);
- else
- assert_no_attr(dom, node, "mode");
-
- if ((index = dom.findList(node, "spacing-align", "start,center,end")) >= 0)
- this->setSpacingAlign((SkTextBox::SpacingAlign)index);
- else
- assert_no_attr(dom, node, "spacing-align");
-
- SkScalar s[2];
- if (dom.findScalars(node, "margin", s, 2))
- this->setMargin(s[0], s[1]);
- else
- assert_no_attr(dom, node, "margin");
-
- const char* text = dom.findAttr(node, "text");
- if (text)
- this->setText(text);
-
- if ((node = dom.getFirstChild(node, "paint")) != NULL &&
- (node = dom.getFirstChild(node, "screenplay")) != NULL)
- {
+ this->INHERITED::onInflate(dom, node);
+
+ int index;
+ if ((index = dom.findList(node, "mode", "fixed,auto-width,auto-height")) >= 0)
+ this->setMode((Mode)index);
+ else
+ assert_no_attr(dom, node, "mode");
+
+ if ((index = dom.findList(node, "spacing-align", "start,center,end")) >= 0)
+ this->setSpacingAlign((SkTextBox::SpacingAlign)index);
+ else
+ assert_no_attr(dom, node, "spacing-align");
+
+ SkScalar s[2];
+ if (dom.findScalars(node, "margin", s, 2))
+ this->setMargin(s[0], s[1]);
+ else
+ assert_no_attr(dom, node, "margin");
+
+ const char* text = dom.findAttr(node, "text");
+ if (text)
+ this->setText(text);
+
+ if ((node = dom.getFirstChild(node, "paint")) != NULL &&
+ (node = dom.getFirstChild(node, "screenplay")) != NULL)
+ {
// FIXME: Including inflate_paint causes Windows build to fail -- it complains
// that SKListView::SkListView is undefined.
#if 0
- inflate_paint(dom, node, &fPaint);
+ inflate_paint(dom, node, &fPaint);
#endif
- }
+ }
}
}
diff --git a/src/views/animated/SkWidgetViews.cpp b/src/views/animated/SkWidgetViews.cpp
index ee03b7b1a7..9c1cae7fb2 100644
--- a/src/views/animated/SkWidgetViews.cpp
+++ b/src/views/animated/SkWidgetViews.cpp
@@ -19,7 +19,7 @@ enum SkinEnum {
kProgress_SkinEnum,
kScroll_SkinEnum,
kStaticText_SkinEnum,
-
+
kSkinEnumCount
};
*/
@@ -45,7 +45,7 @@ void init_skin_anim(const char path[], SkAnimator* anim)
{
SkASSERT(path && anim);
- SkFILEStream stream(path);
+ SkFILEStream stream(path);
if (!stream.isValid())
{
@@ -69,9 +69,9 @@ void init_skin_paint(SkinEnum se, SkPaint* paint)
{
SkASSERT(paint);
- SkAnimator anim;
- SkCanvas canvas;
-
+ SkAnimator anim;
+ SkCanvas canvas;
+
init_skin_anim(se, &anim);
anim.draw(&canvas, paint, 0);
}
@@ -80,15 +80,15 @@ void inflate_paint(const SkDOM& dom, const SkDOM::Node* node, SkPaint* paint)
{
SkASSERT(paint);
- SkAnimator anim;
- SkCanvas canvas;
-
+ SkAnimator anim;
+ SkCanvas canvas;
+
if (!anim.decodeDOM(dom, node))
{
SkDEBUGF(("inflate_paint: decoding dom failed\n"));
SkDEBUGCODE(dom.dump(node);)
sk_throw();
- }
+ }
anim.draw(&canvas, paint, 0);
}
@@ -102,7 +102,7 @@ const char* SkWidgetView::getLabel() const
{
return fLabel.c_str();
}
-
+
void SkWidgetView::getLabel(SkString* label) const
{
if (label)
@@ -118,7 +118,7 @@ void SkWidgetView::setLabel(const char label[], size_t len)
{
if ((label == NULL && fLabel.size() != 0) || !fLabel.equals(label, len))
{
- SkString tmp(label, len);
+ SkString tmp(label, len);
this->onLabelChange(fLabel.c_str(), tmp.c_str());
fLabel.swap(tmp);
@@ -138,13 +138,13 @@ bool SkWidgetView::postWidgetEvent()
{
if (!fEvent.isType(""))
{
- SkEvent evt(fEvent); // make a copy since onPrepareWidgetEvent may edit the event
+ SkEvent evt(fEvent); // make a copy since onPrepareWidgetEvent may edit the event
if (this->onPrepareWidgetEvent(&evt))
{
SkDEBUGCODE(evt.dump("SkWidgetView::postWidgetEvent");)
- this->postToListeners(evt); // wonder if this should return true if there are > 0 listeners...
+ this->postToListeners(evt); // wonder if this should return true if there are > 0 listeners...
return true;
}
}
@@ -158,7 +158,7 @@ bool SkWidgetView::postWidgetEvent()
const char* label = dom.findAttr(node, "label");
if (label)
this->setLabel(label);
-
+
if ((node = dom.getFirstChild(node, "event")) != NULL)
fEvent.inflate(dom, node);
}
@@ -178,8 +178,8 @@ static const char gWidgetEventSinkIDSlotName[] = "sk-widget-sinkid-slot";
SkEventSinkID SkWidgetView::GetWidgetEventSinkID(const SkEvent& evt)
{
- int32_t sinkID;
-
+ int32_t sinkID;
+
return evt.findS32(gWidgetEventSinkIDSlotName, &sinkID) ? (SkEventSinkID)sinkID : 0;
}
@@ -204,14 +204,14 @@ SkCheckButtonView::SkCheckButtonView() : fCheckState(kOff_CheckState)
void SkCheckButtonView::setCheckState(CheckState state)
{
SkASSERT((unsigned)state <= kUnknown_CheckState);
-
+
if (fCheckState != state)
{
this->onCheckStateChange(this->getCheckState(), state);
fCheckState = SkToU8(state);
}
}
-
+
/*virtual*/ void SkCheckButtonView::onCheckStateChange(CheckState oldState, CheckState newState)
{
this->inval(NULL);
@@ -220,7 +220,7 @@ void SkCheckButtonView::setCheckState(CheckState state)
/*virtual*/ void SkCheckButtonView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
this->INHERITED::onInflate(dom, node);
-
+
int index = dom.findList(node, "check-state", "off,on,unknown");
if (index >= 0)
this->setCheckState((CheckState)index);
@@ -238,8 +238,8 @@ static const char gCheckStateSlotName[] = "sk-checkbutton-check-slot";
bool SkCheckButtonView::GetWidgetEventCheckState(const SkEvent& evt, CheckState* state)
{
- int32_t state32;
-
+ int32_t state32;
+
if (evt.findS32(gCheckStateSlotName, &state32))
{
if (state)
@@ -274,7 +274,7 @@ protected:
evt.setString("LABEL", newLabel);
fAnim.doUserEvent(evt);
}
-
+
virtual void onFocusChange(bool gainFocus)
{
this->INHERITED::onFocusChange(gainFocus);
@@ -298,19 +298,19 @@ protected:
virtual void onDraw(SkCanvas* canvas)
{
- SkPaint paint;
- SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs());
-
+ SkPaint paint;
+ SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs());
+
if (diff == SkAnimator::kDifferent)
this->inval(NULL);
else if (diff == SkAnimator::kPartiallyDifferent)
{
- SkRect bounds;
+ SkRect bounds;
fAnim.getInvalBounds(&bounds);
this->inval(&bounds);
}
}
-
+
virtual bool onEvent(const SkEvent& evt)
{
if (evt.isType(SK_EventType_Inval))
@@ -320,20 +320,20 @@ protected:
}
if (evt.isType("recommendDim"))
{
- SkScalar height;
-
+ SkScalar height;
+
if (evt.findScalar("y", &height))
this->setHeight(height);
return true;
}
return this->INHERITED::onEvent(evt);
}
-
+
virtual bool onPrepareWidgetEvent(SkEvent* evt)
{
if (this->INHERITED::onPrepareWidgetEvent(evt))
{
- SkEvent e("user");
+ SkEvent e("user");
e.setString("id", "handlePress");
(void)fAnim.doUserEvent(e);
return true;
@@ -342,8 +342,8 @@ protected:
}
private:
- SkAnimator fAnim;
-
+ SkAnimator fAnim;
+
typedef SkButtonView INHERITED;
};
@@ -354,7 +354,7 @@ SkView* SkWidgetFactory(const char name[])
{
if (name == NULL)
return NULL;
-
+
// must be in the same order as the SkSkinWidgetEnum is declared
static const char* gNames[] = {
"sk-border",
@@ -364,7 +364,7 @@ SkView* SkWidgetFactory(const char name[])
"sk-progress",
"sk-scroll",
"sk-text"
-
+
};
for (size_t i = 0; i < SK_ARRAY_COUNT(gNames); i++)
diff --git a/src/views/mac/SkNSView.h b/src/views/mac/SkNSView.h
index 8b83b34f49..109a9982cc 100644
--- a/src/views/mac/SkNSView.h
+++ b/src/views/mac/SkNSView.h
@@ -21,7 +21,7 @@ class SkEvent;
@interface SkNSView : NSView {
BOOL fRedrawRequestPending;
-
+
NSString* fTitle;
SkOSWindow* fWind;
#if SK_SUPPORT_GPU
diff --git a/src/views/mac/SkOSWindow_Mac.cpp b/src/views/mac/SkOSWindow_Mac.cpp
index 63106f088d..ec107901f8 100644
--- a/src/views/mac/SkOSWindow_Mac.cpp
+++ b/src/views/mac/SkOSWindow_Mac.cpp
@@ -26,15 +26,15 @@
static void (*gPrevNewHandler)();
extern "C" {
- static void sk_new_handler()
- {
- if (SkGraphics::SetFontCacheUsed(0))
- return;
- if (gPrevNewHandler)
- gPrevNewHandler();
- else
- sk_throw();
- }
+ static void sk_new_handler()
+ {
+ if (SkGraphics::SetFontCacheUsed(0))
+ return;
+ if (gPrevNewHandler)
+ gPrevNewHandler();
+ else
+ sk_throw();
+ }
}
static SkOSWindow* gCurrOSWin;
@@ -43,36 +43,36 @@ static EventQueueRef gCurrEventQ;
static OSStatus MyDrawEventHandler(EventHandlerCallRef myHandler,
EventRef event, void *userData) {
- // NOTE: GState is save/restored by the HIView system doing the callback,
+ // NOTE: GState is save/restored by the HIView system doing the callback,
// so the draw handler doesn't need to do it
- OSStatus status = noErr;
- CGContextRef context;
- HIRect bounds;
+ OSStatus status = noErr;
+ CGContextRef context;
+ HIRect bounds;
- // Get the CGContextRef
- status = GetEventParameter (event, kEventParamCGContextRef,
+ // Get the CGContextRef
+ status = GetEventParameter (event, kEventParamCGContextRef,
typeCGContextRef, NULL,
sizeof (CGContextRef),
NULL,
&context);
- if (status != noErr) {
- SkDebugf("Got error %d getting the context!\n", status);
- return status;
- }
+ if (status != noErr) {
+ SkDebugf("Got error %d getting the context!\n", status);
+ return status;
+ }
- // Get the bounding rectangle
- HIViewGetBounds ((HIViewRef) userData, &bounds);
+ // Get the bounding rectangle
+ HIViewGetBounds ((HIViewRef) userData, &bounds);
gCurrOSWin->doPaint(context);
- return status;
+ return status;
}
-#define SK_MacEventClass FOUR_CHAR_CODE('SKec')
-#define SK_MacEventKind FOUR_CHAR_CODE('SKek')
-#define SK_MacEventParamName FOUR_CHAR_CODE('SKev')
-#define SK_MacEventSinkIDParamName FOUR_CHAR_CODE('SKes')
+#define SK_MacEventClass FOUR_CHAR_CODE('SKec')
+#define SK_MacEventKind FOUR_CHAR_CODE('SKek')
+#define SK_MacEventParamName FOUR_CHAR_CODE('SKev')
+#define SK_MacEventSinkIDParamName FOUR_CHAR_CODE('SKes')
static void set_bindingside(HISideBinding* side, HIViewRef parent, HIBindingKind kind) {
side->toView = parent;
@@ -94,17 +94,17 @@ static void set_axisposition(HIAxisPosition* pos, HIViewRef parent, HIPositionKi
SkOSWindow::SkOSWindow(void* hWnd) : fHWND(hWnd), fAGLCtx(NULL)
{
- OSStatus result;
+ OSStatus result;
WindowRef wr = (WindowRef)hWnd;
HIViewRef imageView, parent;
HIViewRef rootView = HIViewGetRoot(wr);
HIViewFindByID(rootView, kHIViewWindowContentID, &parent);
result = HIImageViewCreate(NULL, &imageView);
- SkASSERT(result == noErr);
+ SkASSERT(result == noErr);
result = HIViewAddSubview(parent, imageView);
- SkASSERT(result == noErr);
+ SkASSERT(result == noErr);
fHVIEW = imageView;
@@ -128,41 +128,41 @@ SkOSWindow::SkOSWindow(void* hWnd) : fHWND(hWnd), fAGLCtx(NULL)
HIImageViewSetOpaque(imageView, true);
HIImageViewSetScaleToFit(imageView, false);
- static const EventTypeSpec gTypes[] = {
- { kEventClassKeyboard, kEventRawKeyDown },
+ static const EventTypeSpec gTypes[] = {
+ { kEventClassKeyboard, kEventRawKeyDown },
{ kEventClassKeyboard, kEventRawKeyUp },
- { kEventClassMouse, kEventMouseDown },
- { kEventClassMouse, kEventMouseDragged },
- { kEventClassMouse, kEventMouseMoved },
- { kEventClassMouse, kEventMouseUp },
- { kEventClassTextInput, kEventTextInputUnicodeForKeyEvent },
- { kEventClassWindow, kEventWindowBoundsChanged },
-// { kEventClassWindow, kEventWindowDrawContent },
- { SK_MacEventClass, SK_MacEventKind }
- };
-
- EventHandlerUPP handlerUPP = NewEventHandlerUPP(SkOSWindow::EventHandler);
- int count = SK_ARRAY_COUNT(gTypes);
-
- result = InstallEventHandler(GetWindowEventTarget(wr), handlerUPP,
- count, gTypes, this, nil);
- SkASSERT(result == noErr);
-
- gCurrOSWin = this;
- gCurrEventQ = GetCurrentEventQueue();
- gEventTarget = GetWindowEventTarget(wr);
-
- static bool gOnce = true;
- if (gOnce) {
- gOnce = false;
- gPrevNewHandler = set_new_handler(sk_new_handler);
- }
+ { kEventClassMouse, kEventMouseDown },
+ { kEventClassMouse, kEventMouseDragged },
+ { kEventClassMouse, kEventMouseMoved },
+ { kEventClassMouse, kEventMouseUp },
+ { kEventClassTextInput, kEventTextInputUnicodeForKeyEvent },
+ { kEventClassWindow, kEventWindowBoundsChanged },
+// { kEventClassWindow, kEventWindowDrawContent },
+ { SK_MacEventClass, SK_MacEventKind }
+ };
+
+ EventHandlerUPP handlerUPP = NewEventHandlerUPP(SkOSWindow::EventHandler);
+ int count = SK_ARRAY_COUNT(gTypes);
+
+ result = InstallEventHandler(GetWindowEventTarget(wr), handlerUPP,
+ count, gTypes, this, nil);
+ SkASSERT(result == noErr);
+
+ gCurrOSWin = this;
+ gCurrEventQ = GetCurrentEventQueue();
+ gEventTarget = GetWindowEventTarget(wr);
+
+ static bool gOnce = true;
+ if (gOnce) {
+ gOnce = false;
+ gPrevNewHandler = set_new_handler(sk_new_handler);
+ }
}
void SkOSWindow::doPaint(void* ctx)
{
#if 0
- this->update(NULL);
+ this->update(NULL);
const SkBitmap& bm = this->getBitmap();
CGImageRef img = SkCreateCGImageRef(bm);
@@ -187,10 +187,10 @@ void SkOSWindow::doPaint(void* ctx)
void SkOSWindow::updateSize()
{
- Rect r;
+ Rect r;
- GetWindowBounds((WindowRef)fHWND, kWindowContentRgn, &r);
- this->resize(r.right - r.left, r.bottom - r.top);
+ GetWindowBounds((WindowRef)fHWND, kWindowContentRgn, &r);
+ this->resize(r.right - r.left, r.bottom - r.top);
#if 0
HIRect frame;
@@ -238,24 +238,24 @@ void SkOSWindow::onAddMenu(const SkOSMenu* sk_menu)
static void getparam(EventRef inEvent, OSType name, OSType type, UInt32 size, void* data)
{
- EventParamType actualType;
- UInt32 actualSize;
- OSStatus status;
-
- status = GetEventParameter(inEvent, name, type, &actualType, size, &actualSize, data);
- SkASSERT(status == noErr);
- SkASSERT(actualType == type);
- SkASSERT(actualSize == size);
+ EventParamType actualType;
+ UInt32 actualSize;
+ OSStatus status;
+
+ status = GetEventParameter(inEvent, name, type, &actualType, size, &actualSize, data);
+ SkASSERT(status == noErr);
+ SkASSERT(actualType == type);
+ SkASSERT(actualSize == size);
}
enum {
- SK_MacReturnKey = 36,
- SK_MacDeleteKey = 51,
- SK_MacEndKey = 119,
- SK_MacLeftKey = 123,
- SK_MacRightKey = 124,
- SK_MacDownKey = 125,
- SK_MacUpKey = 126,
+ SK_MacReturnKey = 36,
+ SK_MacDeleteKey = 51,
+ SK_MacEndKey = 119,
+ SK_MacLeftKey = 123,
+ SK_MacRightKey = 124,
+ SK_MacDownKey = 125,
+ SK_MacUpKey = 126,
SK_Mac0Key = 0x52,
SK_Mac1Key = 0x53,
@@ -271,17 +271,17 @@ enum {
static SkKey raw2key(UInt32 raw)
{
- static const struct {
- UInt32 fRaw;
- SkKey fKey;
- } gKeys[] = {
- { SK_MacUpKey, kUp_SkKey },
- { SK_MacDownKey, kDown_SkKey },
- { SK_MacLeftKey, kLeft_SkKey },
- { SK_MacRightKey, kRight_SkKey },
- { SK_MacReturnKey, kOK_SkKey },
- { SK_MacDeleteKey, kBack_SkKey },
- { SK_MacEndKey, kEnd_SkKey },
+ static const struct {
+ UInt32 fRaw;
+ SkKey fKey;
+ } gKeys[] = {
+ { SK_MacUpKey, kUp_SkKey },
+ { SK_MacDownKey, kDown_SkKey },
+ { SK_MacLeftKey, kLeft_SkKey },
+ { SK_MacRightKey, kRight_SkKey },
+ { SK_MacReturnKey, kOK_SkKey },
+ { SK_MacDeleteKey, kBack_SkKey },
+ { SK_MacEndKey, kEnd_SkKey },
{ SK_Mac0Key, k0_SkKey },
{ SK_Mac1Key, k1_SkKey },
{ SK_Mac2Key, k2_SkKey },
@@ -292,54 +292,54 @@ static SkKey raw2key(UInt32 raw)
{ SK_Mac7Key, k7_SkKey },
{ SK_Mac8Key, k8_SkKey },
{ SK_Mac9Key, k9_SkKey }
- };
+ };
- for (unsigned i = 0; i < SK_ARRAY_COUNT(gKeys); i++)
- if (gKeys[i].fRaw == raw)
- return gKeys[i].fKey;
- return kNONE_SkKey;
+ for (unsigned i = 0; i < SK_ARRAY_COUNT(gKeys); i++)
+ if (gKeys[i].fRaw == raw)
+ return gKeys[i].fKey;
+ return kNONE_SkKey;
}
static void post_skmacevent()
{
- EventRef ref;
- OSStatus status = CreateEvent(nil, SK_MacEventClass, SK_MacEventKind, 0, 0, &ref);
- SkASSERT(status == noErr);
+ EventRef ref;
+ OSStatus status = CreateEvent(nil, SK_MacEventClass, SK_MacEventKind, 0, 0, &ref);
+ SkASSERT(status == noErr);
#if 0
- status = SetEventParameter(ref, SK_MacEventParamName, SK_MacEventParamName, sizeof(evt), &evt);
- SkASSERT(status == noErr);
- status = SetEventParameter(ref, SK_MacEventSinkIDParamName, SK_MacEventSinkIDParamName, sizeof(sinkID), &sinkID);
- SkASSERT(status == noErr);
+ status = SetEventParameter(ref, SK_MacEventParamName, SK_MacEventParamName, sizeof(evt), &evt);
+ SkASSERT(status == noErr);
+ status = SetEventParameter(ref, SK_MacEventSinkIDParamName, SK_MacEventSinkIDParamName, sizeof(sinkID), &sinkID);
+ SkASSERT(status == noErr);
#endif
- EventTargetRef target = gEventTarget;
- SetEventParameter(ref, kEventParamPostTarget, typeEventTargetRef, sizeof(target), &target);
- SkASSERT(status == noErr);
+ EventTargetRef target = gEventTarget;
+ SetEventParameter(ref, kEventParamPostTarget, typeEventTargetRef, sizeof(target), &target);
+ SkASSERT(status == noErr);
- status = PostEventToQueue(gCurrEventQ, ref, kEventPriorityStandard);
- SkASSERT(status == noErr);
+ status = PostEventToQueue(gCurrEventQ, ref, kEventPriorityStandard);
+ SkASSERT(status == noErr);
- ReleaseEvent(ref);
+ ReleaseEvent(ref);
}
pascal OSStatus SkOSWindow::EventHandler( EventHandlerCallRef inHandler, EventRef inEvent, void* userData )
{
- SkOSWindow* win = (SkOSWindow*)userData;
- OSStatus result = eventNotHandledErr;
- UInt32 wClass = GetEventClass(inEvent);
- UInt32 wKind = GetEventKind(inEvent);
+ SkOSWindow* win = (SkOSWindow*)userData;
+ OSStatus result = eventNotHandledErr;
+ UInt32 wClass = GetEventClass(inEvent);
+ UInt32 wKind = GetEventKind(inEvent);
- gCurrOSWin = win; // will need to be in TLS. Set this so PostEvent will work
+ gCurrOSWin = win; // will need to be in TLS. Set this so PostEvent will work
- switch (wClass) {
+ switch (wClass) {
case kEventClassMouse: {
- Point pt;
- getparam(inEvent, kEventParamMouseLocation, typeQDPoint, sizeof(pt), &pt);
- SetPortWindowPort((WindowRef)win->getHWND());
- GlobalToLocal(&pt);
+ Point pt;
+ getparam(inEvent, kEventParamMouseLocation, typeQDPoint, sizeof(pt), &pt);
+ SetPortWindowPort((WindowRef)win->getHWND());
+ GlobalToLocal(&pt);
- switch (wKind) {
+ switch (wKind) {
case kEventMouseDown:
if (win->handleClick(pt.h, pt.v, Click::kDown_State)) {
result = noErr;
@@ -357,9 +357,9 @@ pascal OSStatus SkOSWindow::EventHandler( EventHandlerCallRef inHandler, EventRe
break;
default:
break;
- }
+ }
break;
- }
+ }
case kEventClassKeyboard:
if (wKind == kEventRawKeyDown) {
UInt32 raw;
@@ -412,8 +412,8 @@ pascal OSStatus SkOSWindow::EventHandler( EventHandlerCallRef inHandler, EventRe
post_skmacevent();
}
#if 0
- SkEvent* evt;
- SkEventSinkID sinkID;
+ SkEvent* evt;
+ SkEventSinkID sinkID;
getparam(inEvent, SK_MacEventParamName, SK_MacEventParamName, sizeof(evt), &evt);
getparam(inEvent, SK_MacEventSinkIDParamName, SK_MacEventSinkIDParamName, sizeof(sinkID), &sinkID);
#endif
@@ -422,47 +422,47 @@ pascal OSStatus SkOSWindow::EventHandler( EventHandlerCallRef inHandler, EventRe
}
default:
break;
- }
- if (result == eventNotHandledErr) {
- result = CallNextEventHandler(inHandler, inEvent);
}
- return result;
+ if (result == eventNotHandledErr) {
+ result = CallNextEventHandler(inHandler, inEvent);
+ }
+ return result;
}
///////////////////////////////////////////////////////////////////////////////////////
void SkEvent::SignalNonEmptyQueue()
{
- post_skmacevent();
-// SkDebugf("signal nonempty\n");
+ post_skmacevent();
+// SkDebugf("signal nonempty\n");
}
-static TMTask gTMTaskRec;
-static TMTask* gTMTaskPtr;
+static TMTask gTMTaskRec;
+static TMTask* gTMTaskPtr;
static void sk_timer_proc(TMTask* rec)
{
- SkEvent::ServiceQueueTimer();
-// SkDebugf("timer task fired\n");
+ SkEvent::ServiceQueueTimer();
+// SkDebugf("timer task fired\n");
}
void SkEvent::SignalQueueTimer(SkMSec delay)
{
- if (gTMTaskPtr)
- {
- RemoveTimeTask((QElem*)gTMTaskPtr);
- DisposeTimerUPP(gTMTaskPtr->tmAddr);
- gTMTaskPtr = nil;
- }
- if (delay)
- {
- gTMTaskPtr = &gTMTaskRec;
- memset(gTMTaskPtr, 0, sizeof(gTMTaskRec));
- gTMTaskPtr->tmAddr = NewTimerUPP(sk_timer_proc);
- OSErr err = InstallTimeTask((QElem*)gTMTaskPtr);
-// SkDebugf("installtimetask of %d returned %d\n", delay, err);
- PrimeTimeTask((QElem*)gTMTaskPtr, delay);
- }
+ if (gTMTaskPtr)
+ {
+ RemoveTimeTask((QElem*)gTMTaskPtr);
+ DisposeTimerUPP(gTMTaskPtr->tmAddr);
+ gTMTaskPtr = nil;
+ }
+ if (delay)
+ {
+ gTMTaskPtr = &gTMTaskRec;
+ memset(gTMTaskPtr, 0, sizeof(gTMTaskRec));
+ gTMTaskPtr->tmAddr = NewTimerUPP(sk_timer_proc);
+ OSErr err = InstallTimeTask((QElem*)gTMTaskPtr);
+// SkDebugf("installtimetask of %d returned %d\n", delay, err);
+ PrimeTimeTask((QElem*)gTMTaskPtr, delay);
+ }
}
#define USE_MSAA 0
diff --git a/src/views/sdl/SkOSWindow_SDL.cpp b/src/views/sdl/SkOSWindow_SDL.cpp
index c2ba8b4349..4edc5acfd3 100644
--- a/src/views/sdl/SkOSWindow_SDL.cpp
+++ b/src/views/sdl/SkOSWindow_SDL.cpp
@@ -24,7 +24,7 @@ static void post_SkEvent_event() {
static bool skia_setBitmapFromSurface(SkBitmap* dst, SDL_Surface* src) {
SkBitmap::Config config;
-
+
switch (src->format->BytesPerPixel) {
case 2:
config = SkBitmap::kRGB_565_Config;
@@ -35,7 +35,7 @@ static bool skia_setBitmapFromSurface(SkBitmap* dst, SDL_Surface* src) {
default:
return false;
}
-
+
dst->setConfig(config, src->w, src->h, src->pitch);
dst->setPixels(src->pixels);
return true;
@@ -44,7 +44,7 @@ static bool skia_setBitmapFromSurface(SkBitmap* dst, SDL_Surface* src) {
SkOSWindow::SkOSWindow(void* screen) {
fScreen = reinterpret_cast<SDL_Surface*>(screen);
this->resize(fScreen->w, fScreen->h);
-
+
uint32_t rmask = SK_R32_MASK << SK_R32_SHIFT;
uint32_t gmask = SK_G32_MASK << SK_G32_SHIFT;
uint32_t bmask = SK_B32_MASK << SK_B32_SHIFT;
@@ -141,7 +141,7 @@ static SkKey find_skkey(SDLKey src) {
SDLK_UNKNOWN, // power
SDLK_UNKNOWN, // camera
};
-
+
const SDLKey* array = gKeys;
for (size_t i = 0; i < SK_ARRAY_COUNT(gKeys); i++) {
if (array[i] == src) {
@@ -213,7 +213,7 @@ void SkEvent::SignalNonEmptyQueue() {
static Uint32 timer_callback(Uint32 interval) {
// SkDebugf("-------- timercallback %d\n", interval);
- SkEvent::ServiceQueueTimer();
+ SkEvent::ServiceQueueTimer();
return 0;
}
diff --git a/src/views/unix/SkOSWindow_Unix.cpp b/src/views/unix/SkOSWindow_Unix.cpp
index e761bdef74..46a2b3dd09 100644
--- a/src/views/unix/SkOSWindow_Unix.cpp
+++ b/src/views/unix/SkOSWindow_Unix.cpp
@@ -231,7 +231,7 @@ bool SkOSWindow::attach(SkBackEndTypes /* attachType */, int msaaSampleCount) {
this->initWindow(msaaSampleCount);
if (NULL == fUnixWindow.fDisplay) {
return false;
- }
+ }
if (NULL == fUnixWindow.fGLContext) {
SkASSERT(NULL != fVi);
diff --git a/src/views/unix/keysym2ucs.c b/src/views/unix/keysym2ucs.c
index 520c6a7614..a0c4ced9e0 100644
--- a/src/views/unix/keysym2ucs.c
+++ b/src/views/unix/keysym2ucs.c
@@ -828,19 +828,19 @@ long keysym2ucs(KeySym keysym)
/* also check for directly encoded 24-bit UCS characters */
if ((keysym & 0xff000000) == 0x01000000)
- return keysym & 0x00ffffff;
+ return keysym & 0x00ffffff;
/* binary search in table */
while (max >= min) {
- mid = (min + max) / 2;
- if (keysymtab[mid].keysym < keysym)
- min = mid + 1;
- else if (keysymtab[mid].keysym > keysym)
- max = mid - 1;
- else {
- /* found it */
- return keysymtab[mid].ucs;
- }
+ mid = (min + max) / 2;
+ if (keysymtab[mid].keysym < keysym)
+ min = mid + 1;
+ else if (keysymtab[mid].keysym > keysym)
+ max = mid - 1;
+ else {
+ /* found it */
+ return keysymtab[mid].ucs;
+ }
}
/* no matching Unicode value found */
diff --git a/src/views/win/SkOSWindow_win.cpp b/src/views/win/SkOSWindow_win.cpp
index 88a0a36a0f..038a2e85a1 100644
--- a/src/views/win/SkOSWindow_win.cpp
+++ b/src/views/win/SkOSWindow_win.cpp
@@ -115,7 +115,7 @@ bool SkOSWindow::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
} break;
case WM_UNICHAR:
this->handleChar(wParam);
- return true;
+ return true;
case WM_CHAR: {
this->handleChar(SkUTF8_ToUnichar((char*)&wParam));
return true;
@@ -138,11 +138,11 @@ bool SkOSWindow::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
delete rect;
return true;
} break;
-
- case WM_LBUTTONDOWN:
+
+ case WM_LBUTTONDOWN:
this->handleClick(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), Click::kDown_State);
return true;
-
+
case WM_MOUSEMOVE:
this->handleClick(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), Click::kMoved_State);
return true;
@@ -172,15 +172,15 @@ void SkOSWindow::doPaint(void* ctx) {
memset(&bmi, 0, sizeof(bmi));
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = bitmap.width();
- bmi.bmiHeader.biHeight = -bitmap.height(); // top-down image
+ bmi.bmiHeader.biHeight = -bitmap.height(); // top-down image
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 32;
bmi.bmiHeader.biCompression = BI_RGB;
bmi.bmiHeader.biSizeImage = 0;
- //
- // Do the SetDIBitsToDevice.
- //
+ //
+ // Do the SetDIBitsToDevice.
+ //
// TODO(wjmaclean):
// Fix this call to handle SkBitmaps that have rowBytes != width,
// i.e. may have padding at the end of lines. The SkASSERT below
@@ -235,7 +235,7 @@ enum {
SK_MacRightKey = 124,
SK_MacDownKey = 125,
SK_MacUpKey = 126,
-
+
SK_Mac0Key = 0x52,
SK_Mac1Key = 0x53,
SK_Mac2Key = 0x54,
@@ -247,7 +247,7 @@ enum {
SK_Mac8Key = 0x5b,
SK_Mac9Key = 0x5c
};
-
+
static SkKey raw2key(uint32_t raw)
{
static const struct {
@@ -272,7 +272,7 @@ static SkKey raw2key(uint32_t raw)
{ SK_Mac8Key, k8_SkKey },
{ SK_Mac9Key, k9_SkKey }
};
-
+
for (unsigned i = 0; i < SK_ARRAY_COUNT(gKeys); i++)
if (gKeys[i].fRaw == raw)
return gKeys[i].fKey;
@@ -303,7 +303,7 @@ void SkEvent::SignalQueueTimer(SkMSec delay)
gTimer = NULL;
}
if (delay)
- {
+ {
gTimer = SetTimer(NULL, 0, delay, sk_timer_proc);
//SkDebugf("SetTimer of %d returned %d\n", delay, gTimer);
}
@@ -382,7 +382,7 @@ HGLRC create_gl(HWND hwnd, int msaaSampleCount) {
BOOL set = SetPixelFormat(dc, format, &pfd);
SkASSERT(TRUE == set);
}
-
+
HGLRC glrc = wglCreateContext(dc);
SkASSERT(glrc);
@@ -428,7 +428,7 @@ bool create_ANGLE(EGLNativeWindowType hWnd,
EGLSurface* eglSurface) {
static const EGLint contextAttribs[] = {
EGL_CONTEXT_CLIENT_VERSION, 2,
- EGL_NONE, EGL_NONE
+ EGL_NONE, EGL_NONE
};
static const EGLint configAttribList[] = {
EGL_RED_SIZE, 8,
@@ -482,33 +482,33 @@ bool create_ANGLE(EGLNativeWindowType hWnd,
}
}
if (!foundConfig) {
- if (!eglChooseConfig(display, configAttribList,
+ if (!eglChooseConfig(display, configAttribList,
&config, 1, &numConfigs)) {
return false;
}
}
// Create a surface
- EGLSurface surface = eglCreateWindowSurface(display, config,
- (EGLNativeWindowType)hWnd,
+ EGLSurface surface = eglCreateWindowSurface(display, config,
+ (EGLNativeWindowType)hWnd,
surfaceAttribList);
if (surface == EGL_NO_SURFACE) {
return false;
}
// Create a GL context
- EGLContext context = eglCreateContext(display, config,
+ EGLContext context = eglCreateContext(display, config,
EGL_NO_CONTEXT,
contextAttribs );
if (context == EGL_NO_CONTEXT ) {
return false;
- }
-
+ }
+
// Make the context current
if (!eglMakeCurrent(display, surface, surface, context)) {
return false;
}
-
+
*eglDisplay = display;
*eglContext = context;
*eglSurface = surface;
@@ -583,7 +583,7 @@ bool SkOSWindow::attach(SkBackEndTypes attachType, int msaaSampleCount) {
switch (attachType) {
case kNone_BackEndType:
// nothing to do
- break;
+ break;
#if SK_SUPPORT_GPU
case kNativeGL_BackEndType:
result = attachGL(msaaSampleCount);
@@ -611,7 +611,7 @@ void SkOSWindow::detach() {
switch (fAttached) {
case kNone_BackEndType:
// nothing to do
- break;
+ break;
#if SK_SUPPORT_GPU
case kNativeGL_BackEndType:
detachGL();
@@ -633,7 +633,7 @@ void SkOSWindow::present() {
switch (fAttached) {
case kNone_BackEndType:
// nothing to do
- return;
+ return;
#if SK_SUPPORT_GPU
case kNativeGL_BackEndType:
presentGL();
diff --git a/src/xml/SkDOM.cpp b/src/xml/SkDOM.cpp
index 474c2915bb..bdfdd86bdc 100644
--- a/src/xml/SkDOM.cpp
+++ b/src/xml/SkDOM.cpp
@@ -19,10 +19,10 @@ bool SkXMLParser::parse(const SkDOM& dom, const SkDOMNode* node)
if (this->startElement(elemName))
return false;
-
+
SkDOM::AttrIter iter(dom, node);
const char* name, *value;
-
+
while ((name = iter.next(&value)) != NULL)
if (this->addAttribute(name, value))
return false;
@@ -32,7 +32,7 @@ bool SkXMLParser::parse(const SkDOM& dom, const SkDOMNode* node)
if (!this->parse(dom, node))
return false;
} while ((node = dom.getNextSibling(node)) != NULL);
-
+
return !this->endElement(elemName);
}
@@ -312,7 +312,7 @@ static void walk_dom(const SkDOM& dom, const SkDOM::Node* node, SkXMLParser* par
const char* elem = dom.getName(node);
parser->startElement(elem);
-
+
SkDOM::AttrIter iter(dom, node);
const char* name;
const char* value;
@@ -467,7 +467,7 @@ void SkDOM::dump(const Node* node, int level) const
void SkDOM::UnitTest()
{
#ifdef SK_SUPPORT_UNITTEST
- static const char gDoc[] =
+ static const char gDoc[] =
"<root a='1' b='2'>"
"<elem1 c='3' />"
"<elem2 d='4' />"
diff --git a/src/xml/SkJSDisplayable.cpp b/src/xml/SkJSDisplayable.cpp
index 0e14fde52e..502779743f 100644
--- a/src/xml/SkJSDisplayable.cpp
+++ b/src/xml/SkJSDisplayable.cpp
@@ -83,7 +83,7 @@ JSBool SkJSDisplayable::Draw(JSContext *cx, JSObject *obj, uintN argc,
}
-JSFunctionSpec SkJSDisplayable_methods[] =
+JSFunctionSpec SkJSDisplayable_methods[] =
{
{ "draw", SkJSDisplayable::Draw, 1, 0, 0 },
{ 0 }
@@ -219,7 +219,7 @@ JSBool SkJSDisplayable::GetProperty(JSContext *cx, JSObject *obj, jsval id,
jsval *vp)
{
if (JSVAL_IS_INT(id) == 0)
- return JS_TRUE;
+ return JS_TRUE;
SkJSDisplayable *p = (SkJSDisplayable *) JS_GetPrivate(cx, obj);
SkDisplayable* displayable = p->fDisplayable;
SkDisplayTypes displayableType = displayable->getType();
@@ -295,7 +295,7 @@ JSBool SkJSDisplayable::GetProperty(JSContext *cx, JSObject *obj, jsval id,
JSBool SkJSDisplayable::SetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) {
if (JSVAL_IS_INT(id) == 0)
- return JS_TRUE;
+ return JS_TRUE;
SkJSDisplayable *p = (SkJSDisplayable *) JS_GetPrivate(cx, obj);
SkDisplayable* displayable = p->fDisplayable;
SkDisplayTypes displayableType = displayable->getType();
diff --git a/src/xml/SkXMLParser.cpp b/src/xml/SkXMLParser.cpp
index 17329be1cc..63929a94e2 100644
--- a/src/xml/SkXMLParser.cpp
+++ b/src/xml/SkXMLParser.cpp
@@ -74,7 +74,7 @@ bool SkXMLParser::endElement(const char elem[])
return this->onEndElement(elem);
}
-bool SkXMLParser::text(const char text[], int len)
+bool SkXMLParser::text(const char text[], int len)
{
return this->onText(text, len);
}
diff --git a/src/xml/SkXMLPullParser.cpp b/src/xml/SkXMLPullParser.cpp
index 03fed42343..4080aeb1ec 100644
--- a/src/xml/SkXMLPullParser.cpp
+++ b/src/xml/SkXMLPullParser.cpp
@@ -26,7 +26,7 @@ SkXMLPullParser::SkXMLPullParser(SkStream* stream) : fStream(NULL)
{
fCurr.fEventType = ERROR;
fDepth = 0;
-
+
this->setStream(stream);
}
@@ -65,12 +65,12 @@ SkXMLPullParser::EventType SkXMLPullParser::nextToken()
case END_TAG:
fDepth -= 1;
// fall through
- default:
+ default:
reset(&fCurr);
fCurr.fEventType = this->onNextToken();
break;
}
-
+
switch (fCurr.fEventType) {
case START_TAG:
fDepth += 1;
@@ -125,11 +125,11 @@ int SkXMLPullParser::getAttributeCount()
void SkXMLPullParser::getAttributeInfo(int index, AttrInfo* info)
{
SkASSERT((unsigned)index < (unsigned)fCurr.fAttrInfoCount);
-
+
if (info)
*info = fCurr.fAttrInfos[index];
}
-
+
bool SkXMLPullParser::onEntityReplacement(const char name[],
SkString* replacement)
{
diff --git a/src/xml/SkXMLWriter.cpp b/src/xml/SkXMLWriter.cpp
index 935745dc95..451d1d5241 100644
--- a/src/xml/SkXMLWriter.cpp
+++ b/src/xml/SkXMLWriter.cpp
@@ -69,7 +69,7 @@ bool SkXMLWriter::doStart(const char name[], size_t length)
return firstChild;
}
-SkXMLWriter::Elem* SkXMLWriter::getEnd()
+SkXMLWriter::Elem* SkXMLWriter::getEnd()
{
Elem* elem;
fElems.pop(&elem);
diff --git a/tests/AAClipTest.cpp b/tests/AAClipTest.cpp
index c5e82ba647..1b060a7d2d 100644
--- a/tests/AAClipTest.cpp
+++ b/tests/AAClipTest.cpp
@@ -272,7 +272,7 @@ static void test_irect(skiatest::Reporter* reporter) {
}
REPORTER_ASSERT(reporter, nonEmptyAA == nonEmptyBW);
REPORTER_ASSERT(reporter, clip2.getBounds() == rgn2.getBounds());
-
+
SkMask maskBW, maskAA;
copyToMask(rgn2, &maskBW);
clip2.copyToMask(&maskAA);
@@ -307,7 +307,7 @@ static void test_path_with_hole(skiatest::Reporter* reporter) {
for (int i = 0; i < 2; ++i) {
SkAAClip clip;
clip.setPath(path, NULL, 1 == i);
-
+
SkMask mask;
clip.copyToMask(&mask);
SkAutoMaskFreeImage freeM(mask.fImage);
@@ -350,7 +350,7 @@ static void did_dx_affect(skiatest::Reporter* reporter, const SkScalar dx[],
for (size_t i = 0; i < count; ++i) {
SkRect r;
r.set(ir);
-
+
SkRasterClip rc0(ir);
SkRasterClip rc1(ir);
SkRasterClip rc2(ir);
@@ -360,7 +360,7 @@ static void did_dx_affect(skiatest::Reporter* reporter, const SkScalar dx[],
rc1.op(r, SkRegion::kIntersect_Op, true);
r.offset(-2*dx[i], 0);
rc2.op(r, SkRegion::kIntersect_Op, true);
-
+
REPORTER_ASSERT(reporter, changed != (rc0 == rc1));
REPORTER_ASSERT(reporter, changed != (rc0 == rc2));
}
@@ -368,7 +368,7 @@ static void did_dx_affect(skiatest::Reporter* reporter, const SkScalar dx[],
static void test_nearly_integral(skiatest::Reporter* reporter) {
// All of these should generate equivalent rasterclips
-
+
static const SkScalar gSafeX[] = {
0, SK_Scalar1/1000, SK_Scalar1/100, SK_Scalar1/10,
};
@@ -388,7 +388,7 @@ static void test_regressions(skiatest::Reporter* reporter) {
SkRect r;
r.fLeft = SkFloatToScalar(129.892181f);
r.fTop = SkFloatToScalar(10.3999996f);
- r.fRight = SkFloatToScalar(130.892181f);
+ r.fRight = SkFloatToScalar(130.892181f);
r.fBottom = SkFloatToScalar(20.3999996f);
clip.setRect(r, true);
}
diff --git a/tests/BlitRowTest.cpp b/tests/BlitRowTest.cpp
index b37b47e16b..fca4588282 100644
--- a/tests/BlitRowTest.cpp
+++ b/tests/BlitRowTest.cpp
@@ -136,7 +136,7 @@ static void test_00_FF(skiatest::Reporter* reporter) {
SkBitmap dstBM;
dstBM.setConfig(gDstConfig[i], W, 1);
dstBM.allocPixels();
-
+
SkCanvas canvas(dstBM);
for (size_t j = 0; j < SK_ARRAY_COUNT(gSrcRec); j++) {
srcBM.eraseColor(gSrcRec[j].fSrc);
@@ -178,7 +178,7 @@ struct Mesh {
SkShader* s = SkShader::CreateBitmapShader(bm, SkShader::kClamp_TileMode,
SkShader::kClamp_TileMode);
paint->setShader(s)->unref();
-
+
}
void draw(SkCanvas* canvas, SkPaint* paint) {
@@ -199,7 +199,7 @@ static bool gOnce;
static void test_diagonal(skiatest::Reporter* reporter) {
static const int W = 64;
static const int H = W;
-
+
static const SkBitmap::Config gDstConfig[] = {
SkBitmap::kARGB_8888_Config,
SkBitmap::kRGB_565_Config,
@@ -210,7 +210,7 @@ static void test_diagonal(skiatest::Reporter* reporter) {
static const SkColor gDstBG[] = { 0, 0xFFFFFFFF };
SkPaint paint;
-
+
SkBitmap srcBM;
srcBM.setConfig(SkBitmap::kARGB_8888_Config, W, H);
srcBM.allocPixels();
@@ -226,7 +226,7 @@ static void test_diagonal(skiatest::Reporter* reporter) {
dstBM1.setConfig(gDstConfig[i], W, H);
dstBM0.allocPixels();
dstBM1.allocPixels();
-
+
SkCanvas canvas0(dstBM0);
SkCanvas canvas1(dstBM1);
SkColor bgColor;
@@ -236,7 +236,7 @@ static void test_diagonal(skiatest::Reporter* reporter) {
for (int c = 0; c <= 0xFF; c++) {
srcBM.eraseARGB(0xFF, c, c, c);
-
+
for (int k = 0; k < 4; k++) {
bool dither = (k & 1) != 0;
uint8_t alpha = (k & 2) ? 0x80 : 0xFF;
diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp
index 3ff6d4bedf..6063dd943f 100644
--- a/tests/CanvasTest.cpp
+++ b/tests/CanvasTest.cpp
@@ -18,7 +18,7 @@
* The general pattern for creating a new test step is to write a test
* function of the form:
*
- * static void MyTestStepFunction(SkCanvas* canvas,
+ * static void MyTestStepFunction(SkCanvas* canvas,
* skiatest::Reporter* reporter,
* CanvasTestStep* testStep)
* {
@@ -79,7 +79,7 @@ private:
static void test_clipVisitor(skiatest::Reporter* reporter, SkCanvas* canvas) {
SkISize size = canvas->getDeviceSize();
-
+
SkBitmap bm;
bm.setConfig(SkBitmap::kARGB_8888_Config, size.width(), size.height());
SkCanvas c(bm);
@@ -93,7 +93,7 @@ static void test_clipVisitor(skiatest::Reporter* reporter, SkCanvas* canvas) {
static const int kWidth = 2;
static const int kHeight = 2;
// Maximum stream length for picture serialization
-static const size_t kMaxPictureBufferSize = 1024;
+static const size_t kMaxPictureBufferSize = 1024;
// Format strings that describe the test context. The %s token is where
// the name of the test step is inserted. The context is required for
@@ -101,31 +101,31 @@ static const size_t kMaxPictureBufferSize = 1024;
// functions that are called multiple times in different contexts (test
// cases and test steps).
static const char* const kDefaultAssertMessageFormat = "%s";
-static const char* const kCanvasDrawAssertMessageFormat =
+static const char* const kCanvasDrawAssertMessageFormat =
"Drawing test step %s with SkCanvas";
-static const char* const kPictureDrawAssertMessageFormat =
+static const char* const kPictureDrawAssertMessageFormat =
"Drawing test step %s with SkPicture";
-static const char* const kPictureSecondDrawAssertMessageFormat =
+static const char* const kPictureSecondDrawAssertMessageFormat =
"Duplicate draw of test step %s with SkPicture";
-static const char* const kPictureReDrawAssertMessageFormat =
+static const char* const kPictureReDrawAssertMessageFormat =
"Playing back test step %s from an SkPicture to another SkPicture";
-static const char* const kDeferredDrawAssertMessageFormat =
+static const char* const kDeferredDrawAssertMessageFormat =
"Drawing test step %s with SkDeferredCanvas";
-static const char* const kProxyDrawAssertMessageFormat =
+static const char* const kProxyDrawAssertMessageFormat =
"Drawing test step %s with SkProxyCanvas";
-static const char* const kNWayDrawAssertMessageFormat =
+static const char* const kNWayDrawAssertMessageFormat =
"Drawing test step %s with SkNWayCanvas";
-static const char* const kRoundTripAssertMessageFormat =
+static const char* const kRoundTripAssertMessageFormat =
"test step %s, SkPicture consistency after round trip";
-static const char* const kPictureRecoringAssertMessageFormat =
+static const char* const kPictureRecoringAssertMessageFormat =
"test step %s, SkPicture state consistency after recording";
-static const char* const kPicturePlaybackAssertMessageFormat =
+static const char* const kPicturePlaybackAssertMessageFormat =
"test step %s, SkPicture state consistency in playback canvas";
-static const char* const kDeferredPreFlushAssertMessageFormat =
+static const char* const kDeferredPreFlushAssertMessageFormat =
"test step %s, SkDeferredCanvas state consistency before flush";
static const char* const kDeferredPostFlushPlaybackAssertMessageFormat =
"test step %s, SkDeferredCanvas playback canvas state consistency after flush";
-static const char* const kDeferredPostFlushAssertMessageFormat =
+static const char* const kDeferredPostFlushAssertMessageFormat =
"test step %s, SkDeferredCanvas state consistency after flush";
static const char* const kPictureResourceReuseMessageFormat =
"test step %s, SkPicture duplicate flattened object test";
@@ -180,7 +180,7 @@ private:
///////////////////////////////////////////////////////////////////////////////
// Constants used by test steps
-const SkRect kTestRect =
+const SkRect kTestRect =
SkRect::MakeXYWH(SkIntToScalar(0), SkIntToScalar(0),
SkIntToScalar(2), SkIntToScalar(1));
static SkMatrix testMatrix() {
@@ -233,7 +233,7 @@ SkPoint kTestPoints2[] = {
{ SkIntToScalar(9), SkIntToScalar(1) },
{ SkIntToScalar(10), SkIntToScalar(1) },
};
-
+
///////////////////////////////////////////////////////////////////////////////
// Macros for defining test steps
@@ -265,7 +265,7 @@ TEST_STEP(NAME, NAME##TestStep )
///////////////////////////////////////////////////////////////////////////////
-// Basic test steps for most virtual methods in SkCanvas that draw or affect
+// Basic test steps for most virtual methods in SkCanvas that draw or affect
// the state of the canvas.
SIMPLE_TEST_STEP_WITH_ASSERT(Translate,
@@ -323,9 +323,9 @@ SIMPLE_TEST_STEP(DrawData, drawData(kTestText.c_str(), kTestText.size()));
///////////////////////////////////////////////////////////////////////////////
// Complex test steps
-// Save/restore calls cannot be in isolated simple test steps because the test
+// Save/restore calls cannot be in isolated simple test steps because the test
// cases that use SkPicture require that save and restore calls be balanced.
-static void SaveMatrixStep(SkCanvas* canvas,
+static void SaveMatrixStep(SkCanvas* canvas,
skiatest::Reporter* reporter,
CanvasTestStep* testStep) {
int saveCount = canvas->getSaveCount();
@@ -333,16 +333,16 @@ static void SaveMatrixStep(SkCanvas* canvas,
canvas->clipRegion(kTestRegion);
canvas->translate(SkIntToScalar(1), SkIntToScalar(2));
canvas->restore();
- REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount,
+ REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount,
testStep->assertMessage());
- REPORTER_ASSERT_MESSAGE(reporter, canvas->getTotalMatrix().isIdentity(),
+ REPORTER_ASSERT_MESSAGE(reporter, canvas->getTotalMatrix().isIdentity(),
testStep->assertMessage());
REPORTER_ASSERT_MESSAGE(reporter, canvas->getTotalClip() == kTestRegion,
testStep->assertMessage());
}
TEST_STEP(SaveMatrix, SaveMatrixStep);
-static void SaveClipStep(SkCanvas* canvas,
+static void SaveClipStep(SkCanvas* canvas,
skiatest::Reporter* reporter,
CanvasTestStep* testStep) {
int saveCount = canvas->getSaveCount();
@@ -350,16 +350,16 @@ static void SaveClipStep(SkCanvas* canvas,
canvas->translate(SkIntToScalar(1), SkIntToScalar(2));
canvas->clipRegion(kTestRegion);
canvas->restore();
- REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount,
+ REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount,
testStep->assertMessage());
- REPORTER_ASSERT_MESSAGE(reporter, !canvas->getTotalMatrix().isIdentity(),
+ REPORTER_ASSERT_MESSAGE(reporter, !canvas->getTotalMatrix().isIdentity(),
testStep->assertMessage());
REPORTER_ASSERT_MESSAGE(reporter, canvas->getTotalClip() != kTestRegion,
testStep->assertMessage());
}
TEST_STEP(SaveClip, SaveClipStep);
-static void SaveMatrixClipStep(SkCanvas* canvas,
+static void SaveMatrixClipStep(SkCanvas* canvas,
skiatest::Reporter* reporter,
CanvasTestStep* testStep) {
int saveCount = canvas->getSaveCount();
@@ -367,53 +367,53 @@ static void SaveMatrixClipStep(SkCanvas* canvas,
canvas->translate(SkIntToScalar(1), SkIntToScalar(2));
canvas->clipRegion(kTestRegion);
canvas->restore();
- REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount,
+ REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount,
testStep->assertMessage());
- REPORTER_ASSERT_MESSAGE(reporter, canvas->getTotalMatrix().isIdentity(),
+ REPORTER_ASSERT_MESSAGE(reporter, canvas->getTotalMatrix().isIdentity(),
testStep->assertMessage());
REPORTER_ASSERT_MESSAGE(reporter, canvas->getTotalClip() != kTestRegion,
testStep->assertMessage());
}
TEST_STEP(SaveMatrixClip, SaveMatrixClipStep);
-static void SaveLayerStep(SkCanvas* canvas,
+static void SaveLayerStep(SkCanvas* canvas,
skiatest::Reporter* reporter,
CanvasTestStep* testStep) {
int saveCount = canvas->getSaveCount();
canvas->saveLayer(NULL, NULL);
canvas->restore();
- REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount,
+ REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount,
testStep->assertMessage());
}
TEST_STEP(SaveLayer, SaveLayerStep);
-static void BoundedSaveLayerStep(SkCanvas* canvas,
+static void BoundedSaveLayerStep(SkCanvas* canvas,
skiatest::Reporter* reporter,
CanvasTestStep* testStep) {
int saveCount = canvas->getSaveCount();
canvas->saveLayer(&kTestRect, NULL);
canvas->restore();
- REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount,
+ REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount,
testStep->assertMessage());
}
TEST_STEP(BoundedSaveLayer, BoundedSaveLayerStep);
-static void PaintSaveLayerStep(SkCanvas* canvas,
+static void PaintSaveLayerStep(SkCanvas* canvas,
skiatest::Reporter* reporter,
CanvasTestStep* testStep) {
int saveCount = canvas->getSaveCount();
canvas->saveLayer(NULL, &kTestPaint);
canvas->restore();
- REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount,
+ REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount,
testStep->assertMessage());
}
TEST_STEP(PaintSaveLayer, PaintSaveLayerStep);
-static void TwoClipOpsStep(SkCanvas* canvas,
+static void TwoClipOpsStep(SkCanvas* canvas,
skiatest::Reporter* reporter,
CanvasTestStep* testStep) {
// This test exercises a functionality in SkPicture that leads to the
- // recording of restore offset placeholders. This test will trigger an
+ // recording of restore offset placeholders. This test will trigger an
// assertion at playback time if the placeholders are not properly
// filled when the recording ends.
canvas->clipRect(kTestRect);
@@ -423,7 +423,7 @@ TEST_STEP(TwoClipOps, TwoClipOpsStep);
// exercise fix for http://code.google.com/p/skia/issues/detail?id=560
// ('SkPathStroker::lineTo() fails for line with length SK_ScalarNearlyZero')
-static void DrawNearlyZeroLengthPathTestStep(SkCanvas* canvas,
+static void DrawNearlyZeroLengthPathTestStep(SkCanvas* canvas,
skiatest::Reporter* reporter,
CanvasTestStep* testStep) {
SkPaint paint;
@@ -444,7 +444,7 @@ static void DrawNearlyZeroLengthPathTestStep(SkCanvas* canvas,
}
TEST_STEP(DrawNearlyZeroLengthPath, DrawNearlyZeroLengthPathTestStep);
-static void DrawVerticesShaderTestStep(SkCanvas* canvas,
+static void DrawVerticesShaderTestStep(SkCanvas* canvas,
skiatest::Reporter* reporter,
CanvasTestStep* testStep) {
SkPoint pts[4];
@@ -461,7 +461,7 @@ static void DrawVerticesShaderTestStep(SkCanvas* canvas,
}
TEST_STEP(DrawVerticesShader, DrawVerticesShaderTestStep);
-static void DrawPictureTestStep(SkCanvas* canvas,
+static void DrawPictureTestStep(SkCanvas* canvas,
skiatest::Reporter* reporter,
CanvasTestStep* testStep) {
SkPicture* testPicture = SkNEW_ARGS(SkPicture, ());
@@ -474,7 +474,7 @@ static void DrawPictureTestStep(SkCanvas* canvas,
}
TEST_STEP(DrawPicture, DrawPictureTestStep);
-static void SaveRestoreTestStep(SkCanvas* canvas,
+static void SaveRestoreTestStep(SkCanvas* canvas,
skiatest::Reporter* reporter,
CanvasTestStep* testStep) {
int baseSaveCount = canvas->getSaveCount();
@@ -497,7 +497,7 @@ static void SaveRestoreTestStep(SkCanvas* canvas,
}
TEST_STEP(SaveRestore, SaveRestoreTestStep);
-static void DrawLayerTestStep(SkCanvas* canvas,
+static void DrawLayerTestStep(SkCanvas* canvas,
skiatest::Reporter* reporter,
CanvasTestStep* testStep) {
REPORTER_ASSERT_MESSAGE(reporter, !canvas->isDrawingToLayer(),
@@ -506,7 +506,7 @@ static void DrawLayerTestStep(SkCanvas* canvas,
REPORTER_ASSERT_MESSAGE(reporter, !canvas->isDrawingToLayer(),
testStep->assertMessage());
canvas->restore();
-
+
const SkRect* bounds = NULL; // null means include entire bounds
const SkPaint* paint = NULL;
@@ -575,7 +575,7 @@ TEST_STEP(NestedSaveRestoreWithFlush, \
NestedSaveRestoreWithFlushTestStep);
static void AssertCanvasStatesEqual(skiatest::Reporter* reporter,
- const SkCanvas* canvas1,
+ const SkCanvas* canvas1,
const SkCanvas* canvas2,
CanvasTestStep* testStep) {
REPORTER_ASSERT_MESSAGE(reporter, canvas1->getDeviceSize() ==
@@ -611,7 +611,7 @@ static void AssertCanvasStatesEqual(skiatest::Reporter* reporter,
canvas2->getTotalClip(), testStep->assertMessage());
// The following test code is commented out because the test fails when
- // the canvas is an SkPictureRecord or SkDeferredCanvas
+ // the canvas is an SkPictureRecord or SkDeferredCanvas
// Issue: http://code.google.com/p/skia/issues/detail?id=498
// Also, creating a LayerIter on an SkProxyCanvas crashes
// Issue: http://code.google.com/p/skia/issues/detail?id=499
@@ -699,12 +699,12 @@ private:
}
}
*/
-
+
}
public:
- static void TestPictureFlattenedObjectReuse(skiatest::Reporter* reporter,
+ static void TestPictureFlattenedObjectReuse(skiatest::Reporter* reporter,
CanvasTestStep* testStep,
uint32_t recordFlags) {
// Verify that when a test step is executed twice, no extra resources
@@ -753,7 +753,7 @@ public:
deferredCanvas.flush();
testStep->setAssertMessageFormat(
kDeferredPostFlushPlaybackAssertMessageFormat);
- AssertCanvasStatesEqual(reporter,
+ AssertCanvasStatesEqual(reporter,
deferredCanvas.immediateCanvas(),
&referenceCanvas, testStep);
@@ -835,7 +835,7 @@ static void TestNWayCanvasStateConsistency(
* that the all canvas derivatives report the same state as an SkCanvas
* after having executed the test step.
*/
-static void TestOverrideStateConsistency(skiatest::Reporter* reporter,
+static void TestOverrideStateConsistency(skiatest::Reporter* reporter,
CanvasTestStep* testStep) {
SkBitmap referenceStore;
createBitmap(&referenceStore, SkBitmap::kARGB_8888_Config, 0xFFFFFFFF);
@@ -862,7 +862,7 @@ static void TestOverrideStateConsistency(skiatest::Reporter* reporter,
if (false) { // avoid bit rot, suppress warning
TestNWayCanvasStateConsistency(reporter, testStep, referenceCanvas);
}
-
+
if (false) { // avoid bit rot, suppress warning
test_clipVisitor(reporter, &referenceCanvas);
}
diff --git a/tests/ClampRangeTest.cpp b/tests/ClampRangeTest.cpp
index dd13bf4dc6..fa3804eccb 100644
--- a/tests/ClampRangeTest.cpp
+++ b/tests/ClampRangeTest.cpp
@@ -96,7 +96,7 @@ void TestClampRange(skiatest::Reporter* reporter) {
test_range(0xFFFF, 0, 20);
test_range(-ff(2), 0, 20);
test_range( ff(2), 0, 20);
-
+
test_range(-10, 1, 20);
test_range(10, -1, 20);
test_range(-10, 3, 20);
@@ -108,7 +108,7 @@ void TestClampRange(skiatest::Reporter* reporter) {
test_range(ff(1)/2, ff(-16384), 100);
SkRandom rand;
-
+
// test non-overflow cases
for (int i = 0; i < 1000000; i++) {
SkFixed fx = rand.nextS() >> 1;
@@ -117,7 +117,7 @@ void TestClampRange(skiatest::Reporter* reporter) {
SkFixed dx = (sx - fx) / count;
test_range(fx, dx, count);
}
-
+
// test overflow cases
for (int i = 0; i < 100000; i++) {
SkFixed fx = rand.nextS();
diff --git a/tests/ClipCacheTest.cpp b/tests/ClipCacheTest.cpp
index b0be2f15ab..795e861d37 100644
--- a/tests/ClipCacheTest.cpp
+++ b/tests/ClipCacheTest.cpp
@@ -60,7 +60,7 @@ static void test_clip_bounds(skiatest::Reporter* reporter, GrContext* context) {
GrAutoUnref au(texture);
SkIRect intScreen = SkIRect::MakeWH(kXSize, kYSize);
- SkRect screen = SkRect::MakeWH(SkIntToScalar(kXSize),
+ SkRect screen = SkRect::MakeWH(SkIntToScalar(kXSize),
SkIntToScalar(kYSize));
SkRect clipRect(screen);
clipRect.outset(10, 10);
@@ -73,8 +73,8 @@ static void test_clip_bounds(skiatest::Reporter* reporter, GrContext* context) {
bool isIntersectionOfRects = true;
SkRect devStackBounds;
- stack.getConservativeBounds(0, 0, kXSize, kYSize,
- &devStackBounds,
+ stack.getConservativeBounds(0, 0, kXSize, kYSize,
+ &devStackBounds,
&isIntersectionOfRects);
// make sure that the SkClipStack is behaving itself
@@ -119,7 +119,7 @@ static void check_state(skiatest::Reporter* reporter,
static void test_cache(skiatest::Reporter* reporter, GrContext* context) {
if (false) { // avoid bit rot, suppress warning
- createTexture(context);
+ createTexture(context);
}
GrClipMaskCache cache;
diff --git a/tests/ClipCubicTest.cpp b/tests/ClipCubicTest.cpp
index 1c9199f4da..2e913a7354 100644
--- a/tests/ClipCubicTest.cpp
+++ b/tests/ClipCubicTest.cpp
@@ -21,7 +21,7 @@ static void test_giantClip() {
bm.allocPixels();
SkCanvas canvas(bm);
canvas.clear(0);
-
+
SkPath path;
path.moveTo(0, 0); path.lineTo(1, 0); path.lineTo(33, 1);
SkPaint paint;
diff --git a/tests/ClipStackTest.cpp b/tests/ClipStackTest.cpp
index 1def9b4e94..19e28ad647 100644
--- a/tests/ClipStackTest.cpp
+++ b/tests/ClipStackTest.cpp
@@ -269,7 +269,7 @@ static void test_bounds(skiatest::Reporter* reporter, bool useRects) {
&isIntersectionOfRects);
if (useRects) {
- REPORTER_ASSERT(reporter, isIntersectionOfRects ==
+ REPORTER_ASSERT(reporter, isIntersectionOfRects ==
(gOps[op] == SkRegion::kIntersect_Op));
} else {
REPORTER_ASSERT(reporter, !isIntersectionOfRects);
diff --git a/tests/ClipperTest.cpp b/tests/ClipperTest.cpp
index 724ff56cd8..b914374b98 100644
--- a/tests/ClipperTest.cpp
+++ b/tests/ClipperTest.cpp
@@ -16,7 +16,7 @@ static void test_hairclipping(skiatest::Reporter* reporter) {
bm.setConfig(SkBitmap::kARGB_8888_Config, 4, 4);
bm.allocPixels();
bm.eraseColor(SK_ColorWHITE);
-
+
SkPaint paint;
paint.setAntiAlias(true);
@@ -24,7 +24,7 @@ static void test_hairclipping(skiatest::Reporter* reporter) {
canvas.clipRect(SkRect::MakeWH(SkIntToScalar(4), SkIntToScalar(2)));
canvas.drawLine(SkFloatToScalar(1.5f), SkFloatToScalar(1.5f),
SkFloatToScalar(3.5f), SkFloatToScalar(3.5f), paint);
-
+
/**
* We had a bug where we misinterpreted the bottom of the clip, and
* would draw another pixel (to the right in this case) on the same
@@ -50,7 +50,7 @@ static void test_hairclipping(skiatest::Reporter* reporter) {
static void test_edgeclipper(skiatest::Reporter* reporter) {
SkEdgeClipper clipper;
-
+
const SkPoint pts[] = {
{ SkFloatToScalar(3.0995476e+010f), SkFloatToScalar(42.929779f) },
{ SkFloatToScalar(-3.0995163e+010f), SkFloatToScalar(51.050385f) },
@@ -97,7 +97,7 @@ static void test_intersectline(skiatest::Reporter* reporter) {
}
REPORTER_ASSERT(reporter, !valid);
}
-
+
static const SkPoint gFull[] = {
// diagonals, chords
{ L, T }, { R, B },
@@ -121,7 +121,7 @@ static void test_intersectline(skiatest::Reporter* reporter) {
}
REPORTER_ASSERT(reporter, valid && !memcmp(&gFull[i], dst, sizeof(dst)));
}
-
+
static const SkPoint gPartial[] = {
{ L - 10, CY }, { CX, CY }, { L, CY }, { CX, CY },
{ CX, T - 10 }, { CX, CY }, { CX, T }, { CX, CY },
@@ -141,7 +141,7 @@ static void test_intersectline(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, valid &&
!memcmp(&gPartial[i+2], dst, sizeof(dst)));
}
-
+
}
static void TestClipper(skiatest::Reporter* reporter) {
diff --git a/tests/ColorFilterTest.cpp b/tests/ColorFilterTest.cpp
index 7cfb467c2b..4016f2193d 100644
--- a/tests/ColorFilterTest.cpp
+++ b/tests/ColorFilterTest.cpp
@@ -72,13 +72,13 @@ static void test_asColorMode(skiatest::Reporter* reporter) {
if (m != expectedMode) {
expectedMode = SkXfermode::kSrc_Mode;
}
- }
+ }
// SkDebugf("--- got [%d %x] expected [%d %x]\n", m, c, expectedMode, expectedColor);
REPORTER_ASSERT(reporter, c == expectedColor);
REPORTER_ASSERT(reporter, m == expectedMode);
-
+
{
SkColorFilter* cf2 = reincarnate(cf);
SkAutoUnref aur2(cf2);
diff --git a/tests/DataRefTest.cpp b/tests/DataRefTest.cpp
index 8505fa96a0..d6ba775ccd 100644
--- a/tests/DataRefTest.cpp
+++ b/tests/DataRefTest.cpp
@@ -14,7 +14,7 @@ template <typename T> class SkTUnref {
public:
SkTUnref(T* ref) : fRef(ref) {}
~SkTUnref() { fRef->unref(); }
-
+
operator T*() { return fRef; }
operator const T*() { return fRef; }
@@ -42,7 +42,7 @@ static void test_dataset_subset(skiatest::Reporter* reporter,
static void test_datasets_equal(skiatest::Reporter* reporter,
const SkDataSet& ds0, const SkDataSet& ds1) {
REPORTER_ASSERT(reporter, ds0.count() == ds1.count());
-
+
test_dataset_subset(reporter, ds0, ds1);
test_dataset_subset(reporter, ds1, ds0);
}
@@ -50,7 +50,7 @@ static void test_datasets_equal(skiatest::Reporter* reporter,
static void test_dataset(skiatest::Reporter* reporter, const SkDataSet& ds,
int count) {
REPORTER_ASSERT(reporter, ds.count() == count);
-
+
SkDataSet::Iter iter(ds);
int index = 0;
for (; !iter.done(); iter.next()) {
@@ -66,14 +66,14 @@ static void test_dataset(skiatest::Reporter* reporter, const SkDataSet& ds,
SkMemoryStream istream;
istream.setData(ostream.copyToData())->unref();
SkDataSet copy(&istream);
-
+
test_datasets_equal(reporter, ds, copy);
}
static void test_dataset(skiatest::Reporter* reporter) {
SkDataSet set0(NULL, 0);
SkDataSet set1("hello", SkTUnref<SkData>(SkData::NewWithCString("world")));
-
+
const SkDataSet::Pair pairs[] = {
{ "one", SkData::NewWithCString("1") },
{ "two", SkData::NewWithCString("2") },
@@ -133,7 +133,7 @@ static void TestData(skiatest::Reporter* reporter) {
assert_len(reporter, r1, strlen(str));
assert_len(reporter, r2, N * sizeof(int));
assert_len(reporter, r3, 6);
-
+
assert_data(reporter, r1, str, strlen(str));
assert_data(reporter, r3, "people", 6);
@@ -143,7 +143,7 @@ static void TestData(skiatest::Reporter* reporter) {
tmp = SkData::NewSubset(r1, 0, 0);
assert_len(reporter, tmp, 0);
tmp->unref();
-
+
test_cstring(reporter);
test_dataset(reporter);
}
diff --git a/tests/DeferredCanvasTest.cpp b/tests/DeferredCanvasTest.cpp
index 8f72603696..5eda56832f 100644
--- a/tests/DeferredCanvasTest.cpp
+++ b/tests/DeferredCanvasTest.cpp
@@ -90,7 +90,7 @@ static void TestDeferredCanvasFreshFrame(skiatest::Reporter* reporter) {
canvas.clipRect(partialRect, SkRegion::kIntersect_Op, false);
canvas.clear(0x00000000);
canvas.restore();
- REPORTER_ASSERT(reporter, canvas.isFreshFrame());
+ REPORTER_ASSERT(reporter, canvas.isFreshFrame());
// Verify that full frame rects with different forms of opaque paint
// trigger frames to be marked as fresh
@@ -107,11 +107,11 @@ static void TestDeferredCanvasFreshFrame(skiatest::Reporter* reporter) {
SkBitmap bmp;
create(&bmp, SkBitmap::kARGB_8888_Config, 0xFFFFFFFF);
bmp.setIsOpaque(true);
- SkShader* shader = SkShader::CreateBitmapShader(bmp,
+ SkShader* shader = SkShader::CreateBitmapShader(bmp,
SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);
paint.setShader(shader)->unref();
canvas.drawRect(fullRect, paint);
- REPORTER_ASSERT(reporter, canvas.isFreshFrame());
+ REPORTER_ASSERT(reporter, canvas.isFreshFrame());
}
// Verify that full frame rects with different forms of non-opaque paint
@@ -129,11 +129,11 @@ static void TestDeferredCanvasFreshFrame(skiatest::Reporter* reporter) {
SkBitmap bmp;
create(&bmp, SkBitmap::kARGB_8888_Config, 0xFFFFFFFF);
bmp.setIsOpaque(false);
- SkShader* shader = SkShader::CreateBitmapShader(bmp,
+ SkShader* shader = SkShader::CreateBitmapShader(bmp,
SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);
paint.setShader(shader)->unref();
canvas.drawRect(fullRect, paint);
- REPORTER_ASSERT(reporter, !canvas.isFreshFrame());
+ REPORTER_ASSERT(reporter, !canvas.isFreshFrame());
}
// Verify that incomplete coverage does not trigger a fresh frame
@@ -165,7 +165,7 @@ static void TestDeferredCanvasFreshFrame(skiatest::Reporter* reporter) {
canvas.drawRect(fullRect, paint);
REPORTER_ASSERT(reporter, !canvas.isFreshFrame());
}
-
+
// Verify kSrcMode triggers a fresh frame even with transparent color
{
SkPaint paint;
@@ -227,7 +227,7 @@ public:
fStorageAllocatedChangedCount++;
}
virtual void flushedDrawCommands() SK_OVERRIDE {
- fFlushedDrawCommandsCount++;
+ fFlushedDrawCommandsCount++;
}
int fPrepareForDrawCount;
@@ -258,7 +258,7 @@ static void TestDeferredCanvasBitmapCaching(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, 1 == notificationCounter.fStorageAllocatedChangedCount);
// stored bitmap + drawBitmap command
REPORTER_ASSERT(reporter, canvas.storageAllocatedForRecording() > bitmapSize);
-
+
// verify that nothing can be freed at this point
REPORTER_ASSERT(reporter, 0 == canvas.freeMemoryIfPossible(~0));
@@ -292,7 +292,7 @@ static void TestDeferredCanvasBitmapCaching(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, bytesFreed >= bitmapSize);
REPORTER_ASSERT(reporter, bytesFreed < 2*bitmapSize);
- // Verifiy that partial purge works, image zero is in cache but not reffed by
+ // Verifiy that partial purge works, image zero is in cache but not reffed by
// a pending draw, while image 1 is locked-in.
canvas.freeMemoryIfPossible(~0);
REPORTER_ASSERT(reporter, 2 == notificationCounter.fFlushedDrawCommandsCount);
diff --git a/tests/DequeTest.cpp b/tests/DequeTest.cpp
index 00162bb6ad..62e8e4db7d 100644
--- a/tests/DequeTest.cpp
+++ b/tests/DequeTest.cpp
@@ -80,10 +80,10 @@ public:
}
};
-static void assert_blocks(skiatest::Reporter* reporter,
+static void assert_blocks(skiatest::Reporter* reporter,
const SkDeque& deq,
int allocCount) {
- DequeUnitTestHelper helper(deq);
+ DequeUnitTestHelper helper(deq);
if (0 == deq.count()) {
REPORTER_ASSERT(reporter, 1 == helper.fNumBlocksAllocated);
@@ -91,8 +91,8 @@ static void assert_blocks(skiatest::Reporter* reporter,
int expected = (deq.count() + allocCount - 1) / allocCount;
// A block isn't freed in the deque when it first becomes empty so
// sometimes an extra block lingers around
- REPORTER_ASSERT(reporter,
- expected == helper.fNumBlocksAllocated ||
+ REPORTER_ASSERT(reporter,
+ expected == helper.fNumBlocksAllocated ||
expected+1 == helper.fNumBlocksAllocated);
}
}
diff --git a/tests/DrawBitmapRectTest.cpp b/tests/DrawBitmapRectTest.cpp
index e11acbc95e..0147a71faf 100644
--- a/tests/DrawBitmapRectTest.cpp
+++ b/tests/DrawBitmapRectTest.cpp
@@ -37,41 +37,41 @@ static void test_wacky_bitmapshader(skiatest::Reporter* reporter,
dev.setConfig(SkBitmap::kARGB_8888_Config, 0x56F, 0x4f6);
dev.allocPixels();
dev.eraseColor(0); // necessary, so we know if we draw to it
-
+
SkMatrix matrix;
-
+
SkCanvas c(dev);
- matrix.setAll(SkFloatToScalar(-119.34097f),
- SkFloatToScalar(-43.436558f),
+ matrix.setAll(SkFloatToScalar(-119.34097f),
+ SkFloatToScalar(-43.436558f),
SkFloatToScalar(93489.945f),
- SkFloatToScalar(43.436558f),
- SkFloatToScalar(-119.34097f),
+ SkFloatToScalar(43.436558f),
+ SkFloatToScalar(-119.34097f),
SkFloatToScalar(123.98426f),
0, 0, SK_Scalar1);
c.concat(matrix);
-
+
SkBitmap bm;
bm.setConfig(SkBitmap::kARGB_8888_Config, width, height);
bm.allocPixels();
bm.eraseColor(SK_ColorRED);
-
+
SkShader* s = SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode,
SkShader::kRepeat_TileMode);
- matrix.setAll(SkFloatToScalar(0.0078740157f),
- 0,
+ matrix.setAll(SkFloatToScalar(0.0078740157f),
+ 0,
SkIntToScalar(249),
- 0,
- SkFloatToScalar(0.0078740157f),
+ 0,
+ SkFloatToScalar(0.0078740157f),
SkIntToScalar(239),
0, 0, SK_Scalar1);
s->setLocalMatrix(matrix);
-
+
SkPaint paint;
paint.setShader(s)->unref();
-
+
SkRect r = SkRect::MakeXYWH(681, 239, 695, 253);
c.drawRect(r, paint);
-
+
assert_ifDrawnTo(reporter, dev, shouldBeDrawn);
}
#endif
@@ -106,7 +106,7 @@ static void test_giantrepeat_crbug118018(skiatest::Reporter* reporter) {
{ 0x7f, 0xFFFF, true }, // should draw, test max height
{ 0xFFFF, 0xFFFF, false }, // allocation fails (too much RAM)
};
-
+
for (size_t i = 0; i < SK_ARRAY_COUNT(gTests); ++i) {
test_wacky_bitmapshader(reporter,
gTests[i].fWidth, gTests[i].fHeight,
@@ -127,11 +127,11 @@ static void test_nan_antihair(skiatest::Reporter* reporter) {
SkPath path;
path.moveTo(0, 0);
path.lineTo(10, SK_ScalarNaN);
-
+
SkPaint paint;
paint.setAntiAlias(true);
paint.setStyle(SkPaint::kStroke_Style);
-
+
// before our fix to SkScan_Antihair.cpp to check for integral NaN (0x800...)
// this would trigger an assert/crash.
//
diff --git a/tests/DrawPathTest.cpp b/tests/DrawPathTest.cpp
index 8b787bb197..55e3164b10 100644
--- a/tests/DrawPathTest.cpp
+++ b/tests/DrawPathTest.cpp
@@ -64,13 +64,13 @@ static void test_crbug131181(skiatest::Reporter*) {
0x419727af, 0x43011f0c, 0x41972663, 0x43011f27,
0x419728fc, 0x43011ed4, 0x4194064b, 0x43012197
};
-
+
SkPath path;
moveToH(&path, &data[0]);
cubicToH(&path, &data[2]);
-
+
SkAutoTUnref<SkCanvas> canvas(new_canvas(640, 480));
-
+
SkPaint paint;
paint.setAntiAlias(true);
canvas->drawPath(path, paint);
@@ -84,7 +84,7 @@ static void test_crbug_140803(skiatest::Reporter* reporter) {
bm.setConfig(SkBitmap::kARGB_8888_Config, 2700, 30*1024);
bm.allocPixels();
SkCanvas canvas(bm);
-
+
SkPath path;
path.moveTo(2762, 20);
path.quadTo(11, 21702, 10, 21706);
@@ -100,7 +100,7 @@ static void test_crbug_140803(skiatest::Reporter* reporter) {
//
static void test_inversepathwithclip(skiatest::Reporter* reporter) {
SkPath path;
-
+
path.moveTo(0, SkIntToScalar(20));
path.quadTo(SkIntToScalar(10), SkIntToScalar(10),
SkIntToScalar(20), SkIntToScalar(20));
@@ -118,7 +118,7 @@ static void test_inversepathwithclip(skiatest::Reporter* reporter) {
canvas.get()->drawPath(path, paint);
canvas.get()->restore();
-
+
// Now do the test again, with the path flipped, so we only draw in the
// top half of our bounds, and have the clip intersect our bounds at the
// bottom.
@@ -145,7 +145,7 @@ static void test_bug533(skiatest::Reporter* reporter) {
SkPath path;
path.moveTo(64, 3);
path.quadTo(-329936, -100000000, 1153, 330003);
-
+
SkPaint paint;
paint.setAntiAlias(true);
@@ -194,10 +194,10 @@ static void test_bigcubic(skiatest::Reporter* reporter) {
SkPath path;
path.moveTo(64, 3);
path.cubicTo(-329936, -100000000, -329936, 100000000, 1153, 330003);
-
+
SkPaint paint;
paint.setAntiAlias(true);
-
+
SkAutoTUnref<SkCanvas> canvas(new_canvas(640, 480));
canvas.get()->drawPath(path, paint);
#endif
@@ -211,7 +211,7 @@ static void test_giantaa(skiatest::Reporter* reporter) {
const int H = 400;
SkAutoTUnref<SkCanvas> canvas(new_canvas(33000, 10));
canvas.get()->clear(0);
-
+
SkPaint paint;
paint.setAntiAlias(true);
SkPath path;
diff --git a/tests/DrawTextTest.cpp b/tests/DrawTextTest.cpp
index c5fa326bda..4f3eb829a1 100644
--- a/tests/DrawTextTest.cpp
+++ b/tests/DrawTextTest.cpp
@@ -67,7 +67,7 @@ static void test_drawText(skiatest::Reporter* reporter) {
SkPaint paint;
paint.setColor(SK_ColorGRAY);
paint.setTextSize(SkIntToScalar(20));
-
+
SkIRect drawTextRect = SkIRect::MakeWH(64, 64);
SkBitmap drawTextBitmap;
create(&drawTextBitmap, drawTextRect, SkBitmap::kARGB_8888_Config);
diff --git a/tests/FillPathTest.cpp b/tests/FillPathTest.cpp
index 22ceb1987d..0ddf4e2521 100644
--- a/tests/FillPathTest.cpp
+++ b/tests/FillPathTest.cpp
@@ -28,7 +28,7 @@ struct FakeBlitter : public SkBlitter {
}
// http://code.google.com/p/skia/issues/detail?id=87
-// Lines which is not clipped by boundary based clipping,
+// Lines which is not clipped by boundary based clipping,
// but skipped after tessellation, should be cleared by the blitter.
static void TestFillPathInverse(skiatest::Reporter* reporter) {
FakeBlitter blitter;
diff --git a/tests/FlateTest.cpp b/tests/FlateTest.cpp
index 446e41242d..879973fc90 100644
--- a/tests/FlateTest.cpp
+++ b/tests/FlateTest.cpp
@@ -74,13 +74,13 @@ static void TestFlate(skiatest::Reporter* reporter, SkMemoryStream* testStream,
inputSize = testStream->read(NULL, SkZeroSizeMemStream::kGetSizeKey);
REPORTER_ASSERT(reporter, data1->size() == inputSize);
REPORTER_ASSERT(reporter, memcmp(testStream->getMemoryBase(),
- data1->data(),
+ data1->data(),
data1->size()) == 0);
// Check that the uncompressed data matches the source data.
SkAutoDataUnref data2(uncompressed.copyToData());
REPORTER_ASSERT(reporter, testData.getLength() == uncompressed.getOffset());
- REPORTER_ASSERT(reporter, memcmp(testData.getMemoryBase(),
+ REPORTER_ASSERT(reporter, memcmp(testData.getMemoryBase(),
data2->data(),
testData.getLength()) == 0);
}
diff --git a/tests/FontHostStreamTest.cpp b/tests/FontHostStreamTest.cpp
index b1c49f83ab..eb301e3535 100644
--- a/tests/FontHostStreamTest.cpp
+++ b/tests/FontHostStreamTest.cpp
@@ -71,7 +71,7 @@ static void test_fontHostStream(skiatest::Reporter* reporter) {
SkPaint paint;
paint.setColor(SK_ColorGRAY);
paint.setTextSize(SkIntToScalar(30));
-
+
paint.setTypeface(SkTypeface::CreateFromName("Georgia", SkTypeface::kNormal))->unref();
SkIRect origRect = SkIRect::MakeWH(64, 64);
diff --git a/tests/FontHostTest.cpp b/tests/FontHostTest.cpp
index ab0d58e0b6..879fdd0720 100644
--- a/tests/FontHostTest.cpp
+++ b/tests/FontHostTest.cpp
@@ -73,7 +73,7 @@ static void test_tables(skiatest::Reporter* reporter, SkTypeface* face) {
REPORTER_ASSERT(reporter, gKnownTableSizes[j].fSize == size);
}
}
-
+
// do we get the same size from GetTableData and GetTableSize
{
SkAutoMalloc data(size);
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index 888da2de09..e14198c6db 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -74,7 +74,7 @@ bool GrGpuGL::programUnitTest() {
dummyDesc.fHeight = 22;
SkAutoTUnref<GrTexture> dummyTexture2(this->createTexture(dummyDesc, NULL, 0));
- // GrGLSLGeneration glslGeneration =
+ // GrGLSLGeneration glslGeneration =
GrGetGLSLGeneration(this->glBinding(), this->glInterface());
static const int STAGE_OPTS[] = {
0,
@@ -199,7 +199,7 @@ static void GLProgramsTest(skiatest::Reporter* reporter, GrContext* context) {
#include "TestClassDef.h"
DEFINE_GPUTESTCLASS("GLPrograms", GLProgramsTestClass, GLProgramsTest)
-// This is evil evil evil. The linker may throw away whole translation units as dead code if it
+// This is evil evil evil. The linker may throw away whole translation units as dead code if it
// thinks none of the functions are called. It will do this even if there are static initilializers
// in the unit that could pass pointers to functions from the unit out to other translation units!
// We force some of the effects that would otherwise be discarded to link here.
diff --git a/tests/GeometryTest.cpp b/tests/GeometryTest.cpp
index 12cc81632f..69d980ac8b 100644
--- a/tests/GeometryTest.cpp
+++ b/tests/GeometryTest.cpp
@@ -15,7 +15,7 @@ static bool nearly_equal(const SkPoint& a, const SkPoint& b) {
static void testChopCubic(skiatest::Reporter* reporter) {
/*
Inspired by this test, which used to assert that the tValues had dups
-
+
<path stroke="#202020" d="M0,0 C0,0 1,1 2190,5130 C2190,5070 2220,5010 2205,4980" />
*/
const SkPoint src[] = {
@@ -57,7 +57,7 @@ static void TestGeometry(skiatest::Reporter* reporter) {
for (int i = 0; i < 4; ++i) {
REPORTER_ASSERT(reporter, nearly_equal(cubic[i], dst[i]));
}
-
+
testChopCubic(reporter);
}
diff --git a/tests/GradientTest.cpp b/tests/GradientTest.cpp
index 36103c1d5f..007caa3b4e 100644
--- a/tests/GradientTest.cpp
+++ b/tests/GradientTest.cpp
@@ -62,7 +62,7 @@ static void linear_gradproc(skiatest::Reporter* reporter, const GradRec& rec) {
rec.fPos,
rec.fColorCount,
rec.fTileMode));
-
+
SkShader::GradientInfo info;
rec.gradCheck(reporter, s, &info, SkShader::kLinear_GradientType);
REPORTER_ASSERT(reporter, !memcmp(info.fPoint, rec.fPoint, 2 * sizeof(SkPoint)));
@@ -75,7 +75,7 @@ static void radial_gradproc(skiatest::Reporter* reporter, const GradRec& rec) {
rec.fPos,
rec.fColorCount,
rec.fTileMode));
-
+
SkShader::GradientInfo info;
rec.gradCheck(reporter, s, &info, SkShader::kRadial_GradientType);
REPORTER_ASSERT(reporter, info.fPoint[0] == rec.fPoint[0]);
@@ -91,7 +91,7 @@ static void radial2_gradproc(skiatest::Reporter* reporter, const GradRec& rec) {
rec.fPos,
rec.fColorCount,
rec.fTileMode));
-
+
SkShader::GradientInfo info;
rec.gradCheck(reporter, s, &info, SkShader::kRadial2_GradientType);
REPORTER_ASSERT(reporter, !memcmp(info.fPoint, rec.fPoint, 2 * sizeof(SkPoint)));
@@ -104,7 +104,7 @@ static void sweep_gradproc(skiatest::Reporter* reporter, const GradRec& rec) {
rec.fColors,
rec.fPos,
rec.fColorCount));
-
+
SkShader::GradientInfo info;
rec.gradCheck(reporter, s, &info, SkShader::kSweep_GradientType);
REPORTER_ASSERT(reporter, info.fPoint[0] == rec.fPoint[0]);
@@ -119,7 +119,7 @@ static void conical_gradproc(skiatest::Reporter* reporter, const GradRec& rec) {
rec.fPos,
rec.fColorCount,
rec.fTileMode));
-
+
SkShader::GradientInfo info;
rec.gradCheck(reporter, s, &info, SkShader::kConical_GradientType);
REPORTER_ASSERT(reporter, !memcmp(info.fPoint, rec.fPoint, 2 * sizeof(SkPoint)));
@@ -154,7 +154,7 @@ static void TestGradients(skiatest::Reporter* reporter) {
sweep_gradproc,
conical_gradproc,
};
-
+
for (size_t i = 0; i < SK_ARRAY_COUNT(gProcs); ++i) {
gProcs[i](reporter, rec);
}
diff --git a/tests/MathTest.cpp b/tests/MathTest.cpp
index 6f945dd79e..fb2adc127a 100644
--- a/tests/MathTest.cpp
+++ b/tests/MathTest.cpp
@@ -39,7 +39,7 @@ static void test_floor(skiatest::Reporter* reporter) {
static const float gVals[] = {
0, 1, 1.1f, 1.01f, 1.001f, 1.0001f, 1.00001f, 1.000001f, 1.0000001f
};
-
+
for (size_t i = 0; i < SK_ARRAY_COUNT(gVals); ++i) {
test_floor_value(reporter, gVals[i]);
// test_floor_value(reporter, -gVals[i]);
@@ -305,7 +305,7 @@ static void unittest_isfinite(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, !SkScalarIsNaN(big));
REPORTER_ASSERT(reporter, !SkScalarIsNaN(-big));
REPORTER_ASSERT(reporter, !SkScalarIsNaN(0));
-
+
REPORTER_ASSERT(reporter, !SkScalarIsFinite(nan));
REPORTER_ASSERT(reporter, SkScalarIsFinite(big));
REPORTER_ASSERT(reporter, SkScalarIsFinite(-big));
@@ -457,11 +457,11 @@ static void TestMath(skiatest::Reporter* reporter) {
// These random values are being treated as 32-bit-patterns, not as
// ints; calling SkIntToScalar() here produces crashes.
p.setLength((SkScalar) rand.nextS(),
- (SkScalar) rand.nextS(),
+ (SkScalar) rand.nextS(),
SK_Scalar1);
check_length(reporter, p, SK_Scalar1);
p.setLength((SkScalar) (rand.nextS() >> 13),
- (SkScalar) (rand.nextS() >> 13),
+ (SkScalar) (rand.nextS() >> 13),
SK_Scalar1);
check_length(reporter, p, SK_Scalar1);
}
diff --git a/tests/Matrix44Test.cpp b/tests/Matrix44Test.cpp
index 9e589e6aa9..703787701d 100644
--- a/tests/Matrix44Test.cpp
+++ b/tests/Matrix44Test.cpp
@@ -115,7 +115,7 @@ static void TestMatrix44(skiatest::Reporter* reporter) {
mat.setTranslate(2, 3, 4);
float dataf[16];
double datad[16];
-
+
mat.asColMajorf(dataf);
assert16<float>(reporter, dataf,
1, 0, 0, 0,
diff --git a/tests/MatrixTest.cpp b/tests/MatrixTest.cpp
index 60f4831762..30542dccae 100644
--- a/tests/MatrixTest.cpp
+++ b/tests/MatrixTest.cpp
@@ -88,12 +88,12 @@ static void test_flatten(skiatest::Reporter* reporter, const SkMatrix& m) {
uint32_t size2 = m.writeToMemory(buffer);
REPORTER_ASSERT(reporter, size1 == size2);
REPORTER_ASSERT(reporter, size1 <= SkMatrix::kMaxFlattenSize);
-
+
SkMatrix m2;
uint32_t size3 = m2.readFromMemory(buffer);
REPORTER_ASSERT(reporter, size1 == size3);
REPORTER_ASSERT(reporter, are_equal(reporter, m, m2));
-
+
char buffer2[SkMatrix::kMaxFlattenSize + 100];
size3 = m2.writeToMemory(buffer2);
REPORTER_ASSERT(reporter, size1 == size3);
@@ -149,7 +149,7 @@ static void test_matrix_max_stretch(skiatest::Reporter* reporter) {
mat.postConcat(mats[x]);
}
SkScalar stretch = mat.getMaxStretch();
-
+
if ((stretch < 0) != mat.hasPerspective()) {
stretch = mat.getMaxStretch();
}
diff --git a/tests/MemsetTest.cpp b/tests/MemsetTest.cpp
index 7e80b57ddc..ad1a21c77c 100644
--- a/tests/MemsetTest.cpp
+++ b/tests/MemsetTest.cpp
@@ -12,7 +12,7 @@
static void test_chunkalloc(skiatest::Reporter* reporter) {
size_t min = 256;
SkChunkAlloc alloc(min);
-
+
REPORTER_ASSERT(reporter, 0 == alloc.totalCapacity());
REPORTER_ASSERT(reporter, 0 == alloc.blockCount());
REPORTER_ASSERT(reporter, !alloc.contains(NULL));
@@ -27,7 +27,7 @@ static void test_chunkalloc(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, alloc.totalCapacity() >= size);
REPORTER_ASSERT(reporter, alloc.blockCount() > 0);
REPORTER_ASSERT(reporter, alloc.contains(ptr));
-
+
alloc.reset();
REPORTER_ASSERT(reporter, !alloc.contains(ptr));
}
@@ -71,14 +71,14 @@ static bool compare32(const uint32_t base[], uint32_t value, int count) {
static void test_16(skiatest::Reporter* reporter) {
uint16_t buffer[TOTAL];
-
+
for (int count = 0; count < MAX_COUNT; ++count) {
for (int alignment = 0; alignment < MAX_ALIGNMENT; ++alignment) {
set_zero(buffer, sizeof(buffer));
-
+
uint16_t* base = &buffer[PAD + alignment];
sk_memset16(base, VALUE16, count);
-
+
compare16(buffer, 0, PAD + alignment);
compare16(base, VALUE16, count);
compare16(base + count, 0, TOTAL - count - PAD - alignment);
@@ -88,14 +88,14 @@ static void test_16(skiatest::Reporter* reporter) {
static void test_32(skiatest::Reporter* reporter) {
uint32_t buffer[TOTAL];
-
+
for (int count = 0; count < MAX_COUNT; ++count) {
for (int alignment = 0; alignment < MAX_ALIGNMENT; ++alignment) {
set_zero(buffer, sizeof(buffer));
-
+
uint32_t* base = &buffer[PAD + alignment];
sk_memset32(base, VALUE32, count);
-
+
compare32(buffer, 0, PAD + alignment);
compare32(base, VALUE32, count);
compare32(base + count, 0, TOTAL - count - PAD - alignment);
@@ -111,7 +111,7 @@ static void test_32(skiatest::Reporter* reporter) {
static void TestMemset(skiatest::Reporter* reporter) {
test_16(reporter);
test_32(reporter);
-
+
test_chunkalloc(reporter);
};
diff --git a/tests/MetaDataTest.cpp b/tests/MetaDataTest.cpp
index 1cc3ccaec0..439065236a 100644
--- a/tests/MetaDataTest.cpp
+++ b/tests/MetaDataTest.cpp
@@ -36,7 +36,7 @@ static void test_ptrs(skiatest::Reporter* reporter) {
static void TestMetaData(skiatest::Reporter* reporter) {
SkMetaData m1;
-
+
REPORTER_ASSERT(reporter, !m1.findS32("int"));
REPORTER_ASSERT(reporter, !m1.findScalar("scalar"));
REPORTER_ASSERT(reporter, !m1.findString("hello"));
@@ -45,28 +45,28 @@ static void TestMetaData(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, !m1.removeString("hello"));
REPORTER_ASSERT(reporter, !m1.removeString("true"));
REPORTER_ASSERT(reporter, !m1.removeString("false"));
-
+
m1.setS32("int", 12345);
m1.setScalar("scalar", SK_Scalar1 * 42);
m1.setString("hello", "world");
m1.setPtr("ptr", &m1);
m1.setBool("true", true);
m1.setBool("false", false);
-
+
int32_t n;
SkScalar s;
-
+
m1.setScalar("scalar", SK_Scalar1/2);
-
+
REPORTER_ASSERT(reporter, m1.findS32("int", &n) && n == 12345);
REPORTER_ASSERT(reporter, m1.findScalar("scalar", &s) && s == SK_Scalar1/2);
REPORTER_ASSERT(reporter, !strcmp(m1.findString("hello"), "world"));
REPORTER_ASSERT(reporter, m1.hasBool("true", true));
REPORTER_ASSERT(reporter, m1.hasBool("false", false));
-
+
SkMetaData::Iter iter(m1);
const char* name;
-
+
static const struct {
const char* fName;
SkMetaData::Type fType;
@@ -79,7 +79,7 @@ static void TestMetaData(skiatest::Reporter* reporter) {
{ "true", SkMetaData::kBool_Type, 1 },
{ "false", SkMetaData::kBool_Type, 1 }
};
-
+
int loop = 0;
int count;
SkMetaData::Type t;
@@ -99,13 +99,13 @@ static void TestMetaData(skiatest::Reporter* reporter) {
loop += 1;
}
REPORTER_ASSERT(reporter, loop == SK_ARRAY_COUNT(gElems));
-
+
REPORTER_ASSERT(reporter, m1.removeS32("int"));
REPORTER_ASSERT(reporter, m1.removeScalar("scalar"));
REPORTER_ASSERT(reporter, m1.removeString("hello"));
REPORTER_ASSERT(reporter, m1.removeBool("true"));
REPORTER_ASSERT(reporter, m1.removeBool("false"));
-
+
REPORTER_ASSERT(reporter, !m1.findS32("int"));
REPORTER_ASSERT(reporter, !m1.findScalar("scalar"));
REPORTER_ASSERT(reporter, !m1.findString("hello"));
diff --git a/tests/PaintTest.cpp b/tests/PaintTest.cpp
index d459b3941e..2a84e4cdbb 100644
--- a/tests/PaintTest.cpp
+++ b/tests/PaintTest.cpp
@@ -77,7 +77,7 @@ static void regression_cubic(skiatest::Reporter* reporter) {
SkFloatToScalar(304.720354932878f),
SkFloatToScalar(453.15255460013304f),
SkFloatToScalar(305.788586869862f));
-
+
SkRect fillR, strokeR;
fillR = path.getBounds();
diff --git a/tests/ParsePathTest.cpp b/tests/ParsePathTest.cpp
index 116dbd0fd8..c91186005a 100644
--- a/tests/ParsePathTest.cpp
+++ b/tests/ParsePathTest.cpp
@@ -49,7 +49,7 @@ static void TestParsePath(skiatest::Reporter* reporter) {
test_to_from(reporter, path);
}
-
+
SkRect r;
r.set(0, 0, SkFloatToScalar(10), SkFloatToScalar(10.5f));
SkPath p;
diff --git a/tests/PathCoverageTest.cpp b/tests/PathCoverageTest.cpp
index 9734f75e1e..87ec908558 100644
--- a/tests/PathCoverageTest.cpp
+++ b/tests/PathCoverageTest.cpp
@@ -123,7 +123,7 @@ static bool one_d_pe(const int* array, const unsigned int count,
quadraticPointCount_CC(path, SkIntToScalar(1));
uint32_t estimatedCount =
quadraticPointCount_EE(path, SkIntToScalar(1));
-
+
if (false) { // avoid bit rot, suppress warning
computedCount =
quadraticPointCount_EC(path, SkIntToScalar(1));
diff --git a/tests/PathMeasureTest.cpp b/tests/PathMeasureTest.cpp
index 9d153c25bd..211eb11a71 100644
--- a/tests/PathMeasureTest.cpp
+++ b/tests/PathMeasureTest.cpp
@@ -16,12 +16,12 @@ static void test_small_segment3(skiatest::Reporter* reporter) {
{ 100000000000.0f, 100000000000.0f }, { 0, 0 }, { 10, 10 },
{ 10, 10 }, { 0, 0 }, { 10, 10 }
};
-
+
path.moveTo(pts[0]);
for (size_t i = 1; i < SK_ARRAY_COUNT(pts); i += 2) {
path.cubicTo(pts[i], pts[i + 1], pts[i + 2]);
}
-
+
SkPathMeasure meas(path, false);
meas.getLength();
#endif
@@ -32,10 +32,10 @@ static void test_small_segment2(skiatest::Reporter* reporter) {
SkPath path;
const SkPoint pts[] = {
{ 0, 0 },
- { 100000000000.0f, 100000000000.0f }, { 0, 0 },
- { 10, 10 }, { 0, 0 },
+ { 100000000000.0f, 100000000000.0f }, { 0, 0 },
+ { 10, 10 }, { 0, 0 },
};
-
+
path.moveTo(pts[0]);
for (size_t i = 1; i < SK_ARRAY_COUNT(pts); i += 2) {
path.quadTo(pts[i], pts[i + 1]);
@@ -55,7 +55,7 @@ static void test_small_segment(skiatest::Reporter* reporter) {
// tiny (non-zero) jump between these points
{ SK_Scalar1, SK_Scalar1 },
};
-
+
path.moveTo(pts[0]);
for (size_t i = 1; i < SK_ARRAY_COUNT(pts); ++i) {
path.lineTo(pts[i]);
@@ -161,11 +161,11 @@ static void TestPathMeasure(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, tangent.fY == SK_Scalar1);
REPORTER_ASSERT(reporter, meas.getPosTan(SkFloatToScalar(4.5f), &position, &tangent));
REPORTER_ASSERT(reporter,
- SkScalarNearlyEqual(position.fX,
- SkFloatToScalar(2.5f),
+ SkScalarNearlyEqual(position.fX,
+ SkFloatToScalar(2.5f),
SkFloatToScalar(0.0001f)));
REPORTER_ASSERT(reporter,
- SkScalarNearlyEqual(position.fY,
+ SkScalarNearlyEqual(position.fY,
SkFloatToScalar(2.0f),
SkFloatToScalar(0.0001f)));
REPORTER_ASSERT(reporter, tangent.fX == SK_Scalar1);
@@ -193,7 +193,7 @@ static void TestPathMeasure(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, length == SK_Scalar1);
REPORTER_ASSERT(reporter, meas.getPosTan(SK_ScalarHalf, &position, &tangent));
REPORTER_ASSERT(reporter,
- SkScalarNearlyEqual(position.fX,
+ SkScalarNearlyEqual(position.fX,
SkFloatToScalar(1.5f),
SkFloatToScalar(0.0001f)));
REPORTER_ASSERT(reporter,
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index 0053640e15..50b3583cc0 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -22,7 +22,7 @@ static void test_isfinite_after_transform(skiatest::Reporter* reporter) {
SkPath path;
path.quadTo(157, 366, 286, 208);
path.arcTo(37, 442, 315, 163, 957494590897113.0f);
-
+
SkMatrix matrix;
matrix.setScale(1000*1000, 1000*1000);
@@ -47,7 +47,7 @@ static void test_isfinite_after_transform(skiatest::Reporter* reporter) {
static void test_rect_isfinite(skiatest::Reporter* reporter) {
const SkScalar inf = SK_ScalarInfinity;
const SkScalar nan = SK_ScalarNaN;
-
+
SkRect r;
r.setEmpty();
REPORTER_ASSERT(reporter, r.isFinite());
@@ -55,22 +55,22 @@ static void test_rect_isfinite(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, !r.isFinite());
r.set(0, 0, nan, 0);
REPORTER_ASSERT(reporter, !r.isFinite());
-
+
SkPoint pts[] = {
{ 0, 0 },
{ SK_Scalar1, 0 },
{ 0, SK_Scalar1 },
};
-
+
bool isFine = r.setBoundsCheck(pts, 3);
REPORTER_ASSERT(reporter, isFine);
REPORTER_ASSERT(reporter, !r.isEmpty());
-
+
pts[1].set(inf, 0);
isFine = r.setBoundsCheck(pts, 3);
REPORTER_ASSERT(reporter, !isFine);
REPORTER_ASSERT(reporter, r.isEmpty());
-
+
pts[1].set(nan, 0);
isFine = r.setBoundsCheck(pts, 3);
REPORTER_ASSERT(reporter, !isFine);
@@ -80,7 +80,7 @@ static void test_rect_isfinite(skiatest::Reporter* reporter) {
static void test_path_isfinite(skiatest::Reporter* reporter) {
const SkScalar inf = SK_ScalarInfinity;
const SkScalar nan = SK_ScalarNaN;
-
+
SkPath path;
REPORTER_ASSERT(reporter, path.isFinite());
@@ -155,7 +155,7 @@ DONE:
static void test_addPoly(skiatest::Reporter* reporter) {
SkPoint pts[32];
SkRandom rand;
-
+
for (size_t i = 0; i < SK_ARRAY_COUNT(pts); ++i) {
pts[i].fX = rand.nextSScalar1();
pts[i].fY = rand.nextSScalar1();
@@ -173,19 +173,19 @@ static void test_addPoly(skiatest::Reporter* reporter) {
static void test_strokerec(skiatest::Reporter* reporter) {
SkStrokeRec rec(SkStrokeRec::kFill_InitStyle);
REPORTER_ASSERT(reporter, rec.isFillStyle());
-
+
rec.setHairlineStyle();
REPORTER_ASSERT(reporter, rec.isHairlineStyle());
-
+
rec.setStrokeStyle(SK_Scalar1, false);
REPORTER_ASSERT(reporter, SkStrokeRec::kStroke_Style == rec.getStyle());
-
+
rec.setStrokeStyle(SK_Scalar1, true);
REPORTER_ASSERT(reporter, SkStrokeRec::kStrokeAndFill_Style == rec.getStyle());
-
+
rec.setStrokeStyle(0, false);
REPORTER_ASSERT(reporter, SkStrokeRec::kHairline_Style == rec.getStyle());
-
+
rec.setStrokeStyle(0, true);
REPORTER_ASSERT(reporter, SkStrokeRec::kFill_Style == rec.getStyle());
}
@@ -226,7 +226,7 @@ static void test_direction(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, valid);
REPORTER_ASSERT(reporter, !path.cheapComputeDirection(NULL));
}
-
+
static const char* gCW[] = {
"M 10 10 L 10 10 Q 20 10 20 20",
"M 10 10 C 20 10 20 20 20 20",
@@ -241,7 +241,7 @@ static void test_direction(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, valid);
check_direction(&path, SkPath::kCW_Direction, reporter);
}
-
+
static const char* gCCW[] = {
"M 10 10 L 10 10 Q 20 10 20 -20",
"M 10 10 C 20 10 20 -20 20 -20",
@@ -309,11 +309,11 @@ static void stroke_cubic(const SkPoint pts[4]) {
SkPath path;
path.moveTo(pts[0]);
path.cubicTo(pts[1], pts[2], pts[3]);
-
+
SkPaint paint;
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeWidth(SK_Scalar1 * 2);
-
+
SkPath fill;
paint.getFillPath(path, &fill);
}
@@ -328,16 +328,16 @@ static void stroke_tiny_cubic() {
{ 372.0f, 92.0f },
{ 372.0f, 92.0f },
};
-
+
stroke_cubic(p0);
-
+
SkPoint p1[] = {
{ 372.0f, 92.0f },
{ 372.0007f, 92.000755f },
{ 371.99927f, 92.003922f },
{ 371.99826f, 92.003899f },
};
-
+
stroke_cubic(p1);
}
@@ -398,7 +398,7 @@ static void test_close(skiatest::Reporter* reporter) {
check_close(reporter, quad);
SkPath cubic;
- quad.cubicTo(SK_Scalar1, SK_Scalar1, 10 * SK_Scalar1,
+ quad.cubicTo(SK_Scalar1, SK_Scalar1, 10 * SK_Scalar1,
10*SK_Scalar1, 20 * SK_Scalar1, 20*SK_Scalar1);
check_close(reporter, cubic);
cubic.close();
@@ -448,27 +448,27 @@ static void test_convexity2(skiatest::Reporter* reporter) {
pt.moveTo(0, 0);
pt.close();
check_convexity(reporter, pt, SkPath::kConvex_Convexity);
-
+
SkPath line;
line.moveTo(12*SK_Scalar1, 20*SK_Scalar1);
line.lineTo(-12*SK_Scalar1, -20*SK_Scalar1);
line.close();
check_convexity(reporter, pt, SkPath::kConvex_Convexity);
-
+
SkPath triLeft;
triLeft.moveTo(0, 0);
triLeft.lineTo(SK_Scalar1, 0);
triLeft.lineTo(SK_Scalar1, SK_Scalar1);
triLeft.close();
check_convexity(reporter, triLeft, SkPath::kConvex_Convexity);
-
+
SkPath triRight;
triRight.moveTo(0, 0);
triRight.lineTo(-SK_Scalar1, 0);
triRight.lineTo(SK_Scalar1, SK_Scalar1);
triRight.close();
check_convexity(reporter, triRight, SkPath::kConvex_Convexity);
-
+
SkPath square;
square.moveTo(0, 0);
square.lineTo(SK_Scalar1, 0);
@@ -476,7 +476,7 @@ static void test_convexity2(skiatest::Reporter* reporter) {
square.lineTo(0, SK_Scalar1);
square.close();
check_convexity(reporter, square, SkPath::kConvex_Convexity);
-
+
SkPath redundantSquare;
redundantSquare.moveTo(0, 0);
redundantSquare.lineTo(0, 0);
@@ -492,7 +492,7 @@ static void test_convexity2(skiatest::Reporter* reporter) {
redundantSquare.lineTo(0, SK_Scalar1);
redundantSquare.close();
check_convexity(reporter, redundantSquare, SkPath::kConvex_Convexity);
-
+
SkPath bowTie;
bowTie.moveTo(0, 0);
bowTie.lineTo(0, 0);
@@ -508,7 +508,7 @@ static void test_convexity2(skiatest::Reporter* reporter) {
bowTie.lineTo(0, SK_Scalar1);
bowTie.close();
check_convexity(reporter, bowTie, SkPath::kConcave_Convexity);
-
+
SkPath spiral;
spiral.moveTo(0, 0);
spiral.lineTo(100*SK_Scalar1, 0);
@@ -519,7 +519,7 @@ static void test_convexity2(skiatest::Reporter* reporter) {
spiral.lineTo(50*SK_Scalar1, 75*SK_Scalar1);
spiral.close();
check_convexity(reporter, spiral, SkPath::kConcave_Convexity);
-
+
SkPath dent;
dent.moveTo(0, 0);
dent.lineTo(100*SK_Scalar1, 100*SK_Scalar1);
@@ -583,7 +583,7 @@ static void test_convexity(skiatest::Reporter* reporter) {
path.addRect(0, 0, SkIntToScalar(10), SkIntToScalar(10), SkPath::kCW_Direction);
REPORTER_ASSERT(reporter, V == SkPath::ComputeConvexity(path));
REPORTER_ASSERT(reporter, path.cheapIsDirection(SkPath::kCW_Direction));
-
+
static const struct {
const char* fPathStr;
SkPath::Convexity fExpectedConvexity;
@@ -612,7 +612,7 @@ static void test_isLine(skiatest::Reporter* reporter) {
const SkScalar value = SkIntToScalar(5);
REPORTER_ASSERT(reporter, !path.isLine(NULL));
-
+
// set some non-zero values
pts[0].set(value, value);
pts[1].set(value, value);
@@ -672,7 +672,7 @@ static void test_isRect(skiatest::Reporter* reporter) {
SkPoint rc[] = {{0, 0}, {1, 0}, {1, 1}, {0, 1}, {0, 0}};
SkPoint rd[] = {{0, 0}, {0, 1}, {1, 1}, {1, 0}, {0, 0}};
SkPoint re[] = {{0, 0}, {1, 0}, {1, 0}, {1, 1}, {0, 1}};
-
+
// failing tests
SkPoint f1[] = {{0, 0}, {1, 0}, {1, 1}}; // too few points
SkPoint f2[] = {{0, 0}, {1, 1}, {0, 1}, {1, 0}}; // diagonal
@@ -682,7 +682,7 @@ static void test_isRect(skiatest::Reporter* reporter) {
SkPoint f6[] = {{0, 0}, {1, 0}, {1, 1}, {0, 1}, {0, 2}}; // end overshoots
SkPoint f7[] = {{0, 0}, {1, 0}, {1, 1}, {0, 2}}; // end overshoots
SkPoint f8[] = {{0, 0}, {1, 0}, {1, 1}, {1, 0}}; // 'L'
-
+
// failing, no close
SkPoint c1[] = {{0, 0}, {1, 0}, {1, 1}, {0, 1}}; // close doesn't match
SkPoint c2[] = {{0, 0}, {1, 0}, {1, 2}, {0, 2}, {0, 1}}; // ditto
@@ -693,12 +693,12 @@ static void test_isRect(skiatest::Reporter* reporter) {
sizeof(rd), sizeof(re),
sizeof(f1), sizeof(f2), sizeof(f3), sizeof(f4), sizeof(f5), sizeof(f6),
sizeof(f7), sizeof(f8),
- sizeof(c1), sizeof(c2)
+ sizeof(c1), sizeof(c2)
};
SkPoint* tests[] = {
r1, r2, r3, r4, r5, r6, r7, r8, r9, ra, rb, rc, rd, re,
f1, f2, f3, f4, f5, f6, f7, f8,
- c1, c2
+ c1, c2
};
SkPoint* lastPass = re;
SkPoint* lastClose = f8;
@@ -723,7 +723,7 @@ static void test_isRect(skiatest::Reporter* reporter) {
close = false;
}
}
-
+
// fail, close then line
SkPath path1;
path1.moveTo(r1[0].fX, r1[0].fY);
@@ -733,7 +733,7 @@ static void test_isRect(skiatest::Reporter* reporter) {
path1.close();
path1.lineTo(1, 0);
REPORTER_ASSERT(reporter, fail ^ path1.isRect(0));
-
+
// fail, move in the middle
path1.reset();
path1.moveTo(r1[0].fX, r1[0].fY);
@@ -754,7 +754,7 @@ static void test_isRect(skiatest::Reporter* reporter) {
}
path1.close();
REPORTER_ASSERT(reporter, fail ^ path1.isRect(0));
-
+
// fail, quad
path1.reset();
path1.moveTo(r1[0].fX, r1[0].fY);
@@ -766,7 +766,7 @@ static void test_isRect(skiatest::Reporter* reporter) {
}
path1.close();
REPORTER_ASSERT(reporter, fail ^ path1.isRect(0));
-
+
// fail, cubic
path1.reset();
path1.moveTo(r1[0].fX, r1[0].fY);
@@ -794,7 +794,7 @@ static void write_and_read_back(skiatest::Reporter* reporter,
reader.readPath(&readBack);
REPORTER_ASSERT(reporter, readBack == p);
- REPORTER_ASSERT(reporter, readBack.getConvexityOrUnknown() ==
+ REPORTER_ASSERT(reporter, readBack.getConvexityOrUnknown() ==
p.getConvexityOrUnknown());
REPORTER_ASSERT(reporter, readBack.isOval(NULL) == p.isOval(NULL));
@@ -850,7 +850,7 @@ static void test_flattening(skiatest::Reporter* reporter) {
static void test_transform(skiatest::Reporter* reporter) {
SkPath p, p1;
-
+
static const SkPoint pts[] = {
{ 0, 0 },
{ SkIntToScalar(10), SkIntToScalar(10) },
@@ -861,12 +861,12 @@ static void test_transform(skiatest::Reporter* reporter) {
p.lineTo(pts[1]);
p.quadTo(pts[2], pts[3]);
p.cubicTo(pts[4], pts[5], pts[6]);
-
+
SkMatrix matrix;
matrix.reset();
p.transform(matrix, &p1);
REPORTER_ASSERT(reporter, p == p1);
-
+
matrix.setScale(SK_Scalar1 * 2, SK_Scalar1 * 3);
p.transform(matrix, &p1);
SkPoint pts1[7];
@@ -977,7 +977,7 @@ static void test_segment_masks(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, SkPath::kCubic_SegmentMask == p.getSegmentMasks());
p2 = p;
REPORTER_ASSERT(reporter, p2.getSegmentMasks() == p.getSegmentMasks());
-
+
REPORTER_ASSERT(reporter, !p.isEmpty());
}
@@ -1005,7 +1005,7 @@ static void test_iter(skiatest::Reporter* reporter) {
iter.setPath(p, true);
REPORTER_ASSERT(reporter, iter.next(pts) == SkPath::kDone_Verb);
-
+
struct iterTestData {
const char* testPath;
const bool forceClose;
@@ -1092,7 +1092,7 @@ static void test_raw_iter(skiatest::Reporter* reporter) {
// Test that setting an empty path works
noPathIter.setPath(p);
REPORTER_ASSERT(reporter, noPathIter.next(pts) == SkPath::kDone_Verb);
-
+
// Test an iterator with an initial empty path
SkPath::RawIter iter(p);
REPORTER_ASSERT(reporter, iter.next(pts) == SkPath::kDone_Verb);
@@ -1242,7 +1242,7 @@ static void test_raw_iter(skiatest::Reporter* reporter) {
}
expectedVerbs[numIterVerbs++] = nextVerb;
}
-
+
iter.setPath(p);
numVerbs = numIterVerbs;
numIterVerbs = 0;
diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp
index 67bb65929b..392c5ac463 100644
--- a/tests/ReadPixelsTest.cpp
+++ b/tests/ReadPixelsTest.cpp
@@ -19,7 +19,7 @@
static const int DEV_W = 100, DEV_H = 100;
static const SkIRect DEV_RECT = SkIRect::MakeWH(DEV_W, DEV_H);
-static const SkRect DEV_RECT_S = SkRect::MakeWH(DEV_W * SK_Scalar1,
+static const SkRect DEV_RECT_S = SkRect::MakeWH(DEV_W * SK_Scalar1,
DEV_H * SK_Scalar1);
namespace {
@@ -51,7 +51,7 @@ SkPMColor getCanvasColor(int x, int y) {
}
return SkPremultiplyARGBInline(a, r, g, b);
}
-
+
SkPMColor getBitmapColor(int x, int y, int w, int h) {
int n = y * w + x;
@@ -125,7 +125,7 @@ void fillCanvas(SkCanvas* canvas) {
canvas->drawBitmap(bmp, 0, 0, &paint);
canvas->restore();
}
-
+
void fillBitmap(SkBitmap* bitmap) {
SkASSERT(bitmap->lockPixelsAreWritable());
SkAutoLockPixels alp(*bitmap);
@@ -172,7 +172,7 @@ bool checkRead(skiatest::Reporter* reporter,
SkASSERT(SkBitmap::kARGB_8888_Config == bitmap.config());
SkASSERT(!bitmap.isNull());
SkASSERT(checkCanvasPixels || checkBitmapPixels);
-
+
int bw = bitmap.width();
int bh = bitmap.height();
@@ -187,7 +187,7 @@ bool checkRead(skiatest::Reporter* reporter,
for (int bx = 0; bx < bw; ++bx) {
int devx = bx + srcRect.fLeft;
int devy = by + srcRect.fTop;
-
+
uint32_t pixel = *reinterpret_cast<SkPMColor*>(pixels + by * bitmap.rowBytes() + bx * bitmap.bytesPerPixel());
if (clippedSrcRect.contains(devx, devy)) {
@@ -214,11 +214,11 @@ bool checkRead(skiatest::Reporter* reporter,
enum BitmapInit {
kFirstBitmapInit = 0,
-
+
kNoPixels_BitmapInit = kFirstBitmapInit,
kTight_BitmapInit,
kRowBytes_BitmapInit,
-
+
kBitmapInitCnt
};
@@ -253,7 +253,7 @@ void init_bitmap(SkBitmap* bitmap, const SkIRect& rect, BitmapInit init) {
void ReadPixelsTest(skiatest::Reporter* reporter, GrContext* context) {
SkCanvas canvas;
-
+
const SkIRect testRects[] = {
// entire thing
DEV_RECT,
diff --git a/tests/ReadWriteAlphaTest.cpp b/tests/ReadWriteAlphaTest.cpp
index faa7629e7b..751c9128c4 100644
--- a/tests/ReadWriteAlphaTest.cpp
+++ b/tests/ReadWriteAlphaTest.cpp
@@ -60,7 +60,7 @@ static void ReadWriteAlphaTest(skiatest::Reporter* reporter, GrContext* context)
memset(readback, 0x1, X_SIZE * Y_SIZE);
// read the texture back
- texture->readPixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig,
+ texture->readPixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig,
readback, 0);
// make sure the original & read back versions match
@@ -89,11 +89,11 @@ static void ReadWriteAlphaTest(skiatest::Reporter* reporter, GrContext* context)
canvas.drawRect(rect, paint);
- texture->readPixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig,
+ texture->readPixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig,
readback, 0);
match = true;
-
+
for (int y = 0; y < Y_SIZE; ++y) {
for (int x = 0; x < X_SIZE; ++x) {
if (0xFF != readback[x][y]) {
diff --git a/tests/RefCntTest.cpp b/tests/RefCntTest.cpp
index 5197ffb86b..ed771e77f8 100644
--- a/tests/RefCntTest.cpp
+++ b/tests/RefCntTest.cpp
@@ -42,7 +42,7 @@ static void test_refarray(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, N == InstCounterClass::gInstCounter);
array->unref();
REPORTER_ASSERT(reporter, 0 == InstCounterClass::gInstCounter);
-
+
// Now test the copy factory
int i;
diff --git a/tests/RegionTest.cpp b/tests/RegionTest.cpp
index db43e333c0..8e66502f5e 100644
--- a/tests/RegionTest.cpp
+++ b/tests/RegionTest.cpp
@@ -161,7 +161,7 @@ static void TestRegion(skiatest::Reporter* reporter) {
{ 2, 2, 3, 3 },
};
REPORTER_ASSERT(reporter, test_rects(r2, SK_ARRAY_COUNT(r2)));
-
+
const SkIRect rects[] = {
{ 0, 0, 1, 2 },
{ 2, 1, 3, 3 },
@@ -181,7 +181,7 @@ static void TestRegion(skiatest::Reporter* reporter) {
}
REPORTER_ASSERT(reporter, test_rects(rect, N));
}
-
+
test_proc(reporter, contains_proc);
test_proc(reporter, intersects_proc);
test_empties(reporter);
diff --git a/tests/ScalarTest.cpp b/tests/ScalarTest.cpp
index 20719145f7..801872e12e 100644
--- a/tests/ScalarTest.cpp
+++ b/tests/ScalarTest.cpp
@@ -53,7 +53,7 @@ static void test_isRectFinite(skiatest::Reporter* reporter) {
{ gI2, SK_ARRAY_COUNT(gI2), false },
{ gI3, SK_ARRAY_COUNT(gI3), false },
};
-
+
for (size_t i = 0; i < SK_ARRAY_COUNT(gSets); ++i) {
SkRect r;
r.set(gSets[i].fPts, gSets[i].fCount);
@@ -118,7 +118,7 @@ static void test_isfinite(skiatest::Reporter* reporter) {
float fValue;
bool fIsFinite;
};
-
+
float max = 3.402823466e+38f;
float inf = max * max;
float nan = inf * 0;
@@ -170,7 +170,7 @@ static void test_isfinite(skiatest::Reporter* reporter) {
const Rec& rec1 = data[j];
for (size_t k = 0; k < SK_ARRAY_COUNT(gProc1); ++k) {
IsFiniteProc1 proc1 = gProc1[k];
-
+
for (size_t m = 0; m < SK_ARRAY_COUNT(gProc2); ++m) {
bool finite = gProc2[m](rec0.fValue, rec1.fValue, proc1);
bool finite2 = rec0.fIsFinite && rec1.fIsFinite;
@@ -179,7 +179,7 @@ static void test_isfinite(skiatest::Reporter* reporter) {
}
}
}
-
+
test_isRectFinite(reporter);
}
diff --git a/tests/ShaderOpacityTest.cpp b/tests/ShaderOpacityTest.cpp
index a8177eeb8b..0af25d1ec2 100644
--- a/tests/ShaderOpacityTest.cpp
+++ b/tests/ShaderOpacityTest.cpp
@@ -13,9 +13,9 @@
static void test_bitmap(skiatest::Reporter* reporter) {
SkBitmap bmp;
bmp.setConfig(SkBitmap::kARGB_8888_Config, 2, 2);
-
+
// test 1: bitmap without pixel data
- SkShader* shader = SkShader::CreateBitmapShader(bmp,
+ SkShader* shader = SkShader::CreateBitmapShader(bmp,
SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);
REPORTER_ASSERT(reporter, shader);
REPORTER_ASSERT(reporter, !shader->isOpaque());
@@ -25,7 +25,7 @@ static void test_bitmap(skiatest::Reporter* reporter) {
bmp.allocPixels();
// test 2: not opaque by default
- shader = SkShader::CreateBitmapShader(bmp,
+ shader = SkShader::CreateBitmapShader(bmp,
SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);
REPORTER_ASSERT(reporter, shader);
REPORTER_ASSERT(reporter, !shader->isOpaque());
@@ -33,7 +33,7 @@ static void test_bitmap(skiatest::Reporter* reporter) {
// test 3: explicitly opaque
bmp.setIsOpaque(true);
- shader = SkShader::CreateBitmapShader(bmp,
+ shader = SkShader::CreateBitmapShader(bmp,
SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);
REPORTER_ASSERT(reporter, shader);
REPORTER_ASSERT(reporter, shader->isOpaque());
@@ -41,7 +41,7 @@ static void test_bitmap(skiatest::Reporter* reporter) {
// test 4: explicitly not opaque
bmp.setIsOpaque(false);
- shader = SkShader::CreateBitmapShader(bmp,
+ shader = SkShader::CreateBitmapShader(bmp,
SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);
REPORTER_ASSERT(reporter, shader);
REPORTER_ASSERT(reporter, !shader->isOpaque());
@@ -102,7 +102,7 @@ static void test_color(skiatest::Reporter* reporter)
SkColorShader colorShader3(SkColorSetARGB(0x7F,0,0,0));
REPORTER_ASSERT(reporter, !colorShader3.isOpaque());
- // with inherrited color, shader must declare itself as opaque,
+ // with inherrited color, shader must declare itself as opaque,
// since lack of opacity will depend solely on the paint
SkColorShader colorShader4;
REPORTER_ASSERT(reporter, colorShader4.isOpaque());
diff --git a/tests/SortTest.cpp b/tests/SortTest.cpp
index 2ca8f2f614..d1a61d4c70 100644
--- a/tests/SortTest.cpp
+++ b/tests/SortTest.cpp
@@ -73,7 +73,7 @@ static void TestSort(skiatest::Reporter* reporter) {
if (false) { // avoid bit rot, suppress warning
compare_int(array, array);
}
-
+
test_checksum(reporter);
}
diff --git a/tests/StreamTest.cpp b/tests/StreamTest.cpp
index 85b1b2ee5b..b5e3cd98b8 100644
--- a/tests/StreamTest.cpp
+++ b/tests/StreamTest.cpp
@@ -108,18 +108,18 @@ static void TestPackedUInt(skiatest::Reporter* reporter) {
0xFFFFFD, 0xFFFFFE, 0xFFFFFF, 0x1000000, 0x1000001,
0x7FFFFFFE, 0x7FFFFFFF, 0x80000000, 0x80000001, 0xFFFFFFFE, 0xFFFFFFFF
};
-
-
+
+
size_t i;
char buffer[sizeof(sizes) * 4];
-
+
SkMemoryWStream wstream(buffer, sizeof(buffer));
for (i = 0; i < SK_ARRAY_COUNT(sizes); ++i) {
bool success = wstream.writePackedUInt(sizes[i]);
REPORTER_ASSERT(reporter, success);
}
wstream.flush();
-
+
SkMemoryStream rstream(buffer, sizeof(buffer));
for (i = 0; i < SK_ARRAY_COUNT(sizes); ++i) {
size_t n = rstream.readPackedUInt();
diff --git a/tests/StringTest.cpp b/tests/StringTest.cpp
index 08bd2809cb..5ae718fed3 100644
--- a/tests/StringTest.cpp
+++ b/tests/StringTest.cpp
@@ -68,7 +68,7 @@ static void TestString(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, a.contains("hello"));
REPORTER_ASSERT(reporter, !a.contains("hellohello"));
REPORTER_ASSERT(reporter, a.contains(""));
-
+
SkString e(a);
SkString f("hello");
SkString g("helloz", 5);
@@ -148,7 +148,7 @@ static void TestString(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, buffer[18] == ' ');
REPORTER_ASSERT(reporter, buffer[19] == 0);
REPORTER_ASSERT(reporter, buffer[20] == 'a');
-
+
}
#include "TestClassDef.h"
diff --git a/tests/TLSTest.cpp b/tests/TLSTest.cpp
index 9bebb1babc..5fa0903ca8 100644
--- a/tests/TLSTest.cpp
+++ b/tests/TLSTest.cpp
@@ -38,7 +38,7 @@ static void test_measuretext(skiatest::Reporter* reporter) {
for (i = 0; i < N; ++i) {
threads[i] = new SkThread(thread_main);
}
-
+
for (i = 0; i < N; ++i) {
threads[i]->start();
}
diff --git a/tests/Test.h b/tests/Test.h
index 2396d6f964..a3beb0c724 100644
--- a/tests/Test.h
+++ b/tests/Test.h
@@ -59,11 +59,11 @@ namespace skiatest {
void reportFailed(const SkString& desc) {
this->report(desc.c_str(), kFailed);
}
-
+
bool getCurrSuccess() const {
return fCurrTestSuccess;
}
-
+
protected:
virtual void onStart(Test*) {}
virtual void onReport(const char desc[], Result) {}
diff --git a/tests/TestSize.cpp b/tests/TestSize.cpp
index 97a66683ba..6a9a88773f 100644
--- a/tests/TestSize.cpp
+++ b/tests/TestSize.cpp
@@ -10,7 +10,7 @@
static void TestISize(skiatest::Reporter* reporter) {
SkISize a, b;
-
+
a.set(0, 0);
REPORTER_ASSERT(reporter, a.isEmpty());
a.set(5, -5);
@@ -19,7 +19,7 @@ static void TestISize(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, a.isEmpty());
b.set(5, 0);
REPORTER_ASSERT(reporter, a == b);
-
+
a.set(3, 5);
REPORTER_ASSERT(reporter, !a.isEmpty());
b = a;
@@ -32,13 +32,13 @@ static void TestISize(skiatest::Reporter* reporter) {
static void TestSize(skiatest::Reporter* reporter) {
TestISize(reporter);
-
+
SkSize a, b;
int ix = 5;
int iy = 3;
SkScalar x = SkIntToScalar(ix);
SkScalar y = SkIntToScalar(iy);
-
+
a.set(0, 0);
REPORTER_ASSERT(reporter, a.isEmpty());
a.set(x, -x);
@@ -47,7 +47,7 @@ static void TestSize(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, a.isEmpty());
b.set(x, 0);
REPORTER_ASSERT(reporter, a == b);
-
+
a.set(y, x);
REPORTER_ASSERT(reporter, !a.isEmpty());
b = a;
@@ -56,7 +56,7 @@ static void TestSize(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, !(a != b));
REPORTER_ASSERT(reporter,
a.fWidth == b.fWidth && a.fHeight == b.fHeight);
-
+
SkISize ia;
ia.set(ix, iy);
a.set(x, y);
diff --git a/tests/UnicodeTest.cpp b/tests/UnicodeTest.cpp
index 1293fb6afb..ec9a8bc003 100644
--- a/tests/UnicodeTest.cpp
+++ b/tests/UnicodeTest.cpp
@@ -72,7 +72,7 @@ static void test_textencodings(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, (int)len8 == count8);
REPORTER_ASSERT(reporter, (int)len8 == count16);
REPORTER_ASSERT(reporter, (int)len8 == count32);
-
+
REPORTER_ASSERT(reporter, !memcmp(glyphs8, glyphs16, count8 * sizeof(uint16_t)));
REPORTER_ASSERT(reporter, !memcmp(glyphs8, glyphs32, count8 * sizeof(uint16_t)));
}
diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp
index d5ce8af573..5a9cf26f78 100644
--- a/tests/WritePixelsTest.cpp
+++ b/tests/WritePixelsTest.cpp
@@ -20,7 +20,7 @@ class GrContext;
static const int DEV_W = 100, DEV_H = 100;
static const SkIRect DEV_RECT = SkIRect::MakeWH(DEV_W, DEV_H);
-static const SkRect DEV_RECT_S = SkRect::MakeWH(DEV_W * SK_Scalar1,
+static const SkRect DEV_RECT_S = SkRect::MakeWH(DEV_W * SK_Scalar1,
DEV_H * SK_Scalar1);
static const U8CPU DEV_PAD = 0xee;
@@ -351,7 +351,7 @@ bool setupBitmap(SkBitmap* bitmap,
void WritePixelsTest(skiatest::Reporter* reporter, GrContext* context) {
SkCanvas canvas;
-
+
const SkIRect testRects[] = {
// entire thing
DEV_RECT,
diff --git a/tests/Writer32Test.cpp b/tests/Writer32Test.cpp
index 8b048a7b73..f2dcf90ea7 100644
--- a/tests/Writer32Test.cpp
+++ b/tests/Writer32Test.cpp
@@ -15,7 +15,7 @@
static void test_ptr(skiatest::Reporter* reporter) {
SkSWriter32<32> writer(32);
-
+
void* p0 = reporter;
void* p1 = &writer;
@@ -135,14 +135,14 @@ static void Tests(skiatest::Reporter* reporter) {
SkWriter32 writer(256 * 4);
REPORTER_ASSERT(reporter, NULL == writer.getSingleBlock());
test1(reporter, &writer);
-
+
writer.reset();
test2(reporter, &writer);
writer.reset();
testWritePad(reporter, &writer);
}
-
+
// single-block
{
SkWriter32 writer(0);
@@ -154,33 +154,33 @@ static void Tests(skiatest::Reporter* reporter) {
writer.reset(storage, sizeof(storage));
test2(reporter, &writer);
-
+
writer.reset(storage, sizeof(storage));
testWritePad(reporter, &writer);
}
-
+
// small storage
{
SkSWriter32<8 * sizeof(intptr_t)> writer(100);
test1(reporter, &writer);
writer.reset(); // should just rewind our storage
test2(reporter, &writer);
-
+
writer.reset();
testWritePad(reporter, &writer);
}
-
+
// large storage
{
SkSWriter32<1024 * sizeof(intptr_t)> writer(100);
test1(reporter, &writer);
writer.reset(); // should just rewind our storage
test2(reporter, &writer);
-
+
writer.reset();
testWritePad(reporter, &writer);
}
-
+
test_ptr(reporter);
}
diff --git a/tests/XfermodeTest.cpp b/tests/XfermodeTest.cpp
index a851b29df1..0b7012d417 100644
--- a/tests/XfermodeTest.cpp
+++ b/tests/XfermodeTest.cpp
@@ -33,7 +33,7 @@ static void test_asMode(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, reportedMode == mode);
xfer->unref();
} else {
- REPORTER_ASSERT(reporter, SkXfermode::kSrcOver_Mode == mode);
+ REPORTER_ASSERT(reporter, SkXfermode::kSrcOver_Mode == mode);
}
}
@@ -52,7 +52,7 @@ static void test_IsMode(skiatest::Reporter* reporter) {
for (int i = 0; i <= SkXfermode::kLastMode; ++i) {
SkXfermode::Mode mode = (SkXfermode::Mode)i;
-
+
SkXfermode* xfer = SkXfermode::Create(mode);
REPORTER_ASSERT(reporter, SkXfermode::IsMode(xfer, mode));
SkSafeUnref(xfer);
diff --git a/tests/skia_test.cpp b/tests/skia_test.cpp
index ecb00374ff..7913874bf4 100644
--- a/tests/skia_test.cpp
+++ b/tests/skia_test.cpp
@@ -115,7 +115,7 @@ int main (int argc, char * const argv[]) {
for (++argv; argv < stop; ++argv) {
if (strcmp(*argv, "-android") == 0) {
androidMode = true;
-
+
} else if (strcmp(*argv, "--match") == 0) {
++argv;
if (argv < stop && **argv) {
diff --git a/tools/skhello.cpp b/tools/skhello.cpp
index 9d442dca40..46569d5b0f 100644
--- a/tools/skhello.cpp
+++ b/tools/skhello.cpp
@@ -58,7 +58,7 @@ int main (int argc, char * const argv[]) {
SkCanvas canvas(bitmap);
canvas.drawColor(SK_ColorWHITE);
-
+
paint.setTextAlign(SkPaint::kCenter_Align);
canvas.drawText(text.c_str(), text.size(),
SkIntToScalar(w)/2, SkIntToScalar(h)*2/3,
diff --git a/tools/skimage_main.cpp b/tools/skimage_main.cpp
index cb13ad6bb2..504bc30204 100644
--- a/tools/skimage_main.cpp
+++ b/tools/skimage_main.cpp
@@ -83,7 +83,7 @@ int main (int argc, char * const argv[]) {
i += 1; // skip this and the next entry
continue;
}
-
+
SkBitmap bitmap;
if (decodeFile(&bitmap, argv[i])) {
if (outDirIndex) {