aboutsummaryrefslogtreecommitdiffhomepage
path: root/resources
Commit message (Collapse)AuthorAge
* Avoid serializing to 'typ1' on Mac.Gravatar Ben Wagner2018-03-09
| | | | | | | | | | | | | | | | | | | | | CoreGraphics does not provide a means to get the original font data for a CGFont, only the tables. As a result, Skia pieces the font data back together when requested. The most awkward part of this is choosing the first four bytes, and the CTFont suggestion seems to often be wrong. This change doublechecks the selection of 'typ1', prefering to use 'OTTO' if there are no 'TYP1' or 'CID ' tables. These sorts of fonts are extremely old and unlikely to be in current use. It appears that CTFont may report that it has this format if it is an 'OTTO' font with very few glyphs. If Skia serializes such a font with 'typ1' as the first four bytes, CoreGraphics will not create a CGFont from the resulting font data. BUG=chromium:809763,skia:7630 Change-Id: I9979b9f0ebdd27c4ad0903e8ee6237241e755541 Reviewed-on: https://skia-review.googlesource.com/113306 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
* Support pngs with incorrect CMF bytesGravatar Leon Scroggins III2018-02-28
| | | | | | | | | | | | | Bug: chromium:807324 Though these pngs are technically incorrect, many such PNGs exist, and they are supported in Chromium. Ensure that users of SkCodec (e.g. Android, Flutter) display them as well. Change-Id: I2f1e573b4b7039cea81f96397cc0aa4cbc9461c3 Reviewed-on: https://skia-review.googlesource.com/111082 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Derek Sollenberger <djsollen@google.com>
* [skottie] Nested animation supportGravatar Florin Malita2018-02-23
| | | | | | | | | | | | | | | | Extend composition layers to support referencing external .json animations ("$"<PATH> syntax). This is a custom extension (not supported in BM/Lottie). Also make skottie::Animation ref-counted, to facilitate sharing. TBR= Change-Id: I062d031e5868d759f3930dea9b261f9b3ec81684 Reviewed-on: https://skia-review.googlesource.com/109806 Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Florin Malita <fmalita@chromium.org>
* Update piex and add test imageGravatar Leon Scroggins III2018-02-22
| | | | | | | | | Bug: oss-fuzz:6347 Change-Id: Iacf8c7a1677f2651e5c211cffb09eecb388a5f8a Reviewed-on: https://skia-review.googlesource.com/109400 Reviewed-by: Kevin Lubick <kjlubick@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Ensure all rows of a gif are initializedGravatar Leon Scroggins III2018-02-16
| | | | | | | | | | | | | | | | | Bug: oss-fuzz:6274 Even if a frame does not have enough LZW blocks to decode all rows, (which is unknown until we actually decode them), it is marked complete once there are no more LZW blocks. When decoding, even if we've decoded all LZW blocks, check fRowsDecoded to determine whether we've actually all the rows. Report the number of rows decoded so that SkCodec can fill in the remaining ones. Change-Id: I1d6e0c29e3c37649725836cf24a4a239e3266b76 Reviewed-on: https://skia-review.googlesource.com/106964 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
* Check for min int in BMP headerGravatar Leon Scroggins III2018-02-15
| | | | | | | | | | | Bug: os-fuzz:6288 Negating it is undefined, so don't try. Change-Id: I055520b8036dd8b355e744114717e08d76206bc1 Reviewed-on: https://skia-review.googlesource.com/107062 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Check the length of marker before reading itGravatar Leon Scroggins III2018-02-13
| | | | | | | | Bug: os-fuzz:6295 Change-Id: I0ea9a3c54d61d41f21f2e9b945ab83fa2beb00d8 Reviewed-on: https://skia-review.googlesource.com/107025 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Make SkAndroidCodec (optionally) respect originGravatar Leon Scroggins III2018-01-26
| | | | | | | | | | | | | | | | | Bug: b/63909536 ImageDecoder will respect the origin, but BitmapFactory will maintain its current behavior of not respecting it. Add an option to respect it. In addition, add support for reading the EXIF data from a WEBP. This seems to be an uncommon use case, but is occasionally used when converting from a JPEG. Add 8 WEBPs, all converted (with cwebp) from their analogous JPEG files already checked in. Change-Id: I38afca58c86fa99ee9ab7d1dc83aaa4f23132c11 Reviewed-on: https://skia-review.googlesource.com/95300 Reviewed-by: Derek Sollenberger <djsollen@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Add a GM and images to test SkEncodedOriginGravatar Leon Scroggins III2018-01-17
| | | | | | | | Bug: skia:7138 Change-Id: I4800bcffc6a397cb688e63a505dd36145e423fa2 Reviewed-on: https://skia-review.googlesource.com/95083 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* [skotty] Fix path close handlingGravatar Florin Malita2017-12-31
| | | | | | | | | | ... and add a transform animation sample TBR= Change-Id: I27a67d7861dffb9ca22a5e7155ee0eba3b4575f6 Reviewed-on: https://skia-review.googlesource.com/90023 Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Florin Malita <fmalita@chromium.org>
* Initial Lottie loader impl (Skotty)Gravatar Florin Malita2017-12-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Coarse workflow: * Construction 1) build a Json tree 2) collect asset IDs (for preComp/image layer resolution) 3) "attach" pass - traverse the Json tree - build an SkSG dom, one fragment at a time - attach "animator" objects to the dom, for each animated prop 4) done, we can throw away the Json tree * For each animation tick 1) iterate over active animators and poke their respective dom nodes/attributes 2) revalidate the SkSG dom 3) draw the SkSG dom Note: post construction, things are super-simple - we just poke SkSG DOM attributes with interpolated values, and everything else is handled by SkSG (invalidation, revalidation, render). Change-Id: I96a02be7eb4fb4cb3831f59bf2b3908ea190c0dd Reviewed-on: https://skia-review.googlesource.com/89420 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
* Fix Adobe RGB color space in SkiaGravatar Brian Osman2017-12-20
| | | | | | | | | | | | | | | | Our runtime definition of the XYZ matrix was fairly inaccurate. It also didn't round-trip through ICC fixed point correctly. Now, constructing the color space at runtime produces exactly the same matrix as constructing the space from the ICC profile. And the values can then be serialized back to ICC exactly. This eliminates the need for the snapping logic, too. Bug: skia: Change-Id: I69f4a9bfec3eeef153935e21ab3a0630794b1607 Reviewed-on: https://skia-review.googlesource.com/84840 Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Mike Klein <mtklein@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Brian Osman <brianosman@google.com>
* resources: orgainize directory.Gravatar Hal Canary2017-12-08
| | | | | | | | | Should make it easier to ask just for images. Change-Id: If821743dc924c4bfbc6b2b2d29b14affde7b3afd Reviewed-on: https://skia-review.googlesource.com/82684 Commit-Queue: Hal Canary <halcanary@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
* Extract Android FontMgr part of Typeface test.Gravatar Ben Wagner2017-11-13
| | | | | | | | | | | | | Part of the Typeface test is Android specific and tests that the Android legacyMakeTypeface returns nullptr when called with a non-null family name and there is no match. A new FontMgrAndroidLegacyMakeTypeface test is introduced to test this and also properly test creating one with SkFontMgr_Android_CustomFonts. Change-Id: Iceb8b9b5490f5eeeaeac30a68daf2c4daac53c86 Reviewed-on: https://skia-review.googlesource.com/70660 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Ben Wagner <bungeman@google.com>
* Avoid uninitialized memory in readByteArrayAsDataGravatar Leon Scroggins III2017-09-28
| | | | | | | | | | | | | | | | | Bug: 769134 readByteArray can fail (due to not having enough available or due to the wrong alignment). If it does, do not return an uninitialized block of memory. Further, drop the initial size check, which is covered by readByteArray. Add a test. Change-Id: Ia101697c5bb1ca3ae3df1795f37a74b2f602797d Reviewed-on: https://skia-review.googlesource.com/52742 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Add animated cowboy sample from WebKit tests, and fix.Gravatar Jim Van Verth2017-09-25
| | | | | | | | Bug: chromium:712455 Change-Id: Ic9bb9b862abe01f112cc41d28589733460b15bc1 Reviewed-on: https://skia-review.googlesource.com/50181 Commit-Queue: Jim Van Verth <jvanverth@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
* Move lang to list in Android font manager.Gravatar Ben Wagner2017-08-14
| | | | | | | Change-Id: Ia4af2769f4761e6b444ed0c232c48199872f3acc Reviewed-on: https://skia-review.googlesource.com/33480 Reviewed-by: Derek Sollenberger <djsollen@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
* Remove SkTypeface::Style from fuzzers and lua.Gravatar Ben Wagner2017-08-08
| | | | | | | Change-Id: I53be039e21a4c11ec3a4bc54c1424cd3e15afc6a Reviewed-on: https://skia-review.googlesource.com/31643 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
* 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>
* 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>
* 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>
* Better image for copyTo4444 testGravatar Matt Sarett2017-06-01
| | | | | | | | | | This one produces noticeable differences if we fail to dither. Bug:720105 Change-Id: I208d0c8147f4cca1b484f2f55edc09ce1bef2dcb Reviewed-on: https://skia-review.googlesource.com/18036 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Mike Klein <mtklein@chromium.org>
* Add ship.png for DrawShip sampleGravatar Jim Van Verth2017-05-23
| | | | | | | | Bug: skia:5526 Change-Id: I12bd44c7dabd72f215a34ce9e733bb7a29d3fc68 Reviewed-on: https://skia-review.googlesource.com/17763 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
* Add Material Design shadow reference sampleGravatar Jim Van Verth2017-05-23
| | | | | | | Change-Id: I889a3f508407178c457f675c321880d869caf9ea Reviewed-on: https://skia-review.googlesource.com/17717 Commit-Queue: Jim Van Verth <jvanverth@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
* Add animation support to SkWebpCodecGravatar Leon Scroggins III2017-05-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TBR=reed@google.com (No change to the public API, but changed a header file) SkWebpCodec: - Implement onGetFrameCount, onGetFrameInfo, and onGetRepetitionCount - Respect the alpha reported by libwebp. Although the spec states that it is only a hint, the libwebp encoder uses it properly. Respecting allows us to draw opaque images faster and decode them to 565. This also matches other SkCodecs (and Chromium). - onGetPixels: - Decode the frame requested, recursively decoding required frame if necessary - When blending with a prior frame, use SkRasterPipeline SkCodec: - Move check for negative index to getFrameInfo - Reset the colorXform if one is not needed SkCodecAnimation: - Add new blend enum, for WebP's (and APNG's) non-blending option SkFrameHolder: - New base classes for frames and the owner of the frames, allowing code sharing between SkWebpCodec and SkGifCodec (particularly for determining whether a frame has alpha and what frame it depends on) - When moving items from SkGIFFrameContext, use Skia conventions (i.e. int instead of unsigned) - Rename "delay time" to "duration", to match e.g. SkFrameInfo:: fDuration SkGifImageReader: - Move pieces to SkFrameHolder, and adapt to changes made in the process - Make setAlphaAndRequiredFrame (now on the base class SkFrameHolder) more general to support webp, and add support for frames that do not blend - Change SkGIFFrameContext from a struct to a class, to match how we use the distinction elsewhere (i.e. struct is a small object with public fields) - Rework hasTransparentPixel (now hasTransparency, since it returns true in some cases where there is not a transparent pixel) to better fit with the modified setAlphaAndRequiredFrame. Also be more consistent when there is no transparent pixel but no color map. - Simplify an if condition that was previously simplified in 2d61e717 but accidentally got reverted in a4db9be6 CodecAnimTest: - Test new animated webp files - Rearrange the test to more cleanly print alpha type mismatches for the first frame resources: - webp-animated.webp - animated webp from Chromium - blendBG.webp - new webp file using bits of webp-animated-semitransparent4.webp from Chromium - tests required frame and alpha when using the non-blending mode - frames have the following properties: - Frame 0: no alpha, fills screen - Frame 1: alpha, fills screen - Frame 2: no alpha, fills screen - Frame 3: alpha, fills screen, blendBG - Frame 4: no alpha, fills screen, blendBG - Frame 5: alpha, blendBG - Frame 6: covers 4, has alpha, blendBG - also used to test decoding to 565 if the new frame data has alpha but blends onto an opaque frame DM.cpp: - Test animated images to non-native 8888 and unpremul DMSrcSink.cpp: - Do not test non-native 8888 decodes to f16 dst - Test unpremul decodes to f16 - Copy a frame of an animated image prior to drawing, since in unpremul mode, the DM code will premultiply first. Bug: skia: 3315 Change-Id: I4e55ae2ee5bc095b37a743bdcfac644be603b980 Reviewed-on: https://skia-review.googlesource.com/16707 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com> Reviewed-by: Matt Sarett <msarett@google.com>
* Add tool to create test images with interesting color profilesGravatar Matt Sarett2017-05-17
| | | | | | | | Bug: skia: Change-Id: Ia4f892368fceda4a99490f5bd29851837a7a6927 Reviewed-on: https://skia-review.googlesource.com/17212 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
* Add jpeg encoder alpha handling optionGravatar Matt Sarett2017-05-09
| | | | | | | | | | | | | | | | | This instructs us on how to encode jpegs when the src image has alpha. The original behavior is to ignore the alpha channel. This CL adds the option to blend the pixels onto opaque black. Note that kBlendOnBlack and kIgnore are identical unless the input alpha type is kUnpremul. Bug: 713862 Bug: skia:1501 Change-Id: I4891c70bb0ccd83f7974c359bd40a2143b5c49ac Reviewed-on: https://skia-review.googlesource.com/15817 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
* Avoid interpolating color lut with less than 2 pointsGravatar Matt Sarett2017-05-05
| | | | | | | | Bug: 717935 Change-Id: Ibf15b815891eef5a0239bc408bcbfe7c8b1507c5 Reviewed-on: https://skia-review.googlesource.com/15301 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
* SkPngCodec: Do not return kInvalidConversion on corrupt pngGravatar Matt Sarett2017-04-26
| | | | | | | | | | | In this case, the fuzzer thinks there is a bug because we are returning kInvalidConversion for a corrupt png file. Bug: skia:6550 Change-Id: I33f588442f5eaa8a4d642e9328750779f9a9ef5d Reviewed-on: https://skia-review.googlesource.com/14324 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
* Add a test for getFrameInfo on truncated dataGravatar Leon Scroggins III2017-04-17
| | | | | | | | | | | | | | Prior to e132e7be5f9108692254c37db592ea7611abbc15, calling getFrameInfo on an SkGifCodec which was truncated before fully parsing the local color map of the first frame would hit an assert. Add a test to verify that the problem has been fixed. Modify box.gif to use a local color map for the first (and only) frame. Change-Id: I905afe60c0c6ecc82e251e00ef82b2e5b22975a3 Reviewed-on: https://skia-review.googlesource.com/13320 Reviewed-by: Chris Blume <cblume@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Correct GIF frame dependencies and track alphaGravatar Leon Scroggins III2017-04-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add SkCodec::FrameInfo::fAlphaType. The SkImageInfo for the SkCodec specifies the SkAlphaType for the first frame, but the opacity can vary from frame to frame. When determining the required frame, also compute whether a frame has alpha. Update how we determine the required frame, which had bugs. (Update a test that had an incorrect required frame as a result.) Add new test images covering cases that have been fixed: - randPixelsAnim2.gif It has the following frames: A (keep) B (keep) (subset) C (disposePrevious) (covers B) D (any) (does *not* cover B) B and C depend on A, but D depends on B, since after disposing C, B should be visible again. - alphabetAnim.gif Includes frames which fill the image size, with different disposal methods and transparencies. Change-Id: Ie086167711c4cac4931ed8c4ddaeb9c9b0b91fdb Reviewed-on: https://skia-review.googlesource.com/9810 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Matt Sarett <msarett@google.com>
* Set a limit on the size for BMP imagesGravatar Leon Scroggins III2017-02-24
| | | | | | | | | | | | | | | This limit matches the limit used by Chromium. I am not aware of any real world BMPs that are larger than this (or even close to it), but there are some invalid BMPs that are larger than this, leading to crashes when we try to read a row. BUG:34778578 BUG=skia:3617 Change-Id: I0f662e8d0d7bc0b084e86d0c9288b831e1b296d7 Reviewed-on: https://skia-review.googlesource.com/8966 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Reland "Respect canvas size and frame offset in webp decoder"Gravatar Matt Sarett2017-02-07
| | | | | | | | | | | | | | Original Change Reviewed At: https://skia-review.googlesource.com/c/7800 CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-MSAN BUG=skia:6185 Change-Id: I1a7732832d37920545c1775d7c7c65b43ed810f9 Reviewed-on: https://skia-review.googlesource.com/8157 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
* Revert "Reland "Respect canvas size and frame offset in webp decoder""Gravatar Matt Sarett2017-02-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 604971e39a20392fd4c74a56bcdc187311cf86dc. Reason for revert: Strange vk failures Original change's description: > Reland "Respect canvas size and frame offset in webp decoder" > > Original Change Reviewed At: > https://skia-review.googlesource.com/c/7800 > > CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-MSAN > > BUG=skia:6185 > > Change-Id: I92baa9070e15ef3c62dd347c08c906c2715dda10 > Reviewed-on: https://skia-review.googlesource.com/8050 > Reviewed-by: Matt Sarett <msarett@google.com> > Commit-Queue: Matt Sarett <msarett@google.com> > TBR=msarett@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia:6185 CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-MSAN Change-Id: Ice93b62c55ea13fce83140567be16225ff0e2fdb Reviewed-on: https://skia-review.googlesource.com/8123 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Matt Sarett <msarett@google.com>
* Reland "Respect canvas size and frame offset in webp decoder"Gravatar Matt Sarett2017-02-06
| | | | | | | | | | | | | | Original Change Reviewed At: https://skia-review.googlesource.com/c/7800 CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-MSAN BUG=skia:6185 Change-Id: I92baa9070e15ef3c62dd347c08c906c2715dda10 Reviewed-on: https://skia-review.googlesource.com/8050 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
* Revert "Respect canvas size and frame offset in webp decoder"Gravatar Robert Phillips2017-02-06
| | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 0f33970c8d950a68b7d83cc626ac0500953d6b15. Reason for revert: msan complaint Original change's description: > Respect canvas size and frame offset in webp decoder > > BUG=skia:6185 > > Change-Id: Id543cb689a5e33b800ebbc18f4a234e78a4c4298 > Reviewed-on: https://skia-review.googlesource.com/7800 > Commit-Queue: Matt Sarett <msarett@google.com> > Reviewed-by: Leon Scroggins <scroggo@google.com> > TBR=borenet@google.com,msarett@google.com,scroggo@google.com,reviews@skia.org # Not skipping CQ checks because original CL landed > 1 day ago. BUG=skia:6185 Change-Id: Ie01dc7d7ebfebe36a235335d0d8cb28bccb2ecff Reviewed-on: https://skia-review.googlesource.com/8046 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
* Respect canvas size and frame offset in webp decoderGravatar Matt Sarett2017-02-03
| | | | | | | | | BUG=skia:6185 Change-Id: Id543cb689a5e33b800ebbc18f4a234e78a4c4298 Reviewed-on: https://skia-review.googlesource.com/7800 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
* Use fixed size buffer for RLE bmpsGravatar Leon Scroggins III2017-01-19
| | | | | | | | | | | | | | | | | | | | | | | An RLE bmp reports how many bytes it should contain. This number may be incorrect, or it may be a very large number. Previously, we buffered all bytes in a single allocation. Instead, use a fixed size buffer and only read what fits into the buffer. We already have code to refill the buffer if there is more data, so rely on that to keep reading. Choose an arbitrary size for the buffer. It is larger than the maximum possible number of bytes we need to read at once. Add a test with a test image that reports a very large number for the number of bytes it should contain. With the old method, we would allocate 4 gigs of memory to decode this image, which is unnecessary and may result in OOM. BUG=b/33251605 Change-Id: I6d66eace626002725f62237617140cab99ce42f3 Reviewed-on: https://skia-review.googlesource.com/7028 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Matt Sarett <msarett@google.com>
* GIF: Better check for frame dependencyGravatar Leon Scroggins III2017-01-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a frame does not have a valid transparent index and it covers the prior frame, it does not really depend on that frame. Instead, it depends on the frame that the prior frame depends on. Determine this once we have parsed the local color map (if any), so a transparent index out of range of the color map is not considered valid. Share code that determines whether a frame has a transparent pixel. Add a test that we compute the dependencies correctly. randPixelsAnim.gif has 13 frames. After the first, the frames cover all combinations of - Whether the prior frame was keep, restoreBG or restoreToPrevious - Whether the new frame covers the prior frame - Whether the new frame has a transparent pixel (It only does so when using a global color table. It may make sense to expand the test to also cover using local color tables.) The test caught a bug where we incorrectly reused an existing SkColorTable for a different frame. Fix that bug by keeping track of the transparent index associated with the current SkColorTable. Change-Id: I3cf6be7f612990fa7a00d9e74d116d31bd227526 Reviewed-on: https://skia-review.googlesource.com/6402 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Only attempt index8 if underlying GIF is index8Gravatar Leon Scroggins III2016-12-16
| | | | | | | | | | | | | | Recent changes (crrev.com/2045293002) made it so that a GIF may not support index 8. In that case, make SkAndroidCodec not suggest index 8. Add a test and a new test file. randPixelsOffset.gif is the same as randPixels.gif, except its frame is offset. Since it does not have a transparent index, we have to decode to kN32. Change-Id: I1c09ab9094083de3dfc436632b3c26dbde1dccbd Reviewed-on: https://skia-review.googlesource.com/6196 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Matt Sarett <msarett@google.com>
* Stop supporting kUnknown_BmpHeaderTypeGravatar Leon Scroggins III2016-12-15
| | | | | | | | | | | | | | | | | | | | | In SkBmpCodec, if the header size does not match a known header, stop trying to create an SkCodec. We do not know of any BMPs with arbitrarily sized headers, so this should not cause any real regressions. In addition, this fixes a bug where we attempt to read too much data from a file. Since we attempt to read the header size in one read, and a size reported by the "BMP" may be larger than SSIZE_MAX, this will crash when reading from a file. Add a test. BUG:b/33651913 Change-Id: I0f3292db3124dc5ac5cbdbc07196bda130a49ba7 Reviewed-on: https://skia-review.googlesource.com/6150 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Matt Sarett <msarett@google.com>
* SkGifCodec: intersect frameRect with image sizeGravatar Leon Scroggins III2016-12-13
| | | | | | | | | | | | | | | When clearing due to SkCodecAnimation::RestoreBGColor_DisposalMethod, intersect the frameRect with the image size to prevent clearing outside the bounds of the allocated memory. Add a test image, created by the fuzzer. BUG=skia:6046 Change-Id: I43676d28f82abf093ef801752f3a9e881580924c Reviewed-on: https://skia-review.googlesource.com/5860 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Matt Sarett <msarett@google.com>
* Do not create an SkRawCodec with zero dimensionsGravatar Leon Scroggins III2016-12-02
| | | | | | | | | | | | Add a test BUG=skia:3534 BUG=b/33300701 Change-Id: Ifb3a824a36998c5e626c4ad58466845f49d18ebf Reviewed-on: https://skia-review.googlesource.com/5568 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Matt Sarett <msarett@google.com>
* Fail jpeg decodes on too many progressive scansGravatar Matt Sarett2016-11-08
| | | | | | | | | | | BUG:642462 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4560 Change-Id: I22891ce1e0b3a1bedefc34dadd5cf34dfc301b79 Reviewed-on: https://skia-review.googlesource.com/4560 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
* Report repetition count in SkCodecGravatar scroggo2016-11-01
| | | | | | | | | | | | | | | | | | | | | Add a new accessor to retrieve the repetition count. Remove constants (and corresponding copyright) in SkCodecAnimation. These may make sense for the calling code, but are not needed here. kRepetitionCountInfinite corresponds to Blink's kAnimationLoopInfinite. Move cLoopCountNotSeen to private. It is used to determine whether we still need to parse. Add a new enum to the parse query - only parse enough to determine the repetition count. Unlike Chromium, SkGifCodec does not account for deleting the reader (which SkGifCodec does not do) or failed decodes. Add a test. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2447863002 Review-Url: https://codereview.chromium.org/2447863002
* Use correct color table for prior GIF framesGravatar Leon Scroggins III2016-10-31
| | | | | | | | | | | | | | | | | | | | | | | | | | While investigating skbug.com/5883 I noticed that we use the color table for the current frame even while recursively decoding frames that the current frame depends on. This CL updates fCurrColorTable, fCurrColorTableIsReal and fSwizzler before decoding prior frames, and then sets them back afterwards. Move telling the client about the color table into prepareToDecode, since the other callers do not need to do so. (That is only necessary for decoding to index 8, which is unsupported for frames with dependencies.) Add a test that exposes the bug. colorTables.gif has a local color table in its second frame that does not match the global table used by the first frame. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4208 Change-Id: Id2dc9e3283adfd92801d2f38726afa74574b1955 Reviewed-on: https://skia-review.googlesource.com/4208 Reviewed-by: Joost Ouwerling <joostouwerling@google.com> Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Reject non-D50 matrices from ICC profilesGravatar Matt Sarett2016-10-31
| | | | | | | | | | | | BUG:660838 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4200 Change-Id: Ib57eb3705d6fe638e3a9cb56788937fc7e282847 Reviewed-on: https://skia-review.googlesource.com/4200 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
* SkGifCodec: do not write off the end of memory when repeatCount > 1Gravatar Matt Sarett2016-10-26
| | | | | | | | | | | BUG=skia:5887 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3940 Change-Id: I9e3ed6153a73277896ac067ef73918a41a0546b8 Reviewed-on: https://skia-review.googlesource.com/3940 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
* Refactored SkColorSpace and added in a Lab PCS GMGravatar raftias2016-10-18
| | | | | | | | | | | | | | | | | | | | The refactoring breaks off A2B0 tag support into a separate subclass of SkColorSpace_Base, while keeping the current (besides CLUT) functionality in a XYZTRC subclass. ICC profile loading is now aware of this and creates the A2B0 subclass when SkColorSpace::NewICC() is called on a profile in need of the A2B0 functionality. The LabPCSDemo GM loads a .icc profile containing a LAB PCS and then runs a Lab->XYZ conversion on an image using it so we can display it and test out the A2B0 SkColorSpace functionality, sans a/b/m-curves, as well as the Lab->XYZ conversion code. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2389983002 Review-Url: https://codereview.chromium.org/2389983002
* Avoid integer overflow in SkIcoCodec and SkImageInfoGravatar Matt Sarett2016-10-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Original Commit Message: """ Avoid integer overflow in SkIcoCodec Definitely good to avoid overflow here. FWIW, this looks to be harmless for Android's current use. They will just fail later on when trying to allocate the bitmap. BUG=skia:5857 """ With the new test, ASAN also caught an integer overflow bug in SkImageInfo. Fix this as well. CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-ASAN;master.client.skia.android:Test-Android-Clang-AndroidOne-CPU-MT6582-arm-Debug-GN_Android BUG=skia:5857 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3568 Change-Id: I0d777a547850474ea6cea87e36efa05434e33635 Reviewed-on: https://skia-review.googlesource.com/3568 Reviewed-by: Kevin Lubick <kjlubick@google.com>