Chromium Code Reviews| Index: src/codec/SkSwizzler.h |
| diff --git a/src/codec/SkSwizzler.h b/src/codec/SkSwizzler.h |
| index b00ee14e0699189f9834ccc7624ef8ee8924c0f8..724f0ce15e0b07fbc5be7a5af9cdab4eee3e8293 100644 |
| --- a/src/codec/SkSwizzler.h |
| +++ b/src/codec/SkSwizzler.h |
| @@ -125,8 +125,7 @@ public: |
| * @return A new SkSwizzler or NULL on failure. |
| */ |
| static SkSwizzler* CreateSwizzler(SrcConfig, const SkPMColor* ctable, |
| - const SkImageInfo&, void* dst, |
| - size_t dstRowBytes, |
| + const SkImageInfo&, |
| SkCodec::ZeroInitialized); |
| /** |
| @@ -164,62 +163,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 the next 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 src The next row of the source data. |
| + * @param dst The intended destination row for the output. |
|
scroggo
2015/07/27 20:42:06
Maybe this should be "where to write the output",
msarett
2015/07/27 21:11:34
Yeah that is clearer.
|
| * @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 next(const uint8_t* SK_RESTRICT src, void* dst); |
|
scroggo
2015/07/27 20:42:06
I believe this function was named "next" because i
msarett
2015/07/27 21:11:34
Agreed!
|
| 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. |
| @@ -232,7 +190,7 @@ private: |
| */ |
| 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 +200,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 |