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

Side by Side Diff: src/codec/SkSwizzler.h

Issue 980903002: Option for SkCodec to treat dst as all zeroes. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Pass ZeroInitialized to getPixels in Options. Created 5 years, 9 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 unified diff | Download patch
OLDNEW
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, // 1 byte per pixel 21 kGray, // 1 byte per pixel
(...skipping 17 matching lines...) Expand all
39 case kRGB_565: 39 case kRGB_565:
40 return 2; 40 return 2;
41 default: 41 default:
42 SkDebugf("invalid source config passed to BytesPerPixel\n"); 42 SkDebugf("invalid source config passed to BytesPerPixel\n");
43 return -1; 43 return -1;
44 } 44 }
45 } 45 }
46 46
47 /** 47 /**
48 * Create a new SkSwizzler. 48 * Create a new SkSwizzler.
49 * @param sc SrcConfig 49 * @param SrcConfig Description of the format of the source.
50 * @param info dimensions() describe both the src and the dst. 50 * @param SkImageInfo dimensions() describe both the src and the dst.
51 * Other fields describe the dst. 51 * Other fields describe the dst.
52 * @param dst Destination to write pixels. Must match info and dstRowBytes 52 * @param dst Destination to write pixels. Must match info and dstRowBytes
53 * @param dstRowBytes rowBytes for dst. 53 * @param dstRowBytes rowBytes for dst.
54 * @param skipZeroes Whether to skip writing zeroes. Useful if dst is 54 * @param ZeroInitialized Whether dst is zero-initialized. The
55 * zero-initialized. The implementation may or may not respect this. 55 implementation may choose to skip writing zeroes
56 * if set to kYes_ZeroInitialized.
56 * @return A new SkSwizzler or NULL on failure. 57 * @return A new SkSwizzler or NULL on failure.
57 */ 58 */
58 static SkSwizzler* CreateSwizzler(SrcConfig sc, const SkPMColor* ctable, 59 static SkSwizzler* CreateSwizzler(SrcConfig, const SkPMColor* ctable,
59 const SkImageInfo& info, void* dst, 60 const SkImageInfo&, void* dst,
60 size_t dstRowBytes, bool skipZeroes); 61 size_t dstRowBytes, SkImageGenerator::Zero Initialized);
61 /** 62 /**
62 * Swizzle the next line. Call height times, once for each row of source. 63 * Swizzle the next line. Call height times, once for each row of source.
63 * @param src The next row of the source data. 64 * @param src The next row of the source data.
64 * @return Whether the row had non-opaque alpha. 65 * @return Whether the row had non-opaque alpha.
65 */ 66 */
66 bool next(const uint8_t* SK_RESTRICT src); 67 bool next(const uint8_t* SK_RESTRICT src);
67 private: 68 private:
68 /** 69 /**
69 * Method for converting raw data to Skia pixels. 70 * Method for converting raw data to Skia pixels.
70 * @param dstRow Row in which to write the resulting pixels. 71 * @param dstRow Row in which to write the resulting pixels.
(...skipping 14 matching lines...) Expand all
85 const SkImageInfo fDstInfo; 86 const SkImageInfo fDstInfo;
86 void* fDstRow; 87 void* fDstRow;
87 const size_t fDstRowBytes; 88 const size_t fDstRowBytes;
88 int fCurrY; 89 int fCurrY;
89 90
90 SkSwizzler(RowProc proc, const SkPMColor* ctable, int srcBpp, 91 SkSwizzler(RowProc proc, const SkPMColor* ctable, int srcBpp,
91 const SkImageInfo& info, void* dst, size_t rowBytes); 92 const SkImageInfo& info, void* dst, size_t rowBytes);
92 93
93 }; 94 };
94 #endif // SkSwizzler_DEFINED 95 #endif // SkSwizzler_DEFINED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698