Commit Graph

364 Commits

Author SHA1 Message Date
msarett
a5783aeff0 Provides various implementations of Android's SkBitmapRegionDecoder.
Implements testing in DM for these implementations.

nanobench testing will follow after this.

TBR=scroggo
BUG=skia:

Committed: https://skia.googlesource.com/skia/+/76f755e6d54a32f9887ad254ce59a3a62f28bde4

Review URL: https://codereview.chromium.org/1288963002
2015-09-08 15:35:32 -07:00
bsalomon
90e8ab79be Re-enable nvpr text rendering in DM.
Review URL: https://codereview.chromium.org/1306733007
2015-09-08 10:26:51 -07:00
msarett
8fd97eab1d Revert of Provides multiple implementations of Android's SkBitmapRegionDecoder (patchset #16 id:360001 of https://codereview.chromium.org/1288963002/ )
Reason for revert:
Breaking Android bots
Bad use of the utils folder

Original issue's description:
> Provides various implementations of Android's SkBitmapRegionDecoder.
>
> Implements testing in DM for these implementations.
>
> nanobench testing will follow after this.
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/76f755e6d54a32f9887ad254ce59a3a62f28bde4

TBR=scroggo@google.com,reed@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1322773004
2015-09-08 06:59:48 -07:00
msarett
10522ff4cf Scanline decoding for gifs
BUG=skia:

Committed: https://skia.googlesource.com/skia/+/e9c10b9121887e8c300bd41357461418e061984d

