Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: include/codec/SkCodec.h

Issue 1260673002: SkScaledCodec class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Make SkScaledCodec constructor explicit Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: include/codec/SkCodec.h
diff --git a/include/codec/SkCodec.h b/include/codec/SkCodec.h
index 1cdc88d4adcfc0dc4e028913348dd21c287e50e7..f20298e5891b84983f86f805ff47608fee668a7d 100644
--- a/include/codec/SkCodec.h
+++ b/include/codec/SkCodec.h
@@ -52,11 +52,25 @@ public:
* Return a size that approximately supports the desired scale factor.
* The codec may not be able to scale efficiently to the exact scale
* factor requested, so return a size that approximates that scale.
+ * The returned value is the codec's suggestion for the closest valid
+ * scale that it can natively support
*/
SkISize getScaledDimensions(float desiredScale) const {
return this->onGetScaledDimensions(desiredScale);
}
+ /*
+ * Checks if we can patially natively scale to the desiredScale, and partially natively scales
scroggo 2015/08/04 20:05:21 "partially" is missing r (the first time)
emmaleer 2015/08/05 14:47:51 Acknowledged.
+ * the dimensions if possible.
+ * Returns the new sampleSize, which is used to finish scaling to the desiredScale.
+ * Ex: desiredScale = 1/6. Natively can scale by 1/2. New sampleSize = 3, as there is still
+ * 1/3 scaling left to do, which is done by sampling.
+ * Returns -1 if partial native scaling is not supported.
+ */
+ int partiallyNativelyScale(float desiredScale) {
scroggo 2015/08/04 20:05:21 I'm not a huge fan of this name. I am not sure I h
emmaleer 2015/08/05 14:47:51 Okay, I'll first upload the changes for future ref
+ return this->onPartiallyNativelyScale(desiredScale);
+ }
+
/**
* Return (via desiredSubset) a subset which can decoded from this codec,
* or false if this codec cannot decode subsets or anything similar to
@@ -252,6 +266,9 @@ protected:
return this->getInfo().dimensions();
}
+ virtual int onPartiallyNativelyScale(float desiredScale) {
+ return -1;
+ }
virtual SkEncodedFormat onGetEncodedFormat() const = 0;
virtual Result onGetPixels(const SkImageInfo& info,

Powered by Google App Engine
This is Rietveld 408576698