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

Side by Side Diff: src/core/SkSpriteBlitter_ARGB32.cpp

Issue 1037793002: C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: git cl web 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
« no previous file with comments | « src/core/SkScan_Path.cpp ('k') | src/core/SkSpriteBlitter_RGB16.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkSpriteBlitter.h" 10 #include "SkSpriteBlitter.h"
(...skipping 16 matching lines...) Expand all
27 flags32 |= SkBlitRow::kGlobalAlpha_Flag32; 27 flags32 |= SkBlitRow::kGlobalAlpha_Flag32;
28 } 28 }
29 if (!src.isOpaque()) { 29 if (!src.isOpaque()) {
30 flags32 |= SkBlitRow::kSrcPixelAlpha_Flag32; 30 flags32 |= SkBlitRow::kSrcPixelAlpha_Flag32;
31 } 31 }
32 32
33 fProc32 = SkBlitRow::Factory32(flags32); 33 fProc32 = SkBlitRow::Factory32(flags32);
34 fAlpha = alpha; 34 fAlpha = alpha;
35 } 35 }
36 36
37 void blitRect(int x, int y, int width, int height) SK_OVERRIDE { 37 void blitRect(int x, int y, int width, int height) override {
38 SkASSERT(width > 0 && height > 0); 38 SkASSERT(width > 0 && height > 0);
39 uint32_t* SK_RESTRICT dst = fDevice->getAddr32(x, y); 39 uint32_t* SK_RESTRICT dst = fDevice->getAddr32(x, y);
40 const uint32_t* SK_RESTRICT src = fSource->getAddr32(x - fLeft, 40 const uint32_t* SK_RESTRICT src = fSource->getAddr32(x - fLeft,
41 y - fTop); 41 y - fTop);
42 size_t dstRB = fDevice->rowBytes(); 42 size_t dstRB = fDevice->rowBytes();
43 size_t srcRB = fSource->rowBytes(); 43 size_t srcRB = fSource->rowBytes();
44 SkBlitRow::Proc32 proc = fProc32; 44 SkBlitRow::Proc32 proc = fProc32;
45 U8CPU alpha = fAlpha; 45 U8CPU alpha = fAlpha;
46 46
47 do { 47 do {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 fAlpha = paint.getAlpha(); 85 fAlpha = paint.getAlpha();
86 } 86 }
87 87
88 virtual ~Sprite_D32_XferFilter() { 88 virtual ~Sprite_D32_XferFilter() {
89 delete[] fBuffer; 89 delete[] fBuffer;
90 SkSafeUnref(fXfermode); 90 SkSafeUnref(fXfermode);
91 SkSafeUnref(fColorFilter); 91 SkSafeUnref(fColorFilter);
92 } 92 }
93 93
94 virtual void setup(const SkBitmap& device, int left, int top, 94 virtual void setup(const SkBitmap& device, int left, int top,
95 const SkPaint& paint) SK_OVERRIDE { 95 const SkPaint& paint) override {
96 this->INHERITED::setup(device, left, top, paint); 96 this->INHERITED::setup(device, left, top, paint);
97 97
98 int width = device.width(); 98 int width = device.width();
99 if (width > fBufferSize) { 99 if (width > fBufferSize) {
100 fBufferSize = width; 100 fBufferSize = width;
101 delete[] fBuffer; 101 delete[] fBuffer;
102 fBuffer = new SkPMColor[width]; 102 fBuffer = new SkPMColor[width];
103 } 103 }
104 } 104 }
105 105
106 protected: 106 protected:
107 SkColorFilter* fColorFilter; 107 SkColorFilter* fColorFilter;
108 SkXfermode* fXfermode; 108 SkXfermode* fXfermode;
109 int fBufferSize; 109 int fBufferSize;
110 SkPMColor* fBuffer; 110 SkPMColor* fBuffer;
111 SkBlitRow::Proc32 fProc32; 111 SkBlitRow::Proc32 fProc32;
112 U8CPU fAlpha; 112 U8CPU fAlpha;
113 113
114 private: 114 private:
115 typedef SkSpriteBlitter INHERITED; 115 typedef SkSpriteBlitter INHERITED;
116 }; 116 };
117 117
118 /////////////////////////////////////////////////////////////////////////////// 118 ///////////////////////////////////////////////////////////////////////////////
119 119
120 class Sprite_D32_S32A_XferFilter : public Sprite_D32_XferFilter { 120 class Sprite_D32_S32A_XferFilter : public Sprite_D32_XferFilter {
121 public: 121 public:
122 Sprite_D32_S32A_XferFilter(const SkBitmap& source, const SkPaint& paint) 122 Sprite_D32_S32A_XferFilter(const SkBitmap& source, const SkPaint& paint)
123 : Sprite_D32_XferFilter(source, paint) {} 123 : Sprite_D32_XferFilter(source, paint) {}
124 124
125 void blitRect(int x, int y, int width, int height) SK_OVERRIDE { 125 void blitRect(int x, int y, int width, int height) override {
126 SkASSERT(width > 0 && height > 0); 126 SkASSERT(width > 0 && height > 0);
127 uint32_t* SK_RESTRICT dst = fDevice->getAddr32(x, y); 127 uint32_t* SK_RESTRICT dst = fDevice->getAddr32(x, y);
128 const uint32_t* SK_RESTRICT src = fSource->getAddr32(x - fLeft, 128 const uint32_t* SK_RESTRICT src = fSource->getAddr32(x - fLeft,
129 y - fTop); 129 y - fTop);
130 size_t dstRB = fDevice->rowBytes(); 130 size_t dstRB = fDevice->rowBytes();
131 size_t srcRB = fSource->rowBytes(); 131 size_t srcRB = fSource->rowBytes();
132 SkColorFilter* colorFilter = fColorFilter; 132 SkColorFilter* colorFilter = fColorFilter;
133 SkXfermode* xfermode = fXfermode; 133 SkXfermode* xfermode = fXfermode;
134 134
135 do { 135 do {
(...skipping 26 matching lines...) Expand all
162 do { 162 do {
163 *dst++ = SkPixel4444ToPixel32(*src++); 163 *dst++ = SkPixel4444ToPixel32(*src++);
164 } while (--count != 0); 164 } while (--count != 0);
165 } 165 }
166 166
167 class Sprite_D32_S4444_XferFilter : public Sprite_D32_XferFilter { 167 class Sprite_D32_S4444_XferFilter : public Sprite_D32_XferFilter {
168 public: 168 public:
169 Sprite_D32_S4444_XferFilter(const SkBitmap& source, const SkPaint& paint) 169 Sprite_D32_S4444_XferFilter(const SkBitmap& source, const SkPaint& paint)
170 : Sprite_D32_XferFilter(source, paint) {} 170 : Sprite_D32_XferFilter(source, paint) {}
171 171
172 void blitRect(int x, int y, int width, int height) SK_OVERRIDE { 172 void blitRect(int x, int y, int width, int height) override {
173 SkASSERT(width > 0 && height > 0); 173 SkASSERT(width > 0 && height > 0);
174 SkPMColor* SK_RESTRICT dst = fDevice->getAddr32(x, y); 174 SkPMColor* SK_RESTRICT dst = fDevice->getAddr32(x, y);
175 const SkPMColor16* SK_RESTRICT src = fSource->getAddr16(x - fLeft, 175 const SkPMColor16* SK_RESTRICT src = fSource->getAddr16(x - fLeft,
176 y - fTop); 176 y - fTop);
177 size_t dstRB = fDevice->rowBytes(); 177 size_t dstRB = fDevice->rowBytes();
178 size_t srcRB = fSource->rowBytes(); 178 size_t srcRB = fSource->rowBytes();
179 SkPMColor* SK_RESTRICT buffer = fBuffer; 179 SkPMColor* SK_RESTRICT buffer = fBuffer;
180 SkColorFilter* colorFilter = fColorFilter; 180 SkColorFilter* colorFilter = fColorFilter;
181 SkXfermode* xfermode = fXfermode; 181 SkXfermode* xfermode = fXfermode;
182 182
(...skipping 26 matching lines...) Expand all
209 *dst = SkPixel4444ToPixel32(*src); 209 *dst = SkPixel4444ToPixel32(*src);
210 src += 1; 210 src += 1;
211 dst += 1; 211 dst += 1;
212 } while (--count != 0); 212 } while (--count != 0);
213 } 213 }
214 214
215 class Sprite_D32_S4444_Opaque : public SkSpriteBlitter { 215 class Sprite_D32_S4444_Opaque : public SkSpriteBlitter {
216 public: 216 public:
217 Sprite_D32_S4444_Opaque(const SkBitmap& source) : SkSpriteBlitter(source) {} 217 Sprite_D32_S4444_Opaque(const SkBitmap& source) : SkSpriteBlitter(source) {}
218 218
219 void blitRect(int x, int y, int width, int height) SK_OVERRIDE { 219 void blitRect(int x, int y, int width, int height) override {
220 SkASSERT(width > 0 && height > 0); 220 SkASSERT(width > 0 && height > 0);
221 SkPMColor* SK_RESTRICT dst = fDevice->getAddr32(x, y); 221 SkPMColor* SK_RESTRICT dst = fDevice->getAddr32(x, y);
222 const SkPMColor16* SK_RESTRICT src = fSource->getAddr16(x - fLeft, 222 const SkPMColor16* SK_RESTRICT src = fSource->getAddr16(x - fLeft,
223 y - fTop); 223 y - fTop);
224 size_t dstRB = fDevice->rowBytes(); 224 size_t dstRB = fDevice->rowBytes();
225 size_t srcRB = fSource->rowBytes(); 225 size_t srcRB = fSource->rowBytes();
226 226
227 do { 227 do {
228 src_row(dst, src, width); 228 src_row(dst, src, width);
229 dst = (SkPMColor* SK_RESTRICT)((char*)dst + dstRB); 229 dst = (SkPMColor* SK_RESTRICT)((char*)dst + dstRB);
230 src = (const SkPMColor16* SK_RESTRICT)((const char*)src + srcRB); 230 src = (const SkPMColor16* SK_RESTRICT)((const char*)src + srcRB);
231 } while (--height != 0); 231 } while (--height != 0);
232 } 232 }
233 }; 233 };
234 234
235 static void srcover_row(SkPMColor* SK_RESTRICT dst, 235 static void srcover_row(SkPMColor* SK_RESTRICT dst,
236 const SkPMColor16* SK_RESTRICT src, int count) { 236 const SkPMColor16* SK_RESTRICT src, int count) {
237 do { 237 do {
238 *dst = SkPMSrcOver(SkPixel4444ToPixel32(*src), *dst); 238 *dst = SkPMSrcOver(SkPixel4444ToPixel32(*src), *dst);
239 src += 1; 239 src += 1;
240 dst += 1; 240 dst += 1;
241 } while (--count != 0); 241 } while (--count != 0);
242 } 242 }
243 243
244 class Sprite_D32_S4444 : public SkSpriteBlitter { 244 class Sprite_D32_S4444 : public SkSpriteBlitter {
245 public: 245 public:
246 Sprite_D32_S4444(const SkBitmap& source) : SkSpriteBlitter(source) {} 246 Sprite_D32_S4444(const SkBitmap& source) : SkSpriteBlitter(source) {}
247 247
248 void blitRect(int x, int y, int width, int height) SK_OVERRIDE { 248 void blitRect(int x, int y, int width, int height) override {
249 SkASSERT(width > 0 && height > 0); 249 SkASSERT(width > 0 && height > 0);
250 SkPMColor* SK_RESTRICT dst = fDevice->getAddr32(x, y); 250 SkPMColor* SK_RESTRICT dst = fDevice->getAddr32(x, y);
251 const SkPMColor16* SK_RESTRICT src = fSource->getAddr16(x - fLeft, 251 const SkPMColor16* SK_RESTRICT src = fSource->getAddr16(x - fLeft,
252 y - fTop); 252 y - fTop);
253 size_t dstRB = fDevice->rowBytes(); 253 size_t dstRB = fDevice->rowBytes();
254 size_t srcRB = fSource->rowBytes(); 254 size_t srcRB = fSource->rowBytes();
255 255
256 do { 256 do {
257 srcover_row(dst, src, width); 257 srcover_row(dst, src, width);
258 dst = (SkPMColor* SK_RESTRICT)((char*)dst + dstRB); 258 dst = (SkPMColor* SK_RESTRICT)((char*)dst + dstRB);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 } else { 298 } else {
299 // this can handle alpha, but not xfermode or filter 299 // this can handle alpha, but not xfermode or filter
300 blitter = allocator->createT<Sprite_D32_S32>(source, alpha); 300 blitter = allocator->createT<Sprite_D32_S32>(source, alpha);
301 } 301 }
302 break; 302 break;
303 default: 303 default:
304 break; 304 break;
305 } 305 }
306 return blitter; 306 return blitter;
307 } 307 }
OLDNEW
« no previous file with comments | « src/core/SkScan_Path.cpp ('k') | src/core/SkSpriteBlitter_RGB16.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698