History log of /external/skia/src/codec/SkGifCodec.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
03a7f5fe2de9b0c886be4063533c91720ced0bf9 10-Feb-2017 Hal Canary <halcanary@google.com> Make header files idempotent; script to check

Change-Id: I960ded854e6bc7cdee029a7393cac2a686c41754
Reviewed-on: https://skia-review.googlesource.com/8308
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
/external/skia/src/codec/SkGifCodec.h
db6830162eca5b94e61d9825ec93306fc615d204 23-Nov-2016 Hal Canary <halcanary@google.com> SkImageEncoder: simplify API

(re-land 248ff02 & 2cb6cb7, with changes)

- Hide SkImageEncoder class in private header.
- SkImageEncoder::Type becomes SkEncodedImageFormat
- SkEncodedFormat becomes SkEncodedImageFormat
- SkImageEncoder static functions replaced with
single function EncodeImage()
- utility wrappers for EncodeImage() are in
sk_tool_utils.h

TODO: remove link-time registration mechanism.
TODO: clean up clients use of API and flip the flag.
TODO: implement EncodeImage() in chromeium/skia/ext

Change-Id: I47d451e50be4d5c6c130869c7fa7c2857243d9f0
Reviewed-on: https://skia-review.googlesource.com/4909
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Reviewed-on: https://skia-review.googlesource.com/5186
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
/external/skia/src/codec/SkGifCodec.h
a2b4bdce8cfd1a91407595a25683ecff982af22e 22-Nov-2016 Hal Canary <halcanary@google.com> Revert 248ff023 & 2cb6cb72

Revert "SkImageEncoder: simplify API"
This reverts commit 248ff02331d7f73ee4b6c5a7eabeae1080c16cd4.
Revert "Fix bug: can't convert nullptr -> bool"
This reverts commit 2cb6cb7218171b357bb5c934f032ba69c7b78401.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5151
NOTRY=true

Change-Id: I5f6414392d6545f74db0b5bb50608d04f053a8ec
Reviewed-on: https://skia-review.googlesource.com/5151
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
/external/skia/src/codec/SkGifCodec.h
248ff02331d7f73ee4b6c5a7eabeae1080c16cd4 22-Nov-2016 Hal Canary <halcanary@google.com> SkImageEncoder: simplify API

- Hide SkImageEncoder class in private header.
- SkImageEncoder::Type becomes SkEncodedImageFormat
- SkEncodedFormat becomes SkEncodedImageFormat
- SkImageEncoder static functions replaced with
single function EncodeImage()
- utility wrappers for EncodeImage() are in
sk_tool_utils.h

TODO: remove link-time registration mechanism.
TODO: clean up clients use of API and flip the flag.
TODO: implement EncodeImage() in chromeium/skia/ext

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4909

Change-Id: Ib48b31fdc05cf23cda7f56ebfd67c841c149ce70
Reviewed-on: https://skia-review.googlesource.com/4909
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
/external/skia/src/codec/SkGifCodec.h
61eedebe4ce61215a56ced832e0df73c2cb19447 04-Nov-2016 Matt Sarett <msarett@google.com> Add F16, SkColorSpaceXform support to SkGifCodec

BUG=skia:4895

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4396

Change-Id: I7c521760891852daf4f3933ecf02dc08acec64c0
Reviewed-on: https://skia-review.googlesource.com/4396
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
/external/skia/src/codec/SkGifCodec.h
e71b1a1496738ebce4a8cac4ffa5ee1413996542 01-Nov-2016 scroggo <scroggo@chromium.org> Report repetition count in SkCodec

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
/external/skia/src/codec/SkGifCodec.h
fc49b403eb3353fdefe97672017df10b64dee95a 31-Oct-2016 Leon Scroggins III <scroggo@google.com> Use correct color table for prior GIF frames

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>
/external/skia/src/codec/SkGifCodec.h
3d3a65c488162ef1db0b35adf3235d012b04c88d 24-Oct-2016 scroggo <scroggo@chromium.org> Rename GIFImageReader to SkGifImageReader

The former could violate One Definition Rule in Google3, since other
projects that are based on Chrome/webkit also have GIFImageReader.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2445653004

