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

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

Issue 1332053002: Fill incomplete images in SkCodec parent class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Forgot to add SkSampler.cpp Created 5 years, 2 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 #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 dst
26 * The destination row to fill from.
27 *
28 * @param colorType
29 * The color type of the rows to fill.
30 *
31 * @param numRows
32 * The number of rows that we need to fill.
33 *
34 * @param rowBytes
35 * Stride in bytes of the destination.
36 *
37 * @param colorOrIndex
38 * If colorType is kN32, colorOrIndex is treated as a 32-bit color.
39 * If colorType is k565, colorOrIndex is treated as a 16-bit color.
40 * If colorType is kGray, colorOrIndex is treated as an 8-bit color.
41 * If colorType is kIndex, colorOrIndex is treated as an 8-bit index.
42 * Other SkColorTypes are not supported.
43 *
44 * @param zeroInit
45 * Indicates whether memory is already zero initialized.
46 *
47 */
48 void fill(void* dst, SkColorType colorType, int numRows, size_t rowBytes, ui nt32_t colorOrIndex,
49 SkCodec::ZeroInitialized zeroInit);
50
22 virtual ~SkSampler() {} 51 virtual ~SkSampler() {}
23 private: 52 private:
53 /**
54 * Get the the scaled width of the image.
55 *
56 * SkSampler needs the scaled width to fill uninitialized memory in
57 * incomplete images.
58 */
59 int getScaledWidth() {
60 return this->onGetScaledWidth();
61 }
62
63 virtual int onGetScaledWidth() = 0;
64
24 virtual int onSetSampleX(int) = 0; 65 virtual int onSetSampleX(int) = 0;
25 }; 66 };
26 67
27 #endif // SkSampler_DEFINED 68 #endif // SkSampler_DEFINED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698