aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec
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>
* Share code for setting the out_color_space CMYK encoded colorspacesGravatar nagarajan.n2017-09-13
| | | | | | | | | | Share code for setting the out_color_space CMYK encoded colorspaces Bug: NONE Change-Id: I17318aa6c04f4105dd9b7c453ccbc3c3ed563e8f Reviewed-on: https://skia-review.googlesource.com/43420 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Remove loop unrolling code in load_gamutGravatar nagarajan.n2017-09-07
| | | | | | | | | | | This patch removes the loop unrolling code in load_gamut() for improving the code readability. Bug: skia: None Change-Id: I749a3351a9f570347946a419d31efffa85818267 Reviewed-on: https://skia-review.googlesource.com/22001 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
* Remove loop unrolling code in onQueryYUV8Gravatar nagarajan.n2017-09-07
| | | | | | | | | | | This patch removes the loop unrolling code in onQueryYUV8() to improve code readability. Bug: skia: None Change-Id: Iddbc0a114fae05234bfea39802f19a430f6c86ec Reviewed-on: https://skia-review.googlesource.com/22000 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
* Update libjpeg buffer status when it has has to be refilled.Gravatar nagarajan.n2017-09-07
| | | | | | | | | | | | To fix the error "corrupt JPEG data: premature end of data segment chromium" update the status to libjpeg when buffer has to be refilled. Bug: skia: None Change-Id: I20d253133b5cf8e8e75b5f44774d0116a0a854ee Reviewed-on: https://skia-review.googlesource.com/24600 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Stop using SkRasterPipeline inside GIFGravatar Leon Scroggins III2017-09-05
| | | | | | | | | | | SkRasterPipeline was overkill, since blending is just comparing to 0. (Each pixel is either opaque or 0.) Bug: 760935 Change-Id: I082045010709c07cc2558988ef509816b9d4bc65 Reviewed-on: https://skia-review.googlesource.com/42440 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
* Remove SK_LEGACY_FRAME_INFO_ALPHA_TYPEGravatar Leon Scroggins III2017-09-01
| | | | | | | | | | | | With https://chromium-review.googlesource.com/c/621815, Chromium no longer references this. Delete it. TBR=reed@google.com Bug: skia:6839 Change-Id: Icd3d394858859e6732b1429394c7c04bb22b9dea Reviewed-on: https://skia-review.googlesource.com/36581 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
* Initialize the swizzler if there is a subsetGravatar Chong Zhang2017-08-23
| | | | | | | | | Bug: b/64077740 Change-Id: Ic6bef3f63bcda24fc3d88ce0cdcf1216441faa40 Reviewed-on: https://skia-review.googlesource.com/37680 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Make haveDecodedRow return voidGravatar Leon Scroggins III2017-08-22
| | | | | | | | | | The method already always returns true, except in a single case after asserting. Change-Id: Icf241a8af04220d459c0782ffd9b74c34c753236 Reviewed-on: https://skia-review.googlesource.com/37161 Reviewed-by: Chris Blume <cblume@chromium.org> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Call initializeColorXform inside SkCodecGravatar Leon Scroggins III2017-08-18
| | | | | | | | | | | | | | | | | | | | | | | | Make initializeColorXform private, and only call in the base class. Add virtual method to skip initializeColorXform, for classes that do not need one. Change SkCodec::FrameInfo's SkAlphaType to an SkEncodedInfo::Alpha. This allows proper checking internally whether SkCodec needs to do a color correct premultiply. Depends on https://chromium-review.googlesource.com/c/620947, for this API change. (Separated from review.skia.org/25746) Bug: skia:5609 Bug: skia:6839 Change-Id: Icb0d46659c546060c34d32eaf792c86708726c7a Reviewed-on: https://skia-review.googlesource.com/35880 Reviewed-by: Chris Blume <cblume@chromium.org> Reviewed-by: Derek Sollenberger <djsollen@google.com> Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Reland "skia: add heif decoding support"Gravatar Leon Scroggins III2017-08-18
| | | | | | | | | | | | | | This reverts commit db68a426b6ba3a0fa1cace25ac306037eb7413a6. Fixes errors in Android and Google3 Bug: b/64077740 Change-Id: I3d2bb1223e4d8ba912ea2b88144aeecc487fce1a Reviewed-on: https://skia-review.googlesource.com/35701 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Chong Zhang <chz@google.com> Reviewed-by: Mike Klein <mtklein@google.com> Reviewed-by: Derek Sollenberger <djsollen@google.com>
* Move calls to conversion_possible to SkCodecGravatar Leon Scroggins III2017-08-17
| | | | | | | | | | | | | | | | | | | | | | | | Move common code into the base class, so subclasses need not call conversion_possible. Use SkEncodedInfo rather than SkImageInfo, and use the proper frame. API Changes: - SkAndroidCodec: - Add getEncodedInfo(), for SkBitmapRegionCodec - SkEncodedInfo: - Add opaque() helper - SkBitmapRegionDecoder: - Remove unused conversionSupported (Split off from skia-review.googlesource.com/c/25746) Bug: skia:5601 Change-Id: If4a40d4b98a3dd0afde2b6058f92315a393a5baf Reviewed-on: https://skia-review.googlesource.com/34361 Reviewed-by: Mike Klein <mtklein@google.com> Reviewed-by: Derek Sollenberger <djsollen@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Revert "skia: add heif decoding support"Gravatar Mike Klein2017-08-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit c2a954290dc3888f877a047098b84c24363895fb. Reason for revert: both Android and Google3 rolls cannot compile. Android cannot cast std::unique_ptr<T> to T*, Google3 cannot find HeifDecoderAPI.h. Original change's description: > skia: add heif decoding support > > Bug: b/64077740 > Change-Id: I11e0243bcc4c21c0aa5aa29a719dd0fcba7ae6f7 > Reviewed-on: https://skia-review.googlesource.com/35123 > Reviewed-by: Chong Zhang <chz@google.com> > Reviewed-by: Leon Scroggins <scroggo@google.com> > Commit-Queue: Chong Zhang <chz@google.com> > Commit-Queue: Leon Scroggins <scroggo@google.com> TBR=scroggo@google.com,chz@google.com Change-Id: Id98f025e63daec50408186000453d1695170f7a8 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: b/64077740 Reviewed-on: https://skia-review.googlesource.com/35741 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Mike Klein <mtklein@google.com>
* skia: add heif decoding supportGravatar Chong Zhang2017-08-16
| | | | | | | | | | Bug: b/64077740 Change-Id: I11e0243bcc4c21c0aa5aa29a719dd0fcba7ae6f7 Reviewed-on: https://skia-review.googlesource.com/35123 Reviewed-by: Chong Zhang <chz@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Chong Zhang <chz@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* remove SK_SUPPORT_LEGACY_CODEC_NEW dead codeGravatar Mike Reed2017-07-26
| | | | | | | | Bug: skia: Change-Id: I59185b8acc00b6df854c613ba29d1002111fcb42 Reviewed-on: https://skia-review.googlesource.com/27240 Commit-Queue: Mike Klein <mtklein@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
* add Make factory to SkMemoryStream (simplify call-sites)Gravatar Mike Reed2017-07-26
| | | | | | | | Bug: skia:6888 Change-Id: Ia4e432673ed089a91229697c8dde0489f220000d Reviewed-on: https://skia-review.googlesource.com/26884 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
* fix legacy compileGravatar Mike Reed2017-07-25
| | | | | | | Bug: skia: Change-Id: I81953c3c980ef88b168b3a9f9ce94445d0a61218 Reviewed-on: https://skia-review.googlesource.com/26623 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>
* convert over to 2d-modeGravatar Mike Klein2017-07-20
| | | | | | | | | | | | [√] convert all stages to use SkJumper_MemoryCtx / be 2d-compatible [√] convert compile to 2d also, remove 1d run/compile [√] convert all call sites [√] no diffs Change-Id: I3b806eb8fe0c3ec043359616409f7cd1211a1e43 Reviewed-on: https://skia-review.googlesource.com/24263 Commit-Queue: Mike Klein <mtklein@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org>
* sk_sp: act as if operator bool() not implicit.Gravatar Hal Canary2017-07-20
| | | | | | | Change-Id: Icd426a162ca0c778db7b3373efcb2c546da50273 Reviewed-on: https://skia-review.googlesource.com/22543 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* Report first GIF frame after knowing its meta dataGravatar Leon Scroggins III2017-07-19
| | | | | | | | | | | | | | | | | Previously, we reported the first image as soon as it was available. As a result, in crrev.com/2565323003, InitializeNewFrame might be called before the metadata is known, meaning it would read the wrong metadata. Instead of looking at the imagesCount(), SkGifCodec::NewFromStream looks at frameContext(0), which may still exist even if it's not yet counted in imagesCount(). Add a test that confirms the desired behavior. Change-Id: Ib392721ecd2218ba0fcd35aaa64117c0ba3e4ea6 Reviewed-on: https://skia-review.googlesource.com/24405 Reviewed-by: Derek Sollenberger <djsollen@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Use SkRasterPipeline to blend GIF frames and use proper offsetGravatar Leon Scroggins III2017-07-18
| | | | | | | | | | | | | | | | | Mimics SkWebpCodec, but it is simpler, because each pixel is either opaque or transparent, so blending just means using the new pixel if not transparent. Correct the offset when blending f16 frames. It needs to be doubled, since the swizzler used a 4-byte format while f16 is 8-byte. Remove an unnecessary call to sk_bzero. Bug: skia:6750 Change-Id: I8b88d1d66bff660c98c2083031231678a7be5460 Reviewed-on: https://skia-review.googlesource.com/24240 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
* Index8 is dead, remove guarded codeGravatar Mike Reed2017-07-17
| | | | | | | | | | Needs google3 to be updated before this can land. Bug: skia:6828 Change-Id: I2c16be13c6937ffa48768cc24f9f980171c824d6 Reviewed-on: https://skia-review.googlesource.com/23940 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Mike Reed <reed@google.com>
* Report error on failure to create SkCodecGravatar Leon Scroggins III2017-07-14
| | | | | | | | | | | | | | | | | | Update NewFromStream to report an error on failure to create an SkCodec, so that a client can distinguish between - not enough data - invalid data In Chromium, this will allow blink::ImageDecoder to call SetFailed if the stream is invalid early and we never create an SkCodec. Without this, ImageDecoder will keep trying to create an SkCodec when it receives more data. Change-Id: I4f505c56d91c982be36a828fd0f7db17b1596588 Reviewed-on: https://skia-review.googlesource.com/22642 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Derek Sollenberger <djsollen@google.com> Reviewed-by: Chris Blume <cblume@chromium.org>
* Fix double delete in SkBmpCodecGravatar Leon Scroggins III2017-07-14
| | | | | | | | | | | | | | | | | | Previously, if ReadHeader returned false, it deleted the input stream. But there are a couple of cases where ReadHeader creates an SkCodec and then returns false. The SkCodec deletes the stream, and then so does NewFromStream. Make sure that we do not double delete by only deleting if no SkCodec was created. Add a test, so such a double delete will be caught by the bots. Bug: b/37623797 Change-Id: I787422c9af58f0b92ad9e9ef9ad87c54a12f5e31 Reviewed-on: https://skia-review.googlesource.com/23620 Reviewed-by: Derek Sollenberger <djsollen@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Fix computeOutputColorSpaceGravatar Leon Scroggins III2017-07-13
| | | | | | | | | | | | This was accidentally broken when we added a guard for kIndex_8 (https://skia-review.googlesource.com/c/22721). Reenable the code for 32 bit color types. Change-Id: Ibb79a163dc1cffe14e19d2affa17856b549509c4 Reviewed-on: https://skia-review.googlesource.com/23020 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Mike Reed <reed@google.com>
* Guard to remove kIndex_8_SkColorTypeGravatar Mike Reed2017-07-13
| | | | | | | | | Bug: skia:6828 Change-Id: Ia942a36abb18213184f8d436555a658270d97d47 Reviewed-on: https://skia-review.googlesource.com/22721 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org> Reviewed-by: Herb Derby <herb@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>
* Add SkCodec::Result indicating error in the dataGravatar Leon Scroggins III2017-07-06
| | | | | | | | | | | | | | | | | | Previously, SkGifCodec treated an error in the LZW data as incomplete, since we can still draw the partially decoded image. But a client doing incremental decodes needs to distinguish this from truly incomplete data. In the case of an error, the client should not attempt to provide more data and decode again. Add kErrorInInput, and return it when SkGifCodec sees a fatal error. Treat it the same as kIncompleteInput when it comes to filling and DM. Bug: skia:6825 Change-Id: Ic6ce3a62c0b065ed34dcd8006309e43272a3db9f Reviewed-on: https://skia-review.googlesource.com/21530 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Chris Blume <cblume@chromium.org>
* ICO: Prevent calling 'new' with large valuesGravatar Leon Scroggins III2017-07-06
| | | | | | | | | | | numImages is read from untrusted data, and as an unsigned short could be up to 65,536. Avoid calling new with this number, which could result in a crash if it pushes the device over the memory limit. Change-Id: Ifff9e0ac6ade2b3d8584af656ea7d2f9eb4998e2 Reviewed-on: https://skia-review.googlesource.com/21269 Reviewed-by: Derek Sollenberger <djsollen@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* header cleanupGravatar Hal Canary2017-07-05
| | | | | | | Change-Id: I3f7667a1357194ae2bdd341ad9d46eb93920f404 Reviewed-on: https://skia-review.googlesource.com/21374 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* clean up low-hanging swap_rbGravatar Mike Klein2017-06-28
| | | | | | | | | | | | | | | There are two remaining swap_rb uses that both look non-trivial to replace: - sampling out of index8 when the color table is bgra - table transforms on bgra inputs in SkColorSpaceXform I don't think it's a big deal to just leave swap_rb around, just a little sad. Change-Id: I3d30200cf867cbf37d6f86572b1574d3e22e3490 Reviewed-on: https://skia-review.googlesource.com/21040 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Revert "Revert "Do not return Index8 from ↵Gravatar Matt Sarett2017-06-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SkAndroidCodec::computeOutputColorType"" This reverts commit 81c83a7db4e524b19d33bf7c8a9b537b9d606c93. Reason for revert: <INSERT REASONING HERE> Original change's description: > Revert "Do not return Index8 from SkAndroidCodec::computeOutputColorType" > > This reverts commit b6f4767294261dca3beef6f280c4bac69df3f930. > > Reason for revert: This breaks CTS tests in Android. Doh. > > Original change's description: > > Do not return Index8 from SkAndroidCodec::computeOutputColorType > > > > Given that this is the only known use of Index8 color type, > > this is essentially an experimental delete. > > > > Bug: skia:6620 > > Change-Id: Ib363d237e0217f6e7f461a62e54d32892c428095 > > Reviewed-on: https://skia-review.googlesource.com/10586 > > Reviewed-by: Leon Scroggins <scroggo@google.com> > > Commit-Queue: Matt Sarett <msarett@google.com> > > TBR=msarett@google.com,scroggo@google.com,reed@google.com > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia:6620 > > Change-Id: I2b44c695b8b95659520e9532901f636f56e01e2a > Reviewed-on: https://skia-review.googlesource.com/19084 > Reviewed-by: Matt Sarett <msarett@google.com> > Commit-Queue: Matt Sarett <msarett@google.com> TBR=msarett@google.com,scroggo@google.com,reviews@skia.org,reed@google.com # Not skipping CQ checks because original CL landed > 1 day ago. Bug: skia:6620 Change-Id: I7e4e3a5ec068102244ad3a0259aa6aded4f12f36 Reviewed-on: https://skia-review.googlesource.com/19802 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
* Consolidate decoding frames into SkCodecGravatar Leon Scroggins III2017-06-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new private method to SkCodec that handles Options.fFrameIndex: - Check to ensure the index is valid - Call onGetFrameCount to force parsing the stream - Recursively call getPixels (it should be complete, so no need for incremental decoding) to decode the prior frame if necessary - Zero fill a RestoreBGColor frame Call the method in getPixels and startIncrementalDecode, and remove duplicate code from GIF and WEBP. Remove support for scaling frames beyond the first, which is currently unused. Preserve the feature of SkGifCodec that it will only parse to the end of the first frame if the first frame is asked for. (Also note that when we continue a partial frame, we won't force parsing the full stream.) If the client only wants the first frame, parsing the rest would be unnecessary. But if the client wants the second, we assume they will want any remaining frames, so we parse the remainder of the stream. This simplifies the code (so SkCodec does not have to ask its subclass to parse up to a particular frame). Update tests that relied on the old behavior: - Codec_partialAnim now hardcodes the bytes needed. Previously it relied on the old behavior that GIF only parsed up to the frame being decoded. - Codec_skipFullParse now only tests the first frame, since that is the case where it is important to skip a full parse. TBR=reed@google.com No changes to the public API. Change-Id: Ic2f075452dfeedb4e3e60e6cf4df33ee7bd38495 Reviewed-on: https://skia-review.googlesource.com/19276 Reviewed-by: Leon Scroggins <scroggo@google.com> Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Remove debug checks for unsupported ICC profilesGravatar Matt Sarett2017-06-09
| | | | | | | | | | | | This was never fully integrated with our automated image testing. I feel it has limited usefulness in terms of catching bugs. Bug: skia: Change-Id: Iecd0a4e9b664ab0b351debde45ada864379de7ec Reviewed-on: https://skia-review.googlesource.com/19267 Reviewed-by: Leon Scroggins <scroggo@google.com> Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
* Revert "Do not return Index8 from SkAndroidCodec::computeOutputColorType"Gravatar Matt Sarett2017-06-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit b6f4767294261dca3beef6f280c4bac69df3f930. Reason for revert: This breaks CTS tests in Android. Doh. Original change's description: > Do not return Index8 from SkAndroidCodec::computeOutputColorType > > Given that this is the only known use of Index8 color type, > this is essentially an experimental delete. > > Bug: skia:6620 > Change-Id: Ib363d237e0217f6e7f461a62e54d32892c428095 > Reviewed-on: https://skia-review.googlesource.com/10586 > Reviewed-by: Leon Scroggins <scroggo@google.com> > Commit-Queue: Matt Sarett <msarett@google.com> TBR=msarett@google.com,scroggo@google.com,reed@google.com No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia:6620 Change-Id: I2b44c695b8b95659520e9532901f636f56e01e2a Reviewed-on: https://skia-review.googlesource.com/19084 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
* Do not return Index8 from SkAndroidCodec::computeOutputColorTypeGravatar Matt Sarett2017-06-08
| | | | | | | | | | | Given that this is the only known use of Index8 color type, this is essentially an experimental delete. Bug: skia:6620 Change-Id: Ib363d237e0217f6e7f461a62e54d32892c428095 Reviewed-on: https://skia-review.googlesource.com/10586 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
* Make SkCodec more flexible about its required frameGravatar Leon Scroggins III2017-06-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SkCodec sets fRequiredFrame to be the earliest possible frame that a given frame can depend on. e.g. - Frame A fills the screen, Keep - Frame B does not cover A, Keep - Frame C covers B but not A, and is opaque Frame C can depend on either A or B. SkCodec already reports that C depends on A. This CL allows a client of SkCodec to use either A or B to create C. Also expose the DisposalMethod. Since any frame between A and C can be used to create C except for DisposePrevious frames, the client needs to be able to know the disposal method so they do not try to use such a frame to create C. Further, the disposal method can be used to give the client a better idea whether they will continue to need a frame. (e.g. if frame i is DisposePrevious and depends on i-1, the client may not want to steal i-1 to create i, since i+1 may also depend on i-1.) TODO: Share code for decoding prior frames between GIF and WEBP Change-Id: I91a5ae22ba3d8dfbe0bde833fa67ae3da0d81ed6 Reviewed-on: https://skia-review.googlesource.com/13722 Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Chris Blume <cblume@chromium.org> Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Reland "Handle different types of streams in different jpeg source managers"Gravatar Matt Sarett2017-06-07
| | | | | | | | | | | | | | | | | | | For streams that are memory backed (stream->getMemoryBase() returns a non-null ptr and hasLength() returns true), handle the stream with skjpeg_mem_source_mgr, which directly assigns memory base to the source manager. For other non memory backed streams, handle the stream with skjpeg_buffered_source_mgr, which is renamed from the old skjpeg_source_mgr with no implementation change. Original Author: cjbao <cathy.bao@intel.com> https://skia-review.googlesource.com/c/17296/ Bug: skia: Change-Id: I0885c5114083f976a9c08afe5954434196762e39 Reviewed-on: https://skia-review.googlesource.com/18933 Reviewed-by: Mike Klein <mtklein@chromium.org> Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
* Fix alpha issues in SkGifCodecGravatar Leon Scroggins III2017-06-07
| | | | | | | | | | | | | | | | - Call conversion_possible with the proper alpha type for the frame. - Always use kUnpremul for the transform. Previously we used the alpha type for the first frame. If it was opaque and a later frame was not, this would be incorrect. Also fix Codec_frames test. Most of the tests were not running due to a return statement in a loop. Change that to continue, and correct errors in the test. Provide better debugging information. Change-Id: Icd40c09526b1d599168bfe90d93d8ddcdd9ca20f Reviewed-on: https://skia-review.googlesource.com/18935 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Revert "Handle different types of streams in different jpeg source managers"Gravatar Matt Sarett2017-06-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 96cc36124d06e023005dd901b32c59b29f55a135. Reason for revert: I think this is break one of our test bots. I will reland once that is figured out. Original change's description: > Handle different types of streams in different jpeg source managers > > For streams that are memory backed (stream->getMemoryBase() returns > a non-null ptr and hasLength() returns true), handle the stream > with skjpeg_mem_source_mgr, which directly assigns memory base to > the source manager. For other non memory backed streams, handle the > stream with skjpeg_buffered_source_mgr, which is renamed from > the old skjpeg_source_mgr with no implementation change. > > Signed-off-by: cjbao <cathy.bao@intel.com> > Bug: skia: > Change-Id: I748de0bdba726bbb318922c08497135e73e37329 > Reviewed-on: https://skia-review.googlesource.com/17296 > Reviewed-by: Leon Scroggins <scroggo@google.com> > Reviewed-by: Matt Sarett <msarett@google.com> > Commit-Queue: Matt Sarett <msarett@google.com> > TBR=msarett@google.com,scroggo@google.com,cathy.bao@intel.com # Not skipping CQ checks because original CL landed > 1 day ago. Bug: skia: Change-Id: Idf6c426468cc959b3f4661c0b3e86cb4d5e93688 Reviewed-on: https://skia-review.googlesource.com/18850 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Matt Sarett <msarett@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>
* Defend against ICOs with large BMPs embeddedGravatar Leon Scroggins III2017-06-05
| | | | | | | | | | | If the ICO reports that it has a large BMP file embedded, do not crash if we attempt to allocate too much memory. Bug: b/38116746 Change-Id: I70eb66f5e4ffc15587007b398bbe843665eae500 Reviewed-on: https://skia-review.googlesource.com/18447 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>
* Handle different types of streams in different jpeg source managersGravatar cjbao2017-06-05
| | | | | | | | | | | | | | | | | For streams that are memory backed (stream->getMemoryBase() returns a non-null ptr and hasLength() returns true), handle the stream with skjpeg_mem_source_mgr, which directly assigns memory base to the source manager. For other non memory backed streams, handle the stream with skjpeg_buffered_source_mgr, which is renamed from the old skjpeg_source_mgr with no implementation change. Signed-off-by: cjbao <cathy.bao@intel.com> Bug: skia: Change-Id: I748de0bdba726bbb318922c08497135e73e37329 Reviewed-on: https://skia-review.googlesource.com/17296 Reviewed-by: Leon Scroggins <scroggo@google.com> Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
* Avoid new for small arrays in SkBmpCodecGravatar Leon Scroggins III2017-06-02
| | | | | | | | | Use a buffer on the stack to avoid the cost of new/delete. Change-Id: I5c9208ec283e8345c34553343925097926274978 Reviewed-on: https://skia-review.googlesource.com/18402 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* update SkRasterPipeline::run() to also take yGravatar Mike Klein2017-06-01
| | | | | | | | | y isn't used yet. This is just a warmup that updates the callers. Change-Id: I78f4f44e2b82f72b3a39fa8a8bdadef1d1b8a99e Reviewed-on: https://skia-review.googlesource.com/18381 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Klein <mtklein@chromium.org>
* SkRasterPipeline in SkArenaAllocGravatar Mike Klein2017-05-24
| | | | | | | | | Bug: skia:6673 Change-Id: Ia2bae4f6a9039a007a10b6b45bcf2f0854bf6e5c Reviewed-on: https://skia-review.googlesource.com/17794 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>