aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/android
Commit message (Collapse)AuthorAge
* Alternate between two SkBitmaps in SkAnimatedImageGravatar Leon Scroggins III2018-05-23
| | | | | | | | | | | | | | | | | | | | | | Bug: 78866720 The client in Android calls newPictureSnapshot, which results in copying the mutable SkBitmap into a newly allocated one in each frame. Avoid this by calling SkMakeImageFromRasterBitmap with kNever_SkCopyPixelsMode. Make SkAnimatedImage copy on write, by copying before decoding if the bitmap's pixel ref is not unique. Android's AnimatedImageDrawable's current architecture only decodes one frame in advance, so it will never need to perform the copy on write. This will save one bitmap allocation per GIF frame. Add a test to verify that copy on write works as expected. Change-Id: I87eb6e84089096cd2d618b91fb627fc58677e66a Reviewed-on: https://skia-review.googlesource.com/129841 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com> Auto-Submit: Leon Scroggins <scroggo@google.com>
* Simplify SkAnimatedImageGravatar Leon Scroggins III2018-01-30
| | | | | | | | | | | | | Bug: b/63908092 Rather than keeping track of the time and whether the animation is running, leave that up to the client. Offer a single method to decode the next frame, allowing the client to stay one frame ahead. Change-Id: I546013e32e3a0874181b0dce1349bbec07aaadd4 Reviewed-on: https://skia-review.googlesource.com/101544 Reviewed-by: Derek Sollenberger <djsollen@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Add SkAnimatedImage::getRepetitionCountGravatar Leon Scroggins III2018-01-26
| | | | | | | | | | | | Bug: b/63908092 Android does not need to have its end listener attached if the repetition count is infinite. Provide an accessor so it will know. Change-Id: I481b048994a6e86ae88c913a5dcca3788b92bae2 Reviewed-on: https://skia-review.googlesource.com/99883 Reviewed-by: Derek Sollenberger <djsollen@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Make SkAnimatedImage::update return sentinel when stoppedGravatar Leon Scroggins III2018-01-23
| | | | | | | | Bug: b/63908092 Change-Id: I585f3d3efde1db4d5be36b11f19fe6e88f131608 Reviewed-on: https://skia-review.googlesource.com/98062 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Add SkAnimatedImage::isFinishedGravatar Leon Scroggins III2018-01-22
| | | | | | | | | | | Bug: b/63908092 Allows Android to know when to call onAnimationEnd. Change-Id: I9cc102fb485e944ad5983eed9f0b941153128e88 Reviewed-on: https://skia-review.googlesource.com/97401 Reviewed-by: Derek Sollenberger <djsollen@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Respect repetition count in SkAnimatedImageGravatar Leon Scroggins III2018-01-22
| | | | | | | | | | | | | | | | | | | | | | | | | | Bug: b/63908092 By default use the repetition count stored in the encoded data (if any). Allow setting the repetition count manually, so that the animation will stop after n+1 total cycles (unless -1 is used for infinite). If the animation is complete, make start reset it. When the animation is not running, make update return max double (i.e. no need to update any time soon). Fix a bug where the first call to update returned -1. Share write_bm with CodecAnimTest, for debugging. Update Sample to check isRunning rather than keeping its own record of whether the animation is running. Change-Id: I883e4d7325f7a7b23a422fa9d756f9ea3018f0f8 Reviewed-on: https://skia-review.googlesource.com/97082 Reviewed-by: Derek Sollenberger <djsollen@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Add Android ImageDecoder features to SkAnimatedImageGravatar Leon Scroggins III2018-01-17
| | | | | | | | | | | | | | | | 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>
* 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 SK_API to APIs used by the android framework.Gravatar Derek Sollenberger2017-09-21
| | | | | | | | | | | | | This CL enables us to set the default visibility of the symbols on Android to hidden. It is the intent that all of he SK_APIs that have been added to /src directies should be removed as soon as we can remove their callers within Android. Bug: b/31971097 Change-Id: Ic787f94df0fb0c2b8d941aa7095a12b317c4b5de Reviewed-on: https://skia-review.googlesource.com/49501 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: 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>
* Add a private API for writing the clip to the stencilGravatar Stan Iliev2017-08-02
| | | | | | | | | | | Add a private API used by Android framework, which writes the clip into a stencil buffer. This is used by HWUI to clip the WebView. Bug: 31489986 Change-Id: I94515f1539acd9d069c8aceb3300577feed9c94f Reviewed-on: https://skia-review.googlesource.com/29521 Commit-Queue: Stan Iliev <stani@google.com> Reviewed-by: Derek Sollenberger <djsollen@google.com>
* Let region decoders query the type and color spaceGravatar Matt Sarett2017-04-14
| | | | | | | | | | | | | b/36905374, b/32984164 Test: CtsGraphicsTestCases Written by: romainguy@ Change-Id: Ief4bba6ec3cd3446224199d05f06ffcffaaa72b5 Reviewed-on: https://skia-review.googlesource.com/13472 Reviewed-by: Matt Sarett <msarett@google.com> Reviewed-by: Derek Sollenberger <djsollen@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
* Allow BF and BRD clients to request an output color spaceGravatar Matt Sarett2017-04-11
| | | | | | | | | Bug: skia: Change-Id: I0f0d3bfdd5c47544ab71167fd7984ee8e8ac5903 Reviewed-on: https://skia-review.googlesource.com/11601 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
* SkEncodeImage: no more link-time registrationGravatar Hal Canary2016-11-30
| | | | | | | | | | | | | | | Also, no more SkImageEncoder class. SK_SUPPORT_LEGACY_IMAGE_ENCODER_CLASS now only guards some old API shims. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5006 Change-Id: I3797f584f3e8e12ade10d31e8733163453725f40 Reviewed-on: https://skia-review.googlesource.com/5006 Commit-Queue: Hal Canary <halcanary@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com> Reviewed-by: Mike Reed <reed@google.com>
* change SkStreams to work with sk_sp<SkData> instead of SkData*Gravatar reed2016-09-12
| | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2333713002 Review-Url: https://codereview.chromium.org/2333713002
* Delete SkBitmapRegionCanvasGravatar msarett2016-05-18
| | | | | | | | | | | | | | | | This was an approach we considered for implementing Android's BitmapRegionDecoder. It was useful for testing and comparison, but now is no longer worth maintaining and testing. The approach to subset/scaled decodes (clipped decode, then scale) may be worth reconsidering at some point. BUG=skia:5307 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1990543002 Review-Url: https://codereview.chromium.org/1990543002
* Move SkBitmapRegionDecoder to include/android and src/androidGravatar msarett2015-11-13
This will expose the BitmapRegionDecoder API as a public include and move the implementation to src. This makes this code more naturally exposed in Android and easier to test in DM and nanobench. BUG=skia: Review URL: https://codereview.chromium.org/1438873002