Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkRasterPipelineBlitter.cpp
Go to the documentation of this file.
1/*
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
17#include "include/core/SkRect.h"
26#include "src/core/SkBlitter.h"
30#include "src/core/SkMask.h"
31#include "src/core/SkMemset.h"
37
38#include <cstdint>
39#include <cstring>
40#include <functional>
41#include <optional>
42#include <utility>
43
44class SkColorSpace;
45class SkShader;
46
47class SkRasterPipelineBlitter final : public SkBlitter {
48public:
49 // This is our common entrypoint for creating the blitter once we've sorted out shaders.
50 static SkBlitter* Create(const SkPixmap& dst,
51 const SkPaint& paint,
52 const SkColor4f& dstPaintColor,
53 SkArenaAlloc* alloc,
54 const SkRasterPipeline& shaderPipeline,
55 bool is_opaque,
56 bool is_constant,
57 const SkShader* clipShader);
58
60 SkArenaAlloc* alloc)
61 : fDst(std::move(dst))
62 , fAlloc(alloc)
63 , fColorPipeline(alloc)
64 , fBlendPipeline(alloc)
65 {}
66
67 void blitH (int x, int y, int w) override;
68 void blitAntiH (int x, int y, const SkAlpha[], const int16_t[]) override;
69 void blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) override;
70 void blitAntiV2(int x, int y, U8CPU a0, U8CPU a1) override;
71 void blitMask (const SkMask&, const SkIRect& clip) override;
72 void blitRect (int x, int y, int width, int height) override;
73 void blitV (int x, int y, int height, SkAlpha alpha) override;
74
75private:
76 void blitRectWithTrace(int x, int y, int w, int h, bool trace);
77 void appendLoadDst (SkRasterPipeline*) const;
78 void appendStore (SkRasterPipeline*) const;
79
80 // these check internally, and only append if there was a native clipShader
81 void appendClipScale (SkRasterPipeline*) const;
82 void appendClipLerp (SkRasterPipeline*) const;
83
84 SkPixmap fDst;
85 SkArenaAlloc* fAlloc;
86 SkRasterPipeline fColorPipeline;
87 SkRasterPipeline fBlendPipeline;
88 // If the blender is a blend-mode, we retain that information for late-stage optimizations
89 std::optional<SkBlendMode> fBlendMode;
90 // set to pipeline storage (for alpha) if we have a clipShader
91 void* fClipShaderBuffer = nullptr; // "native" : float or U16
92
94 fDstPtr = {nullptr,0}, // Always points to the top-left of fDst.
95 fMaskPtr = {nullptr,0}; // Updated each call to blitMask().
96 SkRasterPipeline_EmbossCtx fEmbossCtx; // Used only for k3D_Format masks.
97
98 // We may be able to specialize blitH() or blitRect() into a memset.
99 void (*fMemset2D)(SkPixmap*, int x,int y, int w,int h, uint64_t color) = nullptr;
100 uint64_t fMemsetColor = 0; // Big enough for largest memsettable dst format, F16.
101
102 // Built lazily on first use.
103 std::function<void(size_t, size_t, size_t, size_t)> fBlitRect,
104 fBlitAntiH,
105 fBlitMaskA8,
106 fBlitMaskLCD16,
107 fBlitMask3D;
108
109 // These values are pointed to by the blit pipelines above,
110 // which allows us to adjust them from call to call.
111 float fCurrentCoverage = 0.0f;
112 float fDitherRate = 0.0f;
113
114 using INHERITED = SkBlitter;
115};
116
118 SkColor4f paintColor = paint.getColor4f();
120 dst.colorSpace(), kUnpremul_SkAlphaType).apply(paintColor.vec());
121 return paintColor;
122}
123
125 const SkPaint& paint,
126 const SkMatrix& ctm,
127 SkArenaAlloc* alloc,
128 sk_sp<SkShader> clipShader,
129 const SkSurfaceProps& props) {
130 SkColorSpace* dstCS = dst.colorSpace();
131 SkColorType dstCT = dst.colorType();
132 SkColor4f dstPaintColor = paint_color_to_dst(paint, dst);
133
134 auto shader = as_SB(paint.getShader());
135
136 SkRasterPipeline_<256> shaderPipeline;
137 if (!shader) {
138 // Having no shader makes things nice and easy... just use the paint color
139 shaderPipeline.appendConstantColor(alloc, dstPaintColor.premul().vec());
140 bool is_opaque = dstPaintColor.fA == 1.0f,
141 is_constant = true;
142 return SkRasterPipelineBlitter::Create(dst, paint, dstPaintColor, alloc, shaderPipeline,
143 is_opaque, is_constant, clipShader.get());
144 }
145
146 bool is_opaque = shader->isOpaque() && dstPaintColor.fA == 1.0f;
147 bool is_constant = shader->isConstant();
148
149 if (shader->appendRootStages({&shaderPipeline, alloc, dstCT, dstCS, dstPaintColor, props},
150 ctm)) {
151 if (dstPaintColor.fA != 1.0f) {
152 shaderPipeline.append(SkRasterPipelineOp::scale_1_float,
153 alloc->make<float>(dstPaintColor.fA));
154 }
155 return SkRasterPipelineBlitter::Create(dst, paint, dstPaintColor, alloc, shaderPipeline,
156 is_opaque, is_constant, clipShader.get());
157 }
158
159 // The shader can't draw with SkRasterPipeline.
160 return nullptr;
161}
162
164 const SkPaint& paint,
165 const SkRasterPipeline& shaderPipeline,
166 bool is_opaque,
167 SkArenaAlloc* alloc,
168 sk_sp<SkShader> clipShader) {
169 bool is_constant = false; // If this were the case, it'd be better to just set a paint color.
171 shaderPipeline, is_opaque, is_constant,
172 clipShader.get());
173}
174
176 const SkPaint& paint,
177 const SkColor4f& dstPaintColor,
178 SkArenaAlloc* alloc,
179 const SkRasterPipeline& shaderPipeline,
180 bool is_opaque,
181 bool is_constant,
182 const SkShader* clipShader) {
183 auto blitter = alloc->make<SkRasterPipelineBlitter>(dst, alloc);
184
185 // Our job in this factory is to fill out the blitter's color and blend pipelines.
186 // The color pipeline is the common front of the full blit pipeline. The blend pipeline is just
187 // the portion that does the actual blending math (and assumes that src and dst are already
188 // loaded).
189 //
190 // The full blit pipelines are each constructed lazily on first use, and include the color
191 // pipeline, reading the dst, the blend pipeline, coverage, dithering, and writing the dst.
192
193 // Start with the color pipeline
194 auto colorPipeline = &blitter->fColorPipeline;
195
196 if (clipShader) {
197 auto clipP = colorPipeline;
199 SkColorSpace* clipCS = nullptr;
200 SkSurfaceProps props{}; // default OK; clipShader doesn't render text
201 SkStageRec rec = {clipP, alloc, clipCT, clipCS, SkColors::kBlack, props};
202 if (as_SB(clipShader)->appendRootStages(rec, SkMatrix::I())) {
203 struct Storage {
204 // large enough for highp (float) or lowp(U16)
206 };
207 auto storage = alloc->make<Storage>();
208 clipP->append(SkRasterPipelineOp::store_src_a, storage->fA);
209 blitter->fClipShaderBuffer = storage->fA;
210 is_constant = false;
211 } else {
212 return nullptr;
213 }
214 }
215
216 // Let's get the shader in first.
217 colorPipeline->extend(shaderPipeline);
218
219 // If there's a color filter it comes next.
220 if (auto colorFilter = paint.getColorFilter()) {
221 SkSurfaceProps props{}; // default OK; colorFilter doesn't render text
222 SkStageRec rec = {
223 colorPipeline, alloc, dst.colorType(), dst.colorSpace(), dstPaintColor, props};
224 if (!as_CFB(colorFilter)->appendStages(rec, is_opaque)) {
225 return nullptr;
226 }
227 is_opaque = is_opaque && as_CFB(colorFilter)->isAlphaUnchanged();
228 }
229
230 // Not all formats make sense to dither (think, F16). We set their dither rate
231 // to zero. We only dither non-constant shaders, so is_constant won't change here.
232 if (paint.isDither() && !is_constant) {
233 switch (dst.info().colorType()) {
235 blitter->fDitherRate = 1 / 15.0f;
236 break;
238 blitter->fDitherRate = 1 / 63.0f;
239 break;
246 blitter->fDitherRate = 1 / 255.0f;
247 break;
254 blitter->fDitherRate = 1 / 1023.0f;
255 break;
256
269 blitter->fDitherRate = 0.0f;
270 break;
271 }
272 if (blitter->fDitherRate > 0.0f) {
273 colorPipeline->append(SkRasterPipelineOp::dither, &blitter->fDitherRate);
274 }
275 }
276
277 // Optimization: A pipeline that's still constant here can collapse back into a constant color.
278 if (is_constant) {
279 SkColor4f constantColor;
280 SkRasterPipeline_MemoryCtx constantColorPtr = { &constantColor, 0 };
281 // We could remove this clamp entirely, but if the destination is 8888, doing the clamp
282 // here allows the color pipeline to still run in lowp (we'll use uniform_color, rather than
283 // unbounded_uniform_color).
284 colorPipeline->appendClampIfNormalized(dst.info());
285 colorPipeline->append(SkRasterPipelineOp::store_f32, &constantColorPtr);
286 colorPipeline->run(0,0,1,1);
287 colorPipeline->reset();
288 colorPipeline->appendConstantColor(alloc, constantColor);
289
290 is_opaque = constantColor.fA == 1.0f;
291 }
292
293 // Now we'll build the blend pipeline
294 auto blendPipeline = &blitter->fBlendPipeline;
295
296 sk_sp<SkBlender> blender = paint.refBlender();
297 if (!blender) {
299 }
300
301 // We can strength-reduce SrcOver into Src when opaque.
302 if (is_opaque && as_BB(blender)->asBlendMode() == SkBlendMode::kSrcOver) {
304 }
305
306 // When we're drawing a constant color in Src mode, we can sometimes just memset.
307 // (The previous two optimizations help find more opportunities for this one.)
308 if (is_constant && as_BB(blender)->asBlendMode() == SkBlendMode::kSrc &&
309 dst.info().bytesPerPixel() <= static_cast<int>(sizeof(blitter->fMemsetColor))) {
310 // Run our color pipeline all the way through to produce what we'd memset when we can.
311 // Not all blits can memset, so we need to keep colorPipeline too.
313 p.extend(*colorPipeline);
314 blitter->fDstPtr = SkRasterPipeline_MemoryCtx{&blitter->fMemsetColor, 0};
315 blitter->appendStore(&p);
316 p.run(0,0,1,1);
317
318 switch (blitter->fDst.shiftPerPixel()) {
319 case 0: blitter->fMemset2D = [](SkPixmap* dst, int x,int y, int w,int h, uint64_t c) {
320 void* p = dst->writable_addr(x,y);
321 while (h --> 0) {
322 memset(p, c, w);
323 p = SkTAddOffset<void>(p, dst->rowBytes());
324 }
325 }; break;
326
327 case 1: blitter->fMemset2D = [](SkPixmap* dst, int x,int y, int w,int h, uint64_t c) {
328 SkOpts::rect_memset16(dst->writable_addr16(x,y), c, w, dst->rowBytes(), h);
329 }; break;
330
331 case 2: blitter->fMemset2D = [](SkPixmap* dst, int x,int y, int w,int h, uint64_t c) {
332 SkOpts::rect_memset32(dst->writable_addr32(x,y), c, w, dst->rowBytes(), h);
333 }; break;
334
335 case 3: blitter->fMemset2D = [](SkPixmap* dst, int x,int y, int w,int h, uint64_t c) {
336 SkOpts::rect_memset64(dst->writable_addr64(x,y), c, w, dst->rowBytes(), h);
337 }; break;
338
339 // TODO(F32)?
340 }
341 }
342
343 {
344 SkSurfaceProps props{}; // default OK; blender doesn't render text
345 SkStageRec rec = {
346 blendPipeline, alloc, dst.colorType(), dst.colorSpace(), dstPaintColor, props};
347 if (!as_BB(blender)->appendStages(rec)) {
348 return nullptr;
349 }
350 blitter->fBlendMode = as_BB(blender)->asBlendMode();
351 }
352
353 blitter->fDstPtr = SkRasterPipeline_MemoryCtx{
354 blitter->fDst.writable_addr(),
355 blitter->fDst.rowBytesAsPixels(),
356 };
357
358 return blitter;
359}
360
361void SkRasterPipelineBlitter::appendLoadDst(SkRasterPipeline* p) const {
362 p->appendLoadDst(fDst.info().colorType(), &fDstPtr);
363 if (fDst.info().alphaType() == kUnpremul_SkAlphaType) {
364 p->append(SkRasterPipelineOp::premul_dst);
365 }
366}
367
368void SkRasterPipelineBlitter::appendStore(SkRasterPipeline* p) const {
369 if (fDst.info().alphaType() == kUnpremul_SkAlphaType) {
370 p->append(SkRasterPipelineOp::unpremul);
371 }
372 p->appendStore(fDst.info().colorType(), &fDstPtr);
373}
374
375void SkRasterPipelineBlitter::appendClipScale(SkRasterPipeline* p) const {
376 if (fClipShaderBuffer) {
377 p->append(SkRasterPipelineOp::scale_native, fClipShaderBuffer);
378 }
379}
380
381void SkRasterPipelineBlitter::appendClipLerp(SkRasterPipeline* p) const {
382 if (fClipShaderBuffer) {
383 p->append(SkRasterPipelineOp::lerp_native, fClipShaderBuffer);
384 }
385}
386
387void SkRasterPipelineBlitter::blitH(int x, int y, int w) {
388 this->blitRect(x,y,w,1);
389}
390
391void SkRasterPipelineBlitter::blitRect(int x, int y, int w, int h) {
392 this->blitRectWithTrace(x, y, w, h, true);
393}
394
395void SkRasterPipelineBlitter::blitRectWithTrace(int x, int y, int w, int h, bool trace) {
396 if (fMemset2D) {
397 fMemset2D(&fDst, x,y, w,h, fMemsetColor);
398 return;
399 }
400
401 if (!fBlitRect) {
402 SkRasterPipeline p(fAlloc);
403 p.extend(fColorPipeline);
404 p.appendClampIfNormalized(fDst.info());
405 if (fBlendMode == SkBlendMode::kSrcOver
406 && (fDst.info().colorType() == kRGBA_8888_SkColorType ||
408 && !fDst.colorSpace()
410 && fDitherRate == 0.0f) {
411 if (fDst.info().colorType() == kBGRA_8888_SkColorType) {
412 p.append(SkRasterPipelineOp::swap_rb);
413 }
414 this->appendClipScale(&p);
415 p.append(SkRasterPipelineOp::srcover_rgba_8888, &fDstPtr);
416 } else {
417 if (fBlendMode != SkBlendMode::kSrc) {
418 this->appendLoadDst(&p);
419 p.extend(fBlendPipeline);
420 this->appendClipLerp(&p);
421 } else if (fClipShaderBuffer) {
422 this->appendLoadDst(&p);
423 this->appendClipLerp(&p);
424 }
425 this->appendStore(&p);
426 }
427 fBlitRect = p.compile();
428 }
429
430 fBlitRect(x,y,w,h);
431}
432
433void SkRasterPipelineBlitter::blitAntiH(int x, int y, const SkAlpha aa[], const int16_t runs[]) {
434 if (!fBlitAntiH) {
435 SkRasterPipeline p(fAlloc);
436 p.extend(fColorPipeline);
437 p.appendClampIfNormalized(fDst.info());
438 if (fBlendMode.has_value() &&
439 SkBlendMode_ShouldPreScaleCoverage(*fBlendMode, /*rgb_coverage=*/false)) {
440 p.append(SkRasterPipelineOp::scale_1_float, &fCurrentCoverage);
441 this->appendClipScale(&p);
442 this->appendLoadDst(&p);
443 p.extend(fBlendPipeline);
444 } else {
445 this->appendLoadDst(&p);
446 p.extend(fBlendPipeline);
447 p.append(SkRasterPipelineOp::lerp_1_float, &fCurrentCoverage);
448 this->appendClipLerp(&p);
449 }
450
451 this->appendStore(&p);
452 fBlitAntiH = p.compile();
453 }
454
455 for (int16_t run = *runs; run > 0; run = *runs) {
456 switch (*aa) {
457 case 0x00: break;
458 case 0xff:this->blitRectWithTrace(x,y,run, 1, false); break;
459 default:
460 fCurrentCoverage = *aa * (1/255.0f);
461 fBlitAntiH(x,y,run,1);
462 }
463 x += run;
464 runs += run;
465 aa += run;
466 }
467}
468
470 SkIRect clip = {x,y, x+2,y+1};
471 uint8_t coverage[] = { (uint8_t)a0, (uint8_t)a1 };
472 SkMask mask(coverage, clip, 2, SkMask::kA8_Format);
473 this->blitMask(mask, clip);
474}
475
477 SkIRect clip = {x,y, x+1,y+2};
478 uint8_t coverage[] = { (uint8_t)a0, (uint8_t)a1 };
479 SkMask mask(coverage, clip, 1, SkMask::kA8_Format);
480 this->blitMask(mask, clip);
481}
482
483void SkRasterPipelineBlitter::blitV(int x, int y, int height, SkAlpha alpha) {
484 SkIRect clip = {x,y, x+1,y+height};
485 SkMask mask(&alpha, clip,
486 0, // so we reuse the 1 "row" for all of height
488 this->blitMask(mask, clip);
489}
490
492 if (mask.fFormat == SkMask::kBW_Format) {
493 // TODO: native BW masks?
494 return INHERITED::blitMask(mask, clip);
495 }
496
497 // ARGB and SDF masks shouldn't make it here.
500 || mask.fFormat == SkMask::k3D_Format);
501
502 auto extract_mask_plane = [&mask](int plane, SkRasterPipeline_MemoryCtx* ctx) {
503 // LCD is 16-bit per pixel; A8 and 3D are 8-bit per pixel.
504 size_t bpp = mask.fFormat == SkMask::kLCD16_Format ? 2 : 1;
505
506 // Select the right mask plane. Usually plane == 0 and this is just mask.fImage.
507 auto ptr = (uintptr_t)mask.fImage
508 + plane * mask.computeImageSize();
509
510 // Update ctx to point "into" this current mask, but lined up with fDstPtr at (0,0).
511 // This sort of trickery upsets UBSAN (pointer-overflow) so our ptr must be a uintptr_t.
512 // mask.fRowBytes is a uint32_t, which would break our addressing math on 64-bit builds.
513 size_t rowBytes = mask.fRowBytes;
514 ctx->stride = rowBytes / bpp;
515 ctx->pixels = (void*)(ptr - mask.fBounds.left() * bpp
516 - mask.fBounds.top() * rowBytes);
517 };
518
519 extract_mask_plane(0, &fMaskPtr);
520 if (mask.fFormat == SkMask::k3D_Format) {
521 extract_mask_plane(1, &fEmbossCtx.mul);
522 extract_mask_plane(2, &fEmbossCtx.add);
523 }
524
525 // Lazily build whichever pipeline we need, specialized for each mask format.
526 if (mask.fFormat == SkMask::kA8_Format && !fBlitMaskA8) {
527 SkRasterPipeline p(fAlloc);
528 p.extend(fColorPipeline);
529 p.appendClampIfNormalized(fDst.info());
530 if (fBlendMode.has_value() &&
531 SkBlendMode_ShouldPreScaleCoverage(*fBlendMode, /*rgb_coverage=*/false)) {
532 p.append(SkRasterPipelineOp::scale_u8, &fMaskPtr);
533 this->appendClipScale(&p);
534 this->appendLoadDst(&p);
535 p.extend(fBlendPipeline);
536 } else {
537 this->appendLoadDst(&p);
538 p.extend(fBlendPipeline);
539 p.append(SkRasterPipelineOp::lerp_u8, &fMaskPtr);
540 this->appendClipLerp(&p);
541 }
542 this->appendStore(&p);
543 fBlitMaskA8 = p.compile();
544 }
545 if (mask.fFormat == SkMask::kLCD16_Format && !fBlitMaskLCD16) {
546 SkRasterPipeline p(fAlloc);
547 p.extend(fColorPipeline);
548 p.appendClampIfNormalized(fDst.info());
549 if (fBlendMode.has_value() &&
550 SkBlendMode_ShouldPreScaleCoverage(*fBlendMode, /*rgb_coverage=*/true)) {
551 // Somewhat unusually, scale_565 needs dst loaded first.
552 this->appendLoadDst(&p);
553 p.append(SkRasterPipelineOp::scale_565, &fMaskPtr);
554 this->appendClipScale(&p);
555 p.extend(fBlendPipeline);
556 } else {
557 this->appendLoadDst(&p);
558 p.extend(fBlendPipeline);
559 p.append(SkRasterPipelineOp::lerp_565, &fMaskPtr);
560 this->appendClipLerp(&p);
561 }
562 this->appendStore(&p);
563 fBlitMaskLCD16 = p.compile();
564 }
565 if (mask.fFormat == SkMask::k3D_Format && !fBlitMask3D) {
566 SkRasterPipeline p(fAlloc);
567 p.extend(fColorPipeline);
568 // This bit is where we differ from kA8_Format:
569 p.append(SkRasterPipelineOp::emboss, &fEmbossCtx);
570 // Now onward just as kA8.
571 p.appendClampIfNormalized(fDst.info());
572 if (fBlendMode.has_value() &&
573 SkBlendMode_ShouldPreScaleCoverage(*fBlendMode, /*rgb_coverage=*/false)) {
574 p.append(SkRasterPipelineOp::scale_u8, &fMaskPtr);
575 this->appendClipScale(&p);
576 this->appendLoadDst(&p);
577 p.extend(fBlendPipeline);
578 } else {
579 this->appendLoadDst(&p);
580 p.extend(fBlendPipeline);
581 p.append(SkRasterPipelineOp::lerp_u8, &fMaskPtr);
582 this->appendClipLerp(&p);
583 }
584 this->appendStore(&p);
585 fBlitMask3D = p.compile();
586 }
587
588 std::function<void(size_t,size_t,size_t,size_t)>* blitter = nullptr;
589 switch (mask.fFormat) {
590 case SkMask::kA8_Format: blitter = &fBlitMaskA8; break;
591 case SkMask::kLCD16_Format: blitter = &fBlitMaskLCD16; break;
592 case SkMask::k3D_Format: blitter = &fBlitMask3D; break;
593 default:
594 SkASSERT(false);
595 return;
596 }
597
598 SkASSERT(blitter);
599 (*blitter)(clip.left(),clip.top(), clip.width(),clip.height());
600}
SkColor4f color
kUnpremul_SkAlphaType
static sk_sp< Effect > Create()
#define SkASSERT(cond)
Definition SkAssert.h:116
bool SkBlendMode_ShouldPreScaleCoverage(SkBlendMode mode, bool rgb_coverage)
@ kSrcOver
r = s + (1-sa)*d
SkBlenderBase * as_BB(SkBlender *blend)
unsigned U8CPU
Definition SkCPUTypes.h:18
static SkColorFilterBase * as_CFB(SkColorFilter *filter)
SkColorSpace * sk_srgb_singleton()
SkColorType
Definition SkColorType.h:19
@ kR16G16B16A16_unorm_SkColorType
pixel with a little endian uint16_t for red, green, blue
Definition SkColorType.h:50
@ kRGBA_10x6_SkColorType
pixel with 10 used bits (most significant) followed by 6 unused
Definition SkColorType.h:33
@ kR8_unorm_SkColorType
Definition SkColorType.h:54
@ kBGR_101010x_SkColorType
pixel with 10 bits each for blue, green, red; in 32-bit word
Definition SkColorType.h:30
@ kARGB_4444_SkColorType
pixel with 4 bits for alpha, red, green, blue; in 16-bit word
Definition SkColorType.h:23
@ kR8G8_unorm_SkColorType
pixel with a uint8_t for red and green
Definition SkColorType.h:43
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
Definition SkColorType.h:26
@ kA16_unorm_SkColorType
pixel with a little endian uint16_t for alpha
Definition SkColorType.h:48
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
Definition SkColorType.h:38
@ kAlpha_8_SkColorType
pixel with alpha in 8-bit byte
Definition SkColorType.h:21
@ kRGB_101010x_SkColorType
pixel with 10 bits each for red, green, blue; in 32-bit word
Definition SkColorType.h:29
@ kSRGBA_8888_SkColorType
Definition SkColorType.h:53
@ kGray_8_SkColorType
pixel with grayscale level in 8-bit byte
Definition SkColorType.h:35
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
Definition SkColorType.h:22
@ kBGRA_10101010_XR_SkColorType
pixel with 10 bits each for blue, green, red, alpha; in 64-bit word, extended range
Definition SkColorType.h:32
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
Definition SkColorType.h:24
@ kRGB_888x_SkColorType
pixel with 8 bits each for red, green, blue; in 32-bit word
Definition SkColorType.h:25
@ kBGRA_1010102_SkColorType
10 bits for blue, green, red; 2 bits for alpha; in 32-bit word
Definition SkColorType.h:28
@ kA16_float_SkColorType
pixel with a half float for alpha
Definition SkColorType.h:45
@ kRGBA_F32_SkColorType
pixel using C float for red, green, blue, alpha; in 128-bit word
Definition SkColorType.h:40
@ kRGBA_1010102_SkColorType
10 bits for red, green, blue; 2 bits for alpha; in 32-bit word
Definition SkColorType.h:27
@ kBGR_101010x_XR_SkColorType
pixel with 10 bits each for blue, green, red; in 32-bit word, extended range
Definition SkColorType.h:31
@ kR16G16_unorm_SkColorType
pixel with a little endian uint16_t for red and green
Definition SkColorType.h:49
@ kRGBA_F16Norm_SkColorType
pixel with half floats in [0,1] for red, green, blue, alpha;
Definition SkColorType.h:36
@ kUnknown_SkColorType
uninitialized
Definition SkColorType.h:20
@ kR16G16_float_SkColorType
pixel with a half float for red and green
Definition SkColorType.h:46
uint8_t SkAlpha
Definition SkColor.h:26
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
Definition SkPath.cpp:3824
static SkColor4f paint_color_to_dst(const SkPaint &paint, const SkPixmap &dst)
SkBlitter * SkCreateRasterPipelineBlitter(const SkPixmap &dst, const SkPaint &paint, const SkMatrix &ctm, SkArenaAlloc *alloc, sk_sp< SkShader > clipShader, const SkSurfaceProps &props)
static constexpr int SkRasterPipeline_kMaxStride
SkShaderBase * as_SB(SkShader *shader)
auto make(Ctor &&ctor) -> decltype(ctor(nullptr))
virtual std::optional< SkBlendMode > asBlendMode() const
static sk_sp< SkBlender > Mode(SkBlendMode mode)
virtual void blitMask(const SkMask &, const SkIRect &clip)
virtual bool appendStages(const SkStageRec &rec, bool shaderIsOpaque) const =0
bool isAlphaUnchanged() const
static const SkMatrix & I()
SkColorSpace * colorSpace() const
Definition SkPixmap.cpp:61
const SkImageInfo & info() const
Definition SkPixmap.h:135
void blitV(int x, int y, int height, SkAlpha alpha) override
Blit a vertical run of pixels with a constant alpha value.
SkRasterPipelineBlitter(SkPixmap dst, SkArenaAlloc *alloc)
static SkBlitter * Create(const SkPixmap &dst, const SkPaint &paint, const SkColor4f &dstPaintColor, SkArenaAlloc *alloc, const SkRasterPipeline &shaderPipeline, bool is_opaque, bool is_constant, const SkShader *clipShader)
void blitAntiH(int x, int y, const SkAlpha[], const int16_t[]) override
void blitH(int x, int y, int w) override
Blit a horizontal run of one or more pixels.
void blitMask(const SkMask &, const SkIRect &clip) override
void blitAntiV2(int x, int y, U8CPU a0, U8CPU a1) override
void blitRect(int x, int y, int width, int height) override
Blit a solid rectangle one or more pixels wide.
void blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) override
void append(SkRasterPipelineOp, void *=nullptr)
void appendConstantColor(SkArenaAlloc *, const float rgba[4])
bool appendRootStages(const SkStageRec &rec, const SkMatrix &ctm) const
T * get() const
Definition SkRefCnt.h:303
const Paint & paint
double y
double x
constexpr SkColor4f kBlack
Definition SkColor.h:435
void(* rect_memset32)(uint32_t[], uint32_t, int, size_t, int)
void(* rect_memset16)(uint16_t[], uint16_t, int, size_t, int)
void(* rect_memset64)(uint64_t[], uint64_t, int, size_t, int)
Definition run.py:1
Definition ref_ptr.h:256
SkScalar w
SkScalar h
int32_t height
int32_t width
void apply(float rgba[4]) const
constexpr int32_t top() const
Definition SkRect.h:120
constexpr int32_t left() const
Definition SkRect.h:113
SkAlphaType alphaType() const
SkColorType colorType() const
const uint32_t fRowBytes
Definition SkMask.h:43
@ k3D_Format
3 8bit per pixl planes: alpha, mul, add
Definition SkMask.h:29
@ kA8_Format
8bits per pixel mask (e.g. antialiasing)
Definition SkMask.h:28
@ kLCD16_Format
565 alpha for r/g/b
Definition SkMask.h:31
@ kBW_Format
1bit per pixel mask (e.g. monochrome)
Definition SkMask.h:27
uint8_t const *const fImage
Definition SkMask.h:41
const SkIRect fBounds
Definition SkMask.h:42
size_t computeImageSize() const
Definition SkMask.cpp:30
const Format fFormat
Definition SkMask.h:44