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

Unified Diff: include/codec/SkScaledCodec.h

Issue 1395183003: Add scaled subset API to SkCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@split0
Patch Set: 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/SkScaledCodec.h
diff --git a/include/codec/SkScaledCodec.h b/include/codec/SkScaledCodec.h
index 028706bc9400bfb7028ba75699029d2454277484..969846b7b5633940e586aefbfbb95f046088e483 100644
--- a/include/codec/SkScaledCodec.h
+++ b/include/codec/SkScaledCodec.h
@@ -33,6 +33,9 @@ protected:
*/
SkISize onGetScaledDimensions(float desiredScale) const override;
bool onDimensionsSupported(const SkISize&) override;
+ bool onSubsetSupported(const SkIRect&, bool) override { return true; }
+ bool onScaledSubsetSupported(const Options&, bool) override;
+ bool onGetScaledSubsetDimensions(float desiredScale, const Options& options) const override;
Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, SkPMColor*, int*, int*)
override;
@@ -50,6 +53,42 @@ protected:
private:
+ /**
+ * Perform the decode with scaling handled by the native codec.
+ * Assumes startScanlineDecoder() has already been called.
+ *
+ * @param scaledInfo Destination image info, containing dimensions that
+ * represent the full size image, scaled to the desired
+ * scale, before any subset has been applied.
+ * @param dst Pointer to destination pixel memory.
+ * @param rowBytes Stride length in destination memory.
+ * @param scaledSubsetRect Desired subset in terms of the scaled dimensions.
+ * @param zeroInit Indicates if destination memory is zero initialized.
+ * @param rowsDecoded Out parameter to specify how many rows were
+ * successfully decoded on an incomplete decode.
+ */
+ Result nativeDecode(const SkImageInfo& scaledInfo, void* dst, size_t rowBytes,
+ const SkIRect& scaledSubsetRect, ZeroInitialized zeroInit, int* rowsDecoded);
+
+ /**
+ * Perform the decode with sampling as the scaling method.
+ * Assumes startScanlineDecoder() has already been called.
+ *
+ * @param scaledSubsetInfo Destination image info, containing dimensions that
+ * represent the scaled and subsetted result.
+ * @param dst Pointer to destination pixel memory.
+ * @param rowBytes Stride length in destination memory.
+ * @param subsetRect Desired subset in terms of the original dimensions.
+ * @param sampleX Sample factor in the x-dimension.
+ * @param sampleY Sample factor in the y-dimension.
+ * @param zeroInit Indicates if destination memory is zero initialized.
+ * @param rowsDecoded Out parameter to specify how many rows were
+ * successfully decoded on an incomplete decode.
+ */
+ Result sampledDecode(const SkImageInfo& scaledSubsetInfo, void* dst, size_t rowBytes,
+ const SkIRect& subsetRect, int sampleX, int sampleY, ZeroInitialized zeroInit,
+ int* rowsDecoded);
+
SkAutoTDelete<SkCodec> fCodec;
explicit SkScaledCodec(SkCodec*);

Powered by Google App Engine
This is Rietveld 408576698