skia2/gyp/tests.gypi

236 lines
7.3 KiB
Plaintext
Raw Normal View History

Add a class to allocate small objects w/o extra calls to new. Add SkSmallAllocator, a template for allocating small (as defined by the instantiation) objects without extra calls to new. Add a helper macro to make using it simple. Remove SkTemplatesPriv.h, whose behavior is replaced by SkSmallAllocator. The old SK_PLACEMENT_NEW had the following drawbacks: - Easily confused with SkNEW_PLACEMENT. - Requires passing around lots of void*s along with the storageSize. - Requires using a separate class for deleting it. - We had multiple ways Auto objects for deleting in different places. - It always did a straight heap allocation on Windows, meaning Windows did not get any advantages from the confusing code. The new SkSmallAllocator simplifies things: - It is clear about what it does. - It takes care of the deletion in one place that is automatically handled. Further, the new class can be used to create more than one object. This is in preparation for BUG=skia:1976, for which we would like to create a new object without extra heap allocations. The plan is to create both the blitter and the new object on the stack using the SkSmallAllocator. Add a new test for SkSmallAllocator. SkShader.h: Move the private version of CreateBitmapShader to SkBitmapProcShader (which already has the implementation) and remove the friend class (which was only used to call this private function). This allows SkSmallAllocator to reside in the private src/ directory. SkBitmapProcShader: Move CreateBitmapShader and the macro for the storage size here. With the macro in a (private) header, the (private) headers with function declarations (which now depend on the storage size used) can see the macro. Use SkSmallAllocator in CreateBitmapShader. Change the macro to kBlitterStorageByteCount, since SkSmallAllocator takes a byte count as its template parameter. SkBlitter: Use the SkSmallAllocator. Remove Sk3DShader::fKillProc and SkAutoCallProc. Both of their behaviors have been moved into SkSmallAllocator (SkAutoCallProc was unnecessary anyway, because the only time we ever used it we also called detach(), so its auto behavior never happened). Create the Sk3DShader on the stack, if there's room. Remove the helper version of Choose, which was unused. SmallAllocatorTest: Test for the new class. The rest: Use SkSmallAllocator. BUG=skia:1976 R=reed@google.com, mtklein@google.com Author: scroggo@google.com Review URL: https://codereview.chromium.org/179343005 git-svn-id: http://skia.googlecode.com/svn/trunk@13696 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-03-07 03:24:41 +00:00
# Common gypi for unit tests.
{
'include_dirs': [
'../src/core',
'../src/effects',
'../src/image',
'../src/lazy',
'../src/images',
'../src/pathops',
'../src/pdf',
'../src/pipe/utils',
'../src/utils',
'../src/utils/debugger',
# Needed for TDStackNesterTest.
'../experimental/PdfViewer',
'../experimental/PdfViewer/src',
],
'dependencies': [
'experimental.gyp:experimental',
'flags.gyp:flags_common',
'pdf.gyp:pdf',
'skia_lib.gyp:skia_lib',
'tools.gyp:picture_utils',
'tools.gyp:resources',
'tools.gyp:sk_tool_utils',
],
'conditions': [
[ 'skia_os == "android"', {
'include_dirs': [
'../src/ports',
],
'sources': [
'../tests/FontConfigParser.cpp',
],
}],
[ 'skia_android_framework == 1', {
'libraries': [
'-ldl',
],
}],
],
'sources': [
'../tests/Test.cpp',
'../tests/Test.h',
'../tests/AAClipTest.cpp',
'../tests/ARGBImageEncoderTest.cpp',
'../tests/AnnotationTest.cpp',
'../tests/AsADashTest.cpp',
'../tests/AtomicTest.cpp',
'../tests/BadIcoTest.cpp',
'../tests/BitSetTest.cpp',
'../tests/BitmapCopyTest.cpp',
'../tests/BitmapGetColorTest.cpp',
'../tests/BitmapHasherTest.cpp',
'../tests/BitmapHeapTest.cpp',
'../tests/BitmapTest.cpp',
'../tests/BlendTest.cpp',
'../tests/BlitRowTest.cpp',
'../tests/BlurTest.cpp',
'../tests/CTest.cpp',
'../tests/CachedDataTest.cpp',
'../tests/CachedDecodingPixelRefTest.cpp',
'../tests/CanvasStateHelpers.cpp',
'../tests/CanvasStateTest.cpp',
'../tests/CanvasTest.cpp',
'../tests/ChecksumTest.cpp',
'../tests/ClampRangeTest.cpp',
'../tests/ClipCacheTest.cpp',
'../tests/ClipCubicTest.cpp',
'../tests/ClipStackTest.cpp',
'../tests/ClipperTest.cpp',
'../tests/ColorFilterTest.cpp',
'../tests/ColorPrivTest.cpp',
'../tests/ColorTest.cpp',
'../tests/DashPathEffectTest.cpp',
'../tests/DataRefTest.cpp',
'../tests/DeferredCanvasTest.cpp',
'../tests/DequeTest.cpp',
'../tests/DeviceLooperTest.cpp',
'../tests/DiscardableMemoryPoolTest.cpp',
'../tests/DiscardableMemoryTest.cpp',
'../tests/DocumentTest.cpp',
'../tests/DrawBitmapRectTest.cpp',
'../tests/DrawPathTest.cpp',
'../tests/DrawTextTest.cpp',
'../tests/DynamicHashTest.cpp',
'../tests/EmptyPathTest.cpp',
'../tests/ErrorTest.cpp',
'../tests/FillPathTest.cpp',
'../tests/FitsInTest.cpp',
'../tests/FlatDataTest.cpp',
'../tests/FlateTest.cpp',
'../tests/FloatingPointTextureTest.cpp',
'../tests/FontHostStreamTest.cpp',
'../tests/FontHostTest.cpp',
'../tests/FontMgrTest.cpp',
'../tests/FontNamesTest.cpp',
'../tests/FontObjTest.cpp',
'../tests/FrontBufferedStreamTest.cpp',
'../tests/GLInterfaceValidationTest.cpp',
'../tests/GLProgramsTest.cpp',
'../tests/GeometryTest.cpp',
'../tests/GifTest.cpp',
'../tests/GpuColorFilterTest.cpp',
'../tests/GpuDrawPathTest.cpp',
'../tests/GpuLayerCacheTest.cpp',
'../tests/GpuRectanizerTest.cpp',
'../tests/GrBinHashKeyTest.cpp',
'../tests/GrContextFactoryTest.cpp',
'../tests/GrDrawTargetTest.cpp',
'../tests/GrAllocatorTest.cpp',
'../tests/GrMemoryPoolTest.cpp',
'../tests/GrOrderedSetTest.cpp',
'../tests/GrGLSLPrettyPrintTest.cpp',
'../tests/GrRedBlackTreeTest.cpp',
'../tests/GrSurfaceTest.cpp',
'../tests/GrTBSearchTest.cpp',
'../tests/GrTRecorderTest.cpp',
'../tests/GradientTest.cpp',
'../tests/ImageCacheTest.cpp',
'../tests/ImageDecodingTest.cpp',
'../tests/ImageFilterTest.cpp',
'../tests/ImageGeneratorTest.cpp',
'../tests/ImageIsOpaqueTest.cpp',
'../tests/ImageNewShaderTest.cpp',
'../tests/InfRectTest.cpp',
'../tests/InterpolatorTest.cpp',
'../tests/JpegTest.cpp',
'../tests/KtxTest.cpp',
'../tests/LListTest.cpp',
'../tests/LayerDrawLooperTest.cpp',
'../tests/LayerRasterizerTest.cpp',
'../tests/LazyPtrTest.cpp',
'../tests/MD5Test.cpp',
'../tests/MallocPixelRefTest.cpp',
'../tests/MaskCacheTest.cpp',
'../tests/MathTest.cpp',
'../tests/Matrix44Test.cpp',
'../tests/MatrixClipCollapseTest.cpp',
'../tests/MatrixTest.cpp',
'../tests/MemoryTest.cpp',
'../tests/MemsetTest.cpp',
'../tests/MessageBusTest.cpp',
'../tests/MetaDataTest.cpp',
'../tests/MipMapTest.cpp',
'../tests/NameAllocatorTest.cpp',
'../tests/OSPathTest.cpp',
'../tests/OnceTest.cpp',
'../tests/PDFJpegEmbedTest.cpp',
'../tests/PDFPrimitivesTest.cpp',
'../tests/PackBitsTest.cpp',
'../tests/PaintTest.cpp',
'../tests/ParsePathTest.cpp',
'../tests/PathCoverageTest.cpp',
'../tests/PathMeasureTest.cpp',
'../tests/PathTest.cpp',
'../tests/PathUtilsTest.cpp',
'../tests/PictureBBHTest.cpp',
'../tests/PictureShaderTest.cpp',
'../tests/PictureTest.cpp',
'../tests/PixelRefTest.cpp',
'../tests/PointTest.cpp',
'../tests/PremulAlphaRoundTripTest.cpp',
'../tests/QuickRejectTest.cpp',
'../tests/RTConfRegistryTest.cpp',
'../tests/RTreeTest.cpp',
'../tests/RandomTest.cpp',
'../tests/ReadPixelsTest.cpp',
'../tests/ReadWriteAlphaTest.cpp',
'../tests/Reader32Test.cpp',
'../tests/RecordDrawTest.cpp',
'../tests/RecordReplaceDrawTest.cpp',
'../tests/RecordOptsTest.cpp',
'../tests/RecordPatternTest.cpp',
'../tests/RecordTest.cpp',
'../tests/RecorderTest.cpp',
'../tests/RecordingXfermodeTest.cpp',
'../tests/RefCntTest.cpp',
'../tests/RefDictTest.cpp',
'../tests/RegionTest.cpp',
'../tests/ResourceCacheTest.cpp',
'../tests/RoundRectTest.cpp',
'../tests/RuntimeConfigTest.cpp',
'../tests/SHA1Test.cpp',
'../tests/ScalarTest.cpp',
'../tests/SerializationTest.cpp',
'../tests/ShaderImageFilterTest.cpp',
'../tests/ShaderOpacityTest.cpp',
'../tests/SizeTest.cpp',
'../tests/Sk4xTest.cpp',
'../tests/SkBase64Test.cpp',
'../tests/SkResourceCacheTest.cpp',
Add a class to allocate small objects w/o extra calls to new. Add SkSmallAllocator, a template for allocating small (as defined by the instantiation) objects without extra calls to new. Add a helper macro to make using it simple. Remove SkTemplatesPriv.h, whose behavior is replaced by SkSmallAllocator. The old SK_PLACEMENT_NEW had the following drawbacks: - Easily confused with SkNEW_PLACEMENT. - Requires passing around lots of void*s along with the storageSize. - Requires using a separate class for deleting it. - We had multiple ways Auto objects for deleting in different places. - It always did a straight heap allocation on Windows, meaning Windows did not get any advantages from the confusing code. The new SkSmallAllocator simplifies things: - It is clear about what it does. - It takes care of the deletion in one place that is automatically handled. Further, the new class can be used to create more than one object. This is in preparation for BUG=skia:1976, for which we would like to create a new object without extra heap allocations. The plan is to create both the blitter and the new object on the stack using the SkSmallAllocator. Add a new test for SkSmallAllocator. SkShader.h: Move the private version of CreateBitmapShader to SkBitmapProcShader (which already has the implementation) and remove the friend class (which was only used to call this private function). This allows SkSmallAllocator to reside in the private src/ directory. SkBitmapProcShader: Move CreateBitmapShader and the macro for the storage size here. With the macro in a (private) header, the (private) headers with function declarations (which now depend on the storage size used) can see the macro. Use SkSmallAllocator in CreateBitmapShader. Change the macro to kBlitterStorageByteCount, since SkSmallAllocator takes a byte count as its template parameter. SkBlitter: Use the SkSmallAllocator. Remove Sk3DShader::fKillProc and SkAutoCallProc. Both of their behaviors have been moved into SkSmallAllocator (SkAutoCallProc was unnecessary anyway, because the only time we ever used it we also called detach(), so its auto behavior never happened). Create the Sk3DShader on the stack, if there's room. Remove the helper version of Choose, which was unused. SmallAllocatorTest: Test for the new class. The rest: Use SkSmallAllocator. BUG=skia:1976 R=reed@google.com, mtklein@google.com Author: scroggo@google.com Review URL: https://codereview.chromium.org/179343005 git-svn-id: http://skia.googlecode.com/svn/trunk@13696 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-03-07 03:24:41 +00:00
'../tests/SmallAllocatorTest.cpp',
'../tests/SortTest.cpp',
'../tests/SrcOverTest.cpp',
'../tests/StreamTest.cpp',
'../tests/StringTest.cpp',
'../tests/StrokeTest.cpp',
Draw more accurate thick-stroked Beziers (disabled) Draw thick-stroked Beziers by computing the outset quadratic, measuring the error, and subdividing until the error is within a predetermined limit. To try this CL out, change src/core/SkStroke.h:18 to #define QUAD_STROKE_APPROXIMATION 1 or from the command line: CPPFLAGS="-D QUAD_STROKE_APPROXIMATION=1" ./gyp_skia Here's what's in this CL: bench/BezierBench.cpp : a microbench for examining where the time is going gm/beziers.cpp : random Beziers with various thicknesses gm/smallarc.cpp : a distillation of bug skia:2769 samplecode/SampleRotateCircles.cpp : controls added for error, limit, width src/core/SkStroke.cpp : the new stroke implementation (disabled) tests/StrokerTest.cpp : a stroke torture test that checks normal and extreme values The new stroke algorithm has a tweakable parameter: stroker.setError(1); (SkStrokeRec.cpp:112) The stroke error is the allowable gap between the midpoint of the stroke quadratic and the center Bezier. As the projection from the quadratic approaches the endpoints, the error is decreased proportionally so that it is always inside the quadratic curve. An overview of how this works: - For a given T range of a Bezier, compute the perpendiculars and find the points outset and inset for some radius. - Construct tangents for the quadratic stroke. - If the tangent don't intersect between them (may happen with cubics), subdivide. - If the quadratic stroke end points are close (again, may happen with cubics), draw a line between them. - Compute the quadratic formed by the intersecting tangents. - If the midpoint of the quadratic is close to the midpoint of the Bezier perpendicular, return the quadratic. - If the end of the stroke at the Bezier midpoint doesn't intersect the quad's bounds, subdivide. - Find where the Bezier midpoint ray intersects the quadratic. - If the intersection is too close to the quad's endpoints, subdivide. - If the error is large proportional to the intersection's distance to the quad's endpoints, subdivide. BUG=skia:723,skia:2769 Review URL: https://codereview.chromium.org/558163005
2014-10-09 12:36:03 +00:00
'../tests/StrokerTest.cpp',
'../tests/SurfaceTest.cpp',
'../tests/TArrayTest.cpp',
'../tests/THashCache.cpp',
'../tests/Time.cpp',
'../tests/TLSTest.cpp',
'../tests/TSetTest.cpp',
'../tests/TextBlobTest.cpp',
'../tests/TextureCompressionTest.cpp',
'../tests/TileGridTest.cpp',
'../tests/ToUnicodeTest.cpp',
'../tests/TracingTest.cpp',
'../tests/TypefaceTest.cpp',
'../tests/UnicodeTest.cpp',
'../tests/UtilsTest.cpp',
'../tests/WArrayTest.cpp',
'../tests/WritePixelsTest.cpp',
'../tests/Writer32Test.cpp',
'../tests/XfermodeTest.cpp',
'../tests/MatrixClipCollapseTest.cpp',
'../src/utils/debugger/SkDrawCommand.h',
'../src/utils/debugger/SkDrawCommand.cpp',
'../src/utils/debugger/SkDebugCanvas.h',
'../src/utils/debugger/SkDebugCanvas.cpp',
'../src/utils/debugger/SkObjectParser.h',
'../src/utils/debugger/SkObjectParser.cpp',
'../tests/PipeTest.cpp',
'../src/pipe/utils/SamplePipeControllers.cpp',
'../tests/TDStackNesterTest.cpp',
'../experimental/PdfViewer/src/SkTDStackNester.h',
],
}