Review-Url: https://codereview.chromium.org/2445653004
/external/skia/src/codec/SkGifCodec.h
19b91531e912283d237435d94516575b28713cba 24-Oct-2016 scroggo <scroggo@chromium.org> Add support for multiple frames in SkCodec

Add an interface to decode frames beyond the first in SkCodec, and
add an implementation for SkGifCodec.

Add getFrameData to SkCodec. This method reads ahead in the stream
to return a vector containing meta data about each frame in the image.
This is not required in order to decode frames beyond the first, but
it allows a client to learn extra information:
- how long the frame should be displayed
- whether a frame should be blended with a prior frame, allowing the
client to provide the prior frame to speed up decoding

Add a new fields to SkCodec::Options:
- fFrameIndex
- fHasPriorFrame

The API is designed so that SkCodec never caches frames. If a
client wants a frame beyond the first, they specify the frame in
Options.fFrameIndex. If the client does not have the
frame's required frame (the frame that this frame must be blended on
top of) cached, they pass false for
Options.fHasPriorFrame. Unless the frame is
independent, the codec will then recursively decode all frames
necessary to decode fFrameIndex. If the client has the required frame
cached, they can put it in the dst they pass to the codec, and the
codec will only draw fFrameIndex onto it.

Replace SkGifCodec's scanline decoding support with progressive
decoding, and update the tests accordingly.

Implement new APIs in SkGifCodec. Instead of using gif_lib, use
GIFImageReader, imported from Chromium (along with its copyright
headers) with the following changes:
- SkGifCodec is now the client
- Replace blink types
- Combine GIFColorMap::buildTable and ::getTable into a method that
creates and returns an SkColorTable
- Input comes from an SkStream, instead of a SegmentReader. Add
SkStreamBuffer, which buffers the (potentially partial) stream in
order to decode progressively.
(FIXME: This requires copying data that previously was read directly
from the SegmentReader. Does this hurt performance? If so, can we
fix it?)
- Remove UMA code
- Instead of reporting screen width and height to the client, allow the
client to query for it
- Fail earlier if the first frame AND screen have size of zero
- Compute required previous frame when adding a new one
- Move GIFParseQuery from GIFImageDecoder to GIFImageReader
- Allow parsing up to a specific frame (to skip parsing the rest of the
stream if a client only wants the first frame)
- Compute whether the first frame has alpha and supports index 8, to
create the SkImageInfo. This happens before reporting that the size
has been decoded.

Add GIFImageDecoder::haveDecodedRow to SkGifCodec, imported from
Chromium (along with its copyright header), with the following changes:
- Add support for sampling
- Use the swizzler
- Keep track of the rows decoded
- Do *not* keep track of whether we've seen alpha

Remove SkCodec::kOutOfOrder_SkScanlineOrder, which was only used by GIF
scanline decoding.

Call onRewind even if there is no stream (SkGifCodec needs to clear its
decoded state so it will decode from the beginning).

Add a method to SkSwizzler to access the offset into the dst, taking
subsetting into account.

Add a GM that animates a GIF.
Add tests for the new APIs.

*** Behavior changes:
* Previously, we reported that an image with a subset frame and no transparent
index was opaque and used the background index (if present) to fill the
background. This is necessary in order to support index 8, but it does not
match viewers/browsers I have seen. Examples:
- Chromium and Gimp render the background transparent
- Firefox, Safari, Linux Image Viewer, Safari Preview clip to the frame (for
a single frame image)
This CL matches Chromium's behavior and renders the background transparent.
This allows us to have consistent behavior across products and simplifies
the code (relative to what we would have to do to continue the old behavior
on Android). It also means that we will no longer support index 8 for some
GIFs.
* Stop checking for GIFSTAMP - all GIFs should be either 89a or 87a.
This matches Chromium. I suspect that bugs would have been reported if valid
GIFs started with "GIFVER" instead of "GIF89a" or "GIF87a" (but did not decode
in Chromium).

