diff options
author | Leon Scroggins III <scroggo@google.com> | 2018-01-16 15:01:17 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-01-16 21:23:08 +0000 |
commit | 07a722cdcf064fca22213dc06a433dd82f080c23 (patch) | |
tree | 8d8e7de91637af359b9ff8649c8bed317019cbf7 /gn/tests.gni | |
parent | 539c6f5c92c2a4f04816d562c3d23556a35a2e98 (diff) |
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>
Diffstat (limited to 'gn/tests.gni')
-rw-r--r-- | gn/tests.gni | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gn/tests.gni b/gn/tests.gni index a4054b8c01..18defe8ae1 100644 --- a/gn/tests.gni +++ b/gn/tests.gni @@ -7,6 +7,7 @@ _tests = get_path_info("../tests", "abspath") tests_sources = [ + "$_tests/AndroidCodecTest.cpp", "$_tests/AAClipTest.cpp", "$_tests/AnnotationTest.cpp", "$_tests/ApplyGammaTest.cpp", |