| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkSwizzler_DEFINED | 8 #ifndef SkSwizzler_DEFINED |
| 9 #define SkSwizzler_DEFINED | 9 #define SkSwizzler_DEFINED |
| 10 | 10 |
| 11 #include "SkTypes.h" | 11 #include "SkCodec.h" |
| 12 #include "SkColor.h" | 12 #include "SkColor.h" |
| 13 #include "SkImageInfo.h" | 13 #include "SkImageInfo.h" |
| 14 | 14 |
| 15 class SkSwizzler : public SkNoncopyable { | 15 class SkSwizzler : public SkNoncopyable { |
| 16 public: | 16 public: |
| 17 /** | 17 /** |
| 18 * Enum describing the config of the source data. | 18 * Enum describing the config of the source data. |
| 19 */ | 19 */ |
| 20 enum SrcConfig { | 20 enum SrcConfig { |
| 21 kGray, | 21 kGray, |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 * Raises an error if each pixel is not stored in an even number of bytes | 106 * Raises an error if each pixel is not stored in an even number of bytes |
| 107 * | 107 * |
| 108 */ | 108 */ |
| 109 static int BytesPerPixel(SrcConfig sc) { | 109 static int BytesPerPixel(SrcConfig sc) { |
| 110 SkASSERT(SkIsAlign8(BitsPerPixel(sc))); | 110 SkASSERT(SkIsAlign8(BitsPerPixel(sc))); |
| 111 return BitsPerPixel(sc) >> 3; | 111 return BitsPerPixel(sc) >> 3; |
| 112 } | 112 } |
| 113 | 113 |
| 114 /** | 114 /** |
| 115 * Create a new SkSwizzler. | 115 * Create a new SkSwizzler. |
| 116 * @param sc SrcConfig | 116 * @param SrcConfig Description of the format of the source. |
| 117 * @param info dimensions() describe both the src and the dst. | 117 * @param SkImageInfo dimensions() describe both the src and the dst. |
| 118 * Other fields describe the dst. | 118 * Other fields describe the dst. |
| 119 * @param dst Destination to write pixels. Must match info and dstRowBytes | 119 * @param dst Destination to write pixels. Must match info and dstRowBytes |
| 120 * @param dstRowBytes rowBytes for dst. | 120 * @param dstRowBytes rowBytes for dst. |
| 121 * @param skipZeroes Whether to skip writing zeroes. Useful if dst is | 121 * @param ZeroInitialized Whether dst is zero-initialized. The |
| 122 * zero-initialized. The implementation may or may not respect
this. | 122 implementation may choose to skip writing zeroes |
| 123 * if set to kYes_ZeroInitialized. |
| 123 * @return A new SkSwizzler or NULL on failure. | 124 * @return A new SkSwizzler or NULL on failure. |
| 124 */ | 125 */ |
| 125 static SkSwizzler* CreateSwizzler(SrcConfig sc, const SkPMColor* ctable, | 126 static SkSwizzler* CreateSwizzler(SrcConfig, const SkPMColor* ctable, |
| 126 const SkImageInfo& info, void* dst, | 127 const SkImageInfo&, void* dst, |
| 127 size_t dstRowBytes, bool skipZeroes); | 128 size_t dstRowBytes, |
| 128 | 129 SkImageGenerator::ZeroInitialized); |
| 129 /** | 130 /** |
| 130 * Swizzle the next line. Call height times, once for each row of source. | 131 * Swizzle the next line. Call height times, once for each row of source. |
| 131 * @param src The next row of the source data. | 132 * @param src The next row of the source data. |
| 132 * @return A result code describing if the row was fully opaque, fully | 133 * @return A result code describing if the row was fully opaque, fully |
| 133 * transparent, or neither | 134 * transparent, or neither |
| 134 */ | 135 */ |
| 135 ResultAlpha next(const uint8_t* SK_RESTRICT src); | 136 ResultAlpha next(const uint8_t* SK_RESTRICT src); |
| 136 | 137 |
| 137 /** | 138 /** |
| 138 * | 139 * |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 const SkImageInfo fDstInfo; | 185 const SkImageInfo fDstInfo; |
| 185 void* fDstRow; | 186 void* fDstRow; |
| 186 const size_t fDstRowBytes; | 187 const size_t fDstRowBytes; |
| 187 int fCurrY; | 188 int fCurrY; |
| 188 | 189 |
| 189 SkSwizzler(RowProc proc, const SkPMColor* ctable, int deltaSrc, | 190 SkSwizzler(RowProc proc, const SkPMColor* ctable, int deltaSrc, |
| 190 const SkImageInfo& info, void* dst, size_t rowBytes); | 191 const SkImageInfo& info, void* dst, size_t rowBytes); |
| 191 | 192 |
| 192 }; | 193 }; |
| 193 #endif // SkSwizzler_DEFINED | 194 #endif // SkSwizzler_DEFINED |
| OLD | NEW |