Index: include/codec/SkCodec.h |
diff --git a/include/codec/SkCodec.h b/include/codec/SkCodec.h |
index 3465c1df5bc1df588e728dafd2622bbd097e6cd8..ae9524b8b78b539cfcf7b2815c2d9c63e0e57944 100644 |
--- a/include/codec/SkCodec.h |
+++ b/include/codec/SkCodec.h |
@@ -55,6 +55,17 @@ public: |
* 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); |
} |