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

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

Issue 1842753002: Style bikeshed - remove extraneous whitespace (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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/SkBlitter_A8.cpp ('k') | src/core/SkBuffer.h » ('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 * Copyright 2016 Google Inc. 2 * Copyright 2016 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 #include "SkCoreBlitters.h" 8 #include "SkCoreBlitters.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkShader.h" 10 #include "SkShader.h"
11 #include "SkUtils.h" 11 #include "SkUtils.h"
12 #include "SkXfermode.h" 12 #include "SkXfermode.h"
13 #include "SkBlitMask.h" 13 #include "SkBlitMask.h"
14 #include "SkTemplates.h" 14 #include "SkTemplates.h"
15 #include "SkPM4f.h" 15 #include "SkPM4f.h"
16 16
17 template <typename State> class SkState_Blitter : public SkRasterBlitter { 17 template <typename State> class SkState_Blitter : public SkRasterBlitter {
18 typedef SkRasterBlitter INHERITED; 18 typedef SkRasterBlitter INHERITED;
19 State fState; 19 State fState;
20 20
21 public: 21 public:
22 SkState_Blitter(const SkPixmap& device, const SkPaint& paint) 22 SkState_Blitter(const SkPixmap& device, const SkPaint& paint)
23 : INHERITED(device) 23 : INHERITED(device)
24 , fState(device.info(), paint, nullptr) 24 , fState(device.info(), paint, nullptr)
25 {} 25 {}
26 26
27 void blitH(int x, int y, int width) override { 27 void blitH(int x, int y, int width) override {
28 SkASSERT(x >= 0 && y >= 0 && x + width <= fDevice.width()); 28 SkASSERT(x >= 0 && y >= 0 && x + width <= fDevice.width());
29 29
30 fState.fProc1(fState.fXfer, State::WritableAddr(fDevice, x, y), 30 fState.fProc1(fState.fXfer, State::WritableAddr(fDevice, x, y),
31 &fState.fPM4f, width, nullptr); 31 &fState.fPM4f, width, nullptr);
32 } 32 }
33 33
34 void blitV(int x, int y, int height, SkAlpha alpha) override { 34 void blitV(int x, int y, int height, SkAlpha alpha) override {
35 SkASSERT(x >= 0 && y >= 0 && y + height <= fDevice.height()); 35 SkASSERT(x >= 0 && y >= 0 && y + height <= fDevice.height());
36 36
37 typename State::DstType* device = State::WritableAddr(fDevice, x, y); 37 typename State::DstType* device = State::WritableAddr(fDevice, x, y);
38 size_t deviceRB = fDevice.rowBytes(); 38 size_t deviceRB = fDevice.rowBytes();
39 39
40 for (int i = 0; i < height; ++i) { 40 for (int i = 0; i < height; ++i) {
41 fState.fProc1(fState.fXfer, device, &fState.fPM4f, 1, &alpha); 41 fState.fProc1(fState.fXfer, device, &fState.fPM4f, 1, &alpha);
42 device = (typename State::DstType*)((char*)device + deviceRB); 42 device = (typename State::DstType*)((char*)device + deviceRB);
43 } 43 }
44 } 44 }
45 45
46 void blitRect(int x, int y, int width, int height) override { 46 void blitRect(int x, int y, int width, int height) override {
47 SkASSERT(x >= 0 && y >= 0 && 47 SkASSERT(x >= 0 && y >= 0 &&
48 x + width <= fDevice.width() && y + height <= fDevice.height()) ; 48 x + width <= fDevice.width() && y + height <= fDevice.height()) ;
49 49
50 typename State::DstType* device = State::WritableAddr(fDevice, x, y); 50 typename State::DstType* device = State::WritableAddr(fDevice, x, y);
51 size_t deviceRB = fDevice.rowBytes(); 51 size_t deviceRB = fDevice.rowBytes();
52 52
53 do { 53 do {
54 fState.fProc1(fState.fXfer, device, &fState.fPM4f, width, nullptr); 54 fState.fProc1(fState.fXfer, device, &fState.fPM4f, width, nullptr);
55 y += 1; 55 y += 1;
56 device = (typename State::DstType*)((char*)device + deviceRB); 56 device = (typename State::DstType*)((char*)device + deviceRB);
57 } while (--height > 0); 57 } while (--height > 0);
58 } 58 }
59 59
60 void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[] ) override { 60 void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[] ) override {
61 typename State::DstType* device = State::WritableAddr(fDevice, x, y); 61 typename State::DstType* device = State::WritableAddr(fDevice, x, y);
62 62
63 for (;;) { 63 for (;;) {
64 int count = *runs; 64 int count = *runs;
65 if (count <= 0) { 65 if (count <= 0) {
66 break; 66 break;
67 } 67 }
68 int aa = *antialias; 68 int aa = *antialias;
69 if (aa) { 69 if (aa) {
70 if (aa == 255) { 70 if (aa == 255) {
71 fState.fProc1(fState.fXfer, device, &fState.fPM4f, count, nu llptr); 71 fState.fProc1(fState.fXfer, device, &fState.fPM4f, count, nu llptr);
72 } else { 72 } else {
73 for (int i = 0; i < count; ++i) { 73 for (int i = 0; i < count; ++i) {
74 fState.fProc1(fState.fXfer, &device[i], &fState.fPM4f, 1 , antialias); 74 fState.fProc1(fState.fXfer, &device[i], &fState.fPM4f, 1 , antialias);
75 } 75 }
76 } 76 }
77 } 77 }
78 device += count; 78 device += count;
79 runs += count; 79 runs += count;
80 antialias += count; 80 antialias += count;
81 x += count; 81 x += count;
82 } 82 }
83 } 83 }
84 84
85 void blitLCDMask(const SkMask& mask, const SkIRect& clip) { 85 void blitLCDMask(const SkMask& mask, const SkIRect& clip) {
86 auto proc = fState.getLCDProc(SkXfermode::kSrcIsSingle_LCDFlag); 86 auto proc = fState.getLCDProc(SkXfermode::kSrcIsSingle_LCDFlag);
87 87
88 const int x = clip.fLeft; 88 const int x = clip.fLeft;
89 const int width = clip.width(); 89 const int width = clip.width();
90 const int y = clip.fTop; 90 const int y = clip.fTop;
91 const int height = clip.height(); 91 const int height = clip.height();
92 92
93 typename State::DstType* device = State::WritableAddr(fDevice, x, y); 93 typename State::DstType* device = State::WritableAddr(fDevice, x, y);
94 const size_t dstRB = fDevice.rowBytes(); 94 const size_t dstRB = fDevice.rowBytes();
95 const uint16_t* maskRow = (const uint16_t*)mask.getAddr(x, y); 95 const uint16_t* maskRow = (const uint16_t*)mask.getAddr(x, y);
96 const size_t maskRB = mask.fRowBytes; 96 const size_t maskRB = mask.fRowBytes;
97 97
98 for (int i = 0; i < height; ++i) { 98 for (int i = 0; i < height; ++i) {
99 proc(device, &fState.fPM4f, width, maskRow); 99 proc(device, &fState.fPM4f, width, maskRow);
100 device = (typename State::DstType*)((char*)device + dstRB); 100 device = (typename State::DstType*)((char*)device + dstRB);
101 maskRow = (const uint16_t*)((const char*)maskRow + maskRB); 101 maskRow = (const uint16_t*)((const char*)maskRow + maskRB);
102 } 102 }
103 } 103 }
104 104
105 void blitMask(const SkMask& mask, const SkIRect& clip) override { 105 void blitMask(const SkMask& mask, const SkIRect& clip) override {
106 if (SkMask::kLCD16_Format == mask.fFormat) { 106 if (SkMask::kLCD16_Format == mask.fFormat) {
107 this->blitLCDMask(mask, clip); 107 this->blitLCDMask(mask, clip);
108 return; 108 return;
109 } 109 }
110 if (SkMask::kA8_Format != mask.fFormat) { 110 if (SkMask::kA8_Format != mask.fFormat) {
111 this->INHERITED::blitMask(mask, clip); 111 this->INHERITED::blitMask(mask, clip);
112 return; 112 return;
113 } 113 }
114 114
115 SkASSERT(mask.fBounds.contains(clip)); 115 SkASSERT(mask.fBounds.contains(clip));
116 116
117 const int x = clip.fLeft; 117 const int x = clip.fLeft;
118 const int width = clip.width(); 118 const int width = clip.width();
119 const int y = clip.fTop; 119 const int y = clip.fTop;
120 const int height = clip.height(); 120 const int height = clip.height();
121 121
122 typename State::DstType* device = State::WritableAddr(fDevice, x, y); 122 typename State::DstType* device = State::WritableAddr(fDevice, x, y);
123 const size_t dstRB = fDevice.rowBytes(); 123 const size_t dstRB = fDevice.rowBytes();
124 const uint8_t* maskRow = (const uint8_t*)mask.getAddr(x, y); 124 const uint8_t* maskRow = (const uint8_t*)mask.getAddr(x, y);
125 const size_t maskRB = mask.fRowBytes; 125 const size_t maskRB = mask.fRowBytes;
126 126
127 for (int i = 0; i < height; ++i) { 127 for (int i = 0; i < height; ++i) {
128 fState.fProc1(fState.fXfer, device, &fState.fPM4f, width, maskRow); 128 fState.fProc1(fState.fXfer, device, &fState.fPM4f, width, maskRow);
129 device = (typename State::DstType*)((char*)device + dstRB); 129 device = (typename State::DstType*)((char*)device + dstRB);
130 maskRow += maskRB; 130 maskRow += maskRB;
131 } 131 }
132 } 132 }
133 }; 133 };
134 134
135 //////////////////////////////////////////////////////////////////////////////// /////////////////// 135 //////////////////////////////////////////////////////////////////////////////// ///////////////////
136 136
137 template <typename State> class SkState_Shader_Blitter : public SkShaderBlitter { 137 template <typename State> class SkState_Shader_Blitter : public SkShaderBlitter {
138 public: 138 public:
139 SkState_Shader_Blitter(const SkPixmap& device, const SkPaint& paint, 139 SkState_Shader_Blitter(const SkPixmap& device, const SkPaint& paint,
140 const SkShader::Context::BlitState& bstate) 140 const SkShader::Context::BlitState& bstate)
141 : INHERITED(device, paint, bstate.fCtx) 141 : INHERITED(device, paint, bstate.fCtx)
142 , fState(device.info(), paint, bstate.fCtx) 142 , fState(device.info(), paint, bstate.fCtx)
143 , fBState(bstate) 143 , fBState(bstate)
144 , fBlitBW(bstate.fBlitBW) 144 , fBlitBW(bstate.fBlitBW)
145 , fBlitAA(bstate.fBlitAA) 145 , fBlitAA(bstate.fBlitAA)
146 {} 146 {}
147 147
148 void blitH(int x, int y, int width) override { 148 void blitH(int x, int y, int width) override {
149 SkASSERT(x >= 0 && y >= 0 && x + width <= fDevice.width()); 149 SkASSERT(x >= 0 && y >= 0 && x + width <= fDevice.width());
150 150
151 if (fBlitBW) { 151 if (fBlitBW) {
152 fBlitBW(&fBState, x, y, fDevice, width); 152 fBlitBW(&fBState, x, y, fDevice, width);
153 return; 153 return;
154 } 154 }
155 155
156 typename State::DstType* device = State::WritableAddr(fDevice, x, y); 156 typename State::DstType* device = State::WritableAddr(fDevice, x, y);
157 fShaderContext->shadeSpan4f(x, y, fState.fBuffer, width); 157 fShaderContext->shadeSpan4f(x, y, fState.fBuffer, width);
158 fState.fProcN(fState.fXfer, device, fState.fBuffer, width, nullptr); 158 fState.fProcN(fState.fXfer, device, fState.fBuffer, width, nullptr);
159 } 159 }
160 160
161 void blitV(int x, int y, int height, SkAlpha alpha) override { 161 void blitV(int x, int y, int height, SkAlpha alpha) override {
162 SkASSERT(x >= 0 && y >= 0 && y + height <= fDevice.height()); 162 SkASSERT(x >= 0 && y >= 0 && y + height <= fDevice.height());
163 163
164 if (fBlitAA) { 164 if (fBlitAA) {
165 for (const int bottom = y + height; y < bottom; ++y) { 165 for (const int bottom = y + height; y < bottom; ++y) {
166 fBlitAA(&fBState, x, y, fDevice, 1, &alpha); 166 fBlitAA(&fBState, x, y, fDevice, 1, &alpha);
167 } 167 }
168 return; 168 return;
169 } 169 }
170 170
171 typename State::DstType* device = State::WritableAddr(fDevice, x, y); 171 typename State::DstType* device = State::WritableAddr(fDevice, x, y);
172 size_t deviceRB = fDevice.rowBytes(); 172 size_t deviceRB = fDevice.rowBytes();
173 173
174 if (fConstInY) { 174 if (fConstInY) {
175 fShaderContext->shadeSpan4f(x, y, fState.fBuffer, 1); 175 fShaderContext->shadeSpan4f(x, y, fState.fBuffer, 1);
176 } 176 }
177 for (const int bottom = y + height; y < bottom; ++y) { 177 for (const int bottom = y + height; y < bottom; ++y) {
178 if (!fConstInY) { 178 if (!fConstInY) {
179 fShaderContext->shadeSpan4f(x, y, fState.fBuffer, 1); 179 fShaderContext->shadeSpan4f(x, y, fState.fBuffer, 1);
180 } 180 }
181 fState.fProcN(fState.fXfer, device, fState.fBuffer, 1, &alpha); 181 fState.fProcN(fState.fXfer, device, fState.fBuffer, 1, &alpha);
182 device = (typename State::DstType*)((char*)device + deviceRB); 182 device = (typename State::DstType*)((char*)device + deviceRB);
183 } 183 }
184 } 184 }
185 185
186 void blitRect(int x, int y, int width, int height) override { 186 void blitRect(int x, int y, int width, int height) override {
187 SkASSERT(x >= 0 && y >= 0 && 187 SkASSERT(x >= 0 && y >= 0 &&
188 x + width <= fDevice.width() && y + height <= fDevice.height()) ; 188 x + width <= fDevice.width() && y + height <= fDevice.height()) ;
189 189
190 if (fBlitBW) { 190 if (fBlitBW) {
191 for (const int bottom = y + height; y < bottom; ++y) { 191 for (const int bottom = y + height; y < bottom; ++y) {
192 fBlitBW(&fBState, x, y, fDevice, width); 192 fBlitBW(&fBState, x, y, fDevice, width);
193 } 193 }
194 return; 194 return;
195 } 195 }
196 196
197 typename State::DstType* device = State::WritableAddr(fDevice, x, y); 197 typename State::DstType* device = State::WritableAddr(fDevice, x, y);
198 size_t deviceRB = fDevice.rowBytes(); 198 size_t deviceRB = fDevice.rowBytes();
199 199
200 if (fConstInY) { 200 if (fConstInY) {
201 fShaderContext->shadeSpan4f(x, y, fState.fBuffer, width); 201 fShaderContext->shadeSpan4f(x, y, fState.fBuffer, width);
202 } 202 }
203 for (const int bottom = y + height; y < bottom; ++y) { 203 for (const int bottom = y + height; y < bottom; ++y) {
204 if (!fConstInY) { 204 if (!fConstInY) {
205 fShaderContext->shadeSpan4f(x, y, fState.fBuffer, width); 205 fShaderContext->shadeSpan4f(x, y, fState.fBuffer, width);
206 } 206 }
207 fState.fProcN(fState.fXfer, device, fState.fBuffer, width, nullptr); 207 fState.fProcN(fState.fXfer, device, fState.fBuffer, width, nullptr);
208 device = (typename State::DstType*)((char*)device + deviceRB); 208 device = (typename State::DstType*)((char*)device + deviceRB);
209 } 209 }
210 } 210 }
211 211
212 void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[] ) override { 212 void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[] ) override {
213 typename State::DstType* device = State::WritableAddr(fDevice, x, y); 213 typename State::DstType* device = State::WritableAddr(fDevice, x, y);
214 214
215 for (;;) { 215 for (;;) {
216 int count = *runs; 216 int count = *runs;
217 if (count <= 0) { 217 if (count <= 0) {
218 break; 218 break;
219 } 219 }
220 int aa = *antialias; 220 int aa = *antialias;
221 if (aa) { 221 if (aa) {
222 if (fBlitBW && (aa == 255)) { 222 if (fBlitBW && (aa == 255)) {
223 fBlitBW(&fBState, x, y, fDevice, count); 223 fBlitBW(&fBState, x, y, fDevice, count);
224 } else { 224 } else {
225 fShaderContext->shadeSpan4f(x, y, fState.fBuffer, count); 225 fShaderContext->shadeSpan4f(x, y, fState.fBuffer, count);
226 if (aa == 255) { 226 if (aa == 255) {
227 fState.fProcN(fState.fXfer, device, fState.fBuffer, coun t, nullptr); 227 fState.fProcN(fState.fXfer, device, fState.fBuffer, coun t, nullptr);
228 } else { 228 } else {
229 for (int i = 0; i < count; ++i) { 229 for (int i = 0; i < count; ++i) {
230 fState.fProcN(fState.fXfer, &device[i], &fState.fBuf fer[i], 1, antialias); 230 fState.fProcN(fState.fXfer, &device[i], &fState.fBuf fer[i], 1, antialias);
231 } 231 }
232 } 232 }
233 } 233 }
234 } 234 }
235 device += count; 235 device += count;
236 runs += count; 236 runs += count;
237 antialias += count; 237 antialias += count;
238 x += count; 238 x += count;
239 } 239 }
240 } 240 }
241 241
242 void blitLCDMask(const SkMask& mask, const SkIRect& clip) { 242 void blitLCDMask(const SkMask& mask, const SkIRect& clip) {
243 auto proc = fState.getLCDProc(0); 243 auto proc = fState.getLCDProc(0);
244 244
245 const int x = clip.fLeft; 245 const int x = clip.fLeft;
246 const int width = clip.width(); 246 const int width = clip.width();
247 int y = clip.fTop; 247 int y = clip.fTop;
248 248
249 typename State::DstType* device = State::WritableAddr(fDevice, x, y); 249 typename State::DstType* device = State::WritableAddr(fDevice, x, y);
250 const size_t deviceRB = fDevice.rowBytes(); 250 const size_t deviceRB = fDevice.rowBytes();
251 const uint16_t* maskRow = (const uint16_t*)mask.getAddr(x, y); 251 const uint16_t* maskRow = (const uint16_t*)mask.getAddr(x, y);
252 const size_t maskRB = mask.fRowBytes; 252 const size_t maskRB = mask.fRowBytes;
253 253
254 if (fConstInY) { 254 if (fConstInY) {
255 fShaderContext->shadeSpan4f(x, y, fState.fBuffer, width); 255 fShaderContext->shadeSpan4f(x, y, fState.fBuffer, width);
256 } 256 }
257 for (; y < clip.fBottom; ++y) { 257 for (; y < clip.fBottom; ++y) {
258 if (!fConstInY) { 258 if (!fConstInY) {
259 fShaderContext->shadeSpan4f(x, y, fState.fBuffer, width); 259 fShaderContext->shadeSpan4f(x, y, fState.fBuffer, width);
260 } 260 }
261 proc(device, fState.fBuffer, width, maskRow); 261 proc(device, fState.fBuffer, width, maskRow);
262 device = (typename State::DstType*)((char*)device + deviceRB); 262 device = (typename State::DstType*)((char*)device + deviceRB);
263 maskRow = (const uint16_t*)((const char*)maskRow + maskRB); 263 maskRow = (const uint16_t*)((const char*)maskRow + maskRB);
(...skipping 21 matching lines...) Expand all
285 if (fBlitAA) { 285 if (fBlitAA) {
286 for (; y < clip.fBottom; ++y) { 286 for (; y < clip.fBottom; ++y) {
287 fBlitAA(&fBState, x, y, fDevice, width, maskRow); 287 fBlitAA(&fBState, x, y, fDevice, width, maskRow);
288 maskRow += maskRB; 288 maskRow += maskRB;
289 } 289 }
290 return; 290 return;
291 } 291 }
292 292
293 typename State::DstType* device = State::WritableAddr(fDevice, x, y); 293 typename State::DstType* device = State::WritableAddr(fDevice, x, y);
294 const size_t deviceRB = fDevice.rowBytes(); 294 const size_t deviceRB = fDevice.rowBytes();
295 295
296 if (fConstInY) { 296 if (fConstInY) {
297 fShaderContext->shadeSpan4f(x, y, fState.fBuffer, width); 297 fShaderContext->shadeSpan4f(x, y, fState.fBuffer, width);
298 } 298 }
299 for (; y < clip.fBottom; ++y) { 299 for (; y < clip.fBottom; ++y) {
300 if (!fConstInY) { 300 if (!fConstInY) {
301 fShaderContext->shadeSpan4f(x, y, fState.fBuffer, width); 301 fShaderContext->shadeSpan4f(x, y, fState.fBuffer, width);
302 } 302 }
303 fState.fProcN(fState.fXfer, device, fState.fBuffer, width, maskRow); 303 fState.fProcN(fState.fXfer, device, fState.fBuffer, width, maskRow);
304 device = (typename State::DstType*)((char*)device + deviceRB); 304 device = (typename State::DstType*)((char*)device + deviceRB);
305 maskRow += maskRB; 305 maskRow += maskRB;
306 } 306 }
307 } 307 }
308 308
309 protected: 309 protected:
310 State fState; 310 State fState;
311 SkShader::Context::BlitState fBState; 311 SkShader::Context::BlitState fBState;
312 SkShader::Context::BlitBW fBlitBW; 312 SkShader::Context::BlitBW fBlitBW;
313 SkShader::Context::BlitAA fBlitAA; 313 SkShader::Context::BlitAA fBlitAA;
314 314
315 typedef SkShaderBlitter INHERITED; 315 typedef SkShaderBlitter INHERITED;
316 }; 316 };
317 317
318 //////////////////////////////////////////////////////////////////////////////// /////////////////// 318 //////////////////////////////////////////////////////////////////////////////// ///////////////////
(...skipping 18 matching lines...) Expand all
337 SkXfermode* fXfer; 337 SkXfermode* fXfer;
338 SkPM4f fPM4f; 338 SkPM4f fPM4f;
339 SkAutoTMalloc<SkPM4f> fBuffer; 339 SkAutoTMalloc<SkPM4f> fBuffer;
340 uint32_t fFlags; 340 uint32_t fFlags;
341 341
342 SkShader::Context::BlitState fBState; 342 SkShader::Context::BlitState fBState;
343 }; 343 };
344 344
345 struct State32 : State4f { 345 struct State32 : State4f {
346 typedef uint32_t DstType; 346 typedef uint32_t DstType;
347 347
348 SkXfermode::D32Proc fProc1; 348 SkXfermode::D32Proc fProc1;
349 SkXfermode::D32Proc fProcN; 349 SkXfermode::D32Proc fProcN;
350 350
351 State32(const SkImageInfo& info, const SkPaint& paint, const SkShader::Conte xt* shaderContext) 351 State32(const SkImageInfo& info, const SkPaint& paint, const SkShader::Conte xt* shaderContext)
352 : State4f(info, paint, shaderContext) 352 : State4f(info, paint, shaderContext)
353 { 353 {
354 if (is_opaque(paint, shaderContext)) { 354 if (is_opaque(paint, shaderContext)) {
355 fFlags |= SkXfermode::kSrcIsOpaque_D32Flag; 355 fFlags |= SkXfermode::kSrcIsOpaque_D32Flag;
356 } 356 }
357 if (info.isSRGB()) { 357 if (info.isSRGB()) {
358 fFlags |= SkXfermode::kDstIsSRGB_D32Flag; 358 fFlags |= SkXfermode::kDstIsSRGB_D32Flag;
359 } 359 }
360 fProc1 = SkXfermode::GetD32Proc(fXfer, fFlags | SkXfermode::kSrcIsSingle _D32Flag); 360 fProc1 = SkXfermode::GetD32Proc(fXfer, fFlags | SkXfermode::kSrcIsSingle _D32Flag);
361 fProcN = SkXfermode::GetD32Proc(fXfer, fFlags); 361 fProcN = SkXfermode::GetD32Proc(fXfer, fFlags);
362 } 362 }
363 363
364 SkXfermode::LCD32Proc getLCDProc(uint32_t oneOrManyFlag) const { 364 SkXfermode::LCD32Proc getLCDProc(uint32_t oneOrManyFlag) const {
365 uint32_t flags = fFlags & 1; 365 uint32_t flags = fFlags & 1;
366 if (!(fFlags & SkXfermode::kDstIsSRGB_D32Flag)) { 366 if (!(fFlags & SkXfermode::kDstIsSRGB_D32Flag)) {
367 flags |= SkXfermode::kDstIsLinearInt_LCDFlag; 367 flags |= SkXfermode::kDstIsLinearInt_LCDFlag;
368 } 368 }
369 return SkXfermode::GetLCD32Proc(flags | oneOrManyFlag); 369 return SkXfermode::GetLCD32Proc(flags | oneOrManyFlag);
370 } 370 }
371 371
372 static DstType* WritableAddr(const SkPixmap& device, int x, int y) { 372 static DstType* WritableAddr(const SkPixmap& device, int x, int y) {
373 return device.writable_addr32(x, y); 373 return device.writable_addr32(x, y);
374 } 374 }
375 }; 375 };
376 376
377 struct State64 : State4f { 377 struct State64 : State4f {
378 typedef uint64_t DstType; 378 typedef uint64_t DstType;
379 379
380 SkXfermode::D64Proc fProc1; 380 SkXfermode::D64Proc fProc1;
381 SkXfermode::D64Proc fProcN; 381 SkXfermode::D64Proc fProcN;
382 382
383 State64(const SkImageInfo& info, const SkPaint& paint, const SkShader::Conte xt* shaderContext) 383 State64(const SkImageInfo& info, const SkPaint& paint, const SkShader::Conte xt* shaderContext)
384 : State4f(info, paint, shaderContext) 384 : State4f(info, paint, shaderContext)
385 { 385 {
386 if (is_opaque(paint, shaderContext)) { 386 if (is_opaque(paint, shaderContext)) {
387 fFlags |= SkXfermode::kSrcIsOpaque_D64Flag; 387 fFlags |= SkXfermode::kSrcIsOpaque_D64Flag;
388 } 388 }
389 if (kRGBA_F16_SkColorType == info.colorType()) { 389 if (kRGBA_F16_SkColorType == info.colorType()) {
390 fFlags |= SkXfermode::kDstIsFloat16_D64Flag; 390 fFlags |= SkXfermode::kDstIsFloat16_D64Flag;
391 } 391 }
392 fProc1 = SkXfermode::GetD64Proc(fXfer, fFlags | SkXfermode::kSrcIsSingle _D64Flag); 392 fProc1 = SkXfermode::GetD64Proc(fXfer, fFlags | SkXfermode::kSrcIsSingle _D64Flag);
393 fProcN = SkXfermode::GetD64Proc(fXfer, fFlags); 393 fProcN = SkXfermode::GetD64Proc(fXfer, fFlags);
394 } 394 }
395 395
396 SkXfermode::LCD64Proc getLCDProc(uint32_t oneOrManyFlag) const { 396 SkXfermode::LCD64Proc getLCDProc(uint32_t oneOrManyFlag) const {
397 uint32_t flags = fFlags & 1; 397 uint32_t flags = fFlags & 1;
398 if (!(fFlags & SkXfermode::kDstIsFloat16_D64Flag)) { 398 if (!(fFlags & SkXfermode::kDstIsFloat16_D64Flag)) {
399 flags |= SkXfermode::kDstIsLinearInt_LCDFlag; 399 flags |= SkXfermode::kDstIsLinearInt_LCDFlag;
400 } 400 }
401 return SkXfermode::GetLCD64Proc(flags | oneOrManyFlag); 401 return SkXfermode::GetLCD64Proc(flags | oneOrManyFlag);
402 } 402 }
403 403
404 static DstType* WritableAddr(const SkPixmap& device, int x, int y) { 404 static DstType* WritableAddr(const SkPixmap& device, int x, int y) {
405 return device.writable_addr64(x, y); 405 return device.writable_addr64(x, y);
406 } 406 }
407 }; 407 };
408 408
409 template <typename State> SkBlitter* create(const SkPixmap& device, const SkPain t& paint, 409 template <typename State> SkBlitter* create(const SkPixmap& device, const SkPain t& paint,
410 SkShader::Context* shaderContext, 410 SkShader::Context* shaderContext,
411 SkTBlitterAllocator* allocator) { 411 SkTBlitterAllocator* allocator) {
412 SkASSERT(allocator != nullptr); 412 SkASSERT(allocator != nullptr);
413 413
(...skipping 18 matching lines...) Expand all
432 SkShader::Context* shaderContext, 432 SkShader::Context* shaderContext,
433 SkTBlitterAllocator* allocator) { 433 SkTBlitterAllocator* allocator) {
434 return create<State32>(device, paint, shaderContext, allocator); 434 return create<State32>(device, paint, shaderContext, allocator);
435 } 435 }
436 436
437 SkBlitter* SkBlitter_ARGB64_Create(const SkPixmap& device, const SkPaint& paint, 437 SkBlitter* SkBlitter_ARGB64_Create(const SkPixmap& device, const SkPaint& paint,
438 SkShader::Context* shaderContext, 438 SkShader::Context* shaderContext,
439 SkTBlitterAllocator* allocator) { 439 SkTBlitterAllocator* allocator) {
440 return create<State64>(device, paint, shaderContext, allocator); 440 return create<State64>(device, paint, shaderContext, allocator);
441 } 441 }
OLDNEW
« no previous file with comments | « src/core/SkBlitter_A8.cpp ('k') | src/core/SkBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698