Go to file
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
animations first cut at a checkbox 2009-10-21 19:41:10 +00:00
bench Move resourceProvider accessor to GrContextPriv (take 2) 2018-01-16 20:53:28 +00:00
bin Add directions for when trouble strikes in fetch-skps. 2018-01-04 21:31:01 +00:00
debugger Update SkSurface MakeFromBackend* factories to take an SkColorType. 2017-12-19 18:41:36 +00:00
dm support gray8 destinations on CPU 2018-01-09 22:19:58 +00:00
docs update bookmaker to ToT 2018-01-11 19:37:49 +00:00
example Update SkSurface MakeFromBackend* factories to take an SkColorType. 2017-12-19 18:41:36 +00:00
experimental [skotty] Refactor paint opacity 2018-01-12 19:48:03 +00:00
fuzz Fix invalid switch in FuzzCanvas 2018-01-11 20:19:48 +00:00
gm relax path bounds check 2018-01-16 20:36:09 +00:00
gn Add SkAndroidCodec::computeSampledSize 2018-01-16 21:23:08 +00:00
include Add SkAndroidCodec::computeSampledSize 2018-01-16 21:23:08 +00:00
infra Update SKP version 2018-01-14 07:43:02 +00:00
platform_tools First version of SkQP app to run on Firebase Testlab 2018-01-08 22:42:21 +00:00
resources [skotty] Fix path close handling 2017-12-31 00:07:39 +00:00
samplecode Use SkAndroidCodec in SkAnimatedImage 2018-01-16 20:36:09 +00:00
site Changes to site documentation 2018-01-11 19:47:58 +00:00
src Add SkAndroidCodec::computeSampledSize 2018-01-16 21:23:08 +00:00
tests Add SkAndroidCodec::computeSampledSize 2018-01-16 21:23:08 +00:00
third_party make lua a rollable dep, roll it 2018-01-10 17:54:00 +00:00
tools Move resourceProvider accessor to GrContextPriv (take 2) 2018-01-16 20:53:28 +00:00
.clang-format Mark flatennable macros as block beginning/ending in .clang-format 2017-01-09 15:31:36 +00:00
.gitignore Ignore generated README.recipes.md 2017-10-26 18:07:27 +00:00
.gn Basic standalone GN configs. 2016-07-21 12:25:45 -07:00
AUTHORS Changes to site documentation 2018-01-11 19:47:58 +00:00
BUILD.gn Use SkAndroidCodec in SkAnimatedImage 2018-01-16 20:36:09 +00:00
codereview.settings Make uploading to Gerrit the default for Skia 2016-11-09 19:07:56 +00:00
CONTRIBUTING Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
CQ_COMMITTERS Moved committer list to chrome-infra-auth and deleted it from the repo 2015-09-02 13:37:54 -07:00
DEPS Roll skia/third_party/externals/angle2/ 4747414ed..f661686c1 (1 commit) 2018-01-16 20:46:19 +00:00
Doxyfile Make the housekeeper upload doxygen to a newer bucket 2016-10-04 13:23:57 -07:00
LICENSE BUG=skia:5602 2016-09-02 11:19:34 -07:00
OWNERS add OWNERS file 2017-12-01 19:50:19 +00:00
PRESUBMIT.py Skip AUTHORS check for Skia service accounts 2018-01-02 18:47:01 +00:00
public.bzl remove SK_SUPPORT_LEGACY_RECTMAKELARGEST flag 2018-01-11 13:11:02 +00:00
README Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
README.chromium Update README.chromium. 2015-06-11 13:19:24 -07:00
whitespace.txt Removed general bot upload permissions, whitespace change to test 2017-12-04 13:03:34 +00:00

Skia is a complete 2D graphic library for drawing Text, Geometries, and Images.

See full details, and build instructions, at https://skia.org.