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

Unified Diff: include/codec/SkCodec.h

Issue 1390213002: Add subsetting to SkScanlineDecoder (Closed) Base URL: https://skia.googlesource.com/skia.git@fill-refactor
Patch Set: Rebase to manage dependencies Created 5 years, 2 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 1b9cb0f5d7e3afb73b0fda2dde8a593e55058ed4..89b7b4344591f69fc8340dd876dd6ce23c6cc746 100644
--- a/include/codec/SkCodec.h
+++ b/include/codec/SkCodec.h
@@ -55,20 +55,7 @@ public:
* The returned value is the codec's suggestion for the closest valid
* scale that it can natively support
*/
- SkISize getScaledDimensions(float desiredScale) const {
- // Negative and zero scales are errors.
- SkASSERT(desiredScale > 0.0f);
- if (desiredScale <= 0.0f) {
- return SkISize::Make(0, 0);
- }
-
- // Upscaling is not supported. Return the original size if the client
- // requests an upscale.
- if (desiredScale >= 1.0f) {
- return this->getInfo().dimensions();
- }
- return this->onGetScaledDimensions(desiredScale);
- }
+ SkISize getScaledDimensions(float desiredScale) const;
/**
* Return (via desiredSubset) a subset which can decoded from this codec,
@@ -85,9 +72,7 @@ public:
* @return true if this codec supports decoding desiredSubset (as
* returned, potentially modified)
*/
- bool getValidSubset(SkIRect* desiredSubset) const {
- return this->onGetValidSubset(desiredSubset);
- }
+ bool getValidSubset(SkIRect* desiredSubset) const;
/**
* Format of the encoded data.
@@ -259,11 +244,11 @@ public:
* @return Enum representing success or reason for failure.
*/
Result startScanlineDecode(const SkImageInfo& dstInfo, const SkCodec::Options* options,
- SkPMColor ctable[], int* ctableCount);
+ SkPMColor ctable[], int* ctableCount);
/**
* Simplified version of startScanlineDecode() that asserts that info is NOT
- * kIndex8_SkColorType and uses the default Options.
+ * kIndex8_SkColorType and uses the default options.
*/
Result startScanlineDecode(const SkImageInfo& dstInfo);
@@ -398,6 +383,11 @@ protected:
return this->getInfo().dimensions();
}
+ virtual bool onGetValidSubset(SkIRect* /* desiredSubset */) const {
+ // By default, subsets are not supported.
+ return false;
+ }
+
// FIXME: What to do about subsets??
/**
* Subclasses should override if they support dimensions other than the
@@ -420,11 +410,6 @@ protected:
SkPMColor ctable[], int* ctableCount,
int* rowsDecoded) = 0;
- virtual bool onGetValidSubset(SkIRect* /* desiredSubset */) const {
- // By default, subsets are not supported.
- return false;
- }
-
virtual bool onReallyHasAlpha() const { return false; }
/**

Powered by Google App Engine
This is Rietveld 408576698