skia2/tests
scroggo@google.com 8d2392487c Add an option on SkImageDecoder to skip writing 0s.
Only implemented for PNG.

Add a getter and setter, and sets the default to false in the
constructor. Also copies the setting in copyFieldsToOther.

Fix an indpendent bug where fDitherImage was not being copied in
copyFieldsToOther.

In SkScaledBitmapSampler::begin, consolidate the settings passed in
by passing a const reference to the decoder. The decoder can be
referenced for its settings of dither, unpremultiplied, and now
skipping writing zeroes. Update callers to use the new API. In png
decoder, rather than passing around a pointer to an initial
read of getDitherImage, and potentially changing it, look at the
field on the decoder itself, and modify it directly. This is a
change in behavior - now if that same decoder is used to decode
a different image, the dither setting has changed. I think this is
okay because A) the typical use case is to use a new decoder for
each decode, B) we do not make any promises that a decode does not
change the decoder and C) it makes the code in SkScaledBitmapSampler
much cleaner.

In SkScaledBitmapScampler, add new row procs for skipping zeroes. Now
that choosing the row proc has five dimensions (src config, dst config,
dither, skip writing zeroes, unpremultiplied), use a new method: each
src/dst combination has a function for choosing the right proc depending
on the decoder.

SkScaledBitmapScampler::RowProc is now public for convenience.

Remove Sample_Gray_D8888_Unpremul, which is effectively no different
from Sample_Gray_D8888.

In cases where unpremultiplied was trivial, such as 565 and when
sampling from gray, decoding may now succeed.

Add a benchmark (currently disabled) for comparing the speed of skipping
writing zeroes versus not skipping. For this particular image, which is
mostly transparent pixels, normal decoding took about 3.6 milliseconds,
while skipping zeroes in the decode took only about 2.5 milliseconds
(this is on a Nexus 4). Presumably it would be slower on an image
with a small amount of transparency, but there will be no slowdown
for an image which reports that it has no transparency.

In SkImageRef_ashmem, always skip writing zeroes, since ashmem
memory is guaranteed to be initialized to 0.

Add a flag to skip writing zeroes in skimage.

Add a regression test for choosing the rowproc to ensure I did not
change any behavior accidentally.

BUG=skia:1661
R=reed@google.com

Review URL: https://codereview.chromium.org/24269006

