aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkCodecPriv.h
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2015-10-21 10:27:10 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-10-21 10:27:10 -0700
commit3d9d7a7213748761d46ade183e11aa7cb55313c1 (patch)
tree80478ddd5999b26b6671287ccd5803791454a4c9 /src/codec/SkCodecPriv.h
parentc7378af961cabef5b77c4dae40d8d3b9c1471a9e (diff)
Create an SkAndroidCodec API separate from SkCodec
We will implement this API using SkCodecs. SkAndroidCodecs will be used to implement the BitmapRegionDecoder Java API (and possibly BitmapFactory). BUG=skia: Review URL: https://codereview.chromium.org/1406223002
Diffstat (limited to 'src/codec/SkCodecPriv.h')
-rw-r--r--src/codec/SkCodecPriv.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/codec/SkCodecPriv.h b/src/codec/SkCodecPriv.h
index 0442625dd2..1b6723fd4a 100644
--- a/src/codec/SkCodecPriv.h
+++ b/src/codec/SkCodecPriv.h
@@ -31,9 +31,19 @@
#define COMPUTE_RESULT_ALPHA \
SkSwizzler::GetResult(zeroAlpha, maxAlpha);
+// FIXME: Consider sharing with dm, nanbench, and tools.
+inline float get_scale_from_sample_size(int sampleSize) {
+ return 1.0f / ((float) sampleSize);
+}
+
+inline bool is_valid_subset(const SkIRect& subset, const SkISize& imageDims) {
+ return SkIRect::MakeSize(imageDims).contains(subset);
+}
+
/*
* returns a scaled dimension based on the original dimension and the sampleSize
* NOTE: we round down here for scaled dimension to match the behavior of SkImageDecoder
+ * FIXME: I think we should call this get_sampled_dimension().
*/
inline int get_scaled_dimension(int srcDimension, int sampleSize) {
if (sampleSize > srcDimension) {