*** Future work not included in this CL:
* Move some checks out of haveDecodedRow, since they are the same for the
entire frame e.g.
- intersecting the frameRect with the full image size
- whether there is a color table
* Change when we write transparent pixels
- In some cases, Chromium deemed this unnecessary, but I suspect it is slower
than the fallback case. There will continue to be cases where we should
*not* write them, but for e.g. the first pass where we have already
cleared to transparent (which we may also be able to skip) writing the
transparent pixels will not make anything incorrect.
* Report color type and alpha type per frame
- Depending on alpha values, disposal methods, frame rects, etc, subsequent
frames may have different properties than the first.
* Skip copies of the encoded data
- We copy the encoded data in case the stream is one that cannot be rewound,
so we can parse and then decode (possibly not immediately). For some input
streams, this is unnecessary.
- I was concerned this cause a performance regression, but on average the
new code is faster than the old for the images I tested [1].
- It may cause a performance regression for Chromium, though, where we can
always move back in the stream, so this should be addressed.

Design doc:
https://docs.google.com/a/google.com/document/d/12Qhf9T92MWfdWujQwCIjhCO3sw6pTJB5pJBwDM1T7Kc/

[1] https://docs.google.com/a/google.com/spreadsheets/d/19V-t9BfbFw5eiwBTKA1qOBkZbchjlTC5EIz6HFy-6RI/

GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=2045293002

Review-Url: https://codereview.chromium.org/2045293002
/external/skia/src/codec/SkGifCodec.h
f7eb6fc71abd7649d65a877e7a10d1060afc0c88 13-Sep-2016 msarett <msarett@google.com> Implement Fill() for incomplete decodes to RGBA_F16

Before this patch, we would hit an SkASSERT(false).

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2335203002

Review-Url: https://codereview.chromium.org/2335203002
/external/skia/src/codec/SkGifCodec.h
c30c418f4eb75f365c7d7a32d5419b41ca780ba8 20-Apr-2016 msarett <msarett@google.com> Add SkEncodedInfo to report properties of encoded image data

All this does is build an SkEncodedInfo for each codec, and
then convert it to an SkImageInfo.

In future steps I intend to:
(1) Use SkEncodedInfo in place of SrcConfig in SkSwizzler.
(2) Support more conversions in SkSwizzler (non-native
BGRA/RGBA, 16-bit components, float, fixed point)
(3) Investigate optimizing conversions from encoded data
to linear color spaces.

BUG=skia:4133
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1820073002

Committed: https://skia.googlesource.com/skia/+/f682d9ad70d690a343bc15e26ef321d86770be41