git-svn-id: http://skia.googlecode.com/svn/trunk@11558 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-10-01 17:27:15 +00:00
..
TestXCode/Tests.xcodeproj migrate more legacy unittests into tests/ 2009-03-07 03:39:23 +00:00
AAClipTest.cpp Add an even more convenient way to declare tests, with example. 2013-09-19 20:56:46 +00:00
AndroidPaintTest.cpp We don't flatten or unflatten SkPaintOptionsAndroid. Reproduce and fix. 2013-09-26 15:16:12 +00:00
AnnotationTest.cpp PDF: add support for named destinations. 2013-03-08 09:09:10 +00:00
ARGBImageEncoderTest.cpp remove dst/rendertarget support for kARGB_4444_Config 2013-06-21 18:30:53 +00:00
AtomicTest.cpp Sanitizing source files in Skia_Periodic_House_Keeping 2013-01-26 07:06:02 +00:00
BitmapCopyTest.cpp Fix build. 2013-08-07 19:39:56 +00:00
BitmapFactoryTest.cpp "Fix" persistent failure of BitmapFactoryTest on debug RazrI 2013-03-21 20:54:42 +00:00
BitmapGetColorTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
BitmapHasherTest.cpp remove dst/rendertarget support for kARGB_4444_Config 2013-06-21 18:30:53 +00:00
BitmapHeapTest.cpp In SkBitmapHeap, defer adding owners for new bitmaps. 2012-11-16 20:34:37 +00:00
BitSetTest.cpp Automatic update of all copyright notices to reflect new license terms. 2011-07-28 14:26:00 +00:00
BlitRowTest.cpp ARM Skia NEON patches - 01 - Simple fixes 2013-07-15 13:10:31 +00:00
BlurTest.cpp Push sigma-based blur interface into our GMs/benches/tests/samplecode 2013-09-06 14:16:12 +00:00
CanvasStateTest.cpp fix printing of error messages in canvasstatetest. 2013-09-18 20:15:12 +00:00
CanvasTest.cpp Split SkDevice into SkBaseDevice and SkBitmapDevice 2013-08-29 11:54:56 +00:00
ChecksumTest.cpp Add SkChecksum::Murmur3. 2013-07-23 20:25:34 +00:00
ClampRangeTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
ClipCacheTest.cpp Remove GrRefCnt.h in favor of SkRefCnt.h 2013-09-09 13:38:37 +00:00
ClipCubicTest.cpp Defining new color constat for transparent color 2012-12-06 21:47:40 +00:00
ClipperTest.cpp Tests : Unused parameters cleanup 2013-02-27 19:17:41 +00:00
ClipStackTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
ColorFilterTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
ColorTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
DataRefTest.cpp Refactor: clean up some unused or mostly-unused API I saw here. 2013-06-18 20:50:34 +00:00
DeferredCanvasTest.cpp promote SkImage::AlphaType to SkAlphaType 2013-09-20 19:33:52 +00:00
DequeTest.cpp Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/) 2012-08-23 18:14:13 +00:00
DeviceLooperTest.cpp Fix Mac 10.6 DeviceLooperTest build error (this time with feeling) 2013-09-18 12:51:50 +00:00
DrawBitmapRectTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
DrawPathTest.cpp promote SkImage::AlphaType to SkAlphaType 2013-09-20 19:33:52 +00:00
DrawTextTest.cpp Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/) 2012-08-23 18:14:13 +00:00
DynamicHashTest.cpp SkTDynamicHash 2013-08-12 14:51:25 +00:00
EmptyPathTest.cpp Refactor: clean up some unused or mostly-unused API I saw here. 2013-06-18 20:50:34 +00:00
ErrorTest.cpp Sanitizing source files in Housekeeper-Nightly 2013-09-20 07:01:33 +00:00
FillPathTest.cpp Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/) 2012-08-23 18:14:13 +00:00
FitsInTest.cpp fix trivial matrix computation 2013-07-14 01:44:59 +00:00
FlatDataTest.cpp use SkTDynamicHash in picture recording 2013-08-20 16:48:47 +00:00
FlateTest.cpp Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/) 2012-08-23 18:14:13 +00:00
FontHostStreamTest.cpp Check whether font creation is failed to avoid segment fault. 2013-05-07 14:32:58 +00:00
FontHostTest.cpp Implement onCountGlyphs and onGetUPEM on Windows. 2013-07-15 19:42:57 +00:00
FontMgrTest.cpp Sanitizing source files in Housekeeper-Nightly 2013-09-20 07:01:33 +00:00
FontNamesTest.cpp Add getFamilyNames to SkTypeface. 2013-08-07 17:09:22 +00:00
FrontBufferedStreamTest.cpp Add a buffered SkStream class. 2013-09-26 21:35:39 +00:00
GeometryTest.cpp Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/) 2012-08-23 18:14:13 +00:00
GLInterfaceValidation.cpp Simplify the GL interface validation test. 2013-03-11 20:22:38 +00:00
GLProgramsTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
GpuBitmapCopyTest.cpp remove dead AutoValidator 2013-06-21 19:05:57 +00:00
GpuDrawPathTest.cpp Temporarily disable GpuTestPath. 2013-08-05 14:50:31 +00:00
GradientTest.cpp Split SkDevice into SkBaseDevice and SkBitmapDevice 2013-08-29 11:54:56 +00:00
GrContextFactoryTest.cpp Add --threads to tests binary, to run non-GPU tests on multiple cores. 2013-04-19 13:24:28 +00:00
GrMemoryPoolTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
GrSurfaceTest.cpp Reland of 8525 with fix for case when GrRT outlives GrTexture. 2013-04-09 15:04:12 +00:00
HashCacheTest.cpp Replace uses of GR_DEBUG by SK_DEBUG. 2013-08-28 14:17:03 +00:00
ImageCacheTest.cpp SkTDynamicHash 2013-08-12 14:51:25 +00:00
ImageDecodingTest.cpp Add an option on SkImageDecoder to skip writing 0s. 2013-10-01 17:27:15 +00:00
ImageFilterTest.cpp Sanitizing source files in Housekeeper-Nightly 2013-09-17 07:01:20 +00:00
InfRectTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
LayerDrawLooperTest.cpp Split SkDevice into SkBaseDevice and SkBitmapDevice 2013-08-29 11:54:56 +00:00
LListTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
MathTest.cpp Add SkDivMod with a special case for ARM. 2013-09-26 19:22:54 +00:00
Matrix44Test.cpp Fix Matrix44Test and double-to-float conversion in SVD code 2013-09-03 19:46:16 +00:00
MatrixTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
MD5Test.cpp Sanitizing source files in Skia_Periodic_House_Keeping 2013-01-31 20:28:24 +00:00
MemoryTest.cpp Add sk_calloc. Remove SkMemory_stdlib, which seems unused. 2013-09-20 14:31:45 +00:00
MemsetTest.cpp combine glyph and image bulk alloc, and adjust initial alloc size, to reduce total waste from 50% to 30% 2013-06-19 19:25:36 +00:00
MetaDataTest.cpp Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/) 2012-08-23 18:14:13 +00:00
MipMapTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
OSPathTest.cpp Fix bug in setting directories for tests. 2013-06-06 14:59:56 +00:00
PackBitsTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
PaintTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
ParsePathTest.cpp Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/) 2012-08-23 18:14:13 +00:00
PathCoverageTest.cpp Tests : Unused parameters cleanup 2013-02-27 19:17:41 +00:00
PathMeasureTest.cpp Tests : Unused parameters cleanup 2013-02-27 19:17:41 +00:00
PathOpsAngleTest.cpp path ops work in progress 2013-09-16 15:55:01 +00:00
PathOpsBoundsTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsCubicIntersectionTest.cpp path ops work in progress 2013-09-16 15:55:01 +00:00
PathOpsCubicIntersectionTestData.cpp path ops work in progress 2013-04-15 19:13:59 +00:00
PathOpsCubicIntersectionTestData.h Make parallel unit testing work on windows 2013-04-10 15:55:37 +00:00
PathOpsCubicLineIntersectionTest.cpp path ops work in progress 2013-09-16 15:55:01 +00:00
PathOpsCubicQuadIntersectionTest.cpp turn off debugging printfs 2013-07-23 15:27:41 +00:00
PathOpsCubicReduceOrderTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsCubicToQuadsTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsDCubicTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsDLineTest.cpp turn off debugging printfs 2013-07-23 15:27:41 +00:00
PathOpsDPointTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsDQuadTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsDRectTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsDTriangleTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsDVectorTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsExtendedTest.cpp path ops work in progress 2013-09-16 15:55:01 +00:00
PathOpsExtendedTest.h harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsInverseTest.cpp path ops : add support for inverse fill 2013-04-22 14:37:05 +00:00
PathOpsLineIntersectionTest.cpp path ops work in progress 2013-09-16 15:55:01 +00:00
PathOpsLineParametetersTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsOpCubicThreadedTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsOpRectThreadedTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsOpTest.cpp path ops work in progress 2013-09-16 15:55:01 +00:00
PathOpsQuadIntersectionTest.cpp turn off debugging printfs 2013-07-23 15:27:41 +00:00
PathOpsQuadIntersectionTestData.cpp path ops work in progress 2013-04-15 19:13:59 +00:00
PathOpsQuadIntersectionTestData.h Add intersections for path ops 2013-04-08 11:50:00 +00:00
PathOpsQuadLineIntersectionTest.cpp path ops work in progress 2013-09-16 15:55:01 +00:00
PathOpsQuadLineIntersectionThreadedTest.cpp turn off debugging printfs 2013-07-23 15:27:41 +00:00
PathOpsQuadParameterizationTest.cpp path ops work in progress 2013-04-15 19:13:59 +00:00
PathOpsQuadReduceOrderTest.cpp path ops work in progress 2013-04-15 19:13:59 +00:00
PathOpsSimplifyDegenerateThreadedTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsSimplifyFailTest.cpp path ops work in progress 2013-09-16 15:55:01 +00:00
PathOpsSimplifyQuadralateralsThreadedTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsSimplifyQuadThreadedTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsSimplifyRectThreadedTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsSimplifyTest.cpp path ops work in progress 2013-09-16 15:55:01 +00:00
PathOpsSimplifyTrianglesThreadedTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsSkpClipTest.cpp turn off debugging printfs 2013-07-23 15:27:41 +00:00
PathOpsTestCommon.cpp Sanitizing source files in Housekeeper-Nightly 2013-07-17 07:01:13 +00:00
PathOpsTestCommon.h harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsThreadedCommon.cpp path ops work in progress 2013-09-16 15:55:01 +00:00
PathOpsThreadedCommon.h path ops work in progress 2013-07-08 17:17:02 +00:00
PathTest.cpp Refactor PathTest.cpp test_isNestedRects and test_isRect. 2013-09-25 18:21:39 +00:00
PathUtilsTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
PDFPrimitivesTest.cpp Fix leaked SkPDFDevice in PDFPrimitivesTest.cpp 2013-08-26 11:10:13 +00:00
PictureTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
PictureUtilsTest.cpp Updated make_filepath test to reflect changes in picture_utils. TBR 2012-07-13 18:43:39 +00:00
PipeTest.cpp Defining new color constat for transparent color 2012-12-06 21:47:40 +00:00
PointTest.cpp by hook or by crook, force gcc to return the value of SkPoint::length() to actually be a float 2013-05-06 15:59:51 +00:00
PremulAlphaRoundTripTest.cpp Patch for r10995 2013-08-29 12:10:20 +00:00
QuickRejectTest.cpp Added toString to SkDrawLooper-derived classes 2013-01-28 20:21:59 +00:00
RandomTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
Reader32Test.cpp Sanitizing source files in Skia_Periodic_House_Keeping 2013-01-26 07:06:02 +00:00
ReadPixelsTest.cpp Sanitizing source files in Housekeeper-Nightly 2013-08-30 07:01:34 +00:00
ReadWriteAlphaTest.cpp Remove GrRefCnt.h in favor of SkRefCnt.h 2013-09-09 13:38:37 +00:00
RefCntTest.cpp Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/) 2012-08-23 18:14:13 +00:00
RefDictTest.cpp Extended Inst counting to find "unknown" leaked object (SkTMaskGamma) 2012-08-16 14:58:06 +00:00
RegionTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
ResourceCacheTest.cpp Sanitizing source files in Housekeeper-Nightly 2013-08-09 07:01:22 +00:00
RoundRectTest.cpp Sanitizing source files in Skia_Periodic_House_Keeping 2013-04-26 07:00:58 +00:00
RTreeTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
ScalarTest.cpp Sanitizing source files in Skia_Periodic_House_Keeping 2013-01-26 07:06:02 +00:00
SHA1Test.cpp Sanitizing source files in Skia_Periodic_House_Keeping 2013-01-31 20:28:24 +00:00
ShaderImageFilterTest.cpp Fix warnings-as-errors on Mac10.6 and Win. Unreviewed. 2013-02-21 17:10:44 +00:00
ShaderOpacityTest.cpp Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/) 2012-08-23 18:14:13 +00:00
Sk64Test.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
skia_test.cpp Add skia_tsan_build to match skia_asan_build and fix one example race. 2013-09-25 22:39:22 +00:00
SortTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
SrcOverTest.cpp Automatic update of all copyright notices to reflect new license terms. 2011-07-28 14:26:00 +00:00
StreamTest.cpp Add a detachAsStream to SkDynamicMemoryWStream. 2013-07-19 22:32:11 +00:00
StringTest.cpp Add SkString::appendU32() and SkString::appendU64() 2013-06-19 18:27:20 +00:00
StrokeTest.cpp Sanitizing source files in Skia_Periodic_House_Keeping 2013-01-26 07:06:02 +00:00
SurfaceTest.cpp promote SkImage::AlphaType to SkAlphaType 2013-09-20 19:33:52 +00:00
Test.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
Test.h Rewrite SkTRegistry to take any trivially-copyable type. 2013-09-04 17:20:18 +00:00
TestClassDef.h Add an even more convenient way to declare tests, with example. 2013-09-19 20:56:46 +00:00
TestSize.cpp Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/) 2012-08-23 18:14:13 +00:00
TileGridTest.cpp Split SkDevice into SkBaseDevice and SkBitmapDevice 2013-08-29 11:54:56 +00:00
TLSTest.cpp Tests : Unused parameters cleanup 2013-02-27 19:17:41 +00:00
ToUnicode.cpp pdf: write only ToUnicode mappings needed by the font, trimming anything out of [firstChar, lastChar] interval. 2013-09-18 19:29:08 +00:00
TSetTest.cpp Deterministic SkTSet and PDF Output 2013-07-24 01:51:08 +00:00
Typeface.cpp Update Android's FontHost to return NULL if familyName does not match 2013-09-19 12:08:40 +00:00
UnicodeTest.cpp Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/) 2012-08-23 18:14:13 +00:00
UnitTestTest.cpp Fix crash when querying a runtime config that is defined in environment 2013-08-14 18:14:37 +00:00
UtilsTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
valgrind.supp More valgrind suppressions 2013-07-13 19:50:40 +00:00
WArrayTest.cpp Replace SkTScopedPtr with SkAutoTDelete in Skia. 2013-08-29 22:14:04 +00:00
WritePixelsTest.cpp Yet another patch for 10995 2013-08-29 12:53:23 +00:00
Writer32Test.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
XfermodeTest.cpp Use ILLEGAL_MODE macro to silence clang error. 2013-04-15 22:12:43 +00:00