aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec
Commit message (Collapse)AuthorAge
* Fix fuschia rollGravatar Leon Scroggins III2018-03-01
| | | | | | | | | Only call png_set_option ifdef PNG_SET_OPTION_SUPPORTED. Change-Id: Ib3d03e15b12b6229f98544b195a6bc32b5aa2f0f Reviewed-on: https://skia-review.googlesource.com/111601 Reviewed-by: Ben Wagner <benjaminwagner@google.com> Commit-Queue: Leon Scroggins <scroggo@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>
* 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>
* Add 2 fuzz targets for image decoding (oss-fuzz)Gravatar Kevin Lubick2018-02-12
| | | | | | | | | | | This also adds in a few small guards to prevent libfuzzer from frequently running out of memory when an image claims to have billions of pixels. Bug: skia: Change-Id: I47a9daac832c4d85a42000698482b61721c38880 Reviewed-on: https://skia-review.googlesource.com/106264 Commit-Queue: Kevin Lubick <kjlubick@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
* move a bunch of helpers from SkImageInfo.h into privGravatar Mike Reed2018-02-09
| | | | | | | | | Bug: skia: Change-Id: I8c91cfdb89e4f22448d1201d391556fe43d86dca Reviewed-on: https://skia-review.googlesource.com/105289 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org> Reviewed-by: Cary Clark <caryclark@google.com>
* 1010102, 101010x, 888x in swGravatar Mike Klein2018-01-30
| | | | | | | | | | | | | | | | | | | Same sort of deal as before, now with all three new formats. While I was at it, I made sure RGBA 8888 and BGRA 8888 both work too. We don't want the 101010's in lowp, but 888x should be fine. After looking at the DM images on monitors at work, I decided to re-enable dither even on 10-bit images. Looking at the GMs in 888x or 101010x is interesting... I think we must not be clearing the memory allocated for layers? Seems like we want to allocate layers as 8888? Change-Id: I3a85b4f00877792a6425a7e7eb31eacb04ae9218 Reviewed-on: https://skia-review.googlesource.com/101640 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Add kRGBX_8888, kRGBA_1010102, and kRGBX_1010102 color types. Unused for now.Gravatar Brian Salomon2018-01-30
| | | | | | | | | BUG= skia:7533 Change-Id: I4b3f6b827fd833ba2d07895884d2abc9a3132366 Reviewed-on: https://skia-review.googlesource.com/99781 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Brian Salomon <bsalomon@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>
* remove SkColorSpace_BaseGravatar Mike Klein2018-01-26
| | | | | | | | | | | | The type SkColorSpace_Base doesn't need to exist. Its one type() query can be answered instead by toXYZD50(). Now all that's left in the file is SkGammas, so rename it to SkGammas.h. Change-Id: Id60ddbfb342accfd5674ae89b37a24a6583ef7b8 Reviewed-on: https://skia-review.googlesource.com/99702 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Stop defining SK_CODEC_PRINTF in debugGravatar Leon Scroggins III2018-01-19
| | | | | | | | | | | Too much spew during DM. TBR=reed@google.com Change-Id: Ifad53b1abb35d1768e83e7867f9e808df3fcaef1 Reviewed-on: https://skia-review.googlesource.com/97160 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Add SkAndroidCodec::computeSampledSizeGravatar Leon Scroggins III2018-01-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | Bug: b/63909536 Android's ImageDecoder API takes as input an arbitrary width and height to scale the image to. Internally, this uses SkAndroidCodec to sample, and then (if not a perfect match) scales to the desired size with drawing. computeSampledSize is a modified version of what ImageDecoder currently does to convert from arbitrary dimensions to a sampleSize. Moving it here allows it to be shared by SkAnimatedImage. The modified version also corrects two bugs: - a client using the dimensions returned by getSampledDimensions previously may have resulted in ImageDecoder decoding to a larger size and then scaling it. (example found in tests: dog.jpg is 180 x 180. getSampledDimensions(8) returns 23 x 23, but the old method resulted in using sampleSize of 7 and downscaling the resulting 25 x 25 image.) - recompute the sampleSize based on the size returned by getSampledDimensions. Change-Id: I022040e8bac31c20988903a0452257f7ae902bc7 Reviewed-on: https://skia-review.googlesource.com/94620 Reviewed-by: Derek Sollenberger <djsollen@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Use SkAndroidCodec in SkAnimatedImageGravatar Leon Scroggins III2018-01-16
| | | | | | | | | | | | | | | | | | | | | | | | | | Bug: b/63909536 Bug: b/63908092 SkAnimatedImage is designed around a specific Android use case, so move it into the android folders. Make SkAnimatedImage hold an SkAndroidCodec (instead of an SkCodec). Expose fCodec so that SkAnimatedImage can animate by using the internal SkCodec. Update the sample to use SkAndroidCodec. Allow webp to decode a scaled down animation. For RestoreBG frames, adjust the frameRect (which is erased) to account for the scaling. Add a test to verify that we decode a webp with a RestoreBG frame successfully. Disable scaling for later frames in other formats (GIF, for now), since the code for erasing a RestoreBG frame is currently unaware of the sampling. Change-Id: I5dd2b86138f2c7f6adcd08dce1bd49040f7dc224 Reviewed-on: https://skia-review.googlesource.com/94621 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Derek Sollenberger <djsollen@google.com>
* Add a method to convert SkCodec::Result to a stringGravatar Leon Scroggins III2018-01-16
| | | | | | | | Bug: b/63909536 Change-Id: Ic91e3401359f80eadd9d1cd79aa8ef642c60b0fc Reviewed-on: https://skia-review.googlesource.com/94781 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Derek Sollenberger <djsollen@google.com>
* Add an SkDrawable for animated images (e.g. GIF)Gravatar Leon Scroggins III2018-01-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug: b/63909536 SkAnimatedImage is a simple drawable for animating a GIF. Thread-safety is left up to the client. At most two bitmaps are stored in the drawable; one for the current frame and one for a frame that may need to be restored. The backup frame prevents some cases where we would otherwise have to re-decode from the beginning of the image. The API lets the client set the time value, and decodes to match that time. TODO: - Callback for when the animation is complete - Ability to use SkAndroidCodec - Modify the loop count (or leave that up to client?) - Better and/or client-specific caching Other changes: - Add a sample which animates a GIF - Reenable SK_CODEC_PRINTF for debug builds and Android Change-Id: I945ffbccdb6008f2a05ed4d9b2af869a261fb300 Reviewed-on: https://skia-review.googlesource.com/93420 Reviewed-by: Derek Sollenberger <djsollen@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* begin cleanup of malloc porting layerGravatar Mike Reed2018-01-05
| | | | | | | | | | | | | | 1. Merge some of the allocators into sk_malloc_flags by redefining a flag to mean zero-init 2. Add more private helpers to simplify our call-sites (and handle some overflow mul checks) 3. The 2-param helpers rely on the saturating SkSafeMath::Mul to pass max_size_t as the request, which should always fail. Bug:508641 Change-Id: I322f1e6ed91113467e0fdb12c91c3dad33d890c8 Reviewed-on: https://skia-review.googlesource.com/90940 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com> Reviewed-by: Stephan Altmueller <stephana@google.com>
* Add SkAndroidCodec::MakeFromCodecGravatar Leon Scroggins III2018-01-04
| | | | | | | | | | | | | Bug: b/71578461 Bug: b/63909536 This allows using APIs on SkCodec (e.g. the out-param result on SkCodec::MakeFrom(Stream/Data), getOrigin) when an SkAndroidCodec is ultimately desired without duplicating the APIs on SkAndroidCodec. Change-Id: Ie9803278348acfb3955a795772d6472c15541646 Reviewed-on: https://skia-review.googlesource.com/90844 Reviewed-by: Derek Sollenberger <djsollen@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Consider overflow in is_orientation_markerGravatar Leon Scroggins III2017-12-19
| | | | | | | | | | | | | Bug: skia:7404 Use a uint64_t to store the four byte integer in order to protect against overflow in the encoded (untrusted) offset. Change-Id: I9592983a7a5353219507b7ec85eae2f2c4a16a1a Reviewed-on: https://skia-review.googlesource.com/85900 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Herb Derby <herb@google.com> Reviewed-by: Kevin Lubick <kjlubick@google.com>
* remove append_from_srgb()Gravatar Mike Klein2017-12-18
| | | | | | | | | | | It's now no different than append(from_srgb). Bug: skia:7419 Change-Id: I97c59b6987f033ec2f1859db40ca3056b87b370a Reviewed-on: https://skia-review.googlesource.com/86741 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Remove SkColorSpace_Base::MakeNamed, along with most uses of Adobe RGBGravatar Brian Osman2017-12-14
| | | | | | | | Bug: skia: Change-Id: Ic914aacc4c47200714d66cf4487932bcb8a7693a Reviewed-on: https://skia-review.googlesource.com/85040 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Mike Klein <mtklein@chromium.org>
* Revert "Remove SkColorSpace_Base::MakeNamed, along with most uses of Adobe RGB"Gravatar Mike Klein2017-12-14
| | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 411b8ea74d66d08252d9b617d7e7d458604dbc2e. Reason for revert: a couple layout tests in the roll. :/ Original change's description: > Remove SkColorSpace_Base::MakeNamed, along with most uses of Adobe RGB > > Bug: skia: > Change-Id: If5935eac48184bc8cbe4db21dac4d6033a8704e6 > Reviewed-on: https://skia-review.googlesource.com/84200 > Commit-Queue: Brian Osman <brianosman@google.com> > Reviewed-by: Mike Klein <mtklein@chromium.org> TBR=mtklein@chromium.org,brianosman@google.com Change-Id: I6d2eb57b613035ec26da15218182c808bed364ed No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/84920 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Mike Klein <mtklein@google.com>
* Remove SkColorSpace_Base::MakeNamed, along with most uses of Adobe RGBGravatar Brian Osman2017-12-13
| | | | | | | | Bug: skia: Change-Id: If5935eac48184bc8cbe4db21dac4d6033a8704e6 Reviewed-on: https://skia-review.googlesource.com/84200 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
* Push much of the SkColorSpace_Base interface up to SkColorSpaceGravatar Brian Osman2017-12-12
| | | | | | | | | | | Some pieces still remain, but the next step looks less mechanical, so I wanted to land this piece independently. Bug: skia: Change-Id: Ie63afcfa08af2f6e4996911fa2225c43441dbfb2 Reviewed-on: https://skia-review.googlesource.com/84120 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Brian Osman <brianosman@google.com>
* Reland "Hide SkEncodedInfo"Gravatar Leon Scroggins III2017-12-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This partially reverts commit 1793e7bb46c1f9d430c1a699a1c3d3168159b659. Hide SkEncodedInfo Bug: skia:7353 Bug: skia:6839 This contains information that is not necessary for clients to know. The Color enum tells the number of components in the input, but this is only interesting internally (to the SkSwizzler). Similarly, the Alpha enum differs from SkAlphaType in that it has kBinary instead of kPremul. This is useful information only internally for determining whether the SkColorSpaceXform needs to premultiply. The bitsPerComponent is potentially useful for a client; Android (in SkAndroidCodec) uses it to determine the SkColorType. Rather than exposing bitsPerComponent, make SkAndroidCodec a friend so it can access the SkEncodedInfo. A future change will change SkCodec to recommend F16 for bitsPerComponent > 8, but that will be more involved; it was the reason for the revert of this CL. Switch conversionSupported to use an SkColorType, which is enough info. Replace the SkEncodedInfo::Alpha field on SkCodec::FrameInfo with an SkAlphaType. SkCodec still needs an SkEncodedInfo, so move its header (which is already not SK_API) to include/private. TBR=mtklein@chromium.org,reed@google.com Change-Id: I928b1f55317602cb37d29da63b53026c8d139cee Reviewed-on: https://skia-review.googlesource.com/80860 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Revert "Hide SkEncodedInfo"Gravatar Leon Scroggins2017-12-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit c6f7a4ffa9522159efc42f7c948bba5e66bb8844. Reason for revert: Causing differences in Gold, stemming from the fact that this changes the recommended SkImageInfo for 16 bits-per-component PNG from N32 to F16. - an F16 bitmap already png-encodes to a 16 bits-per-component PNG, but it does not encode a linear colorspace (possibly a bug?). when we decode this PNG using getInfo(), it fails because it has an F16 color type and non-linear colorspace. (In the encode-srgb-png gm, this results in blank results for F16.) We could correct this on the encoder side, but it seems possible that a 16 bits-per-component PNG could be encoded with a different color space. In that case, we'd want SkCodec to recommend F16/SRGBLinear, but I think we'd want the SkCodec to store the encoded SkColorSpace so that we can Xform between the two. Currently SkCodec only stores one color space, so that will require a refactor. - When decoding 16-bits-per-component PNGs, we are now decoding them to F16. This shows differences in Gold. The srgb/gpu results now look more like F16. I think this is fine. Original change's description: > Hide SkEncodedInfo > > Bug: skia:7353 > Bug: skia:6839 > > This contains information that is not necessary for clients to know. The > Color enum tells the number of components in the input, but this is only > interesting internally (to the SkSwizzler). > > Similarly, the Alpha enum differs from SkAlphaType in that it has > kBinary instead of kPremul. This is useful information only internally > for determining whether the SkColorSpaceXform needs to premultiply. > > The bitsPerComponent is potentially useful for a client; Android (in > SkAndroidCodec) uses it to determine the SkColorType. Rather than > exposing bitsPerComponent, use it to make the same decision that Android > would have made - 16 bits per component means to set the info to F16. Add > a test that computeOutputColorType behaves as expected. > > Switch conversionSupported to use an SkColorType, which is enough info. > > Replace the SkEncodedInfo::Alpha field on SkCodec::FrameInfo with an > SkAlphaType. > > SkCodec still needs an SkEncodedInfo, so move its header (which is > already not SK_API) to include/private. > > Change-Id: Ie2cf11339bf999ebfd4390c0f448f7edd6feabda > Reviewed-on: https://skia-review.googlesource.com/79260 > Reviewed-by: Mike Reed <reed@google.com> > Reviewed-by: Mike Klein <mtklein@chromium.org> > Commit-Queue: Leon Scroggins <scroggo@google.com> TBR=mtklein@chromium.org,scroggo@google.com,reed@google.com Change-Id: I0c5dd1461e1b70d1e55349a8e7ee6b029c3f556e No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia:7353, skia:6839 Reviewed-on: https://skia-review.googlesource.com/80660 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Hide SkEncodedInfoGravatar Leon Scroggins III2017-12-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug: skia:7353 Bug: skia:6839 This contains information that is not necessary for clients to know. The Color enum tells the number of components in the input, but this is only interesting internally (to the SkSwizzler). Similarly, the Alpha enum differs from SkAlphaType in that it has kBinary instead of kPremul. This is useful information only internally for determining whether the SkColorSpaceXform needs to premultiply. The bitsPerComponent is potentially useful for a client; Android (in SkAndroidCodec) uses it to determine the SkColorType. Rather than exposing bitsPerComponent, use it to make the same decision that Android would have made - 16 bits per component means to set the info to F16. Add a test that computeOutputColorType behaves as expected. Switch conversionSupported to use an SkColorType, which is enough info. Replace the SkEncodedInfo::Alpha field on SkCodec::FrameInfo with an SkAlphaType. SkCodec still needs an SkEncodedInfo, so move its header (which is already not SK_API) to include/private. Change-Id: Ie2cf11339bf999ebfd4390c0f448f7edd6feabda Reviewed-on: https://skia-review.googlesource.com/79260 Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Fix setjmp/longjump usage in JPEG error handlingGravatar Chris Dalton2017-12-04
| | | | | | | | | | | | Pushes and pops nested jmp_bufs in a stack for proper handling of nested setjmp calls. Ensures longjmp is never called to a stack frame that has exited. Bug: skia: Change-Id: I18d62504f6e5e3eb53026c3b48617b92ea74b905 Reviewed-on: https://skia-review.googlesource.com/79241 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* encode kAlpha_8 as grayalpha with sigbits for gray==1Gravatar Mike Reed2017-11-30
| | | | | | | | Bug: skia: Change-Id: Ib61e8e0f62af92d8746f5e73469002e7804a8447 Reviewed-on: https://skia-review.googlesource.com/78481 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Mike Reed <reed@google.com>
* Fix webp bug compositing alpha frames on opaque (better fix)Gravatar Leon Scroggins III2017-11-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old code made the wrong assumptions about premultiplication. There are three relevant steps here for decoding a webp frame: 1 tell libwebp to decode 2 colorXform the result (sometimes) 3 blend with the prior frame (sometimes) Rearrange the code to premultiply at the blend step, in a linear space. If the client wants unpremul, the blend step will unpremul after. If there is no blending, the colorXform (if any) will premultiply. If only step 1 is necessary, let libwebp premultiply. This fixes an animated image that has an opaque frame 0 followed by a frame with alpha that blends with it. Add the test image that failed (https://mathiasbynens.be/demo/animated-webp) The prior fix is in 42bae8faa4b9b6a3341b15c6ac7c6b466e95625c. It did not properly handle the colorXform when there was no blending step. Change-Id: I2b9d265ba162eaf7e55a106c8f79341826cee0d3 Reviewed-on: https://skia-review.googlesource.com/72281 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
* WebP - allow more scalesGravatar Leon Scroggins III2017-11-16
| | | | | | | | | | | We previously artificially restricted to using sample sizes. But there is no reason to do so. Android's new API allows arbitrary scaling, so support it. Change-Id: I15f48f9b27b11f8cabb55e3f79ae6ee5ffd39069 Reviewed-on: https://skia-review.googlesource.com/69600 Reviewed-by: Derek Sollenberger <djsollen@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Revert "Fix webp bug compositing alpha frames on opaque"Gravatar Leon Scroggins2017-11-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 42bae8faa4b9b6a3341b15c6ac7c6b466e95625c. Reason for revert: Breaking GMs. A more extensive fix is needed. Original change's description: > Fix webp bug compositing alpha frames on opaque > > select_xform_alpha is used to determine how the color transform should > handle alpha values. In a similar way, we're using it here to determine > whether to premultiply pixels before blending them. In this case, the > source is unpremul, so we should be premultiplying them, but since we > are compositing on an opaque frame, the dst must be opaque and > select_xform_alpha returns kOpaque. As a result, we do not premultiply > (and even hint to the transform that the pixels are opaque). Since this > all applies to the pre-blended pixels, we should not care that the dst > is opaque. So drop the call to select_xform_alpha and just use the alpha > type of the source. This matches the comment on the lines above. > > Add the test image that failed (https://mathiasbynens.be/demo/animated-webp) > > Change-Id: Ibd13c1f067bdf369ce1c882d4f6057aadccfa313 > Reviewed-on: https://skia-review.googlesource.com/71560 > Commit-Queue: Leon Scroggins <scroggo@google.com> > Reviewed-by: Mike Klein <mtklein@chromium.org> TBR=mtklein@chromium.org,scroggo@google.com Change-Id: I6f535ff9b773a93e02a0358b830291594a6e738c No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/71720 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Fix webp bug compositing alpha frames on opaqueGravatar Leon Scroggins III2017-11-14
| | | | | | | | | | | | | | | | | | | | select_xform_alpha is used to determine how the color transform should handle alpha values. In a similar way, we're using it here to determine whether to premultiply pixels before blending them. In this case, the source is unpremul, so we should be premultiplying them, but since we are compositing on an opaque frame, the dst must be opaque and select_xform_alpha returns kOpaque. As a result, we do not premultiply (and even hint to the transform that the pixels are opaque). Since this all applies to the pre-blended pixels, we should not care that the dst is opaque. So drop the call to select_xform_alpha and just use the alpha type of the source. This matches the comment on the lines above. Add the test image that failed (https://mathiasbynens.be/demo/animated-webp) Change-Id: Ibd13c1f067bdf369ce1c882d4f6057aadccfa313 Reviewed-on: https://skia-review.googlesource.com/71560 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
* Make SkImageGeneratorCG apply encoded originGravatar Leon Scroggins III2017-11-03
| | | | | | | | | | | | | | | | | | | | | | | | | | SkImageGeneratorCG: - Detect the origin and apply it to the output - Deprecate NewFromEncodedCG and add MakeFromEncodedCG SkCodecImageGenerator: - Move code elsewhere for sharing - Apply origin for incomplete decodes SkPixmap.cpp/SkPixmapPriv.h: - Now has the shared code for generators to apply origin DMSrcSink.cpp: - Call MakeFromEncodedCG SkCGUtils.h: - Add a version of SkCopyPixelsFromCGImage that takes an SkPixmap Bug: skia:7138 Bug: skia:3834 Change-Id: Ic6dbc76360c6a84913b67373582f328d3946d637 Reviewed-on: https://skia-review.googlesource.com/63740 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Allow bitmap extraction from HEIF image sequencesGravatar Chong Zhang2017-11-01
| | | | | | | | | | b/63633199 Change-Id: I0e86589a485830066fe52ae3a74c18ee7f333a7d Reviewed-on: https://skia-review.googlesource.com/65883 Reviewed-by: Leon Scroggins <scroggo@google.com> Reviewed-by: Chong Zhang <chz@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* fix typo in SkJpegCodec.cppGravatar Mike Klein2017-11-01
| | | | | | | | | The missing break rejects grayscale profiles for grayscale images. Change-Id: I16ad8e7b581f009257a47c4e0f45f7b3c0008487 Reviewed-on: https://skia-review.googlesource.com/66140 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Simplify SkColorSpace::MakeICCGravatar Leon Scroggins III2017-10-31
| | | | | | | | | | | | | | | | | | | Rather than restricting the supported ICC types in MakeICC, create any ICC type that we support, and make the client reject them as necessary by querying the SkColorSpace::Type. Remove ICCTypeFlag and replace uses of it with SkColorSpace::Type. This depends on a change in Chromium (https://chromium-review.googlesource.com/c/chromium/src/+/741843). Without that, this change will start allowing non-CMYK images to use CMYK profiles. Bug: 727128 Change-Id: I085b4665e49bc80083264496d864cc4cd62ae914 Reviewed-on: https://skia-review.googlesource.com/64841 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
* remove off64_t in SkHeifCodecGravatar Mike Klein2017-10-20
| | | | | | | | | | | | I argue int64_t is just as good, and much more familiar. This, I think, will also fix the Emscripten/wasm bot, where somewhat bizarrely off64_t is typedef'd to int. Change-Id: I4eb9d05cbd3066b107fa429beff79e7471e94526 Reviewed-on: https://skia-review.googlesource.com/62362 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* add SkStubHeifDecoderAPI.hGravatar Mike Klein2017-10-20
| | | | | | | | | | | | | | | This should let us build SkHeifCodec even without libheif. I didn't look at libheif itself, so this stub may disagree a bit with the actual interface... just flailed around until it compiled and linked. This turns on the stub in most of our internal builds. Change-Id: I62ed4993198118b2a8217ec846d92ff637cc8ab9 Reviewed-on: https://skia-review.googlesource.com/62321 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* speculative fix for Android rollGravatar Mike Klein2017-10-19
| | | | | | | Change-Id: I2ad50ecad5b668e7196f27f0dda27d3a990374e7 Reviewed-on: https://skia-review.googlesource.com/61904 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Move SkCodec::Origin into its own fileGravatar Leon Scroggins III2017-10-18
| | | | | | | | | | | | | | It is now used by SkPixmap and will soon be in SkJpegEncoder. No need for those to depend on SkCodec. Bug: 768878 TBR=reed@google.com (reed@ already approved the API change in https://skia-review.googlesource.com/60721) Change-Id: If1a6e1d5b60a7a3d8c97818e15a48d28ba804668 Reviewed-on: https://skia-review.googlesource.com/61680 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Revert "Add an Option for orientation on JPEG encodes"Gravatar Ben Wagner2017-10-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 5411a60e0d7370a5d47b5049de845a06fe52e98b. Reason for revert: ASAN and Coverage failing: https://chromium-swarm.appspot.com/task?id=394978f3b7d44610 Flutter_Android failing. Original change's description: > Add an Option for orientation on JPEG encodes > > Move Origin to its own header so that SkPixmap and SkJpegEncoder need > not depend on SkCodec. > > Add libexif, which is already used by Android, and use it to write the > orientation. Write a makefile based on the Android.bp in Android, minus > warnings. (libexif has an LGPL license.) > > Add a test that verifies all the orientations work. > > Optionally enable writing the orientation (and therefore including > libexif). Chromium does not currently need it, and Android does not > expose an API that would allow using it. Disable on Windows, where we > still have build errors to fix. > > Bug: skia:7138 > Change-Id: Iaeff44c36aebe0e639666979dc00e1b7594bbeb1 > Reviewed-on: https://skia-review.googlesource.com/60721 > Commit-Queue: Leon Scroggins <scroggo@google.com> > Reviewed-by: Mike Klein <mtklein@chromium.org> > Reviewed-by: Mike Reed <reed@google.com> TBR=mtklein@chromium.org,mtklein@google.com,scroggo@google.com,reed@google.com Change-Id: I05b7ae8d1c5bbd1de1642d9ef024943500256273 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia:7138 Reviewed-on: https://skia-review.googlesource.com/61620 Reviewed-by: Ben Wagner <benjaminwagner@google.com> Commit-Queue: Ben Wagner <benjaminwagner@google.com>
* Add an Option for orientation on JPEG encodesGravatar Leon Scroggins III2017-10-18
| | | | | | | | | | | | | | | | | | | | | | | Move Origin to its own header so that SkPixmap and SkJpegEncoder need not depend on SkCodec. Add libexif, which is already used by Android, and use it to write the orientation. Write a makefile based on the Android.bp in Android, minus warnings. (libexif has an LGPL license.) Add a test that verifies all the orientations work. Optionally enable writing the orientation (and therefore including libexif). Chromium does not currently need it, and Android does not expose an API that would allow using it. Disable on Windows, where we still have build errors to fix. Bug: skia:7138 Change-Id: Iaeff44c36aebe0e639666979dc00e1b7594bbeb1 Reviewed-on: https://skia-review.googlesource.com/60721 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org> Reviewed-by: Mike Reed <reed@google.com>
* Revert[4] "apply codec origin in generator"Gravatar Mike Reed2017-10-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit dd340146f1fe7414702d6fea251da989d425691e. Reason for revert: ios gn file fixed Original change's description: > Revert "Revert "Revert "apply codec origin in generator""" > > This reverts commit 82269abfec798621c8dbbc6bd48996c0b2686f41. > > Reason for revert: ios build needs include path for SkCodec.h > > Original change's description: > > Revert "Revert "apply codec origin in generator"" > > > > This reverts commit 363dd988a55c2ed3fa92e2368c1c889101425734. > > > > Reason for revert: pdfium fix landed > > > > Original change's description: > > > Revert "apply codec origin in generator" > > > > > > This reverts commit fa15877f487333bec876e7315cf584c0d598d098. > > > > > > Reason for revert: Appears to break PDFium. > > > > > > Original change's description: > > > > apply codec origin in generator > > > > > > > > Bug: skia: > > > > Change-Id: I383dacb49b1e3c88467ccdbf3288764bb1bbf01a > > > > Reviewed-on: https://skia-review.googlesource.com/58600 > > > > Reviewed-by: Leon Scroggins <scroggo@google.com> > > > > Commit-Queue: Mike Reed <reed@google.com> > > > > > > TBR=scroggo@google.com,reed@google.com > > > > > > Change-Id: Id97137d6ec39ca638c941928bae6510814b1c499 > > > No-Presubmit: true > > > No-Tree-Checks: true > > > No-Try: true > > > Bug: skia: > > > Reviewed-on: https://skia-review.googlesource.com/60041 > > > Reviewed-by: Ben Wagner <benjaminwagner@google.com> > > > Commit-Queue: Ben Wagner <benjaminwagner@google.com> > > > > TBR=benjaminwagner@google.com,scroggo@google.com,reed@google.com > > > > Change-Id: I1b54a6e6e6cbda07f346ffbbc4977f9db705abcd > > No-Presubmit: true > > No-Tree-Checks: true > > No-Try: true > > Bug: skia: > > Reviewed-on: https://skia-review.googlesource.com/60320 > > Reviewed-by: Mike Reed <reed@google.com> > > Commit-Queue: Mike Reed <reed@google.com> > > TBR=benjaminwagner@google.com,scroggo@google.com,reed@google.com > > Change-Id: I4c2d310521d1a678b407d30b9fe3c261c49d67bc > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia: > Reviewed-on: https://skia-review.googlesource.com/60560 > Reviewed-by: Mike Reed <reed@google.com> > Commit-Queue: Mike Reed <reed@google.com> TBR=benjaminwagner@google.com,scroggo@google.com,reed@google.com Change-Id: I5c1e53aff3ad174b0d4a806c35b7cdcd194479d7 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/60563 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
* Revert "Revert "Revert "apply codec origin in generator"""Gravatar Mike Reed2017-10-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 82269abfec798621c8dbbc6bd48996c0b2686f41. Reason for revert: ios build needs include path for SkCodec.h Original change's description: > Revert "Revert "apply codec origin in generator"" > > This reverts commit 363dd988a55c2ed3fa92e2368c1c889101425734. > > Reason for revert: pdfium fix landed > > Original change's description: > > Revert "apply codec origin in generator" > > > > This reverts commit fa15877f487333bec876e7315cf584c0d598d098. > > > > Reason for revert: Appears to break PDFium. > > > > Original change's description: > > > apply codec origin in generator > > > > > > Bug: skia: > > > Change-Id: I383dacb49b1e3c88467ccdbf3288764bb1bbf01a > > > Reviewed-on: https://skia-review.googlesource.com/58600 > > > Reviewed-by: Leon Scroggins <scroggo@google.com> > > > Commit-Queue: Mike Reed <reed@google.com> > > > > TBR=scroggo@google.com,reed@google.com > > > > Change-Id: Id97137d6ec39ca638c941928bae6510814b1c499 > > No-Presubmit: true > > No-Tree-Checks: true > > No-Try: true > > Bug: skia: > > Reviewed-on: https://skia-review.googlesource.com/60041 > > Reviewed-by: Ben Wagner <benjaminwagner@google.com> > > Commit-Queue: Ben Wagner <benjaminwagner@google.com> > > TBR=benjaminwagner@google.com,scroggo@google.com,reed@google.com > > Change-Id: I1b54a6e6e6cbda07f346ffbbc4977f9db705abcd > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia: > Reviewed-on: https://skia-review.googlesource.com/60320 > Reviewed-by: Mike Reed <reed@google.com> > Commit-Queue: Mike Reed <reed@google.com> TBR=benjaminwagner@google.com,scroggo@google.com,reed@google.com Change-Id: I4c2d310521d1a678b407d30b9fe3c261c49d67bc No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/60560 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
* Revert "Revert "apply codec origin in generator""Gravatar Mike Reed2017-10-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 363dd988a55c2ed3fa92e2368c1c889101425734. Reason for revert: pdfium fix landed Original change's description: > Revert "apply codec origin in generator" > > This reverts commit fa15877f487333bec876e7315cf584c0d598d098. > > Reason for revert: Appears to break PDFium. > > Original change's description: > > apply codec origin in generator > > > > Bug: skia: > > Change-Id: I383dacb49b1e3c88467ccdbf3288764bb1bbf01a > > Reviewed-on: https://skia-review.googlesource.com/58600 > > Reviewed-by: Leon Scroggins <scroggo@google.com> > > Commit-Queue: Mike Reed <reed@google.com> > > TBR=scroggo@google.com,reed@google.com > > Change-Id: Id97137d6ec39ca638c941928bae6510814b1c499 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia: > Reviewed-on: https://skia-review.googlesource.com/60041 > Reviewed-by: Ben Wagner <benjaminwagner@google.com> > Commit-Queue: Ben Wagner <benjaminwagner@google.com> TBR=benjaminwagner@google.com,scroggo@google.com,reed@google.com Change-Id: I1b54a6e6e6cbda07f346ffbbc4977f9db705abcd No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/60320 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
* Revert "apply codec origin in generator"Gravatar Ben Wagner2017-10-16
| | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit fa15877f487333bec876e7315cf584c0d598d098. Reason for revert: Appears to break PDFium. Original change's description: > apply codec origin in generator > > Bug: skia: > Change-Id: I383dacb49b1e3c88467ccdbf3288764bb1bbf01a > Reviewed-on: https://skia-review.googlesource.com/58600 > Reviewed-by: Leon Scroggins <scroggo@google.com> > Commit-Queue: Mike Reed <reed@google.com> TBR=scroggo@google.com,reed@google.com Change-Id: Id97137d6ec39ca638c941928bae6510814b1c499 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/60041 Reviewed-by: Ben Wagner <benjaminwagner@google.com> Commit-Queue: Ben Wagner <benjaminwagner@google.com>
* apply codec origin in generatorGravatar Mike Reed2017-10-16
| | | | | | | | Bug: skia: Change-Id: I383dacb49b1e3c88467ccdbf3288764bb1bbf01a Reviewed-on: https://skia-review.googlesource.com/58600 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Mike Reed <reed@google.com>
* Remove trailing whitespace.Gravatar Ben Wagner2017-10-09
| | | | | | | | | | | Also adds a presubmit to prevent adding trailing whitespace to source code in the future. Change-Id: I41a4df81487f6f00aa19b188f0cac6a3377efde6 Reviewed-on: https://skia-review.googlesource.com/57380 Reviewed-by: Ravi Mistry <rmistry@google.com> Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
* fix use of uninitialized flag in SkCodecGravatar Ivan Afanasyev2017-10-09
| | | | | | | | | | | | | SkCodec class has the fStartedIncrementalDecode field, which is not initialized on construction, but may be used in incrementalDecode method being uninitialized. Bug: skia: Change-Id: I378412a375100ad2df4aa38f2dd5682867e0e34b Reviewed-on: https://skia-review.googlesource.com/53160 Commit-Queue: Heather Miller <hcm@google.com> Reviewed-by: Mike Klein <mtklein@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>