blob: b62b43f1ce198d4c17e3a4da3c2718262ac80335 [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 Kleinfb191da2016-11-15 13:20:33 -050023 static SkBlitter* Create(const SkPixmap&, const SkPaint&, const SkMatrix& ctm,
Matt Sarett25834ff2017-02-15 15:54:35 -050024 SkArenaAlloc*);
Mike Reed02640952017-05-19 15:32:13 -040025 static SkBlitter* Create(const SkPixmap&, const SkPaint&, const SkMatrix& ctm,
26 const SkRasterPipeline& shaderPipeline,
27 bool is_opaque, bool wants_dither,
28 SkArenaAlloc*);
mtklein9a5c47f2016-07-22 11:05:04 -070029
Matt Sarettf3880932017-03-24 10:06:03 -040030 SkRasterPipelineBlitter(SkPixmap dst, SkBlendMode blend, SkPM4f paintColor)
mtklein9a5c47f2016-07-22 11:05:04 -070031 : fDst(dst)
Mike Kleine902f8d2016-10-26 15:32:26 -040032 , fBlend(blend)
mtklein9a5c47f2016-07-22 11:05:04 -070033 , fPaintColor(paintColor)
34 {}
35
36 void blitH (int x, int y, int w) override;
37 void blitAntiH(int x, int y, const SkAlpha[], const int16_t[]) override;
38 void blitMask (const SkMask&, const SkIRect& clip) override;
39
40 // TODO: The default implementations of the other blits look fine,
41 // but some of them like blitV could probably benefit from custom
42 // blits using something like a SkRasterPipeline::runFew() method.
43
44private:
Mike Reed02640952017-05-19 15:32:13 -040045 void finishBuilding(const SkPaint& paint, const SkMatrix& ctm, bool is_oapque,
46 bool is_constant, bool wants_dither, SkArenaAlloc* alloc);
47
Mike Klein14c8f822016-11-30 19:39:43 -050048 void append_load_d(SkRasterPipeline*) const;
49 void append_blend (SkRasterPipeline*) const;
50 void maybe_clamp (SkRasterPipeline*) const;
51 void append_store (SkRasterPipeline*) const;
mtklein8e4373f2016-07-22 14:20:27 -070052
mtklein9a5c47f2016-07-22 11:05:04 -070053 SkPixmap fDst;
Mike Kleine902f8d2016-10-26 15:32:26 -040054 SkBlendMode fBlend;
mtklein9a5c47f2016-07-22 11:05:04 -070055 SkPM4f fPaintColor;
mtkleina4a44882016-11-04 13:20:07 -070056 SkRasterPipeline fShader;
mtklein9a5c47f2016-07-22 11:05:04 -070057
Mike Klein8729e5b2017-02-16 06:51:48 -050058 // We may be able to specialize blitH() into a memset.
59 bool fCanMemsetInBlitH = false;
60 uint64_t fMemsetColor = 0; // Big enough for largest dst format, F16.
Mike Kleinbd3fe472016-10-25 15:43:46 -040061
Mike Klein8729e5b2017-02-16 06:51:48 -050062 // Built lazily on first use.
63 SkRasterPipeline fBlitH,
64 fBlitAntiH,
65 fBlitMaskA8,
66 fBlitMaskLCD16;
67
68 // These values are pointed to by the blit pipelines above,
69 // which allows us to adjust them from call to call.
Mike Kleindb711c92017-05-03 17:57:48 -040070 void* fDstPtr = nullptr;
71 const void* fMaskPtr = nullptr;
72 float fCurrentCoverage = 0.0f;
73 int fCurrentY = 0;
74 SkJumper_DitherCtx fDitherCtx = { &fCurrentY, 0.0f };
Mike Kleinbd3fe472016-10-25 15:43:46 -040075
mtklein9a5c47f2016-07-22 11:05:04 -070076 typedef SkBlitter INHERITED;
77};
78
79SkBlitter* SkCreateRasterPipelineBlitter(const SkPixmap& dst,
80 const SkPaint& paint,
Mike Kleinfb191da2016-11-15 13:20:33 -050081 const SkMatrix& ctm,
Matt Sarett25834ff2017-02-15 15:54:35 -050082 SkArenaAlloc* alloc) {
83 return SkRasterPipelineBlitter::Create(dst, paint, ctm, alloc);
mtklein9a5c47f2016-07-22 11:05:04 -070084}
85
mtklein9a5c47f2016-07-22 11:05:04 -070086SkBlitter* SkRasterPipelineBlitter::Create(const SkPixmap& dst,
87 const SkPaint& paint,
Mike Kleinfb191da2016-11-15 13:20:33 -050088 const SkMatrix& ctm,
Matt Sarett25834ff2017-02-15 15:54:35 -050089 SkArenaAlloc* alloc) {
Herb Derby83e939b2017-02-07 14:25:11 -050090 auto blitter = alloc->make<SkRasterPipelineBlitter>(
Mike Klein744908e2016-11-11 12:51:36 -050091 dst,
92 paint.getBlendMode(),
Matt Sarettf3880932017-03-24 10:06:03 -040093 SkPM4f_from_SkColor(paint.getColor(), dst.colorSpace()));
Mike Klein744908e2016-11-11 12:51:36 -050094
Mike Klein21aa3d02016-11-30 16:40:56 -050095 SkPM4f* paintColor = &blitter->fPaintColor;
96 SkRasterPipeline* pipeline = &blitter->fShader;
Mike Reed02640952017-05-19 15:32:13 -040097 SkShader* shader = paint.getShader();
mtkleina4a44882016-11-04 13:20:07 -070098
Mike Reed02640952017-05-19 15:32:13 -040099 bool is_opaque = paintColor->a() == 1.0f,
100 is_constant = true,
101 wants_dither = false;
mtkleina4a44882016-11-04 13:20:07 -0700102
mtkleina4a44882016-11-04 13:20:07 -0700103 if (shader) {
Mike Klein319ba3d2017-01-20 15:11:54 -0500104 pipeline->append(SkRasterPipeline::seed_shader, &blitter->fCurrentY);
Mike Klein3a846152017-02-07 12:05:10 -0500105 if (!shader->appendStages(pipeline, dst.colorSpace(), alloc, ctm, paint)) {
Mike Klein44d32792017-05-10 12:29:38 -0400106 // When a shader fails to append stages, it means it has vetoed drawing entirely.
107 return alloc->make<SkNullBlitter>();
Mike Kleinb0d10e02016-11-12 10:29:26 -0500108 }
Mike Kleinfb191da2016-11-15 13:20:33 -0500109
Mike Reed02640952017-05-19 15:32:13 -0400110 if (!is_opaque) {
111 pipeline->append(SkRasterPipeline::scale_1_float, &paintColor->fVec[SkPM4f::A]);
112 }
113 is_opaque = is_opaque && shader->isOpaque();
114 is_constant = shader->isConstant();
115 wants_dither = shader->asAGradient(nullptr) >= SkShader::kLinear_GradientType;
116
Mike Klein43c847b2016-11-21 13:05:23 -0500117 } else {
118 pipeline->append(SkRasterPipeline::constant_color, paintColor);
Mike Kleine902f8d2016-10-26 15:32:26 -0400119 }
mtklein9a5c47f2016-07-22 11:05:04 -0700120
Mike Reed02640952017-05-19 15:32:13 -0400121 blitter->finishBuilding(paint, ctm, is_opaque, is_constant, wants_dither, alloc);
122 return blitter;
123}
124
125SkBlitter* SkCreateRasterPipelineBlitter(const SkPixmap& dst,
126 const SkPaint& paint,
127 const SkMatrix& ctm,
128 const SkRasterPipeline& shaderPipeline,
129 bool is_opaque, bool wants_dither,
130 SkArenaAlloc* alloc) {
131 return SkRasterPipelineBlitter::Create(dst, paint, ctm, shaderPipeline,
132 is_opaque, wants_dither, alloc);
133}
134
135SkBlitter* SkRasterPipelineBlitter::Create(const SkPixmap& dst,
136 const SkPaint& paint,
137 const SkMatrix& ctm,
138 const SkRasterPipeline& shaderPipeline,
139 bool is_opaque, bool wants_dither,
140 SkArenaAlloc* alloc) {
141 auto blitter = alloc->make<SkRasterPipelineBlitter>(
142 dst,
143 paint.getBlendMode(),
144 SkPM4f_from_SkColor(paint.getColor(), dst.colorSpace()));
145
146 bool is_constant = false; // we figure a custom shaderPipeline is never constant
147 SkPM4f* paintColor = &blitter->fPaintColor;
148 SkRasterPipeline* pipeline = &blitter->fShader;
149
150 pipeline->append(SkRasterPipeline::seed_shader, &blitter->fCurrentY);
151 pipeline->extend(shaderPipeline);
152
153 if (paintColor->a() != 1.0f) {
154 pipeline->append(SkRasterPipeline::scale_1_float, &paintColor->fVec[SkPM4f::A]);
155 is_opaque = false;
156 }
157
158 blitter->finishBuilding(paint, ctm, is_opaque, is_constant, wants_dither, alloc);
159 return blitter;
160}
161
162void SkRasterPipelineBlitter::finishBuilding(const SkPaint& paint, const SkMatrix& ctm,
163 bool is_opaque, bool is_constant, bool wants_dither,
164 SkArenaAlloc* alloc) {
165 SkBlendMode* blend = &fBlend;
166 SkPM4f* paintColor = &fPaintColor;
167 SkRasterPipeline* pipeline = &fShader;
168 SkColorFilter* colorFilter = paint.getColorFilter();
169
170 SkASSERT(fDitherCtx.rate == 0);
171 if ((paint.isDither() && fDst.info().colorType() == kRGB_565_SkColorType) || wants_dither) {
172 switch (fDst.info().colorType()) {
173 case kRGB_565_SkColorType:
174 fDitherCtx.rate = 1/63.0f;
175 is_constant = false;
176 break;
177 case kRGBA_8888_SkColorType:
178 case kBGRA_8888_SkColorType:
179 fDitherCtx.rate = 1/255.0f;
180 is_constant = false;
181 break;
182 default:
183 break;
184 }
185 }
186
mtkleina4a44882016-11-04 13:20:07 -0700187 if (colorFilter) {
Mike Reed02640952017-05-19 15:32:13 -0400188 colorFilter->appendStages(pipeline, fDst.colorSpace(), alloc, is_opaque);
mtkleina4a44882016-11-04 13:20:07 -0700189 is_opaque = is_opaque && (colorFilter->getFlags() & SkColorFilter::kAlphaUnchanged_Flag);
mtklein9a5c47f2016-07-22 11:05:04 -0700190 }
191
Mike Klein14c8f822016-11-30 19:39:43 -0500192 if (is_constant) {
mtkleina4a44882016-11-04 13:20:07 -0700193 pipeline->append(SkRasterPipeline::store_f32, &paintColor);
Mike Klein319ba3d2017-01-20 15:11:54 -0500194 pipeline->run(0,1);
mtkleina4a44882016-11-04 13:20:07 -0700195
196 *pipeline = SkRasterPipeline();
197 pipeline->append(SkRasterPipeline::constant_color, paintColor);
198
199 is_opaque = paintColor->a() == 1.0f;
Mike Klein66866172016-11-03 12:22:01 -0400200 }
mtklein8e4373f2016-07-22 14:20:27 -0700201
mtkleina4a44882016-11-04 13:20:07 -0700202 if (is_opaque && *blend == SkBlendMode::kSrcOver) {
203 *blend = SkBlendMode::kSrc;
mtklein8e4373f2016-07-22 14:20:27 -0700204 }
205
Mike Klein14c8f822016-11-30 19:39:43 -0500206 if (is_constant && *blend == SkBlendMode::kSrc) {
Mike Klein14c8f822016-11-30 19:39:43 -0500207 SkRasterPipeline p;
208 p.extend(*pipeline);
Mike Reed02640952017-05-19 15:32:13 -0400209 fDstPtr = &fMemsetColor;
210 this->append_store(&p);
Mike Klein319ba3d2017-01-20 15:11:54 -0500211 p.run(0,1);
Mike Klein14c8f822016-11-30 19:39:43 -0500212
Mike Reed02640952017-05-19 15:32:13 -0400213 fCanMemsetInBlitH = true;
Mike Klein14c8f822016-11-30 19:39:43 -0500214 }
mtklein9a5c47f2016-07-22 11:05:04 -0700215}
216
Mike Kleine902f8d2016-10-26 15:32:26 -0400217void SkRasterPipelineBlitter::append_load_d(SkRasterPipeline* p) const {
Mike Klein8c8cb5b2017-01-06 10:21:56 -0500218 p->append(SkRasterPipeline::move_src_dst);
mtklein8e4373f2016-07-22 14:20:27 -0700219 switch (fDst.info().colorType()) {
Mike Kleine71b1672017-01-13 07:59:23 -0500220 case kAlpha_8_SkColorType: p->append(SkRasterPipeline::load_a8, &fDstPtr); break;
Mike Klein8c8cb5b2017-01-06 10:21:56 -0500221 case kRGB_565_SkColorType: p->append(SkRasterPipeline::load_565, &fDstPtr); break;
Mike Kleine03339a2016-11-28 13:24:27 -0500222 case kBGRA_8888_SkColorType:
Mike Klein8c8cb5b2017-01-06 10:21:56 -0500223 case kRGBA_8888_SkColorType: p->append(SkRasterPipeline::load_8888, &fDstPtr); break;
224 case kRGBA_F16_SkColorType: p->append(SkRasterPipeline::load_f16, &fDstPtr); break;
mtklein8e4373f2016-07-22 14:20:27 -0700225 default: break;
226 }
Mike Kleine03339a2016-11-28 13:24:27 -0500227 if (fDst.info().colorType() == kBGRA_8888_SkColorType) {
Mike Klein8c8cb5b2017-01-06 10:21:56 -0500228 p->append(SkRasterPipeline::swap_rb);
Mike Kleine03339a2016-11-28 13:24:27 -0500229 }
230 if (fDst.info().gammaCloseToSRGB()) {
Mike Klein8c8cb5b2017-01-06 10:21:56 -0500231 p->append_from_srgb(fDst.info().alphaType());
Mike Kleine03339a2016-11-28 13:24:27 -0500232 }
Mike Klein8c8cb5b2017-01-06 10:21:56 -0500233 p->append(SkRasterPipeline::swap);
mtklein8e4373f2016-07-22 14:20:27 -0700234}
235
Mike Klein14c8f822016-11-30 19:39:43 -0500236void SkRasterPipelineBlitter::append_store(SkRasterPipeline* p) const {
Matt Sarettf3880932017-03-24 10:06:03 -0400237 if (fDst.info().gammaCloseToSRGB()) {
Mike Kleine03339a2016-11-28 13:24:27 -0500238 p->append(SkRasterPipeline::to_srgb);
239 }
Mike Kleindb711c92017-05-03 17:57:48 -0400240 if (fDitherCtx.rate > 0.0f) {
241 // We dither after any sRGB transfer function to make sure our 1/255.0f is sensible
242 // over the whole range. If we did it before, 1/255.0f is too big a rate near zero.
243 p->append(SkRasterPipeline::dither, &fDitherCtx);
244 }
245
Mike Kleine03339a2016-11-28 13:24:27 -0500246 if (fDst.info().colorType() == kBGRA_8888_SkColorType) {
247 p->append(SkRasterPipeline::swap_rb);
248 }
mtklein8e4373f2016-07-22 14:20:27 -0700249 switch (fDst.info().colorType()) {
Mike Kleine71b1672017-01-13 07:59:23 -0500250 case kAlpha_8_SkColorType: p->append(SkRasterPipeline::store_a8, &fDstPtr); break;
Mike Kleine03339a2016-11-28 13:24:27 -0500251 case kRGB_565_SkColorType: p->append(SkRasterPipeline::store_565, &fDstPtr); break;
252 case kBGRA_8888_SkColorType:
253 case kRGBA_8888_SkColorType: p->append(SkRasterPipeline::store_8888, &fDstPtr); break;
254 case kRGBA_F16_SkColorType: p->append(SkRasterPipeline::store_f16, &fDstPtr); break;
mtklein8e4373f2016-07-22 14:20:27 -0700255 default: break;
256 }
257}
258
Mike Kleine902f8d2016-10-26 15:32:26 -0400259void SkRasterPipelineBlitter::append_blend(SkRasterPipeline* p) const {
Mike Kleinbb338332017-05-04 12:42:52 -0400260 SkBlendMode_AppendStages(fBlend, p);
Mike Kleine902f8d2016-10-26 15:32:26 -0400261}
Mike Kleine9f74b82016-10-25 13:31:21 -0400262
Mike Klein130863e2016-10-27 11:29:36 -0400263void SkRasterPipelineBlitter::maybe_clamp(SkRasterPipeline* p) const {
Mike Kleine03339a2016-11-28 13:24:27 -0500264 if (SkBlendMode_CanOverflow(fBlend)) {
265 p->append(SkRasterPipeline::clamp_a);
266 }
Mike Klein130863e2016-10-27 11:29:36 -0400267}
268
mtklein9a5c47f2016-07-22 11:05:04 -0700269void SkRasterPipelineBlitter::blitH(int x, int y, int w) {
Mike Klein8729e5b2017-02-16 06:51:48 -0500270 fDstPtr = fDst.writable_addr(0,y);
271 fCurrentY = y;
272
273 if (fCanMemsetInBlitH) {
274 switch (fDst.shiftPerPixel()) {
Mike Klein86125482017-02-17 16:10:46 +0000275 case 0: memset ((uint8_t *)fDstPtr + x, fMemsetColor, w); return;
276 case 1: sk_memset16((uint16_t*)fDstPtr + x, fMemsetColor, w); return;
277 case 2: sk_memset32((uint32_t*)fDstPtr + x, fMemsetColor, w); return;
278 case 3: sk_memset64((uint64_t*)fDstPtr + x, fMemsetColor, w); return;
Mike Klein8729e5b2017-02-16 06:51:48 -0500279 default: break;
280 }
281 }
282
283 auto& p = fBlitH;
284 if (p.empty()) {
Mike Kleinbd3fe472016-10-25 15:43:46 -0400285 p.extend(fShader);
Mike Klein66866172016-11-03 12:22:01 -0400286 if (fBlend != SkBlendMode::kSrc) {
287 this->append_load_d(&p);
288 this->append_blend(&p);
289 this->maybe_clamp(&p);
290 }
Mike Kleine902f8d2016-10-26 15:32:26 -0400291 this->append_store(&p);
Mike Kleinbd3fe472016-10-25 15:43:46 -0400292 }
Mike Klein8729e5b2017-02-16 06:51:48 -0500293 p.run(x,w);
mtklein9a5c47f2016-07-22 11:05:04 -0700294}
295
296void SkRasterPipelineBlitter::blitAntiH(int x, int y, const SkAlpha aa[], const int16_t runs[]) {
Mike Klein8729e5b2017-02-16 06:51:48 -0500297 auto& p = fBlitAntiH;
298 if (p.empty()) {
Mike Kleinbd3fe472016-10-25 15:43:46 -0400299 p.extend(fShader);
Mike Klein66866172016-11-03 12:22:01 -0400300 if (fBlend == SkBlendMode::kSrcOver) {
Mike Kleinbabd93e2016-11-30 16:05:10 -0500301 p.append(SkRasterPipeline::scale_1_float, &fCurrentCoverage);
Mike Klein66866172016-11-03 12:22:01 -0400302 this->append_load_d(&p);
303 this->append_blend(&p);
304 } else {
305 this->append_load_d(&p);
306 this->append_blend(&p);
Mike Kleinbabd93e2016-11-30 16:05:10 -0500307 p.append(SkRasterPipeline::lerp_1_float, &fCurrentCoverage);
Mike Klein66866172016-11-03 12:22:01 -0400308 }
Mike Klein130863e2016-10-27 11:29:36 -0400309 this->maybe_clamp(&p);
Mike Kleine902f8d2016-10-26 15:32:26 -0400310 this->append_store(&p);
Mike Kleinbd3fe472016-10-25 15:43:46 -0400311 }
mtklein9a5c47f2016-07-22 11:05:04 -0700312
Mike Kleinbd3fe472016-10-25 15:43:46 -0400313 fDstPtr = fDst.writable_addr(0,y);
Mike Klein319ba3d2017-01-20 15:11:54 -0500314 fCurrentY = y;
mtklein9a5c47f2016-07-22 11:05:04 -0700315 for (int16_t run = *runs; run > 0; run = *runs) {
Mike Kleinaeb79592016-11-07 09:29:07 -0500316 switch (*aa) {
317 case 0x00: break;
318 case 0xff: this->blitH(x,y,run); break;
319 default:
Mike Kleinbabd93e2016-11-30 16:05:10 -0500320 fCurrentCoverage = *aa * (1/255.0f);
Mike Klein8729e5b2017-02-16 06:51:48 -0500321 p.run(x,run);
Mike Kleinaeb79592016-11-07 09:29:07 -0500322 }
mtklein9a5c47f2016-07-22 11:05:04 -0700323 x += run;
324 runs += run;
325 aa += run;
326 }
327}
328
329void SkRasterPipelineBlitter::blitMask(const SkMask& mask, const SkIRect& clip) {
330 if (mask.fFormat == SkMask::kBW_Format) {
331 // TODO: native BW masks?
332 return INHERITED::blitMask(mask, clip);
333 }
334
Mike Klein8729e5b2017-02-16 06:51:48 -0500335 if (mask.fFormat == SkMask::kA8_Format && fBlitMaskA8.empty()) {
336 auto& p = fBlitMaskA8;
mtklein9a5c47f2016-07-22 11:05:04 -0700337 p.extend(fShader);
Mike Klein66866172016-11-03 12:22:01 -0400338 if (fBlend == SkBlendMode::kSrcOver) {
339 p.append(SkRasterPipeline::scale_u8, &fMaskPtr);
340 this->append_load_d(&p);
341 this->append_blend(&p);
342 } else {
343 this->append_load_d(&p);
344 this->append_blend(&p);
345 p.append(SkRasterPipeline::lerp_u8, &fMaskPtr);
346 }
Mike Klein130863e2016-10-27 11:29:36 -0400347 this->maybe_clamp(&p);
Mike Kleine902f8d2016-10-26 15:32:26 -0400348 this->append_store(&p);
Mike Kleinbd3fe472016-10-25 15:43:46 -0400349 }
350
Mike Klein8729e5b2017-02-16 06:51:48 -0500351 if (mask.fFormat == SkMask::kLCD16_Format && fBlitMaskLCD16.empty()) {
352 auto& p = fBlitMaskLCD16;
Mike Kleinbd3fe472016-10-25 15:43:46 -0400353 p.extend(fShader);
Mike Kleine902f8d2016-10-26 15:32:26 -0400354 this->append_load_d(&p);
355 this->append_blend(&p);
Mike Kleinbd3fe472016-10-25 15:43:46 -0400356 p.append(SkRasterPipeline::lerp_565, &fMaskPtr);
Mike Klein130863e2016-10-27 11:29:36 -0400357 this->maybe_clamp(&p);
Mike Kleine902f8d2016-10-26 15:32:26 -0400358 this->append_store(&p);
Mike Kleinbd3fe472016-10-25 15:43:46 -0400359 }
360
361 int x = clip.left();
362 for (int y = clip.top(); y < clip.bottom(); y++) {
363 fDstPtr = fDst.writable_addr(0,y);
Mike Klein319ba3d2017-01-20 15:11:54 -0500364 fCurrentY = y;
Mike Kleinbd3fe472016-10-25 15:43:46 -0400365
mtklein9a5c47f2016-07-22 11:05:04 -0700366 switch (mask.fFormat) {
367 case SkMask::kA8_Format:
Mike Kleinbd3fe472016-10-25 15:43:46 -0400368 fMaskPtr = mask.getAddr8(x,y)-x;
Mike Klein8729e5b2017-02-16 06:51:48 -0500369 fBlitMaskA8.run(x,clip.width());
mtklein9a5c47f2016-07-22 11:05:04 -0700370 break;
371 case SkMask::kLCD16_Format:
Mike Kleinbd3fe472016-10-25 15:43:46 -0400372 fMaskPtr = mask.getAddrLCD16(x,y)-x;
Mike Klein8729e5b2017-02-16 06:51:48 -0500373 fBlitMaskLCD16.run(x,clip.width());
mtklein9a5c47f2016-07-22 11:05:04 -0700374 break;
Mike Kleinbd3fe472016-10-25 15:43:46 -0400375 default:
376 // TODO
377 break;
mtklein9a5c47f2016-07-22 11:05:04 -0700378 }
mtklein9a5c47f2016-07-22 11:05:04 -0700379 }
380}