15 Commits

Author SHA1 Message Date
Dan Field
5281322421
Refactor instantiateImageCodec/decodeImageFromPixels to provide an ImageDescriptor (#19537)
Refactors instantiateImageCodec and decodeImageFromPixels to provide intermediate data about the image width, height, and bytes per pixel. This allows for more fine grained control from Dart, particularly when trying to reason about how or whether to maintain aspect ratio in the targetWidth/targetHeight parameters.

This leaves the existing methods functional by re-implementing them to use the new ImmutableBuffer/ImageDescriptor class.

The ImmutableBuffer class is provided so that callers can avoid copying the image data multiple times if they wish to re-recreate the image descriptor.

Related Issues
2020-07-21 14:59:18 -07:00
vsmenon
0ef67b5e74
opt out dart:ui from nnbd (#16473)
* opt out dart:ui from nnbd

* Annotate tests as well
2020-02-20 11:04:00 -08:00
Jason Simmons
9e0477643e
Update the exception thrown for invalid data in the codec test (#9929) 2019-07-18 15:54:32 -07:00
Michael Klimushyn
14c82d9969
Only cache required frames (#8837)
Remove the extra `decodedCacheRatioCap` parameter, and the
`_frameBitmaps` member from `Codec`. This means that small looped images
will consume more CPU but prevents us from hitting OOM exceptions based
on trying to render multiple larger images.

Also switch to fDisposalMethod for caching frames.

Previously we looped over every single SkCodec::FrameInfo, tracked its
`fRequiredFrame`, and then saved any frames matching those indeces.
Doing this instead avoids that initialization loop and extra data
structure.
2019-05-13 11:18:20 -07:00
Dan Field
6179ac6377
fix up analysis for Dart in Engine (#7404)
* fix up analysis for Dart in Engine, particularly for tests
2019-01-11 13:50:58 -08:00
Michael Goderbauer
70a1106b50
Unify copyright lines (#6757) 2018-11-07 12:24:35 -08:00
Michael Klimushyn
7afbcd974c
Add a ratio cap to decoded animated image frames (#6310)
Provide a relative, per-image limit to the amount of memory
that's used to cache decoded image frames. Adds an overridable default
that developers can set to control how much memory images are allowed
to use decoded vs undecoded. The cap is set in flutter/flutter#22452.

Note that required frames are always cached regardless of the ratio cap,
because they're currently necessary for the GIF to animate. Previously
cached unessential frames are not cleared in response to the cache
hitting or exceeding the cap.

Addresses #20998 and #14344.
2018-10-09 17:07:46 -07:00
Jason Simmons
1b2a2075a9
Update engine tests for Dart 2 compilation and language changes (#6262) 2018-09-17 09:28:11 -07:00
Jason Simmons
2383bb7c4e
Update the path to Skia test images in codec_test (#4460) 2017-12-13 18:12:42 -08:00
amirh
c1b5e06cb2
expose a Duration object from ui.FrameInfo (#4345) 2017-11-09 14:03:19 -08:00
amirh
2920d61a5c
Make the public ui.Codec API Future based instead of callback based. (#4341) 2017-11-09 09:56:36 -08:00
amirh
179bd4a799
Implement a SingleFrameCodec and return it for non animated images (#4329) 2017-11-07 14:07:02 -08:00
amirh
d8a0dd2958
Decode animation frames and pass FrameInfos to dart (#4324)
https://github.com/flutter/flutter/issues/204
2017-11-06 10:36:02 -08:00
amirh
05b00b1e14
Followup on post-merge comments for 941ed76bc (#4321) 2017-11-03 11:44:23 -07:00
amirh
941ed76bcd
Initial implementation of ui.Codec (a wrapper for SkCodec) (#4318)
This is the first step to support animated GIFs: flutter/flutter#204

TBD in following CLs:
 * Implement Codec.getNextFrame.
 * Add Framework side support to run animations.
2017-11-02 17:56:44 -07:00