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 #ifndef SkSampler_DEFINED | 7 #ifndef SkSampler_DEFINED |
8 #define SkSampler_DEFINED | 8 #define SkSampler_DEFINED |
9 | 9 |
10 #include "SkTypes.h" | 10 #include "SkTypes.h" |
11 | 11 |
12 class SkSampler : public SkNoncopyable { | 12 class SkSampler : public SkNoncopyable { |
13 public: | 13 public: |
14 /** | 14 /** |
15 * Update the sampler to sample every sampleX'th pixel. Returns the | 15 * Update the sampler to sample every sampleX'th pixel. Returns the |
16 * width after sampling. | 16 * width after sampling. |
17 */ | 17 */ |
18 int setSampleX(int sampleX) { | 18 int setSampleX(int sampleX) { |
19 return this->onSetSampleX(sampleX); | 19 return this->onSetSampleX(sampleX); |
20 } | 20 } |
21 | 21 |
| 22 /** |
| 23 * Fill the remainder of the destination with a single color |
| 24 * |
| 25 * @param info |
| 26 * Contains the color type of the rows to fill. |
| 27 * Contains the width of the destination rows to fill |
| 28 * Contains the number of rows that we need to fill. |
| 29 * |
| 30 * @param dst |
| 31 * The destination row to fill from. |
| 32 * |
| 33 * @param rowBytes |
| 34 * Stride in bytes of the destination. |
| 35 * |
| 36 * @param colorOrIndex |
| 37 * If colorType is kN32, colorOrIndex is treated as a 32-bit color. |
| 38 * If colorType is k565, colorOrIndex is treated as a 16-bit color. |
| 39 * If colorType is kGray, colorOrIndex is treated as an 8-bit color. |
| 40 * If colorType is kIndex, colorOrIndex is treated as an 8-bit index. |
| 41 * Other SkColorTypes are not supported. |
| 42 * |
| 43 * @param zeroInit |
| 44 * Indicates whether memory is already zero initialized. |
| 45 * |
| 46 */ |
| 47 static void Fill(const SkImageInfo& info, void* dst, size_t rowBytes, |
| 48 uint32_t colorOrIndex, SkCodec::ZeroInitialized zeroInit); |
| 49 |
| 50 /** |
| 51 * Allow subclasses to implement unique versions of fill(). |
| 52 */ |
| 53 virtual void fill(const SkImageInfo& info, void* dst, size_t rowBytes, |
| 54 uint32_t colorOrIndex, SkCodec::ZeroInitialized zeroInit) {} |
| 55 |
22 virtual ~SkSampler() {} | 56 virtual ~SkSampler() {} |
23 private: | 57 private: |
| 58 |
24 virtual int onSetSampleX(int) = 0; | 59 virtual int onSetSampleX(int) = 0; |
25 }; | 60 }; |
26 | 61 |
27 #endif // SkSampler_DEFINED | 62 #endif // SkSampler_DEFINED |
OLD | NEW |