blob: d18decd1cddefc24d708e70277fccb1d0f627ba9 [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*);
mtklein9a5c47f2016-07-22 11:05:04 -070025
Matt Sarettf3880932017-03-24 10:06:03 -040026 SkRasterPipelineBlitter(SkPixmap dst, SkBlendMode blend, SkPM4f paintColor)
mtklein9a5c47f2016-07-22 11:05:04 -070027 : fDst(dst)
Mike Kleine902f8d2016-10-26 15:32:26 -040028 , fBlend(blend)
mtklein9a5c47f2016-07-22 11:05:04 -070029 , fPaintColor(paintColor)
30 {}
31
32 void blitH (int x, int y, int w) override;
33 void blitAntiH(int x, int y, const SkAlpha[], const int16_t[]) override;
34 void blitMask (const SkMask&, const SkIRect& clip) override;
35
36 // TODO: The default implementations of the other blits look fine,
37 // but some of them like blitV could probably benefit from custom
38 // blits using something like a SkRasterPipeline::runFew() method.
39
40private:
Mike Klein14c8f822016-11-30 19:39:43 -050041 void append_load_d(SkRasterPipeline*) const;
42 void append_blend (SkRasterPipeline*) const;
43 void maybe_clamp (SkRasterPipeline*) const;
44 void append_store (SkRasterPipeline*) const;
mtklein8e4373f2016-07-22 14:20:27 -070045
mtklein9a5c47f2016-07-22 11:05:04 -070046 SkPixmap fDst;
Mike Kleine902f8d2016-10-26 15:32:26 -040047 SkBlendMode fBlend;
mtklein9a5c47f2016-07-22 11:05:04 -070048 SkPM4f fPaintColor;
mtkleina4a44882016-11-04 13:20:07 -070049 SkRasterPipeline fShader;
mtklein9a5c47f2016-07-22 11:05:04 -070050
Mike Klein8729e5b2017-02-16 06:51:48 -050051 // We may be able to specialize blitH() into a memset.
52 bool fCanMemsetInBlitH = false;
53 uint64_t fMemsetColor = 0; // Big enough for largest dst format, F16.
Mike Kleinbd3fe472016-10-25 15:43:46 -040054
Mike Klein8729e5b2017-02-16 06:51:48 -050055 // Built lazily on first use.
56 SkRasterPipeline fBlitH,
57 fBlitAntiH,
58 fBlitMaskA8,
59 fBlitMaskLCD16;
60
61 // These values are pointed to by the blit pipelines above,
62 // which allows us to adjust them from call to call.
Mike Kleindb711c92017-05-03 17:57:48 -040063 void* fDstPtr = nullptr;
64 const void* fMaskPtr = nullptr;
65 float fCurrentCoverage = 0.0f;
66 int fCurrentY = 0;
67 SkJumper_DitherCtx fDitherCtx = { &fCurrentY, 0.0f };
Mike Kleinbd3fe472016-10-25 15:43:46 -040068
mtklein9a5c47f2016-07-22 11:05:04 -070069 typedef SkBlitter INHERITED;
70};
71
72SkBlitter* SkCreateRasterPipelineBlitter(const SkPixmap& dst,
73 const SkPaint& paint,
Mike Kleinfb191da2016-11-15 13:20:33 -050074 const SkMatrix& ctm,
Matt Sarett25834ff2017-02-15 15:54:35 -050075 SkArenaAlloc* alloc) {
76 return SkRasterPipelineBlitter::Create(dst, paint, ctm, alloc);
mtklein9a5c47f2016-07-22 11:05:04 -070077}
78
mtklein8e4373f2016-07-22 14:20:27 -070079static bool supported(const SkImageInfo& info) {
mtklein8e4373f2016-07-22 14:20:27 -070080 switch (info.colorType()) {
Mike Kleine71b1672017-01-13 07:59:23 -050081 case kAlpha_8_SkColorType: return true;
82 case kRGB_565_SkColorType: return true;
mtklein4e90e3e2016-07-25 14:35:31 -070083 case kN32_SkColorType: return info.gammaCloseToSRGB();
84 case kRGBA_F16_SkColorType: return true;
mtklein4e90e3e2016-07-25 14:35:31 -070085 default: return false;
mtklein8e4373f2016-07-22 14:20:27 -070086 }
87}
mtklein9a5c47f2016-07-22 11:05:04 -070088
mtklein9a5c47f2016-07-22 11:05:04 -070089SkBlitter* SkRasterPipelineBlitter::Create(const SkPixmap& dst,
90 const SkPaint& paint,
Mike Kleinfb191da2016-11-15 13:20:33 -050091 const SkMatrix& ctm,
Matt Sarett25834ff2017-02-15 15:54:35 -050092 SkArenaAlloc* alloc) {
Herb Derby83e939b2017-02-07 14:25:11 -050093 auto blitter = alloc->make<SkRasterPipelineBlitter>(
Mike Klein744908e2016-11-11 12:51:36 -050094 dst,
95 paint.getBlendMode(),
Matt Sarettf3880932017-03-24 10:06:03 -040096 SkPM4f_from_SkColor(paint.getColor(), dst.colorSpace()));
Mike Klein744908e2016-11-11 12:51:36 -050097
Mike Kleinf98b7302016-11-06 10:18:06 -050098
Mike Klein21aa3d02016-11-30 16:40:56 -050099 SkBlendMode* blend = &blitter->fBlend;
100 SkPM4f* paintColor = &blitter->fPaintColor;
101 SkRasterPipeline* pipeline = &blitter->fShader;
mtkleina4a44882016-11-04 13:20:07 -0700102
103 SkShader* shader = paint.getShader();
104 SkColorFilter* colorFilter = paint.getColorFilter();
105
106 // TODO: all temporary
Mike Kleinb0d10e02016-11-12 10:29:26 -0500107 if (!supported(dst.info()) || !SkBlendMode_AppendStages(*blend)) {
Herb Derby83e939b2017-02-07 14:25:11 -0500108 return nullptr;
mtklein9a5c47f2016-07-22 11:05:04 -0700109 }
mtkleina4a44882016-11-04 13:20:07 -0700110
Mike Kleindb711c92017-05-03 17:57:48 -0400111 // TODO: Think more about under what conditions we dither:
112 // - if we're drawing anything into 565 and the user has asked us to dither, or
113 // - if we're drawing a gradient into 565 or 8888.
114 if ((paint.isDither() && dst.info().colorType() == kRGB_565_SkColorType) ||
115 (shader && shader->asAGradient(nullptr) >= SkShader::kLinear_GradientType)) {
116 switch (dst.info().colorType()) {
117 default: blitter->fDitherCtx.rate = 0.0f; break;
118 case kRGB_565_SkColorType: blitter->fDitherCtx.rate = 1/63.0f; break;
119 case kRGBA_8888_SkColorType:
120 case kBGRA_8888_SkColorType: blitter->fDitherCtx.rate = 1/255.0f; break;
121 }
122 }
123
Mike Klein14c8f822016-11-30 19:39:43 -0500124 bool is_opaque = paintColor->a() == 1.0f,
Mike Kleindb711c92017-05-03 17:57:48 -0400125 is_constant = blitter->fDitherCtx.rate == 0.0f;
mtkleina4a44882016-11-04 13:20:07 -0700126 if (shader) {
Mike Klein319ba3d2017-01-20 15:11:54 -0500127 pipeline->append(SkRasterPipeline::seed_shader, &blitter->fCurrentY);
Mike Klein3a846152017-02-07 12:05:10 -0500128 if (!shader->appendStages(pipeline, dst.colorSpace(), alloc, ctm, paint)) {
Herb Derby83e939b2017-02-07 14:25:11 -0500129 return nullptr;
Mike Kleinb0d10e02016-11-12 10:29:26 -0500130 }
Mike Klein43c847b2016-11-21 13:05:23 -0500131 if (!is_opaque) {
Mike Kleinbabd93e2016-11-30 16:05:10 -0500132 pipeline->append(SkRasterPipeline::scale_1_float,
Mike Klein43c847b2016-11-21 13:05:23 -0500133 &paintColor->fVec[SkPM4f::A]);
134 }
Mike Kleinfb191da2016-11-15 13:20:33 -0500135
Mike Kleindb711c92017-05-03 17:57:48 -0400136 is_opaque = is_opaque && shader->isOpaque();
137 is_constant = is_constant && shader->isConstant();
Mike Klein43c847b2016-11-21 13:05:23 -0500138 } else {
139 pipeline->append(SkRasterPipeline::constant_color, paintColor);
Mike Kleine902f8d2016-10-26 15:32:26 -0400140 }
mtklein9a5c47f2016-07-22 11:05:04 -0700141
mtkleina4a44882016-11-04 13:20:07 -0700142 if (colorFilter) {
Mike Klein3a846152017-02-07 12:05:10 -0500143 if (!colorFilter->appendStages(pipeline, dst.colorSpace(), alloc, is_opaque)) {
Herb Derby83e939b2017-02-07 14:25:11 -0500144 return nullptr;
Mike Klein66866172016-11-03 12:22:01 -0400145 }
mtkleina4a44882016-11-04 13:20:07 -0700146 is_opaque = is_opaque && (colorFilter->getFlags() & SkColorFilter::kAlphaUnchanged_Flag);
mtklein9a5c47f2016-07-22 11:05:04 -0700147 }
148
Mike Klein14c8f822016-11-30 19:39:43 -0500149 if (is_constant) {
mtkleina4a44882016-11-04 13:20:07 -0700150 pipeline->append(SkRasterPipeline::store_f32, &paintColor);
Mike Klein319ba3d2017-01-20 15:11:54 -0500151 pipeline->run(0,1);
mtkleina4a44882016-11-04 13:20:07 -0700152
153 *pipeline = SkRasterPipeline();
154 pipeline->append(SkRasterPipeline::constant_color, paintColor);
155
156 is_opaque = paintColor->a() == 1.0f;
Mike Klein66866172016-11-03 12:22:01 -0400157 }
mtklein8e4373f2016-07-22 14:20:27 -0700158
mtkleina4a44882016-11-04 13:20:07 -0700159 if (is_opaque && *blend == SkBlendMode::kSrcOver) {
160 *blend = SkBlendMode::kSrc;
mtklein8e4373f2016-07-22 14:20:27 -0700161 }
162
Mike Klein14c8f822016-11-30 19:39:43 -0500163 if (is_constant && *blend == SkBlendMode::kSrc) {
Mike Klein14c8f822016-11-30 19:39:43 -0500164 SkRasterPipeline p;
165 p.extend(*pipeline);
Mike Klein8729e5b2017-02-16 06:51:48 -0500166 blitter->fDstPtr = &blitter->fMemsetColor;
Mike Klein14c8f822016-11-30 19:39:43 -0500167 blitter->append_store(&p);
Mike Klein319ba3d2017-01-20 15:11:54 -0500168 p.run(0,1);
Mike Klein14c8f822016-11-30 19:39:43 -0500169
Mike Klein8729e5b2017-02-16 06:51:48 -0500170 blitter->fCanMemsetInBlitH = true;
Mike Klein14c8f822016-11-30 19:39:43 -0500171 }
172
mtklein9a5c47f2016-07-22 11:05:04 -0700173 return blitter;
174}
175
Mike Kleine902f8d2016-10-26 15:32:26 -0400176void SkRasterPipelineBlitter::append_load_d(SkRasterPipeline* p) const {
mtklein8e4373f2016-07-22 14:20:27 -0700177 SkASSERT(supported(fDst.info()));
178
Mike Klein8c8cb5b2017-01-06 10:21:56 -0500179 p->append(SkRasterPipeline::move_src_dst);
mtklein8e4373f2016-07-22 14:20:27 -0700180 switch (fDst.info().colorType()) {
Mike Kleine71b1672017-01-13 07:59:23 -0500181 case kAlpha_8_SkColorType: p->append(SkRasterPipeline::load_a8, &fDstPtr); break;
Mike Klein8c8cb5b2017-01-06 10:21:56 -0500182 case kRGB_565_SkColorType: p->append(SkRasterPipeline::load_565, &fDstPtr); break;
Mike Kleine03339a2016-11-28 13:24:27 -0500183 case kBGRA_8888_SkColorType:
Mike Klein8c8cb5b2017-01-06 10:21:56 -0500184 case kRGBA_8888_SkColorType: p->append(SkRasterPipeline::load_8888, &fDstPtr); break;
185 case kRGBA_F16_SkColorType: p->append(SkRasterPipeline::load_f16, &fDstPtr); break;
mtklein8e4373f2016-07-22 14:20:27 -0700186 default: break;
187 }
Mike Kleine03339a2016-11-28 13:24:27 -0500188 if (fDst.info().colorType() == kBGRA_8888_SkColorType) {
Mike Klein8c8cb5b2017-01-06 10:21:56 -0500189 p->append(SkRasterPipeline::swap_rb);
Mike Kleine03339a2016-11-28 13:24:27 -0500190 }
191 if (fDst.info().gammaCloseToSRGB()) {
Mike Klein8c8cb5b2017-01-06 10:21:56 -0500192 p->append_from_srgb(fDst.info().alphaType());
Mike Kleine03339a2016-11-28 13:24:27 -0500193 }
Mike Klein8c8cb5b2017-01-06 10:21:56 -0500194 p->append(SkRasterPipeline::swap);
mtklein8e4373f2016-07-22 14:20:27 -0700195}
196
Mike Klein14c8f822016-11-30 19:39:43 -0500197void SkRasterPipelineBlitter::append_store(SkRasterPipeline* p) const {
Matt Sarettf3880932017-03-24 10:06:03 -0400198 if (fDst.info().gammaCloseToSRGB()) {
Mike Kleine03339a2016-11-28 13:24:27 -0500199 p->append(SkRasterPipeline::to_srgb);
200 }
Mike Kleindb711c92017-05-03 17:57:48 -0400201 if (fDitherCtx.rate > 0.0f) {
202 // We dither after any sRGB transfer function to make sure our 1/255.0f is sensible
203 // over the whole range. If we did it before, 1/255.0f is too big a rate near zero.
204 p->append(SkRasterPipeline::dither, &fDitherCtx);
205 }
206
Mike Kleine03339a2016-11-28 13:24:27 -0500207 if (fDst.info().colorType() == kBGRA_8888_SkColorType) {
208 p->append(SkRasterPipeline::swap_rb);
209 }
Mike Klein21aa3d02016-11-30 16:40:56 -0500210 SkASSERT(supported(fDst.info()));
mtklein8e4373f2016-07-22 14:20:27 -0700211 switch (fDst.info().colorType()) {
Mike Kleine71b1672017-01-13 07:59:23 -0500212 case kAlpha_8_SkColorType: p->append(SkRasterPipeline::store_a8, &fDstPtr); break;
Mike Kleine03339a2016-11-28 13:24:27 -0500213 case kRGB_565_SkColorType: p->append(SkRasterPipeline::store_565, &fDstPtr); break;
214 case kBGRA_8888_SkColorType:
215 case kRGBA_8888_SkColorType: p->append(SkRasterPipeline::store_8888, &fDstPtr); break;
216 case kRGBA_F16_SkColorType: p->append(SkRasterPipeline::store_f16, &fDstPtr); break;
mtklein8e4373f2016-07-22 14:20:27 -0700217 default: break;
218 }
219}
220
Mike Kleine902f8d2016-10-26 15:32:26 -0400221void SkRasterPipelineBlitter::append_blend(SkRasterPipeline* p) const {
222 SkAssertResult(SkBlendMode_AppendStages(fBlend, p));
223}
Mike Kleine9f74b82016-10-25 13:31:21 -0400224
Mike Klein130863e2016-10-27 11:29:36 -0400225void SkRasterPipelineBlitter::maybe_clamp(SkRasterPipeline* p) const {
Mike Kleine03339a2016-11-28 13:24:27 -0500226 if (SkBlendMode_CanOverflow(fBlend)) {
227 p->append(SkRasterPipeline::clamp_a);
228 }
Mike Klein130863e2016-10-27 11:29:36 -0400229}
230
mtklein9a5c47f2016-07-22 11:05:04 -0700231void SkRasterPipelineBlitter::blitH(int x, int y, int w) {
Mike Klein8729e5b2017-02-16 06:51:48 -0500232 fDstPtr = fDst.writable_addr(0,y);
233 fCurrentY = y;
234
235 if (fCanMemsetInBlitH) {
236 switch (fDst.shiftPerPixel()) {
Mike Klein86125482017-02-17 16:10:46 +0000237 case 0: memset ((uint8_t *)fDstPtr + x, fMemsetColor, w); return;
238 case 1: sk_memset16((uint16_t*)fDstPtr + x, fMemsetColor, w); return;
239 case 2: sk_memset32((uint32_t*)fDstPtr + x, fMemsetColor, w); return;
240 case 3: sk_memset64((uint64_t*)fDstPtr + x, fMemsetColor, w); return;
Mike Klein8729e5b2017-02-16 06:51:48 -0500241 default: break;
242 }
243 }
244
245 auto& p = fBlitH;
246 if (p.empty()) {
Mike Kleinbd3fe472016-10-25 15:43:46 -0400247 p.extend(fShader);
Mike Klein66866172016-11-03 12:22:01 -0400248 if (fBlend != SkBlendMode::kSrc) {
249 this->append_load_d(&p);
250 this->append_blend(&p);
251 this->maybe_clamp(&p);
252 }
Mike Kleine902f8d2016-10-26 15:32:26 -0400253 this->append_store(&p);
Mike Kleinbd3fe472016-10-25 15:43:46 -0400254 }
Mike Klein8729e5b2017-02-16 06:51:48 -0500255 p.run(x,w);
mtklein9a5c47f2016-07-22 11:05:04 -0700256}
257
258void SkRasterPipelineBlitter::blitAntiH(int x, int y, const SkAlpha aa[], const int16_t runs[]) {
Mike Klein8729e5b2017-02-16 06:51:48 -0500259 auto& p = fBlitAntiH;
260 if (p.empty()) {
Mike Kleinbd3fe472016-10-25 15:43:46 -0400261 p.extend(fShader);
Mike Klein66866172016-11-03 12:22:01 -0400262 if (fBlend == SkBlendMode::kSrcOver) {
Mike Kleinbabd93e2016-11-30 16:05:10 -0500263 p.append(SkRasterPipeline::scale_1_float, &fCurrentCoverage);
Mike Klein66866172016-11-03 12:22:01 -0400264 this->append_load_d(&p);
265 this->append_blend(&p);
266 } else {
267 this->append_load_d(&p);
268 this->append_blend(&p);
Mike Kleinbabd93e2016-11-30 16:05:10 -0500269 p.append(SkRasterPipeline::lerp_1_float, &fCurrentCoverage);
Mike Klein66866172016-11-03 12:22:01 -0400270 }
Mike Klein130863e2016-10-27 11:29:36 -0400271 this->maybe_clamp(&p);
Mike Kleine902f8d2016-10-26 15:32:26 -0400272 this->append_store(&p);
Mike Kleinbd3fe472016-10-25 15:43:46 -0400273 }
mtklein9a5c47f2016-07-22 11:05:04 -0700274
Mike Kleinbd3fe472016-10-25 15:43:46 -0400275 fDstPtr = fDst.writable_addr(0,y);
Mike Klein319ba3d2017-01-20 15:11:54 -0500276 fCurrentY = y;
mtklein9a5c47f2016-07-22 11:05:04 -0700277 for (int16_t run = *runs; run > 0; run = *runs) {
Mike Kleinaeb79592016-11-07 09:29:07 -0500278 switch (*aa) {
279 case 0x00: break;
280 case 0xff: this->blitH(x,y,run); break;
281 default:
Mike Kleinbabd93e2016-11-30 16:05:10 -0500282 fCurrentCoverage = *aa * (1/255.0f);
Mike Klein8729e5b2017-02-16 06:51:48 -0500283 p.run(x,run);
Mike Kleinaeb79592016-11-07 09:29:07 -0500284 }
mtklein9a5c47f2016-07-22 11:05:04 -0700285 x += run;
286 runs += run;
287 aa += run;
288 }
289}
290
291void SkRasterPipelineBlitter::blitMask(const SkMask& mask, const SkIRect& clip) {
292 if (mask.fFormat == SkMask::kBW_Format) {
293 // TODO: native BW masks?
294 return INHERITED::blitMask(mask, clip);
295 }
296
Mike Klein8729e5b2017-02-16 06:51:48 -0500297 if (mask.fFormat == SkMask::kA8_Format && fBlitMaskA8.empty()) {
298 auto& p = fBlitMaskA8;
mtklein9a5c47f2016-07-22 11:05:04 -0700299 p.extend(fShader);
Mike Klein66866172016-11-03 12:22:01 -0400300 if (fBlend == SkBlendMode::kSrcOver) {
301 p.append(SkRasterPipeline::scale_u8, &fMaskPtr);
302 this->append_load_d(&p);
303 this->append_blend(&p);
304 } else {
305 this->append_load_d(&p);
306 this->append_blend(&p);
307 p.append(SkRasterPipeline::lerp_u8, &fMaskPtr);
308 }
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 }
312
Mike Klein8729e5b2017-02-16 06:51:48 -0500313 if (mask.fFormat == SkMask::kLCD16_Format && fBlitMaskLCD16.empty()) {
314 auto& p = fBlitMaskLCD16;
Mike Kleinbd3fe472016-10-25 15:43:46 -0400315 p.extend(fShader);
Mike Kleine902f8d2016-10-26 15:32:26 -0400316 this->append_load_d(&p);
317 this->append_blend(&p);
Mike Kleinbd3fe472016-10-25 15:43:46 -0400318 p.append(SkRasterPipeline::lerp_565, &fMaskPtr);
Mike Klein130863e2016-10-27 11:29:36 -0400319 this->maybe_clamp(&p);
Mike Kleine902f8d2016-10-26 15:32:26 -0400320 this->append_store(&p);
Mike Kleinbd3fe472016-10-25 15:43:46 -0400321 }
322
323 int x = clip.left();
324 for (int y = clip.top(); y < clip.bottom(); y++) {
325 fDstPtr = fDst.writable_addr(0,y);
Mike Klein319ba3d2017-01-20 15:11:54 -0500326 fCurrentY = y;
Mike Kleinbd3fe472016-10-25 15:43:46 -0400327
mtklein9a5c47f2016-07-22 11:05:04 -0700328 switch (mask.fFormat) {
329 case SkMask::kA8_Format:
Mike Kleinbd3fe472016-10-25 15:43:46 -0400330 fMaskPtr = mask.getAddr8(x,y)-x;
Mike Klein8729e5b2017-02-16 06:51:48 -0500331 fBlitMaskA8.run(x,clip.width());
mtklein9a5c47f2016-07-22 11:05:04 -0700332 break;
333 case SkMask::kLCD16_Format:
Mike Kleinbd3fe472016-10-25 15:43:46 -0400334 fMaskPtr = mask.getAddrLCD16(x,y)-x;
Mike Klein8729e5b2017-02-16 06:51:48 -0500335 fBlitMaskLCD16.run(x,clip.width());
mtklein9a5c47f2016-07-22 11:05:04 -0700336 break;
Mike Kleinbd3fe472016-10-25 15:43:46 -0400337 default:
338 // TODO
339 break;
mtklein9a5c47f2016-07-22 11:05:04 -0700340 }
mtklein9a5c47f2016-07-22 11:05:04 -0700341 }
342}