Prefer native scaling to sampling
authormsarett <msarett@google.com>
Tue, 18 Aug 2015 15:03:58 +0000 (08:03 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 18 Aug 2015 15:03:58 +0000 (08:03 -0700)
commita83593b88a38765eba5f349d4e12d66b3e626af9
treeb744b3d4ccb3d47e27ffef614cc44b49806ee5ab
parent0628a52b0cd11a7d5e3415f85c8b8d7cfa655151
Prefer native scaling to sampling

In the cases we have come across so far, native scaling has better performance
and correctness than sampling.  If native scaling is supported we want to use
it.

Jpegs native scale rounds up.
Ex: An 11x11 image with sampleSize=8 scales to 2x2.

SkScaledCodec rounds down.
Ex: An 11x11 image with sampleSize=8 scales to 1x1.

Before the CL, we would choose to use SkScaledCodec because it scales closer to
the "ideal" scale.

I think we want to go with the native option as long as its within 1 of the
ideal value.
BUG=skia:

Review URL: https://codereview.chromium.org/1284243004
src/codec/SkScaledCodec.cpp