Index: src/codec/SkSwizzler.h |
diff --git a/src/codec/SkSwizzler.h b/src/codec/SkSwizzler.h |
index b00ee14e0699189f9834ccc7624ef8ee8924c0f8..76ca74877a391c9670ef8f71d68a8ed8ad131e52 100644 |
--- a/src/codec/SkSwizzler.h |
+++ b/src/codec/SkSwizzler.h |
@@ -117,17 +117,13 @@ public: |
* @param SrcConfig Description of the format of the source. |
* @param SkImageInfo dimensions() describe both the src and the dst. |
* Other fields describe the dst. |
- * @param dst Destination to write pixels. Must match info and dstRowBytes |
- * @param dstRowBytes rowBytes for dst. |
* @param ZeroInitialized Whether dst is zero-initialized. The |
implementation may choose to skip writing zeroes |
* if set to kYes_ZeroInitialized. |
* @return A new SkSwizzler or NULL on failure. |
*/ |
static SkSwizzler* CreateSwizzler(SrcConfig, const SkPMColor* ctable, |
- const SkImageInfo&, void* dst, |
- size_t dstRowBytes, |
- SkCodec::ZeroInitialized); |
+ const SkImageInfo&, SkCodec::ZeroInitialized); |
/** |
* Fill the remainder of the destination with a single color |
@@ -164,62 +160,21 @@ public: |
uint32_t numRows, uint32_t colorOrIndex, const SkPMColor* colorTable); |
/** |
- * Swizzle the next line. Call height times, once for each row of source. |
+ * Swizzle a line. Generally this will be called height times, once |
+ * for each row of source. |
+ * By allowing the caller to pass in the dst pointer, we give the caller |
+ * flexibility to use the swizzler even when the encoded data does not |
+ * store the rows in order. This also improves usability for scaled and |
+ * subset decodes. |
+ * @param dst Where we write the output. |
* @param src The next row of the source data. |
* @return A result code describing if the row was fully opaque, fully |
* transparent, or neither |
*/ |
- ResultAlpha next(const uint8_t* SK_RESTRICT src); |
- |
- /** |
- * |
- * Alternate version of next that allows the caller to specify the row. |
- * It is very important to only use one version of next. Since the other |
- * version modifies the dst pointer, it will change the behavior of this |
- * function. We will check this in Debug mode. |
- * |
- */ |
- ResultAlpha next(const uint8_t* SK_RESTRICT src, int y); |
- |
- /** |
- * Update the destination row. |
- * |
- * Typically this is done by next, but for a client that wants to manually |
- * modify the destination row (for example, for decoding scanline one at a |
- * time) they can call this before each call to next. |
- * TODO: Maybe replace this with a version of next which allows supplying the |
- * destination? |
- */ |
- void setDstRow(void* dst) { fDstRow = dst; } |
- |
- /** |
- * Get the next destination row to decode to |
- */ |
- void* getDstRow() { |
- // kDesignateRow_NextMode does not update the fDstRow ptr. This function is |
- // unnecessary in that case since fDstRow will always be equal to the pointer |
- // passed to CreateSwizzler(). |
- SkASSERT(kDesignateRow_NextMode != fNextMode); |
- return fDstRow; |
- } |
+ ResultAlpha swizzle(void* dst, const uint8_t* SK_RESTRICT src); |
private: |
-#ifdef SK_DEBUG |
- /* |
- * |
- * Keep track of which version of next the caller is using |
- * |
- */ |
- enum NextMode { |
- kUninitialized_NextMode, |
- kConsecutive_NextMode, |
- kDesignateRow_NextMode, |
- }; |
- |
- NextMode fNextMode; |
-#endif |
- |
/** |
* Method for converting raw data to Skia pixels. |
* @param dstRow Row in which to write the resulting pixels. |
@@ -227,12 +182,11 @@ private: |
* @param width Width in pixels |
* @param deltaSrc if bitsPerPixel % 8 == 0, deltaSrc is bytesPerPixel |
* else, deltaSrc is bitsPerPixel |
- * @param y Line of source. |
* @param ctable Colors (used for kIndex source). |
*/ |
typedef ResultAlpha (*RowProc)(void* SK_RESTRICT dstRow, |
const uint8_t* SK_RESTRICT src, |
- int width, int deltaSrc, int y, |
+ int width, int deltaSrc, |
const SkPMColor ctable[]); |
const RowProc fRowProc; |
@@ -242,12 +196,10 @@ private: |
// else |
// deltaSrc is bitsPerPixel |
const SkImageInfo fDstInfo; |
- void* fDstRow; |
- const size_t fDstRowBytes; |
int fCurrY; |
SkSwizzler(RowProc proc, const SkPMColor* ctable, int deltaSrc, |
- const SkImageInfo& info, void* dst, size_t rowBytes); |
+ const SkImageInfo& info); |
}; |
#endif // SkSwizzler_DEFINED |