skia2/include/codec
Leon Scroggins III 07a722cdcf Add SkAndroidCodec::computeSampledSize
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>
2018-01-16 21:23:08 +00:00
..
SkAndroidCodec.h Add SkAndroidCodec::computeSampledSize 2018-01-16 21:23:08 +00:00
SkCodec.h Add a method to convert SkCodec::Result to a string 2018-01-16 17:17:58 +00:00
SkCodecAnimation.h Make SkCodec more flexible about its required frame 2017-06-07 20:15:17 +00:00
SkEncodedOrigin.h Move SkCodec::Origin into its own file 2017-10-18 19:08:16 +00:00