Review URL: https://codereview.chromium.org/1305123002
2015-09-07 08:54:01 -07:00
jcgregorio
e3330cf2cf Revert of Scanline decoding for gifs (patchset #15 id:380001 of https://codereview.chromium.org/1305123002/ )
Reason for revert:
Breaks the build with SkScanlineDecoder.h not found:

http://build.chromium.org/p/client.skia/builders/Linux%20Builder/builds/3722/steps/compile/logs/stdio

../../third_party/skia/src/utils/SkBitmapRegionCanvas.h:10:10: fatal error: 'SkScanlineDecoder.h' file not found
#include "SkScanlineDecoder.h"

Original issue's description:
> Scanline decoding for gifs
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/e9c10b9121887e8c300bd41357461418e061984d

TBR=scroggo@google.com,djsollen@google.com,msarett@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1320273004
2015-09-05 10:16:28 -07:00
msarett
e9c10b9121 Scanline decoding for gifs
BUG=skia:

Review URL: https://codereview.chromium.org/1305123002
2015-09-04 13:28:26 -07:00
msarett
76f755e6d5 Provides various implementations of Android's SkBitmapRegionDecoder.
Implements testing in DM for these implementations.

nanobench testing will follow after this.

BUG=skia:

Review URL: https://codereview.chromium.org/1288963002
2015-09-04 13:00:50 -07:00
msarett
36c3796fbf Remove unwanted images in Gold
These extra outputs were caused by recent changes to
push_codec_srcs.
https://codereview.chromium.org/1327433003/

*** First, I would argue that we do not want to test
"native" modes (ex: codec, scanline, etc) to scales
that require sampling (ex: 0.1, 0.2, etc).  Right now,
we are trying to scale jpegs to 0.1, settling for 0.125
as the closest option, and then trying to compare the
0.125 scaled image to the actual 0.1 scaled image in
Gold.

*** Second, I messed up and caused our test setup to
try to decode to kIndex8 and kGray8 "always" instead
of only when it is recommended.  The bad effect of this
happens because we can decode jpegs to kGray8 even if
they are color images.  Right now in Gold, we have a
bunch of untriaged gray versions of color images.

The second issue would have been caught if we signaled
a fatal failure for invalid conversions.  Maybe we should
look into this now that 565 is supported everywhere?

BUG=skia:

Review URL: https://codereview.chromium.org/1314163007
2015-09-02 13:20:52 -07:00
msarett
9e707a0412 Various improvements to CodecSrc testing in dm
*** Add CodecMode and ScaledCodecMode (in place of
NormalMode), so now we test SkCodec's getPixels() and
SkScaledCodec's getPixels()

*** Don't attempt to test scanline and codec modes using
the dimensions that were recommended for SkScaledCodec.

*** Change tags so that each scale gets its own output
folder.

TODO: Make ScanlineMode and ScanlineSubsetMode support
kOutOfOrder etc.  I think this belongs with the gif CL -
I don't want to add test modes that we don't run yet.

BUG=skia:4202
BUG=skia:4238

Review URL: https://codereview.chromium.org/1327433003
2015-09-01 14:57:57 -07:00
bsalomon
afcd7cd324 Rename flag from "distance field" to "device independent."
Review URL: https://codereview.chromium.org/1322433006
2015-08-31 12:39:41 -07:00
msarett
5406d6f39a Scanline decoding for bmp
Redesigns SkScanlineDecoder.h to indicate the ordering
in which the scanlines are provided

Refactors SkSwizzler::Fill() to include the zeroInit check
and to actually be correct.

BUG=skia:3257
BUG=skia:4198

Review URL: https://codereview.chromium.org/1287423002
2015-08-31 06:55:13 -07:00
hendrikw
885bf09255 skia: add ability to load command_buffer_gles2
BUG=skia:

Review URL: https://codereview.chromium.org/1306823003
2015-08-27 10:38:39 -07:00
halcanary
96fcdcc219 Style Change: NULL->nullptr
DOCS_PREVIEW= https://skia.org/?cl=1316233002

Review URL: https://codereview.chromium.org/1316233002
2015-08-27 07:41:16 -07:00
halcanary
385fe4d4b6 Style Change: SkNEW->new; SkDELETE->delete
DOCS_PREVIEW= https://skia.org/?cl=1316123003

Review URL: https://codereview.chromium.org/1316123003
2015-08-26 13:07:49 -07:00
bungeman
60e0fee6d4 Remove include of stdlib.h from SkTypes.h.
Unfortunately, immintrin.h (which is also included by SkTypes)
includes xmmintrin.h which includes mm_malloc.h which includes
stdlib.h for malloc even though, from the implementation, it is
difficult to see why.

Fortunately, arm_neon.h does not seem to be involved in such
shenanigans, so building for Android will keep things sane.

TBR=reed@google.com
Doesn't change Skia API, just moves an include.

Review URL: https://codereview.chromium.org/1313203003
2015-08-26 05:15:46 -07:00
mtklein
c64137c245 DM: "wb" (binary mode) may matter on Windows
I suspect we might be doing some funky /n -> /r/n translations without 'b'.
This kills the PNG.

BUG=skia:

NOTREECHECKS=true

Review URL: https://codereview.chromium.org/1303063008
2015-08-25 10:56:08 -07:00
mtklein
fccb77d59e DM: use SkBitmap::reset()
BUG=skia:

Review URL: https://codereview.chromium.org/1310373004
2015-08-24 14:13:29 -07:00
mtklein
a5114d7f26 Have DM manually encode its .png outputs.
This eliminates some variability on various axes: different PNG encoders, different libpng versions, different formats (RGB, indexed), different unpremultiplication, different sRGB tags.

BUG=skia:

Committed: https://skia.googlesource.com/skia/+/3cc0dfffb70c0bd08ed8899efcd2e98da86a6ec7

CQ_EXTRA_TRYBOTS=client.skia:Test-Win8-MSVC-ShuttleB-CPU-AVX2-x86_64-Debug-Trybot

Review URL: https://codereview.chromium.org/1304443002
2015-08-24 13:27:01 -07:00
mtklein
c6ad06acef unsigned -> int for counts and indices in picture-related code
also, (C)

BUG=skia:

Review URL: https://codereview.chromium.org/1300163002
2015-08-19 09:51:01 -07:00
reed
451af5062e remove SkDeferredCanvas
Waiting a day or so to see if the blink-removal of SkDeferredCanvas sticks

BUG=skia:

Review URL: https://codereview.chromium.org/1269093002
2015-08-19 08:18:04 -07:00
mtklein
8c9a67ae4b Revert of Have DM manually encode its .png outputs. (patchset #2 id:20001 of https://codereview.chromium.org/1304443002/ )
Reason for revert:
derek + Test-Win8-MSVC-ShuttleB-CPU-AVX2-x86_64-Debug

Original issue's description:
> Have DM manually encode its .png outputs.
>
> This eliminates some variability on various axes: different PNG encoders, different libpng versions, different formats (RGB, indexed), different unpremultiplication, different sRGB tags.
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/3cc0dfffb70c0bd08ed8899efcd2e98da86a6ec7

TBR=stephana@google.com,msarett@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1297383002
2015-08-19 08:11:37 -07:00
mtklein
3cc0dfffb7 Have DM manually encode its .png outputs.
This eliminates some variability on various axes: different PNG encoders, different libpng versions, different formats (RGB, indexed), different unpremultiplication, different sRGB tags.

BUG=skia:

Review URL: https://codereview.chromium.org/1304443002
2015-08-19 07:37:51 -07:00
msarett
b32758a72f Test scaling for small images
We don't want to test small images on Gold because they are
not interested to look at.  Instead, I wrote a unit test to
verify that scaling small images does not cause crashes.

BUG=skia:

Review URL: https://codereview.chromium.org/1287863004
2015-08-18 13:22:46 -07:00
scroggo
cc2feb161f Support more swizzles to 565 in SkCodec
Add more swizzling functions for swizzling to 565. Much of this
code was revived from crrev.com/1055743003 (for BMP). Also added
swizzling functions for WBMP.

Consolidate the static function conversion_possible.

In SkCodec::getPixels, check that the alphatype corresponds to the
colorType. This prevents requesting 565 + non-opaque.

In SkIcoCodec, report that the image is unpremul (instead of
whatever the largest embedded codec thinks), but modify the
requested info to have the alpha type expected/required by the
embedded codec.

Add tests for decoding to 565.

BUG=skia:3257
BUG=skia:3683

Review URL: https://codereview.chromium.org/1277213002
2015-08-14 08:32:46 -07:00
emmaleer
8f4ba76742 SkScaledCodec class
This class does scaling by using a scanlineDecoder.
getScanlines and skipScanlines are used for y sampling,
the swizzler is used for x sampling

this class is currently only working for png and jpeg images
I will update other Codec types to work soon

For SkJpegCodec to implement width wise swizzling it now
uses a swizzler. I ran performance tests on this change.
Here are the performance test results:
https://docs.google.com/a/google.com/spreadsheets/d/1D7-Q_GXD_dI68LZO005NNvb8Wq2Ee0wEBEPG72671yw/edit?usp=sharing

BUG=skia:

Committed: https://skia.googlesource.com/skia/+/0944100ac89f797714eeae0cf2875e2335ff52ee

Committed: https://skia.googlesource.com/skia/+/d518ea7927f9f4e0ed5b4134d1b4f48243855a47

Committed: https://skia.googlesource.com/skia/+/b157917507d4f7d2651f0aeb566d31603cc02240

Review URL: https://codereview.chromium.org/1260673002
2015-08-14 07:44:46 -07:00
egdaniel
b0a32cc38f Revert of SkScaledCodec class (patchset #35 id:680001 of https://codereview.chromium.org/1260673002/ )
Reason for revert:
breaking ubuntu bots

Original issue's description:
> SkScaledCodec class
>
> This class does scaling by using a scanlineDecoder.
> getScanlines and skipScanlines are used for y sampling,
> the swizzler is used for x sampling
>
> this class is currently only working for png and jpeg images
> I will update other Codec types to work soon
>
> For SkJpegCodec to implement width wise swizzling it now
> uses a swizzler. I ran performance tests on this change.
> Here are the performance test results:
> https://docs.google.com/a/google.com/spreadsheets/d/1D7-Q_GXD_dI68LZO005NNvb8Wq2Ee0wEBEPG72671yw/edit?usp=sharing
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/0944100ac89f797714eeae0cf2875e2335ff52ee
>
> Committed: https://skia.googlesource.com/skia/+/d518ea7927f9f4e0ed5b4134d1b4f48243855a47
>
> Committed: https://skia.googlesource.com/skia/+/b157917507d4f7d2651f0aeb566d31603cc02240

TBR=scroggo@google.com,msarett@google.com,djsollen@google.com,mtklein@google.com,emmaleer@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1285173003
2015-08-14 06:37:37 -07:00
emmaleer
b157917507 SkScaledCodec class
This class does scaling by using a scanlineDecoder.
getScanlines and skipScanlines are used for y sampling,
the swizzler is used for x sampling

this class is currently only working for png and jpeg images
I will update other Codec types to work soon

For SkJpegCodec to implement width wise swizzling it now
uses a swizzler. I ran performance tests on this change.
Here are the performance test results:
https://docs.google.com/a/google.com/spreadsheets/d/1D7-Q_GXD_dI68LZO005NNvb8Wq2Ee0wEBEPG72671yw/edit?usp=sharing

BUG=skia:

Committed: https://skia.googlesource.com/skia/+/0944100ac89f797714eeae0cf2875e2335ff52ee

Committed: https://skia.googlesource.com/skia/+/d518ea7927f9f4e0ed5b4134d1b4f48243855a47

Review URL: https://codereview.chromium.org/1260673002
2015-08-14 05:46:09 -07:00
emmaleer
c7993d747f Revert of SkScaledCodec class (patchset #34 id:660001 of https://codereview.chromium.org/1260673002/ )
Reason for revert:
Seg-faulting:
http://build.chromium.org/p/client.skia/builders/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86-Release/builds/1608/steps/dm/logs/stdio

Original issue's description:
> SkScaledCodec class
>
> This class does scaling by using a scanlineDecoder.
> getScanlines and skipScanlines are used for y sampling,
> the swizzler is used for x sampling
>
> this class is currently only working for png and jpeg images
> I will update other Codec types to work soon
>
> For SkJpegCodec to implement width wise swizzling it now
> uses a swizzler. I ran performance tests on this change.
> Here are the performance test results:
> https://docs.google.com/a/google.com/spreadsheets/d/1D7-Q_GXD_dI68LZO005NNvb8Wq2Ee0wEBEPG72671yw/edit?usp=sharing
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/0944100ac89f797714eeae0cf2875e2335ff52ee
>
> Committed: https://skia.googlesource.com/skia/+/d518ea7927f9f4e0ed5b4134d1b4f48243855a47

TBR=scroggo@google.com,msarett@google.com,djsollen@google.com,mtklein@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1294613002
2015-08-13 13:59:21 -07:00
emmaleer
d518ea7927 SkScaledCodec class
This class does scaling by using a scanlineDecoder.
getScanlines and skipScanlines are used for y sampling,
the swizzler is used for x sampling

this class is currently only working for png and jpeg images
I will update other Codec types to work soon

For SkJpegCodec to implement width wise swizzling it now
uses a swizzler. I ran performance tests on this change.
Here are the performance test results:
https://docs.google.com/a/google.com/spreadsheets/d/1D7-Q_GXD_dI68LZO005NNvb8Wq2Ee0wEBEPG72671yw/edit?usp=sharing

BUG=skia:

Committed: https://skia.googlesource.com/skia/+/0944100ac89f797714eeae0cf2875e2335ff52ee

Review URL: https://codereview.chromium.org/1260673002
2015-08-13 13:07:03 -07:00
emmaleer
e5aaa07c35 Revert of SkScaledCodec class (patchset #32 id:620001 of https://codereview.chromium.org/1260673002/ )
Reason for revert:
Segfaulting:
http://build.chromium.org/p/client.skia/builders/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86-Release/builds/1605/steps/dm/logs/stdio

Original issue's description:
> SkScaledCodec class
>
> This class does scaling by using a scanlineDecoder.
> getScanlines and skipScanlines are used for y sampling,
> the swizzler is used for x sampling
>
> this class is currently only working for png and jpeg images
> I will update other Codec types to work soon
>
> For SkJpegCodec to implement width wise swizzling it now
> uses a swizzler. I ran performance tests on this change.
> Here are the performance test results:
> https://docs.google.com/a/google.com/spreadsheets/d/1D7-Q_GXD_dI68LZO005NNvb8Wq2Ee0wEBEPG72671yw/edit?usp=sharing
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/0944100ac89f797714eeae0cf2875e2335ff52ee

TBR=scroggo@google.com,msarett@google.com,djsollen@google.com,mtklein@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1294593002
2015-08-13 11:44:05 -07:00
emmaleer
0944100ac8 SkScaledCodec class
This class does scaling by using a scanlineDecoder.
getScanlines and skipScanlines are used for y sampling,
the swizzler is used for x sampling

this class is currently only working for png and jpeg images
I will update other Codec types to work soon

For SkJpegCodec to implement width wise swizzling it now
uses a swizzler. I ran performance tests on this change.
Here are the performance test results:
https://docs.google.com/a/google.com/spreadsheets/d/1D7-Q_GXD_dI68LZO005NNvb8Wq2Ee0wEBEPG72671yw/edit?usp=sharing

BUG=skia:

Review URL: https://codereview.chromium.org/1260673002
2015-08-13 11:26:57 -07:00
scroggo
0df0e43488 Revert of Update libwebp and resume testing scaled webp (patchset #2 id:20001 of https://codereview.chromium.org/1280073002/ )
Reason for revert:
Compile failures, e.g.

http://build.chromium.org/p/client.skia.compile/builders/Build-Ubuntu-GCC-Arm7-Debug-Android_NoNeon/builds/1427/steps/build%20most/logs/stdio

Original issue's description:
> Update libwebp and resume testing scaled webp
>
> libwebp has a fix for [1]. Update to the commit that contains the fix.
>
> Update libwebp.gypi, corresponding to libwebp's latest makefile.
>
> Turn back on DM testing for scaled webp, now that it should no longer
> use uninitialized memory.
>
> Fix a warning in config.h
>
> [1] https://code.google.com/p/webp/issues/detail?id=254
>
> BUG=skia:4038
>
> Committed: https://skia.googlesource.com/skia/+/0575d3e6c272744a66ab3281f9871366717df339

TBR=djsollen@google.com,msarett@google.com,scroggo@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:4038

Review URL: https://codereview.chromium.org/1278173004
2015-08-07 12:53:25 -07:00
scroggo
0575d3e6c2 Update libwebp and resume testing scaled webp
libwebp has a fix for [1]. Update to the commit that contains the fix.

Update libwebp.gypi, corresponding to libwebp's latest makefile.

Turn back on DM testing for scaled webp, now that it should no longer
use uninitialized memory.

Fix a warning in config.h

[1] https://code.google.com/p/webp/issues/detail?id=254

BUG=skia:4038

Review URL: https://codereview.chromium.org/1280073002
2015-08-07 12:49:16 -07:00
mtklein
c0e1af1422 Revert of Intentionally crash DM to make sure all bots are up-to-date. (patchset #1 id:1 of https://codereview.chromium.org/1274693002/ )
Reason for revert:
win x64 looks fixed

Original issue's description:
> Intentionally crash DM to make sure all bots are up-to-date.
>
> NOTREECHECKS=true
> NOTRY=true
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/3749b9646103f544f17aa926fab050f1e5178b17

TBR=borenet@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1275543003
2015-08-05 08:40:19 -07:00
Mike Klein
3749b96461 Intentionally crash DM to make sure all bots are up-to-date.
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1274693002 .
2015-08-05 11:13:59 -04:00
scroggo
1c005e4a38 Create a scanline decoder without creating a codec
Prior to this CL, if a client wanted to decode scanlines, they had to
create an SkCodec in order to get an SkScanlineDecoder. This introduces
complications if input data is not easily shared between the two
objects.

Instead, add methods to SkScanlineDecoder for creating a new one from
input data, and remove the creation functions from SkCodec.

Update DM and tests.

Review URL: https://codereview.chromium.org/1267583002
2015-08-04 09:24:45 -07:00
mtklein
f23190078b Missing overrides for Sinks in HWUI.
See crrev.com/1263113002

BUG=skia:4138

Review URL: https://codereview.chromium.org/1263143004
2015-08-03 10:20:28 -07:00
mtklein
99cab4e308 DM: track a direct/indirect bit for each Sink too.
The decoding tests can now veto indirect sinks like pipe-8888.

This moves Sink type detection from automatic to explicit; I can't think of any
way to automatically differentiate pipe-8888 from 8888 based only on the
output.  (They should ideally be identical, after all.)

BUG=skia:4138

Review URL: https://codereview.chromium.org/1263113002
2015-07-31 06:43:04 -07:00
scroggo
4358f13ac6 Call notifyPixelsChanged after modifying bitmap
In CodecSrc's scanline_subset test, we decode a subset of an image to a
bitmap, draw it to the canvas, and then repeat. This is fine for most
backends, but not for pipe. Pipe sees the same generation ID, so it
assumes it is the same bitmap it saw before, and just draws the
original one.

Call notifyPixelsChanged, so the bitmap will get a new generation ID,
fixing pipe.

BUG=skia:4138

Review URL: https://codereview.chromium.org/1265983004
2015-07-30 11:33:04 -07:00
mtklein
e0effd6080 Allow Srcs to veto Sinks based on their broad type.
This breaks Sinks down into three auto-detected types:
  - GPU:    anything that requests to be run in the GPU enclave
  - Vector: anything that writes to the stream instead of the bitmap
  - Raster: everything else

Some examples: gpu -> GPU, msaa16 -> GPU, 8888 -> raster, pdf -> vector,
               svg -> vector, pipe-8888 -> raster, tiles_rt-gpu -> GPU

This lets image decoding sinks veto non-raster backends explicitly,
and can let particular GMs veto GPU or non-GPU sinks as they like.

BUG=skia:

Review URL: https://codereview.chromium.org/1239953004
2015-07-29 06:37:28 -07:00
caryclark
1818acb6a4 rename portable_typeface_always to portable_typeface
TBR=reed@google.com

Review URL: https://codereview.chromium.org/1257773002
2015-07-24 12:09:25 -07:00
scroggo
b636b45971 Add the ability to decode a subset to SkCodec
This allows codecs that support subsets natively (i.e. WEBP) to do so.

Add a field on SkCodec::Options representing the subset.

Add a method on SkCodec to find a valid subset which approximately
matches a desired subset.

Implement subset decodes in SkWebpCodec.

Add a test in DM for decoding subsets.
Notice that we only start on even boundaries. This is due to the
way libwebp's API works. SkWEBPImageDecoder does not take this into
account, which results in visual artifacts.

FIXME: Subsets with scaling are not pixel identical, but close. (This
may be fine, though - they are not perceptually different. We'll just
need to mark another set of images in gold as valid, once
https://skbug.com/4038 is fixed, so we can tests scaled webp without
generating new images on each run.)

Review URL: https://codereview.chromium.org/1240143002
2015-07-22 07:16:20 -07:00
scroggo
6f818b39af Do not attempt to scale webp.
Scaling webp ends triggers warnings on our valgrind bot. It also results in
generating many images in Skia Gold that look mostly the same except
for a few pixels along the right edge.

BUG=skia:4038

Review URL: https://codereview.chromium.org/1227843005
2015-07-13 08:17:00 -07:00
scroggo
9b2cdbf481 Allow creating multiple scanline decoders.
Make getScanlineDecoder return a new object each time, which is
owned by the caller, and independent from any existing scanline
decoders and the SkCodec itself.

Since the SkCodec already contains the entire state machine, and it
is used by the scanline decoders, simply create a new SkCodec which
is now owned by the scanline decoder.

Move code that cleans up after using a scanline decoder into its
destructor

One side effect is that creating the first scanline decoder requires
a duplication of the stream and re-reading the header. (With some
more complexity/changes, we could pass the state machine to the
scanline decoder and make the SkCodec recreate its own state machine
instead.) The typical client of the scanline decoder (region decoder)
uses an SkMemoryStream, so the duplication is cheap, although we
should consider the extra time to reread the header/recreate the state
machine. (If/when we use the scanline decoder for other purposes,
where the stream may not be cheaply duplicated, we should consider
passing the state machine.)

One (intended) result of this change is that a client can create a
new scanline decoder in a new thread, and decode different pieces of
the image simultaneously.

In SkPngCodec::decodePalette, use fBitDepth rather than a parameter.

Review URL: https://codereview.chromium.org/1230033004
2015-07-10 12:07:02 -07:00
scroggo
eb602a5c94 SkCodec no longer inherits from SkImageGenerator.
SkImageGenerator makes some assumptions that are not necessarily valid
for SkCodec. For example, SkCodec does not assume that it can always be
rewound.

We also have an ongoing question of what an SkCodec should report as
its default settings (i.e. the return from getInfo). It makes sense for
an SkCodec to report that its pixels are unpremultiplied, if that is
the case for the underlying data, but if a client of SkImageGenerator
uses the default settings (as many do), they will receive
unpremultiplied pixels which cannot (currently) be drawn with Skia. We
may ultimately decide to revisit SkCodec reporting an SkImageInfo, but
I have left it unchanged for now.

Import features of SkImageGenerator used by SkCodec into SkCodec.

I have left SkImageGenerator unchanged for now, but it no longer needs
Result or Options. This will require changes to Chromium.

Manually handle the lifetime of fScanlineDecoder, so SkScanlineDecoder.h
can include SkCodec.h (where Result is), and SkCodec.h does not need
to include it (to delete fScanlineDecoder).

In many places, make the following simple changes:
- Now include SkScanlineDecoder.h, which is no longer included by
  SkCodec.h
- Use the enums in SkCodec, rather than SkImageGenerator
- Stop including SkImageGenerator.h where no longer needed

Review URL: https://codereview.chromium.org/1220733013
2015-07-09 08:16:03 -07:00
mtklein
711a245dda DM runs more than 100k tests now.
BUG=skia:

Review URL: https://codereview.chromium.org/1217493006
2015-07-08 08:49:20 -07:00
mtklein
38408460ad DM: swizzle BGRA to RGBA before calculating pixel MD5.
We name our .pngs by pixel hashes for gold.  For 8888 images, we're hashing
SkPMColors, which have platform-dependent order: BGRA on Linux and Windows,
RGBA otherwise. This means we can end up with pixel-identical pngs with
different hashes, which is confusing.

This CL standardizes on RGBA for 8888 configs, arbitrarily chosen so that
Android ends up a no-op.  Long-term, this should eliminate most of the
0-pixel-diff problems we see on gold.skia.org.  There are other ways to end up
with the same .png from different SkBitmaps (think, red 565 square vs. red 8888
square) but they're rather less common / likely.

This will temporarily create a giant 0-pixel-diff problem on gold.skia.org.
Any Linux or Windows images which are not already pixel-identical to a Mac or
Android image should show up as untriaged hashes that are pixel-identical to
their version just before landing (we're only changing the hash, not the .png).
This means anything vaguely platform dependent (fonts, GPUs) will probably show
up as needing a triage but with a zero diff from a previous image.

If this goes well, we might do the same for 565.  Just want to leave them out
for now to cut down on the triaging I need to do in one go.

BUG=skia:

Review URL: https://codereview.chromium.org/1226933005
2015-07-08 07:25:27 -07:00
mtklein
1b24933e52 Remove SkThread.h, include SkMutex.h or SkAtomics.h as appropriate.
SkThread.h doesn't do anything anymore execept include those two,
and thankfully, it doesn't seem to be mentioned outside Skia.

No public API changes.
TBR=reed@google.com

BUG=skia:

Committed: https://skia.googlesource.com/skia/+/c50acf2321d7a934c80d754e9cbe936dfb8eb4cc

Review URL: https://codereview.chromium.org/1215393002
2015-07-07 12:21:22 -07:00
mtklein
d2baa90938 Make sp- via support SkDrawables; add a GM to test it.
BUG=skia:

Review URL: https://codereview.chromium.org/1212363005
2015-07-07 09:43:28 -07:00
msarett
1c8a587120 Add libjpeg-turbo library (depends on yasm)
Mangle external function names to avoid conflict with libjpeg
Take advantage of direct color conversion (RGBA, BGRA, 565)
Prepare to use jpeg_skip_scanlines (when it is upstreamed)

BUG=skia:

Committed: https://skia.googlesource.com/skia/+/b60c3f8291529303299262dba19b1a896060bd2d

Committed: https://skia.googlesource.com/skia/+/f8bf9181d7b0463c8e371755cfbb9ece90b34fc5

Committed: https://skia.googlesource.com/skia/+/e9e3ee33f30c14c31afd5fc3fe4dda7f15783c75

Committed: https://skia.googlesource.com/skia/+/40141b57f061fbfcc2fa38da942d9efe25aca4d0

Review URL: https://codereview.chromium.org/1180983002
2015-07-07 08:50:01 -07:00