aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkBmpStandardCodec.cpp
Commit message (Collapse)AuthorAge
* make most of SkColorPriv.h privateGravatar Cary Clark2017-09-15
| | | | | | | | | | | | | created new file src/core/SkColorData.h for internal consumption. Note that many of the functions there are unused as well. Bug: skia: 6898 R: reed@google.com Change-Id: I25bfd5a9c21f53558c4ca65a77eb5d322d897c6d Reviewed-on: https://skia-review.googlesource.com/46848 Commit-Queue: Cary Clark <caryclark@google.com> Reviewed-by: Mike Reed <reed@google.com>
* use unique_ptr for codec factoriesGravatar Mike Reed2017-07-25
| | | | | | | | | | Will need guards for android (at least) Bug: skia: Change-Id: I2bb8e656997984489ef1f2e41cd3d301c4e7b947 Reviewed-on: https://skia-review.googlesource.com/26040 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Reed <reed@google.com>
* Reland "Remove support for decoding to kIndex_8"Gravatar Leon Scroggins2017-07-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Original change's description: > > Remove support for decoding to kIndex_8 > > > > Fix up callsites, and remove tests that no longer make sense. > > > > Bug: skia:6828 > > Change-Id: I2548c4b7528b7b1be7412563156f27b52c9d4295 > > Reviewed-on: https://skia-review.googlesource.com/21664 > > Reviewed-by: Derek Sollenberger <djsollen@google.com> > > Commit-Queue: Leon Scroggins <scroggo@google.com> > > TBR=djsollen@google.com,scroggo@google.com > > Change-Id: I1bc669441f250690884e75a9a61427fdf75c6907 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia:6828 > Reviewed-on: https://skia-review.googlesource.com/22120 > Reviewed-by: Leon Scroggins <scroggo@google.com> > Commit-Queue: Leon Scroggins <scroggo@google.com> TBR=djsollen@google.com,scroggo@google.com Bug: skia:6828 Change-Id: I36ff5a11c529d29e8adc95f43b8edc6fd1dbf5b8 Reviewed-on: https://skia-review.googlesource.com/22320 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Revert "Remove support for decoding to kIndex_8"Gravatar Leon Scroggins2017-07-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 742a3e298fda669006147e4a305bab8452369b1f. Reason for revert: Breaking Android roll: frameworks/base/core/jni/android/graphics/BitmapFactory.cpp:453:18: error: no member named 'fColorPtr' in 'SkAndroidCodec::AndroidOptions' codecOptions.fColorPtr = colorPtr; ~~~~~~~~~~~~ ^ frameworks/base/core/jni/android/graphics/BitmapFactory.cpp:454:18: error: no member named 'fColorCount' in 'SkAndroidCodec::AndroidOptions' codecOptions.fColorCount = colorCount; ~~~~~~~~~~~~ ^ Original change's description: > Remove support for decoding to kIndex_8 > > Fix up callsites, and remove tests that no longer make sense. > > Bug: skia:6828 > Change-Id: I2548c4b7528b7b1be7412563156f27b52c9d4295 > Reviewed-on: https://skia-review.googlesource.com/21664 > Reviewed-by: Derek Sollenberger <djsollen@google.com> > Commit-Queue: Leon Scroggins <scroggo@google.com> TBR=djsollen@google.com,scroggo@google.com Change-Id: I1bc669441f250690884e75a9a61427fdf75c6907 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia:6828 Reviewed-on: https://skia-review.googlesource.com/22120 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Remove support for decoding to kIndex_8Gravatar Leon Scroggins III2017-07-10
| | | | | | | | | | Fix up callsites, and remove tests that no longer make sense. Bug: skia:6828 Change-Id: I2548c4b7528b7b1be7412563156f27b52c9d4295 Reviewed-on: https://skia-review.googlesource.com/21664 Reviewed-by: Derek Sollenberger <djsollen@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Simplify SkCodecs' call to SkColorSpaceXform::applyGravatar Leon Scroggins III2017-06-05
| | | | | | | | | | | | | | | | | | | | | | | | | | Most SkCodec subclasses did the following to apply their SkColorSpaceXform: dstFormat = select_xform_format(dstInfo.colorType()); srcFormat = select_xform_format(<something that doesn't change>); xformAlphaType = select_xform_alpha(dstInfo.alphaType(), this->getInfo().alphaType()); this->colorXform()->apply(dstFormat, dst, srcFormat, src, width, xformAlphaType); Consolidate the computation of these parameters into SkCodec and add a new method to SkCodec that calls apply() with those parameters. Add a SkColorSpaceXform::ColorFormat to SkCodec. This allows the new method SkCodec::applyColorXform to supply the ColorFormat. TBR=reed@google.com (No change to public API.) Change-Id: I8ea7ba4c0024be827a9f9359796c778744330f6e Reviewed-on: https://skia-review.googlesource.com/18523 Reviewed-by: Leon Scroggins <scroggo@google.com> Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Replace BMP calls to new with calls to mallocGravatar Leon Scroggins III2017-06-05
| | | | | | | | | | | | | | | | | A BMP can have an arbitrarily large width. We typically read a row into a block of memory before swizzling it to the output. Rather than calling new to create that block of memory, which may crash when we run out of memory, call malloc, and return null if malloc fails. Add a common base class for Mask and Standard BMP codecs. This class handles allocating and freeing the buffer. Bug: b/37623797 Change-Id: I0510b76d688d030865faa481bb2fb1351dac2c97 Reviewed-on: https://skia-review.googlesource.com/18400 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* 565 codec color xform support: fix colortable / incomplete image behaviorGravatar Matt Sarett2017-04-04
| | | | | | | | | | | | | | | | | | This fixes a bug that was exposed when I added color space support for 565 decodes. Before this CL, we would sometimes fill incomplete images with R and B swapped. This fixes that issue. Part of the fix is the decision to do 565 xforms when building the color table (then just swizzle to 565), rather than do them per pixel after swizzling. Bug: skia: Change-Id: I09e1ec75aba09a4e288015ea746465d0c3f7d59f Reviewed-on: https://skia-review.googlesource.com/11137 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Matt Sarett <msarett@google.com>
* Prepare to test all image decode modes to F16Gravatar Matt Sarett2017-02-02
| | | | | | | | | | | | | | | I've only been running F16 tests in "colorImage" mode. We really should be running our "image" tests to F16 as well - so they can be tested with scaling, subsets, etc. This CL fixes bugs so that we can enable those tests. BUG=skia: Change-Id: I8137eb4fce7ea12f2c9d233a029d946d4a63e6b0 Reviewed-on: https://skia-review.googlesource.com/7801 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
* Refactor RGBA/BGRA xform logic in SkCodecsGravatar Matt Sarett2016-11-08
| | | | | | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4554 Change-Id: Ic9105a2806b915fc56b6810a80dd444561d0d959 Reviewed-on: https://skia-review.googlesource.com/4554 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
* s/SkAutoTUnref/sk_sp/ in src/ part 1Gravatar Hal Canary2016-11-07
| | | | | | | | | GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4480 Change-Id: I7d3219b02ad5094785e1b7635a9482e69aadbc8c Reviewed-on: https://skia-review.googlesource.com/4480 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* Fix color xforms for Index8 bmpsGravatar Matt Sarett2016-11-04
| | | | | | | | | | | | | Thanks to Gold for catching this. BUG=skia:4895 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4426 Change-Id: Icc816d933e9e2fd312858a5430fa21a47722563e Reviewed-on: https://skia-review.googlesource.com/4426 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
* Add F16, SkColorSpaceXform support to SkBmpCodecGravatar Matt Sarett2016-11-03
| | | | | | | | | | | BUG=skia:4895 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4390 Change-Id: I9cb727e7f13816b0ac882f62ec635a4528c3a524 Reviewed-on: https://skia-review.googlesource.com/4390 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
* Revert "Add F16, SkColorSpaceXform support to SkBmpCodec"Gravatar Matt Sarett2016-11-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit d851795e7992565c1eb2b9474ee5ad01d1a01fad. Reason for revert: <INSERT REASONING HERE> Original change's description: > Add F16, SkColorSpaceXform support to SkBmpCodec > > BUG=skia:4895 > > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4300 > > Change-Id: I2f2b8d3854ea3a8c5904dd3c5bea0342e2be9789 > Reviewed-on: https://skia-review.googlesource.com/4300 > Reviewed-by: Leon Scroggins <scroggo@google.com> > Commit-Queue: Matt Sarett <msarett@google.com> > Speculative revert for MSAN TBR=borenet@google.com,msarett@google.com,scroggo@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: Ie48c03c0c3156267763fbcf96818477567c5069d Reviewed-on: https://skia-review.googlesource.com/4378 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Matt Sarett <msarett@google.com>
* Add F16, SkColorSpaceXform support to SkBmpCodecGravatar Matt Sarett2016-11-03
| | | | | | | | | | | BUG=skia:4895 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4300 Change-Id: I2f2b8d3854ea3a8c5904dd3c5bea0342e2be9789 Reviewed-on: https://skia-review.googlesource.com/4300 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
* Remove SkAutoTDeleteArrayGravatar Ben Wagner2016-11-02
| | | | | | | | | | | | This class is already just an alias for std::unique_ptr<T[]>, so replace all uses with that and delete the class. CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-ASAN-Trybot,Test-Ubuntu-Clang-Golo-GPU-GT610-x86_64-Debug-ASAN-Trybot Change-Id: I40668d398356a22da071ee791666c7f728b59266 Reviewed-on: https://skia-review.googlesource.com/4362 Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
* Implement Fill() for incomplete decodes to RGBA_F16Gravatar msarett2016-09-13
| | | | | | | | | Before this patch, we would hit an SkASSERT(false). BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2335203002 Review-Url: https://codereview.chromium.org/2335203002
* Checking for valid colorType, alphaType, colorSpace in SkCodecGravatar msarett2016-09-08
| | | | | | | | | | | | | | | | | * Refactor to share code between SkPngCodec and SkWebpCodec * Didn't end up sharing with SkJpegCodec but did refactor that code a bit * Disallow conversions to F16 with non-linear color spaces * Fail to decode if we fail to create a SkColorSpaceXform (should be an assert soon). We used to fallback on a legacy decode if we failed to create the transform. * A bunch of name changes BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2319293003 Committed: https://skia.googlesource.com/skia/+/7a9900d6d34e437bb24beb5524a1f6488ae138c9 Review-Url: https://codereview.chromium.org/2319293003
* Revert of Checking for valid colorType, alphaType, colorSpace in SkCodec ↵Gravatar msarett2016-09-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (patchset #2 id:100001 of https://codereview.chromium.org/2319293003/ ) Reason for revert: Broken perf bots Original issue's description: > Checking for valid colorType, alphaType, colorSpace in SkCodec > > * Refactor to share code between SkPngCodec and SkWebpCodec > * Didn't end up sharing with SkJpegCodec but did refactor > that code a bit > * Disallow conversions to F16 with non-linear color spaces > * Fail to decode if we fail to create a SkColorSpaceXform > (should be an assert soon). We used to fallback on a > legacy decode if we failed to create the transform. > * A bunch of name changes > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2319293003 > > Committed: https://skia.googlesource.com/skia/+/7a9900d6d34e437bb24beb5524a1f6488ae138c9 TBR=scroggo@google.com,brianosman@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review-Url: https://codereview.chromium.org/2328663002
* Checking for valid colorType, alphaType, colorSpace in SkCodecGravatar msarett2016-09-08
| | | | | | | | | | | | | | | | * Refactor to share code between SkPngCodec and SkWebpCodec * Didn't end up sharing with SkJpegCodec but did refactor that code a bit * Disallow conversions to F16 with non-linear color spaces * Fail to decode if we fail to create a SkColorSpaceXform (should be an assert soon). We used to fallback on a legacy decode if we failed to create the transform. * A bunch of name changes BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2319293003 Review-Url: https://codereview.chromium.org/2319293003
* Fix ICO bug exposed by the fuzzerGravatar msarett2016-05-04
| | | | | | | BUG=skia:5248 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1949773002 Review-Url: https://codereview.chromium.org/1949773002
* Support the non-native (RGBA/BGRA) swizzleGravatar msarett2016-04-22
| | | | | | | BUG=skia:4456 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1907593004 Review URL: https://codereview.chromium.org/1907593004
* Use SkEncodedInfo in place of SkSwizzler::SrcConfigGravatar msarett2016-04-22
| | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1911613002 Review URL: https://codereview.chromium.org/1911613002
* Add SkEncodedInfo to report properties of encoded image dataGravatar msarett2016-04-20
| | | | | | | | | | | | | | | | | | | All this does is build an SkEncodedInfo for each codec, and then convert it to an SkImageInfo. In future steps I intend to: (1) Use SkEncodedInfo in place of SrcConfig in SkSwizzler. (2) Support more conversions in SkSwizzler (non-native BGRA/RGBA, 16-bit components, float, fixed point) (3) Investigate optimizing conversions from encoded data to linear color spaces. BUG=skia:4133 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1820073002 Committed: https://skia.googlesource.com/skia/+/f682d9ad70d690a343bc15e26ef321d86770be41 Review URL: https://codereview.chromium.org/1820073002
* Revert of Add SkEncodedInfo to report properties of encoded image data ↵Gravatar robertphillips2016-04-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (patchset #6 id:200001 of https://codereview.chromium.org/1820073002/ ) Reason for revert: Lots of bots failing Original issue's description: > Add SkEncodedInfo to report properties of encoded image data > > All this does is build an SkEncodedInfo for each codec, and > then convert it to an SkImageInfo. > > In future steps I intend to: > (1) Use SkEncodedInfo in place of SrcConfig in SkSwizzler. > (2) Support more conversions in SkSwizzler (non-native > BGRA/RGBA, 16-bit components, float, fixed point) > (3) Investigate optimizing conversions from encoded data > to linear color spaces. > > BUG=skia:4133 > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1820073002 > > Committed: https://skia.googlesource.com/skia/+/f682d9ad70d690a343bc15e26ef321d86770be41 TBR=scroggo@google.com,reed@google.com,msarett@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia:4133 Review URL: https://codereview.chromium.org/1895383002
* Add SkEncodedInfo to report properties of encoded image dataGravatar msarett2016-04-18
| | | | | | | | | | | | | | | | | All this does is build an SkEncodedInfo for each codec, and then convert it to an SkImageInfo. In future steps I intend to: (1) Use SkEncodedInfo in place of SrcConfig in SkSwizzler. (2) Support more conversions in SkSwizzler (non-native BGRA/RGBA, 16-bit components, float, fixed point) (3) Investigate optimizing conversions from encoded data to linear color spaces. BUG=skia:4133 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1820073002 Review URL: https://codereview.chromium.org/1820073002
* Refactor SkBmpCodecGravatar msarett2016-03-22
| | | | | | | | | | | | I started working on indicating the native encoded formats and things got really complicated for bmp. I think starting with this refactor may help a little, and I also think that this is a good change by itself. BUG=skia:4133 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1820283002 Review URL: https://codereview.chromium.org/1820283002
* Fix colorType/alphaType checks in SkCodecGravatar msarett2016-02-15
| | | | | | | | | | | | | | | | Make getPixels() and startScanlineDecode() behave consistently. Require that kGray8 decodes are opaque. Assert that creating the swizzler succeeds. BUG=skia:4203 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1695473002 Committed: https://skia.googlesource.com/skia/+/c7578b6cdd03b61f076ffc7956efd952d6c301c0 Review URL: https://codereview.chromium.org/1695473002
* Revert of Fix colorType/alphaType checks in SkCodec (patchset #5 id:80001 of ↵Gravatar msarett2016-02-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://codereview.chromium.org/1695473002/ ) Reason for revert: Really bad images in Gold. Original issue's description: > Fix colorType/alphaType checks in SkCodec > > Make getPixels() and startScanlineDecode() behave > consistently. > > Require that kGray8 decodes are opaque. > > Assert that creating the swizzler succeeds. > > BUG=skia:4203 > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1695473002 > > Committed: https://skia.googlesource.com/skia/+/c7578b6cdd03b61f076ffc7956efd952d6c301c0 TBR=scroggo@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia:4203 Review URL: https://codereview.chromium.org/1694023002
* Fix colorType/alphaType checks in SkCodecGravatar msarett2016-02-12
| | | | | | | | | | | | | | Make getPixels() and startScanlineDecode() behave consistently. Require that kGray8 decodes are opaque. Assert that creating the swizzler succeeds. BUG=skia:4203 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1695473002 Review URL: https://codereview.chromium.org/1695473002
* Implement onSkipScanlines() for bmp and wbmpGravatar msarett2016-02-11
| | | | | | | | TBR=reed@google.com BUG=skia:4270 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1691083002 Review URL: https://codereview.chromium.org/1691083002
* Support more color types for ICOsGravatar msarett2016-02-11
| | | | | | | BUG=skia:4620 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1694513002 Review URL: https://codereview.chromium.org/1694513002
* Fix bugs in SkBmpCodecGravatar msarett2016-02-03
| | | | | | | | | | | | | | | The decode should not depend on the requested alpha type. These were exposed by: https://codereview.chromium.org/1641273003 This should cause the number of untriaged images in Gold to go to zero. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1663303002 Review URL: https://codereview.chromium.org/1663303002
* Support decoding opaque to *premulGravatar scroggo2016-02-03
| | | | | | | | | | | | | | | | | | | | | | If a client requests unpremul or premul from an opaque SkCodec, support it. The opaque image can be treated as any of them, though it will be less efficient to draw than if the client had used opaque. Change the filling code (i.e. for incomplete images) to base its color on the source alpha type. Prior to adding the support to decode opaque to any, it was fine to use either source or dest (which would have yielded the same result). If the client requests non-opaque, we do not want this to switch the fill value from black to transparent. This also allows simplifying the signatures for getFillValue and onGetFillValue. In CodexTest, expect the same result when decoding opaque to *premul, and compare to the opaque version. BUG=skia:4616 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1641273003 Review URL: https://codereview.chromium.org/1641273003
* Fix overflow caught by ASAN.Gravatar benjaminwagner2015-12-04
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/1498923002
* Make SkAndroidCodec support icoGravatar msarett2015-12-04
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/1472933002
* Revert of Make SkAndroidCodec support ico (patchset #7 id:130002 of ↵Gravatar scroggo2015-12-04
| | | | | | | | | | | | | | | | | | | | | | | | | https://codereview.chromium.org/1472933002/ ) Reason for revert: Crashing: https://uberchromegw.corp.google.com/i/client.skia.android/builders/Test-Android-GCC-NexusPlayer-CPU-SSE4-x86-Release/builds/1499/steps/dm/logs/stdio Also, related ASAN failures: https://uberchromegw.corp.google.com/i/client.skia/builders/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-ASAN/builds/3676/steps/dm/logs/stdio Original issue's description: > Make SkAndroidCodec support ico > > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/1603e9310f62cf0dd543cdb09dea06aa78373f13 TBR=djsollen@google.com,msarett@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1498903004
* Make SkAndroidCodec support icoGravatar msarett2015-12-04
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/1472933002
* Reenable warnings in src/codecGravatar msarett2015-10-15
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/1400343005
* Add subsetting to SkScanlineDecoderGravatar msarett2015-10-13
| | | | | | | | | | | | This CL allows the SkScanlineDecoder to decode partial scanlines. This is a first step in efficiently implementing subsetting in SkScaledCodec. BUG=skia:4209 Review URL: https://codereview.chromium.org/1390213002
* Fill incomplete images in SkCodec parent classGravatar msarett2015-10-09
| | | | | | | | | | | | | | | | | | | | | | | | | Rather than implementing some sort of "fill" in every SkCodec subclass for incomplete images, let's make the parent class handle this situation. This includes an API change to SkCodec.h SkCodec::getScanlines() now returns the number of lines it read successfully, rather than an SkCodec::Result enum. getScanlines() most often fails on an incomplete input, in which case it is useful to know how many lines were successfully decoded - this provides more information than kIncomplete vs kSuccess. We do lose information when the API is used improperly, as we are no longer able to return kInvalidParameter or kScanlineNotStarted. Known Issues: Does not work for incomplete fFrameIsSubset gifs. Does not work for incomplete icos. BUG=skia: Review URL: https://codereview.chromium.org/1332053002
* Move all knowledge of X sampling into SkScaledCodecGravatar scroggo2015-10-02
| | | | | | | | | | | | | | | | | | | | | | | Prior to this CL, each SkCodec subclass that allows sampling does an extra check in onStartScanlineDecode to determine whether the X dimension is supported for sampling. Remove this check, and provide a way for SkScaledCodec to directly access the SkSwizzler, and update it to do sampling. This way, the SkCodec knows nothing of sampling, but we can still save the extra step of sampling afterwards. FIXME: SkBmpRLECodec still calls SkScaledCodec::DimensionsSupported. It seems like it could directly support sampling, rather than dealing with SkScaledCodec (partially). Add a new base class for SkSwizzler. It allows updating the swizzler after it was created, which is done by SkScaledCodec. Modify SkSwizzler's constructor/factory function to stop taking any info about sampling, assume the sample size is one, and move modifying that into a virtual function overridden from the base class. BUG=skia:4284 Review URL: https://codereview.chromium.org/1372973002
* Call rewindIfNeeded in SkCodecGravatar scroggo2015-09-30
| | | | | | | | | | Rather than calling it in each subclass, call it once in the base class. Call it first, since other steps may modify internal structures which would be replaced by a call to onRewind. BUG=skia:4284 Review URL: https://codereview.chromium.org/1381483002
* Merge SkCodec with SkScanlineDecoderGravatar scroggo2015-09-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Benefits: - This mimics other decoding APIs (including the ones SkCodec relies on, e.g. a png_struct, which can be used to decode an entire image or one line at a time). - It allows a client to ask us to do what we can do efficiently - i.e. start from encoded data and either decode the whole thing or scanlines. - It removes the duplicate methods which appeared in both SkCodec and SkScanlineDecoder (some of which, e.g. in SkJpegScanlineDecoder, just call fCodec->sameMethod()). - It simplifies moving more checks into the base class (e.g. the examples in skbug.com/4284). BUG=skia:4175 BUG=skia:4284 ===================================================================== SkScanlineDecoder.h/.cpp: Removed. SkCodec.h/.cpp: Add methods, enums, and variables which were previously in SkScanlineDecoder. Default fCurrScanline to -1, as a sentinel that start has not been called. General changes: Convert SkScanlineDecoders to SkCodecs. General changes in SkCodec subclasses: Merge SkScanlineDecoder implementation into SkCodec. Most (all?) owned an SkCodec, so they now call this-> instead of fCodec->. SkBmpCodec.h/.cpp: Replace the unused rowOrder method with an override for onGetScanlineOrder. Make getDstRow const, since it is called by onGetY, which is const. SkCodec_libpng.h/.cpp: Make SkPngCodec an abstract class, with two subclasses which handle scanline decoding separately (they share code for decoding the entire image). Reimplement onReallyHasAlpha so that it can return the most recent result (e.g. after a scanline decode which only decoded part of the image) or a better answer (e.g. if the whole image is known to be opaque). Compute fNumberPasses early, so we know which subclass to instantiate. Make SkPngInterlaceScanlineDecoder use the base class' fCurrScanline rather than a separate variable. CodexTest.cpp: Add tests for the state changes in SkCodec (need to call start before decoding scanlines; calling getPixels means that start will need to be called again before decoding more scanlines). Add a test which decodes in stripes, currently only used for an interlaced PNG. TODO: Add tests for onReallyHasAlpha. Review URL: https://codereview.chromium.org/1365313002
* Scanline decoding for bmpGravatar msarett2015-08-31
| | | | | | | | | | | | | 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
* Style Change: NULL->nullptrGravatar halcanary2015-08-27
| | | | | | DOCS_PREVIEW= https://skia.org/?cl=1316233002 Review URL: https://codereview.chromium.org/1316233002
* Style Change: SkNEW->new; SkDELETE->deleteGravatar halcanary2015-08-26
| | | | | | DOCS_PREVIEW= https://skia.org/?cl=1316123003 Review URL: https://codereview.chromium.org/1316123003
* Support more swizzles to 565 in SkCodecGravatar scroggo2015-08-14
| | | | | | | | | | | | | | | | | | | | | | | 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
* SkScaledCodec classGravatar emmaleer2015-08-14
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Revert of SkScaledCodec class (patchset #35 id:680001 of ↵Gravatar egdaniel2015-08-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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