blob: 6397cae8d9a4abcda7a9f18ec0acec1062a3ca37 [file] [log] [blame]
mtklein9a5c47f2016-07-22 11:05:04 -07001/*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
Herb Derbyac04fef2017-01-13 17:34:33 -05008#include "SkArenaAlloc.h"
mtklein9a5c47f2016-07-22 11:05:04 -07009#include "SkBlitter.h"
Mike Kleine902f8d2016-10-26 15:32:26 -040010#include "SkBlendModePriv.h"
mtklein9a5c47f2016-07-22 11:05:04 -070011#include "SkColor.h"
12#include "SkColorFilter.h"
Mike Kleinbaaf8ad2016-09-29 09:04:15 -040013#include "SkOpts.h"
mtklein9a5c47f2016-07-22 11:05:04 -070014#include "SkPM4f.h"
Mike Klein744908e2016-11-11 12:51:36 -050015#include "SkPM4fPriv.h"
mtklein9a5c47f2016-07-22 11:05:04 -070016#include "SkRasterPipeline.h"
17#include "SkShader.h"
Mike Klein14c8f822016-11-30 19:39:43 -050018#include "SkUtils.h"
Mike Klein581e6982017-05-03 13:05:13 -040019#include "../jumper/SkJumper.h"
mtklein9a5c47f2016-07-22 11:05:04 -070020
21class SkRasterPipelineBlitter : public SkBlitter {
22public:
Mike Kleinb35cb312017-05-19 12:01:01 -040023 // Create using paint.getShader() or paint.getColor() if there is no shader.
24 // If there's a shader, we will modulate the shader color by the paint alpha.
25 static SkBlitter* Create(const SkPixmap&, const SkPaint&, SkArenaAlloc*, const SkMatrix& ctm);
mtklein9a5c47f2016-07-22 11:05:04 -070026
Mike Kleinb35cb312017-05-19 12:01:01 -040027 // Create using pre-built shader pipeline.
28 // This pre-built pipeline must already have handled modulating with the paint alpha.
29 static SkBlitter* Create(const SkPixmap&, const SkPaint&, SkArenaAlloc*,
30 const SkRasterPipeline& shaderPipeline,
31 bool is_opaque, bool is_constant, bool wants_dither);
32
33 SkRasterPipelineBlitter(SkPixmap dst, SkBlendMode blend)
mtklein9a5c47f2016-07-22 11:05:04 -070034 : fDst(dst)
Mike Kleine902f8d2016-10-26 15:32:26 -040035 , fBlend(blend)
mtklein9a5c47f2016-07-22 11:05:04 -070036 {}
37
38 void blitH (int x, int y, int w) override;
39 void blitAntiH(int x, int y, const SkAlpha[], const int16_t[]) override;
40 void blitMask (const SkMask&, const SkIRect& clip) override;
41
42 // TODO: The default implementations of the other blits look fine,
43 // but some of them like blitV could probably benefit from custom
44 // blits using something like a SkRasterPipeline::runFew() method.
45
46private:
Mike Klein14c8f822016-11-30 19:39:43 -050047 void append_load_d(SkRasterPipeline*) const;
48 void append_blend (SkRasterPipeline*) const;
49 void maybe_clamp (SkRasterPipeline*) const;
50 void append_store (SkRasterPipeline*) const;
mtklein8e4373f2016-07-22 14:20:27 -070051
mtklein9a5c47f2016-07-22 11:05:04 -070052 SkPixmap fDst;
Mike Kleine902f8d2016-10-26 15:32:26 -040053 SkBlendMode fBlend;
Mike Kleinb35cb312017-05-19 12:01:01 -040054 SkRasterPipeline fColorPipeline;
mtklein9a5c47f2016-07-22 11:05:04 -070055
Mike Klein8729e5b2017-02-16 06:51:48 -050056 // We may be able to specialize blitH() into a memset.
57 bool fCanMemsetInBlitH = false;
58 uint64_t fMemsetColor = 0; // Big enough for largest dst format, F16.
Mike Kleinbd3fe472016-10-25 15:43:46 -040059
Mike Klein8729e5b2017-02-16 06:51:48 -050060 // Built lazily on first use.
61 SkRasterPipeline fBlitH,
62 fBlitAntiH,
63 fBlitMaskA8,
64 fBlitMaskLCD16;
65
66 // These values are pointed to by the blit pipelines above,
67 // which allows us to adjust them from call to call.
Mike Kleindb711c92017-05-03 17:57:48 -040068 void* fDstPtr = nullptr;
69 const void* fMaskPtr = nullptr;
70 float fCurrentCoverage = 0.0f;
71 int fCurrentY = 0;
72 SkJumper_DitherCtx fDitherCtx = { &fCurrentY, 0.0f };
Mike Kleinbd3fe472016-10-25 15:43:46 -040073
mtklein9a5c47f2016-07-22 11:05:04 -070074 typedef SkBlitter INHERITED;
75};
76
77SkBlitter* SkCreateRasterPipelineBlitter(const SkPixmap& dst,
78 const SkPaint& paint,
Mike Kleinfb191da2016-11-15 13:20:33 -050079 const SkMatrix& ctm,
Matt Sarett25834ff2017-02-15 15:54:35 -050080 SkArenaAlloc* alloc) {
Mike Kleinb35cb312017-05-19 12:01:01 -040081 return SkRasterPipelineBlitter::Create(dst, paint, alloc, ctm);
Mike Reed02640952017-05-19 15:32:13 -040082}
83
84SkBlitter* SkCreateRasterPipelineBlitter(const SkPixmap& dst,
85 const SkPaint& paint,
Mike Reed02640952017-05-19 15:32:13 -040086 const SkRasterPipeline& shaderPipeline,
Mike Kleinb35cb312017-05-19 12:01:01 -040087 bool is_opaque,
88 bool wants_dither,
Mike Reed02640952017-05-19 15:32:13 -040089 SkArenaAlloc* alloc) {
Mike Kleinb35cb312017-05-19 12:01:01 -040090 bool is_constant = false; // If this were the case, it'd be better to just set a paint color.
91 return SkRasterPipelineBlitter::Create(dst, paint, alloc,
92 shaderPipeline, is_opaque, is_constant, wants_dither);
Mike Reed02640952017-05-19 15:32:13 -040093}
94
95SkBlitter* SkRasterPipelineBlitter::Create(const SkPixmap& dst,
96 const SkPaint& paint,
Mike Kleinb35cb312017-05-19 12:01:01 -040097 SkArenaAlloc* alloc,
98 const SkMatrix& ctm) {
99 auto paintColor = alloc->make<SkPM4f>(SkPM4f_from_SkColor(paint.getColor(),
100 dst.colorSpace()));
101 if (auto shader = paint.getShader()) {
102 SkRasterPipeline shaderPipeline;
103 if (!shader->appendStages(&shaderPipeline, dst.colorSpace(), alloc, ctm, paint)) {
104 // When a shader fails to append stages, it means it has vetoed drawing entirely.
105 return alloc->make<SkNullBlitter>();
106 }
Mike Reed02640952017-05-19 15:32:13 -0400107
Mike Kleinb35cb312017-05-19 12:01:01 -0400108 bool is_opaque = shader->isOpaque();
109 if (paintColor->a() != 1.0f) {
110 shaderPipeline.append(SkRasterPipeline::scale_1_float, &paintColor->fVec[SkPM4f::A]);
111 is_opaque = false;
112 }
Mike Reed02640952017-05-19 15:32:13 -0400113
Mike Kleinb35cb312017-05-19 12:01:01 -0400114 bool is_constant = shader->isConstant();
115 bool wants_dither = shader->asAGradient(nullptr) >= SkShader::kLinear_GradientType;
116 return Create(dst, paint, alloc, shaderPipeline, is_opaque, is_constant, wants_dither);
Mike Reed02640952017-05-19 15:32:13 -0400117 }
118
Mike Kleinb35cb312017-05-19 12:01:01 -0400119 SkRasterPipeline shaderPipeline;
120 shaderPipeline.append(SkRasterPipeline::constant_color, paintColor);
121 bool is_opaque = paintColor->a() == 1.0f,
122 is_constant = true,
123 wants_dither = false;
124 return Create(dst, paint, alloc, shaderPipeline, is_opaque, is_constant, wants_dither);
Mike Reed02640952017-05-19 15:32:13 -0400125}
126
Mike Kleinb35cb312017-05-19 12:01:01 -0400127SkBlitter* SkRasterPipelineBlitter::Create(const SkPixmap& dst,
128 const SkPaint& paint,
129 SkArenaAlloc* alloc,
130 const SkRasterPipeline& shaderPipeline,
131 bool is_opaque,
132 bool is_constant,
133 bool wants_dither) {
134 auto blitter = alloc->make<SkRasterPipelineBlitter>(dst, paint.getBlendMode());
Mike Reed02640952017-05-19 15:32:13 -0400135
Mike Kleinb35cb312017-05-19 12:01:01 -0400136 // Our job in this factory is to fill out the blitter's color pipeline.
137 // This is the common front of the full blit pipelines, each constructed lazily on first use.
138 // The full blit pipelines handle reading and writing the dst, blending, coverage, dithering.
139 auto colorPipeline = &blitter->fColorPipeline;
140
141 // Let's get the shader in first. If the shader's not constant, it'll need seeding with x,y.
142 if (!is_constant) {
143 colorPipeline->append(SkRasterPipeline::seed_shader, &blitter->fCurrentY);
Mike Reed02640952017-05-19 15:32:13 -0400144 }
Mike Kleinb35cb312017-05-19 12:01:01 -0400145 colorPipeline->extend(shaderPipeline);
Mike Reed02640952017-05-19 15:32:13 -0400146
Mike Kleinb35cb312017-05-19 12:01:01 -0400147 // If there's a color filter it comes next.
148 if (auto colorFilter = paint.getColorFilter()) {
149 colorFilter->appendStages(colorPipeline, dst.colorSpace(), alloc, is_opaque);
mtkleina4a44882016-11-04 13:20:07 -0700150 is_opaque = is_opaque && (colorFilter->getFlags() & SkColorFilter::kAlphaUnchanged_Flag);
mtklein9a5c47f2016-07-22 11:05:04 -0700151 }
152
Mike Kleinb35cb312017-05-19 12:01:01 -0400153 // We'll dither if the shader wants to, or if we're drawing 565 and the paint wants to.
154 // Not all formats make sense to dither (think, F16). We set their dither rate to zero.
155 // We need to decide if we're going to dither now to keep is_constant accurate.
156 if (wants_dither ||
157 (paint.isDither() && dst.info().colorType() == kRGB_565_SkColorType)) {
158 switch (dst.info().colorType()) {
159 default: blitter->fDitherCtx.rate = 0.0f; break;
160 case kRGB_565_SkColorType: blitter->fDitherCtx.rate = 1/63.0f; break;
161 case kRGBA_8888_SkColorType:
162 case kBGRA_8888_SkColorType: blitter->fDitherCtx.rate = 1/255.0f; break;
163 }
164 }
165 is_constant = is_constant && (blitter->fDitherCtx.rate == 0.0f);
166
167 // We're logically done here. The code between here and return blitter is all optimization.
168
169 // A pipeline that's still constant here can collapse back into a constant color.
Mike Klein14c8f822016-11-30 19:39:43 -0500170 if (is_constant) {
Mike Kleinb35cb312017-05-19 12:01:01 -0400171 auto constantColor = alloc->make<SkPM4f>();
172 colorPipeline->append(SkRasterPipeline::store_f32, &constantColor);
173 colorPipeline->run(0,1);
174 *colorPipeline = SkRasterPipeline();
175 colorPipeline->append(SkRasterPipeline::constant_color, constantColor);
mtkleina4a44882016-11-04 13:20:07 -0700176
Mike Kleinb35cb312017-05-19 12:01:01 -0400177 is_opaque = constantColor->a() == 1.0f;
Mike Klein66866172016-11-03 12:22:01 -0400178 }
mtklein8e4373f2016-07-22 14:20:27 -0700179
Mike Kleinb35cb312017-05-19 12:01:01 -0400180 // We can strength-reduce SrcOver into Src when opaque.
181 if (is_opaque && blitter->fBlend == SkBlendMode::kSrcOver) {
182 blitter->fBlend = SkBlendMode::kSrc;
mtklein8e4373f2016-07-22 14:20:27 -0700183 }
184
Mike Kleinb35cb312017-05-19 12:01:01 -0400185 // When we're drawing a constant color in Src mode, we can sometimes just memset.
186 // (The previous two optimizations help find more opportunities for this one.)
187 if (is_constant && blitter->fBlend == SkBlendMode::kSrc) {
188 // Run our color pipeline all the way through to produce what we'd memset when we can.
189 // Not all blits can memset, so we need to keep colorPipeline too.
Mike Klein14c8f822016-11-30 19:39:43 -0500190 SkRasterPipeline p;
Mike Kleinb35cb312017-05-19 12:01:01 -0400191 p.extend(*colorPipeline);
192 blitter->fDstPtr = &blitter->fMemsetColor;
193 blitter->append_store(&p);
Mike Klein319ba3d2017-01-20 15:11:54 -0500194 p.run(0,1);
Mike Klein14c8f822016-11-30 19:39:43 -0500195
Mike Kleinb35cb312017-05-19 12:01:01 -0400196 blitter->fCanMemsetInBlitH = true;
Mike Klein14c8f822016-11-30 19:39:43 -0500197 }
Mike Kleinb35cb312017-05-19 12:01:01 -0400198
199 return blitter;
mtklein9a5c47f2016-07-22 11:05:04 -0700200}
201
Mike Kleine902f8d2016-10-26 15:32:26 -0400202void SkRasterPipelineBlitter::append_load_d(SkRasterPipeline* p) const {
Mike Klein8c8cb5b2017-01-06 10:21:56 -0500203 p->append(SkRasterPipeline::move_src_dst);
mtklein8e4373f2016-07-22 14:20:27 -0700204 switch (fDst.info().colorType()) {
Mike Kleine71b1672017-01-13 07:59:23 -0500205 case kAlpha_8_SkColorType: p->append(SkRasterPipeline::load_a8, &fDstPtr); break;
Mike Klein8c8cb5b2017-01-06 10:21:56 -0500206 case kRGB_565_SkColorType: p->append(SkRasterPipeline::load_565, &fDstPtr); break;
Mike Kleine03339a2016-11-28 13:24:27 -0500207 case kBGRA_8888_SkColorType:
Mike Klein8c8cb5b2017-01-06 10:21:56 -0500208 case kRGBA_8888_SkColorType: p->append(SkRasterPipeline::load_8888, &fDstPtr); break;
209 case kRGBA_F16_SkColorType: p->append(SkRasterPipeline::load_f16, &fDstPtr); break;
mtklein8e4373f2016-07-22 14:20:27 -0700210 default: break;
211 }
Mike Kleine03339a2016-11-28 13:24:27 -0500212 if (fDst.info().colorType() == kBGRA_8888_SkColorType) {
Mike Klein8c8cb5b2017-01-06 10:21:56 -0500213 p->append(SkRasterPipeline::swap_rb);
Mike Kleine03339a2016-11-28 13:24:27 -0500214 }
215 if (fDst.info().gammaCloseToSRGB()) {
Mike Klein8c8cb5b2017-01-06 10:21:56 -0500216 p->append_from_srgb(fDst.info().alphaType());
Mike Kleine03339a2016-11-28 13:24:27 -0500217 }
Mike Klein8c8cb5b2017-01-06 10:21:56 -0500218 p->append(SkRasterPipeline::swap);
mtklein8e4373f2016-07-22 14:20:27 -0700219}
220
Mike Klein14c8f822016-11-30 19:39:43 -0500221void SkRasterPipelineBlitter::append_store(SkRasterPipeline* p) const {
Matt Sarettf3880932017-03-24 10:06:03 -0400222 if (fDst.info().gammaCloseToSRGB()) {
Mike Kleine03339a2016-11-28 13:24:27 -0500223 p->append(SkRasterPipeline::to_srgb);
224 }
Mike Kleindb711c92017-05-03 17:57:48 -0400225 if (fDitherCtx.rate > 0.0f) {
226 // We dither after any sRGB transfer function to make sure our 1/255.0f is sensible
227 // over the whole range. If we did it before, 1/255.0f is too big a rate near zero.
228 p->append(SkRasterPipeline::dither, &fDitherCtx);
229 }
230
Mike Kleine03339a2016-11-28 13:24:27 -0500231 if (fDst.info().colorType() == kBGRA_8888_SkColorType) {
232 p->append(SkRasterPipeline::swap_rb);
233 }
mtklein8e4373f2016-07-22 14:20:27 -0700234 switch (fDst.info().colorType()) {
Mike Kleine71b1672017-01-13 07:59:23 -0500235 case kAlpha_8_SkColorType: p->append(SkRasterPipeline::store_a8, &fDstPtr); break;
Mike Kleine03339a2016-11-28 13:24:27 -0500236 case kRGB_565_SkColorType: p->append(SkRasterPipeline::store_565, &fDstPtr); break;
237 case kBGRA_8888_SkColorType:
238 case kRGBA_8888_SkColorType: p->append(SkRasterPipeline::store_8888, &fDstPtr); break;
239 case kRGBA_F16_SkColorType: p->append(SkRasterPipeline::store_f16, &fDstPtr); break;
mtklein8e4373f2016-07-22 14:20:27 -0700240 default: break;
241 }
242}
243
Mike Kleine902f8d2016-10-26 15:32:26 -0400244void SkRasterPipelineBlitter::append_blend(SkRasterPipeline* p) const {
Mike Kleinbb338332017-05-04 12:42:52 -0400245 SkBlendMode_AppendStages(fBlend, p);
Mike Kleine902f8d2016-10-26 15:32:26 -0400246}
Mike Kleine9f74b82016-10-25 13:31:21 -0400247
Mike Klein130863e2016-10-27 11:29:36 -0400248void SkRasterPipelineBlitter::maybe_clamp(SkRasterPipeline* p) const {
Mike Kleine03339a2016-11-28 13:24:27 -0500249 if (SkBlendMode_CanOverflow(fBlend)) {
250 p->append(SkRasterPipeline::clamp_a);
251 }
Mike Klein130863e2016-10-27 11:29:36 -0400252}
253
mtklein9a5c47f2016-07-22 11:05:04 -0700254void SkRasterPipelineBlitter::blitH(int x, int y, int w) {
Mike Klein8729e5b2017-02-16 06:51:48 -0500255 fDstPtr = fDst.writable_addr(0,y);
256 fCurrentY = y;
257
258 if (fCanMemsetInBlitH) {
259 switch (fDst.shiftPerPixel()) {
Mike Klein86125482017-02-17 16:10:46 +0000260 case 0: memset ((uint8_t *)fDstPtr + x, fMemsetColor, w); return;
261 case 1: sk_memset16((uint16_t*)fDstPtr + x, fMemsetColor, w); return;
262 case 2: sk_memset32((uint32_t*)fDstPtr + x, fMemsetColor, w); return;
263 case 3: sk_memset64((uint64_t*)fDstPtr + x, fMemsetColor, w); return;
Mike Klein8729e5b2017-02-16 06:51:48 -0500264 default: break;
265 }
266 }
267
268 auto& p = fBlitH;
269 if (p.empty()) {
Mike Kleinb35cb312017-05-19 12:01:01 -0400270 p.extend(fColorPipeline);
Mike Klein66866172016-11-03 12:22:01 -0400271 if (fBlend != SkBlendMode::kSrc) {
272 this->append_load_d(&p);
273 this->append_blend(&p);
274 this->maybe_clamp(&p);
275 }
Mike Kleine902f8d2016-10-26 15:32:26 -0400276 this->append_store(&p);
Mike Kleinbd3fe472016-10-25 15:43:46 -0400277 }
Mike Klein8729e5b2017-02-16 06:51:48 -0500278 p.run(x,w);
mtklein9a5c47f2016-07-22 11:05:04 -0700279}
280
281void SkRasterPipelineBlitter::blitAntiH(int x, int y, const SkAlpha aa[], const int16_t runs[]) {
Mike Klein8729e5b2017-02-16 06:51:48 -0500282 auto& p = fBlitAntiH;
283 if (p.empty()) {
Mike Kleinb35cb312017-05-19 12:01:01 -0400284 p.extend(fColorPipeline);
Mike Klein66866172016-11-03 12:22:01 -0400285 if (fBlend == SkBlendMode::kSrcOver) {
Mike Kleinbabd93e2016-11-30 16:05:10 -0500286 p.append(SkRasterPipeline::scale_1_float, &fCurrentCoverage);
Mike Klein66866172016-11-03 12:22:01 -0400287 this->append_load_d(&p);
288 this->append_blend(&p);
289 } else {
290 this->append_load_d(&p);
291 this->append_blend(&p);
Mike Kleinbabd93e2016-11-30 16:05:10 -0500292 p.append(SkRasterPipeline::lerp_1_float, &fCurrentCoverage);
Mike Klein66866172016-11-03 12:22:01 -0400293 }
Mike Klein130863e2016-10-27 11:29:36 -0400294 this->maybe_clamp(&p);
Mike Kleine902f8d2016-10-26 15:32:26 -0400295 this->append_store(&p);
Mike Kleinbd3fe472016-10-25 15:43:46 -0400296 }
mtklein9a5c47f2016-07-22 11:05:04 -0700297
Mike Kleinbd3fe472016-10-25 15:43:46 -0400298 fDstPtr = fDst.writable_addr(0,y);
Mike Klein319ba3d2017-01-20 15:11:54 -0500299 fCurrentY = y;
mtklein9a5c47f2016-07-22 11:05:04 -0700300 for (int16_t run = *runs; run > 0; run = *runs) {
Mike Kleinaeb79592016-11-07 09:29:07 -0500301 switch (*aa) {
302 case 0x00: break;
303 case 0xff: this->blitH(x,y,run); break;
304 default:
Mike Kleinbabd93e2016-11-30 16:05:10 -0500305 fCurrentCoverage = *aa * (1/255.0f);
Mike Klein8729e5b2017-02-16 06:51:48 -0500306 p.run(x,run);
Mike Kleinaeb79592016-11-07 09:29:07 -0500307 }
mtklein9a5c47f2016-07-22 11:05:04 -0700308 x += run;
309 runs += run;
310 aa += run;
311 }
312}
313
314void SkRasterPipelineBlitter::blitMask(const SkMask& mask, const SkIRect& clip) {
315 if (mask.fFormat == SkMask::kBW_Format) {
316 // TODO: native BW masks?
317 return INHERITED::blitMask(mask, clip);
318 }
319
Mike Klein8729e5b2017-02-16 06:51:48 -0500320 if (mask.fFormat == SkMask::kA8_Format && fBlitMaskA8.empty()) {
321 auto& p = fBlitMaskA8;
Mike Kleinb35cb312017-05-19 12:01:01 -0400322 p.extend(fColorPipeline);
Mike Klein66866172016-11-03 12:22:01 -0400323 if (fBlend == SkBlendMode::kSrcOver) {
324 p.append(SkRasterPipeline::scale_u8, &fMaskPtr);
325 this->append_load_d(&p);
326 this->append_blend(&p);
327 } else {
328 this->append_load_d(&p);
329 this->append_blend(&p);
330 p.append(SkRasterPipeline::lerp_u8, &fMaskPtr);
331 }
Mike Klein130863e2016-10-27 11:29:36 -0400332 this->maybe_clamp(&p);
Mike Kleine902f8d2016-10-26 15:32:26 -0400333 this->append_store(&p);
Mike Kleinbd3fe472016-10-25 15:43:46 -0400334 }
335
Mike Klein8729e5b2017-02-16 06:51:48 -0500336 if (mask.fFormat == SkMask::kLCD16_Format && fBlitMaskLCD16.empty()) {
337 auto& p = fBlitMaskLCD16;
Mike Kleinb35cb312017-05-19 12:01:01 -0400338 p.extend(fColorPipeline);
Mike Kleine902f8d2016-10-26 15:32:26 -0400339 this->append_load_d(&p);
340 this->append_blend(&p);
Mike Kleinbd3fe472016-10-25 15:43:46 -0400341 p.append(SkRasterPipeline::lerp_565, &fMaskPtr);
Mike Klein130863e2016-10-27 11:29:36 -0400342 this->maybe_clamp(&p);
Mike Kleine902f8d2016-10-26 15:32:26 -0400343 this->append_store(&p);
Mike Kleinbd3fe472016-10-25 15:43:46 -0400344 }
345
346 int x = clip.left();
347 for (int y = clip.top(); y < clip.bottom(); y++) {
348 fDstPtr = fDst.writable_addr(0,y);
Mike Klein319ba3d2017-01-20 15:11:54 -0500349 fCurrentY = y;
Mike Kleinbd3fe472016-10-25 15:43:46 -0400350
mtklein9a5c47f2016-07-22 11:05:04 -0700351 switch (mask.fFormat) {
352 case SkMask::kA8_Format:
Mike Kleinbd3fe472016-10-25 15:43:46 -0400353 fMaskPtr = mask.getAddr8(x,y)-x;
Mike Klein8729e5b2017-02-16 06:51:48 -0500354 fBlitMaskA8.run(x,clip.width());
mtklein9a5c47f2016-07-22 11:05:04 -0700355 break;
356 case SkMask::kLCD16_Format:
Mike Kleinbd3fe472016-10-25 15:43:46 -0400357 fMaskPtr = mask.getAddrLCD16(x,y)-x;
Mike Klein8729e5b2017-02-16 06:51:48 -0500358 fBlitMaskLCD16.run(x,clip.width());
mtklein9a5c47f2016-07-22 11:05:04 -0700359 break;
Mike Kleinbd3fe472016-10-25 15:43:46 -0400360 default:
361 // TODO
362 break;
mtklein9a5c47f2016-07-22 11:05:04 -0700363 }
mtklein9a5c47f2016-07-22 11:05:04 -0700364 }
365}