This patch uses equal_range instead of linear search to look up a
factory entry by name. This does require a sort, but the expected usage
is that the sort happens once and look ups happen many times.
This improves performance on Chromium's oop deserialization of
flattenables by about 10%
R=reed@chromium.org
Change-Id: I907f457a2ffb7d5b6d8261343099d982260b8415
Reviewed-on: https://skia-review.googlesource.com/96820
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Bug: b/71719631
Change-Id: I676c34dfe5ea9b5e184ea53dd49a8b835d4e8cb6
Reviewed-on: https://skia-review.googlesource.com/95741
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Bug: b/63909536
Bug: b/63908092
- Scale to an arbitrary size, using the decoding library if it supports
it, and Skia otherwise
- Crop to a subset
- Post-processing with an SkPicture, to facilitate circle masks etc
- isRunning, to implement Animatable2 interface in Java
Change-Id: I13dbabee8e4a22e5cc193856aa3e94ce23ae4cb5
Reviewed-on: https://skia-review.googlesource.com/94660
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
This is pretty much a straight up move of the GrSurfaceProxy code with some plumbing to get the ProxyProvider in the right places.
Change-Id: I63cecb242dada503f97dbd1c0ce7ede75323100d
Reviewed-on: https://skia-review.googlesource.com/94200
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Bug: skia:
Change-Id: I7cce869894e274250f49328550a0ae2d8e04de74
Reviewed-on: https://skia-review.googlesource.com/95022
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This patch enables scaling for overlarge color emojis when trying to
render with SDFs, i.e. between 162 and 324 point in normal text
rendering mode. Also ensures that we only try to render blobs with
bitmap/SDF when the text size will fit in the atlas.
Bug: skia:
Change-Id: Ib675d99ef22bf66368dc8737ef63db4a5d3d5a9f
Reviewed-on: https://skia-review.googlesource.com/94361
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
This will be needed for DDLs that get recorded, but then deleted before
the proxies actually get instantiated.
Bug: skia:
Change-Id: I745366fc7a7edbcd43bc617220d3d4997baa8319
Reviewed-on: https://skia-review.googlesource.com/95101
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Bug: skia:
Change-Id: If110f1716d2ad3b967aadca1c61d3e22386e17b1
Reviewed-on: https://skia-review.googlesource.com/94862
Commit-Queue: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Mike Klein <mtklein@chromium.org>
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>
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>
This reverts commit 9d6929cccf.
Reason for revert: Re-landing, backfill reveals none of the red was related to this CL.
Original change's description:
> Revert "Added SkSL workaround for devices which cannot safely access gl_FragCoord"
>
> This reverts commit 1001f843a4.
>
> Reason for revert: Many failures.
>
> Original change's description:
> > Added SkSL workaround for devices which cannot safely access gl_FragCoord
> >
> > This is the root cause of https://github.com/flutter/flutter/issues/13216
> > I've got a GM that demonstrates the bug, but only in Viewer.
> >
> > Bug: skia:7410
> > Change-Id: Iaa1f27b10166aa09e4dc5949e5a6ca1bd14c99ac
> > Reviewed-on: https://skia-review.googlesource.com/93920
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Brian Osman <brianosman@google.com>
>
> TBR=bsalomon@google.com,brianosman@google.com,ethannicholas@google.com
>
> Change-Id: I2a2edc0a8fa11fe9dac1045dc79ae91106518b02
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:7410
> Reviewed-on: https://skia-review.googlesource.com/94281
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
TBR=bsalomon@google.com,brianosman@google.com,ethannicholas@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: skia:7410
Change-Id: Ib22bda7ff25bb7c8630cc6fa6dc809bf628ea853
Reviewed-on: https://skia-review.googlesource.com/94800
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This is to provide a choke point for DDL to create Lazy Proxies.
Change-Id: If178da13bc6447b31b7601810236d34502d9efbd
Reviewed-on: https://skia-review.googlesource.com/93303
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
This reverts commit 1001f843a4.
Reason for revert: Many failures.
Original change's description:
> Added SkSL workaround for devices which cannot safely access gl_FragCoord
>
> This is the root cause of https://github.com/flutter/flutter/issues/13216
> I've got a GM that demonstrates the bug, but only in Viewer.
>
> Bug: skia:7410
> Change-Id: Iaa1f27b10166aa09e4dc5949e5a6ca1bd14c99ac
> Reviewed-on: https://skia-review.googlesource.com/93920
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
TBR=bsalomon@google.com,brianosman@google.com,ethannicholas@google.com
Change-Id: I2a2edc0a8fa11fe9dac1045dc79ae91106518b02
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:7410
Reviewed-on: https://skia-review.googlesource.com/94281
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
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>
This is needed for future DDL texture work.
Bug: skia:
Change-Id: I07e0b9c67509e63b9cac00adc355254d03784df8
Reviewed-on: https://skia-review.googlesource.com/91500
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
This is the root cause of https://github.com/flutter/flutter/issues/13216
I've got a GM that demonstrates the bug, but only in Viewer.
Bug: skia:7410
Change-Id: Iaa1f27b10166aa09e4dc5949e5a6ca1bd14c99ac
Reviewed-on: https://skia-review.googlesource.com/93920
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Bug introduced when we made isEmpty check for int32_t width/height
Bug:800804
Change-Id: I59799c88fb02f176c1545dd0edae050b510df079
Reviewed-on: https://skia-review.googlesource.com/93302
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
Will work next to try to make isEmpty() private
Bug: skia:7470
Bug:799715
Change-Id: I7b43028ecd86dca68e0c67225712516d2f2f88a2
Reviewed-on: https://skia-review.googlesource.com/92620
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This pulls all the proxy tracking & creation functionality out of the GrResourceCache and GrResourceProvider and consolidates it in the GrProxyProvider.
Change-Id: I7256f7c544319a70c1bd93dd5a9ccbe5fa0a544f
Reviewed-on: https://skia-review.googlesource.com/91501
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Motivation: makes SkBitmap 8 bytes smaller.
fPixelRefOrigin is rarely used, and can be recaluated when needed.
Also, remove two of SkBitmap's private methods and fold in their
functions.
Change-Id: I2cddb9e4b5480404bf6da3edfb0155ab82cf47d2
Reviewed-on: https://skia-review.googlesource.com/91300
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>