Review URL: https://codereview.chromium.org/1820073002
/external/skia/src/codec/SkGifCodec.h
3c920243f831de5892857f86618fd9c4f9655ba2 19-Apr-2016 robertphillips <robertphillips@google.com> Revert of Add SkEncodedInfo to report properties of encoded image data (patchset #6 id:200001 of https://codereview.chromium.org/1820073002/ )

Reason for revert:
Lots of bots failing

Original issue's description:
> Add SkEncodedInfo to report properties of encoded image data
>
> All this does is build an SkEncodedInfo for each codec, and
> then convert it to an SkImageInfo.
>
> In future steps I intend to:
> (1) Use SkEncodedInfo in place of SrcConfig in SkSwizzler.
> (2) Support more conversions in SkSwizzler (non-native
> BGRA/RGBA, 16-bit components, float, fixed point)
> (3) Investigate optimizing conversions from encoded data
> to linear color spaces.
>
> BUG=skia:4133
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1820073002
>
> Committed: https://skia.googlesource.com/skia/+/f682d9ad70d690a343bc15e26ef321d86770be41

TBR=scroggo@google.com,reed@google.com,msarett@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:4133

Review URL: https://codereview.chromium.org/1895383002
/external/skia/src/codec/SkGifCodec.h
f682d9ad70d690a343bc15e26ef321d86770be41 19-Apr-2016 msarett <msarett@google.com> Add SkEncodedInfo to report properties of encoded image data

All this does is build an SkEncodedInfo for each codec, and
then convert it to an SkImageInfo.

In future steps I intend to:
(1) Use SkEncodedInfo in place of SrcConfig in SkSwizzler.
(2) Support more conversions in SkSwizzler (non-native
BGRA/RGBA, 16-bit components, float, fixed point)
(3) Investigate optimizing conversions from encoded data
to linear color spaces.

BUG=skia:4133
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1820073002

Review URL: https://codereview.chromium.org/1820073002
/external/skia/src/codec/SkGifCodec.h
ad8bcfeac4a684a64db3a7447aeea5bc35155f16 07-Mar-2016 msarett <msarett@google.com> Use a smart pointer for SkColorSpace factories

This should fix master-skia in Android because we no longer need
to include src/core for SkCodec.h.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1766413002

Review URL: https://codereview.chromium.org/1766413002
/external/skia/src/codec/SkGifCodec.h
39b2d5a1ac4171aba0e92cb3f9882f62e5730e3e 17-Feb-2016 msarett <msarett@google.com> Individually enable and disable SkCodecs

BUG=skia:4956
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1702533004
CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Ubuntu-GCC-x86_64-Release-CMake-Trybot

Review URL: https://codereview.chromium.org/1702533004
/external/skia/src/codec/SkGifCodec.h
b30d6984e6dfc185bf1eebf927343563057a7bb3 15-Feb-2016 msarett <msarett@google.com> Fix colorType/alphaType checks in SkCodec

Make getPixels() and startScanlineDecode() behave
consistently.

Require that kGray8 decodes are opaque.

Assert that creating the swizzler succeeds.

BUG=skia:4203
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1695473002

Committed: https://skia.googlesource.com/skia/+/c7578b6cdd03b61f076ffc7956efd952d6c301c0

Review URL: https://codereview.chromium.org/1695473002
/external/skia/src/codec/SkGifCodec.h
deabdb5b9712de9e3c6bbb9aa68ec2f20df80a8e 13-Feb-2016 msarett <msarett@google.com> Revert of Fix colorType/alphaType checks in SkCodec (patchset #5 id:80001 of https://codereview.chromium.org/1695473002/ )

Reason for revert:
Really bad images in Gold.

Original issue's description:
> Fix colorType/alphaType checks in SkCodec
>
> Make getPixels() and startScanlineDecode() behave
> consistently.
>
> Require that kGray8 decodes are opaque.
>
> Assert that creating the swizzler succeeds.
>
> BUG=skia:4203
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1695473002
>
> Committed: https://skia.googlesource.com/skia/+/c7578b6cdd03b61f076ffc7956efd952d6c301c0

TBR=scroggo@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:4203

Review URL: https://codereview.chromium.org/1694023002
/external/skia/src/codec/SkGifCodec.h
c7578b6cdd03b61f076ffc7956efd952d6c301c0 12-Feb-2016 msarett <msarett@google.com> Fix colorType/alphaType checks in SkCodec

Make getPixels() and startScanlineDecode() behave
consistently.

Require that kGray8 decodes are opaque.

Assert that creating the swizzler succeeds.

BUG=skia:4203
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1695473002

Review URL: https://codereview.chromium.org/1695473002
/external/skia/src/codec/SkGifCodec.h
c5560bef14149f4c945a4536988aeba1a16adedc 03-Feb-2016 scroggo <scroggo@google.com> Support decoding opaque to *premul

If a client requests unpremul or premul from an opaque SkCodec,
support it. The opaque image can be treated as any of them, though
it will be less efficient to draw than if the client had used
opaque.

Change the filling code (i.e. for incomplete images) to base its color on
the source alpha type. Prior to adding the support to decode opaque to
any, it was fine to use either source or dest (which would have yielded
the same result). If the client requests non-opaque, we do not want this
to switch the fill value from black to transparent. This also allows
simplifying the signatures for getFillValue and onGetFillValue.

In CodexTest, expect the same result when decoding opaque to *premul,
and compare to the opaque version.

BUG=skia:4616
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1641273003

Review URL: https://codereview.chromium.org/1641273003
/external/skia/src/codec/SkGifCodec.h
1a46467b6998f0ff7cb6912565de06510e937180 07-Jan-2016 msarett <msarett@google.com> Rename SkGifCodec, SkIcoCodec, SkWbmpCodec

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1567863003

Review URL: https://codereview.chromium.org/1567863003
/external/skia/src/codec/SkGifCodec.h