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

Unified Diff: include/codec/SkCodec.h

Issue 1372973002: Move all knowledge of X sampling into SkScaledCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@codecSDmerge
Patch Set: Attempt to fix RLE overflow 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
« no previous file with comments | « no previous file | include/codec/SkScaledCodec.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/codec/SkCodec.h
diff --git a/include/codec/SkCodec.h b/include/codec/SkCodec.h
index c0cce853a3aa07e36668bb497883bed2da4b1515..7300a5c7321c40b848007bf5022042136619a667 100644
--- a/include/codec/SkCodec.h
+++ b/include/codec/SkCodec.h
@@ -17,6 +17,7 @@
#include "SkTypes.h"
class SkData;
+class SkSampler;
/**
* Abstraction layer directly on top of an image codec.
@@ -382,6 +383,15 @@ protected:
return this->getInfo().dimensions();
}
+ // FIXME: What to do about subsets??
+ /**
+ * Subclasses should override if they support dimensions other than the
+ * srcInfo's.
+ */
+ virtual bool onDimensionsSupported(const SkISize&) {
+ return false;
+ }
+
virtual SkEncodedFormat onGetEncodedFormat() const = 0;
virtual Result onGetPixels(const SkImageInfo& info,
@@ -455,6 +465,19 @@ private:
SkCodec::Options fOptions;
int fCurrScanline;
+ /**
+ * Return whether these dimensions are supported as a scale.
+ *
+ * The codec may choose to cache the information about scale and subset.
+ * Either way, the same information will be passed to onGetPixels/onStart
+ * on success.
+ *
+ * This must return true for a size returned from getScaledDimensions.
+ */
+ bool dimensionsSupported(const SkISize& dim) {
+ return dim == fSrcInfo.dimensions() || this->onDimensionsSupported(dim);
+ }
+
// Methods for scanline decoding.
virtual SkCodec::Result onStartScanlineDecode(const SkImageInfo& dstInfo,
const SkCodec::Options& options, SkPMColor ctable[], int* ctableCount) {
@@ -477,5 +500,17 @@ private:
return kUnimplemented;
}
+ /**
+ * Return an object which will allow forcing scanline decodes to sample in X.
+ *
+ * May create a sampler, if one is not currently being used. Otherwise, does
+ * not affect ownership.
+ *
+ * Only valid during scanline decoding.
+ */
+ virtual SkSampler* getSampler() { return nullptr; }
+
+ // Needed to call getSampler and dimensionsSupported.
+ friend class SkScaledCodec;
};
#endif // SkCodec_DEFINED
« no previous file with comments | « no previous file | include/codec/SkScaledCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698