aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec
Commit message (Collapse)AuthorAge
* 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>
* Revert[4] "guard old apis for querying byte-size of a bitmap/imageinfo/pixmap"Gravatar Mike Reed2017-10-03
| | | | | | | | | | This reverts commit 5a2e50edc51006ce91366e177a9d21a16775d7fd. Bug: skia: Change-Id: I8d28b5c07d90130e5a1653923740eaf189ecb954 Reviewed-on: https://skia-review.googlesource.com/53900 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
* Remove static initializers in SkCodecGravatar Leon Scroggins III2017-10-03
| | | | | | | | | | | | Bug: 768878 Switch const declarations to constexpr where appropriate. Speculative fix for crbug.com/768878. Change-Id: I7fc356e623ce7a0f2b87e92e9a8ed95d5c423d79 Reviewed-on: https://skia-review.googlesource.com/54101 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Chris Blume <cblume@chromium.org>
* Handle the error input case in SkPngCodec decode functionGravatar nagarajan.n2017-10-03
| | | | | | | | | | | This patch handles the error input case in SkPngCodec decode function when there is error in input. Bug: skia:None Change-Id: I53b44f2411cef129b39e76e2cd6b8cd4c754b932 Reviewed-on: https://skia-review.googlesource.com/51860 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
* Revert "Revert "Revert "guard old apis for querying byte-size of a ↵Gravatar Mike Reed2017-10-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bitmap/imageinfo/pixmap""" This reverts commit cd284c532376d16fcc4ed75baf3da65c3e4a2e95. Reason for revert: assert fired in SkMallocPixelRef.cpp:61: fatal error: "assert(info.computeByteSize(rowBytes) == info.getSafeSize(rowBytes))" google3 thinks it was from surface_rowbytes Original change's description: > Revert "Revert "guard old apis for querying byte-size of a bitmap/imageinfo/pixmap"" > > This reverts commit 809cbedd4b252be221b2ac3b4269d312fd8f53a0. > > Bug: skia: > Change-Id: I680d8daeeeeb15526b44c1305d8fb0c6bfa38e1d > Reviewed-on: https://skia-review.googlesource.com/52665 > Commit-Queue: Mike Reed <reed@google.com> > Reviewed-by: Florin Malita <fmalita@chromium.org> TBR=fmalita@chromium.org,reed@google.com Change-Id: I41e3f7a3f791cc8183291847e783ed8a53bc91d2 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/53802 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
* Revert "Revert "guard old apis for querying byte-size of a ↵Gravatar Mike Reed2017-10-02
| | | | | | | | | | | | bitmap/imageinfo/pixmap"" This reverts commit 809cbedd4b252be221b2ac3b4269d312fd8f53a0. Bug: skia: Change-Id: I680d8daeeeeb15526b44c1305d8fb0c6bfa38e1d Reviewed-on: https://skia-review.googlesource.com/52665 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org>
* Revert "guard old apis for querying byte-size of a bitmap/imageinfo/pixmap"Gravatar Jim Van Verth2017-09-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 88757dacd4f532a0f647c02ae0ee596d31ab5c68. Reason for revert: Still seems to be failing Chromium "telemetry_perf_unittests (with patch) on Android" on android_n5x_swarming_rel. Original change's description: > guard old apis for querying byte-size of a bitmap/imageinfo/pixmap > > Now with legacy behavior for allocpixels > > This was reverted, so the current CL is a "fix" on top of ... > https://skia-review.googlesource.com/c/skia/+/50980 > > Related update to Chrome (in preparation for this change) > https://chromium-review.googlesource.com/c/chromium/src/+/685719 > > Bug: skia: > Change-Id: I4b370ee7e95083ab27421f008132219c9c7b86e9 > Reviewed-on: https://skia-review.googlesource.com/51341 > Reviewed-by: Florin Malita <fmalita@chromium.org> > Commit-Queue: Mike Reed <reed@google.com> TBR=fmalita@chromium.org,reed@google.com Change-Id: I827a0ca1d1e3909e648fde3342cdb8601d34da8d No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/52381 Reviewed-by: Jim Van Verth <jvanverth@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
* Fix truncated webp imagesGravatar Leon Scroggins III2017-09-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug: b/65290323 If a webp file is truncated such that no rows can be decoded, WebPIDecGetRGB does not initialize its "last_y" parameter. We use rowsDecoded (passed as last_y) to determine which remaining rows to fill. Check the return value of WebPIDecGetRGB. If it fails (returns null), or rowsDecoded is <= 0 (matching Chromium's check), return kInvalidInput, since there is nothing to draw. Note that this is a change in behavior for Android. Previously we would decode an empty webp to just a transparent/black rectangle, whereas now we simply fail. I think this is a change for the better. Add a test which truncates a file to have 0 rows available and attempts to decode it. msan verifies that we no longer depend on the uninitialized value. Stop attempting to test decoding subsets from an incomplete webp (in CodecTest.cpp). Unless we have decoded the portion covered by the subset, this will fail. Remove test images inc0.webp (from both dm/ and colorspace/) and inc1.webp. These just decode to transparent rectangles. Replace them with inc2.webp and inc3.webp, which decode part of the image and then have to fill with transparent. Change-Id: I64d40be91c574b45963f9a43d8dd8f4929dd2939 Reviewed-on: https://skia-review.googlesource.com/50303 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: James Zern <jzern@google.com>
* guard old apis for querying byte-size of a bitmap/imageinfo/pixmapGravatar Mike Reed2017-09-27
| | | | | | | | | | | | | | | | Now with legacy behavior for allocpixels This was reverted, so the current CL is a "fix" on top of ... https://skia-review.googlesource.com/c/skia/+/50980 Related update to Chrome (in preparation for this change) https://chromium-review.googlesource.com/c/chromium/src/+/685719 Bug: skia: Change-Id: I4b370ee7e95083ab27421f008132219c9c7b86e9 Reviewed-on: https://skia-review.googlesource.com/51341 Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Mike Reed <reed@google.com>
* Revert "guard old apis for querying byte-size of a bitmap/imageinfo/pixmap"Gravatar Greg Daniel2017-09-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 98a6216b18b57c2f7a0d58f542c60503686aed69. Reason for revert: breaking the chrome roll. Looks like they may be writing data to create an image across all the row bytes and thus writing to unalloced data on the last row. Link to example failing bot: https://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_ng/builds/539960 Original change's description: > guard old apis for querying byte-size of a bitmap/imageinfo/pixmap > > Previously we had size_t and uint64_t variations. > > The new (simpler) API always.. > - returns size_t, or 0 if the calculation overflowed > - returns the trimmed size (does not include rowBytes padding for the last row) > > Bug: skia: > Change-Id: I05173e877918327c7b207d2f7f1ab0db36892e2e > Reviewed-on: https://skia-review.googlesource.com/50980 > Commit-Queue: Mike Reed <reed@google.com> > Reviewed-by: Florin Malita <fmalita@chromium.org> > Reviewed-by: Leon Scroggins <scroggo@google.com> TBR=mtklein@google.com,herb@google.com,scroggo@google.com,fmalita@chromium.org,reed@google.com Change-Id: I726f6ab1b36b14979ba6f37105e0a469b3f0dbc0 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/51262 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
* guard old apis for querying byte-size of a bitmap/imageinfo/pixmapGravatar Mike Reed2017-09-26
| | | | | | | | | | | | | | | Previously we had size_t and uint64_t variations. The new (simpler) API always.. - returns size_t, or 0 if the calculation overflowed - returns the trimmed size (does not include rowBytes padding for the last row) Bug: skia: Change-Id: I05173e877918327c7b207d2f7f1ab0db36892e2e Reviewed-on: https://skia-review.googlesource.com/50980 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org> Reviewed-by: Leon Scroggins <scroggo@google.com>
* Merge fCurrIncrementalCodec and fCurrScanlineCodec usage into single Gravatar nagarajan.n2017-09-25
| | | | | | | | | | | | | variable This patch merges fCurrIncrementalCodec and fCurrScanlineCodec usage into single variable for SkIcoCodec. Bug: skia: None Change-Id: I6629f04fc27b8792c4cb1e6f494f8df7006c6b21 Reviewed-on: https://skia-review.googlesource.com/50520 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Move adding offset to dstRow in SkRawCodec::onGetPixelsGravatar nagarajan.n2017-09-19
| | | | | | | | | | This patch moves adding offset to dstRow in SkRawCodec::onGetPixels. Bug: skia:None Change-Id: Icd6a299b73e394eb67e30ad29829d9e2aa8a3646 Reviewed-on: https://skia-review.googlesource.com/48400 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* 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>