skia2/include
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
..
android Use SkAndroidCodec in SkAnimatedImage 2018-01-16 20:36:09 +00:00
atlastext Add matrix stack to SkAtlasTextTarget. 2017-12-20 14:00:44 +00:00
c C API: document sk_matrix_t 2017-03-21 18:04:34 +00:00
codec Add SkAndroidCodec::computeSampledSize 2018-01-16 21:23:08 +00:00
config Revert "Revert "SkUserConfig.h: remove out-of-date comment on SK_SFNTLY_SUBSETTER"" 2017-01-27 14:40:01 +00:00
core restore intersect methods to use old-style empty-checks on their inputs 2018-01-10 20:39:33 +00:00
effects Revert "Alloc glyph image correctly for SkMask::k3D_Format." 2017-11-14 16:16:45 +00:00
encode Revert "Add an Option for orientation on JPEG encodes" 2017-10-18 18:09:47 +00:00
gpu Move resourceProvider accessor to GrContextPriv (take 2) 2018-01-16 20:53:28 +00:00
pathops Remove trailing whitespace. 2017-10-09 21:20:34 +00:00
ports removed dead code behind legacy fontmgr api flag 2017-10-11 15:18:57 +00:00
private Funnel most proxy creation through GrProxyProvider 2018-01-16 13:28:43 +00:00
svg Add a SkWStream-based SkSVGCanvas factory 2017-09-19 20:33:19 +00:00
utils Fix alpha contribution to tonal color. 2017-12-19 19:27:06 +00:00
views [Viewer] Preserve gesture transformation matrix on slide/backend change 2018-01-05 18:18:39 +00:00