skia2/include
Leon Scroggins 7d1153fc4c Handle EXIF orientation in SkAnimatedImage
Bug: skia:10914
Bug: b/163595585

In a WebP image, it is possible to combine animation with an EXIF
orientation. While SkAndroidCodec attempts to handle orientation itself
by decoding into temporary memory and then drawing through a matrix,
this doesn't work directly when compositing a P-frame into a prior
frame. SkAnimatedImage already uses an SkMatrix to handle cropping and
scaling, so update that matrix to include the orientation.

Make SkAnimatedImage a friend of SkAndroidCodec. This allows the former
to have the same ExifOrientationBehavior specified by the latter, and to
recreate the latter so it does not try to handle the orientation itself.

Clip SkAnimatedImage to its bounds. Android's AnimatedImageDrawable
performs its own clip, but this makes a crop rect work for other
clients.

Update getCurrentFrame to take cropping, scaling, and orientation into
account. This method is used by CanvasKit, which does not use cropping
or scaling, but will now properly orient an animation with an EXIF
orientation.

Add a GM that exercises the various combinations of ways SkAnimatedImage
can be used:
- via newPictureSnapshot (as in Android) versus getCurrentFrame
- scaling down to a dimension that can be output from the
  SkAndroidCodec, versus up, which SkAnimatedImage scales
- with a crop rect
- with a post processor

Change-Id: If1854e9aea23fc4afddf75d39132b38e3fbc6071
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/333223
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
2020-11-12 19:47:59 +00:00
..
android Handle EXIF orientation in SkAnimatedImage 2020-11-12 19:47:59 +00:00
c remove unimplemented sk_data_new_empty() 2020-10-29 16:20:06 +00:00
codec Handle EXIF orientation in SkAnimatedImage 2020-11-12 19:47:59 +00:00
config Track vulkan memory allocations in UMA. 2020-10-29 15:24:23 +00:00
core Update Skia milestone to 89 2020-11-12 16:50:19 +00:00
docs Add appendNodeIdArray to avoid code duplication. 2020-06-23 14:25:33 +00:00
effects Move GrShaderCaps from Program::Settings to Compiler 2020-11-04 19:38:33 +00:00
encode Replace 'typedef xxxxx INHERITED' with 'using INHERITED = xxxx;'. 2020-09-03 03:41:26 +00:00
gpu Split SkYUVAInfo::PlanarConfig into PlaneConfig and Subsampling enums 2020-11-11 22:42:36 +00:00
pathops rm SkPreConfig.h and SkPostConfig.h 2020-02-06 19:16:43 +00:00
ports Replace 'typedef xxxxx INHERITED' with 'using INHERITED = xxxx;'. 2020-09-03 03:41:26 +00:00
private Avoid over-allocation in SkTArray assignment and reserve_back. 2020-11-11 17:09:15 +00:00
svg [svgcanvas] Add flag to suppress newlines and tabs in XML 2019-08-21 20:17:37 +00:00
third_party Roll skcms from c21106442079 to f73242142ce5 (1 revision) 2020-07-16 21:50:37 +00:00
utils Handle EXIF orientation in SkAnimCodecPlayer 2020-11-12 14:43:47 +00:00