Flutter Engine
The Flutter Engine
SkCoreBlitters.h
Go to the documentation of this file.
1/*
2 * Copyright 2006 The Android Open Source Project
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
8#ifndef SkCoreBlitters_DEFINED
9#define SkCoreBlitters_DEFINED
10
17#include "src/core/SkBlitRow.h"
18#include "src/core/SkBlitter.h"
20
21#include <cstdint>
22
23class SkArenaAlloc;
24class SkMatrix;
26class SkShader;
27class SkSurfaceProps;
28struct SkIRect;
29struct SkMask;
30
31class SkRasterBlitter : public SkBlitter {
32public:
34
35protected:
37
38private:
39 using INHERITED = SkBlitter;
40};
41
43public:
44 /**
45 * The storage for shaderContext is owned by the caller, but the object itself is not.
46 * The blitter only ensures that the storage always holds a live object, but it may
47 * exchange that object.
48 */
50 SkShaderBase::Context* shaderContext);
51 ~SkShaderBlitter() override;
52
53protected:
56
57private:
58 // illegal
59 SkShaderBlitter& operator=(const SkShaderBlitter&);
60
62};
63
64///////////////////////////////////////////////////////////////////////////////
65
67public:
69 void blitH(int x, int y, int width) override;
70 void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[]) override;
71 void blitV(int x, int y, int height, SkAlpha alpha) override;
72 void blitRect(int x, int y, int width, int height) override;
73 void blitMask(const SkMask&, const SkIRect&) override;
74 void blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) override;
75 void blitAntiV2(int x, int y, U8CPU a0, U8CPU a1) override;
76
77protected:
80
81private:
82 unsigned fSrcA, fSrcR, fSrcG, fSrcB;
83
84 // illegal
85 SkARGB32_Blitter& operator=(const SkARGB32_Blitter&);
86
88};
89
91public:
93 : INHERITED(device, paint) { SkASSERT(paint.getAlpha() == 0xFF); }
94 void blitMask(const SkMask&, const SkIRect&) override;
95 void blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) override;
96 void blitAntiV2(int x, int y, U8CPU a0, U8CPU a1) override;
97
98private:
99 using INHERITED = SkARGB32_Blitter;
100};
101
103public:
105 : INHERITED(device, paint) {}
106 void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[]) override;
107 void blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) override;
108 void blitAntiV2(int x, int y, U8CPU a0, U8CPU a1) override;
109
110private:
111 using INHERITED = SkARGB32_Opaque_Blitter;
112};
113
115public:
117 SkShaderBase::Context* shaderContext);
118 ~SkARGB32_Shader_Blitter() override;
119 void blitH(int x, int y, int width) override;
120 void blitV(int x, int y, int height, SkAlpha alpha) override;
121 void blitRect(int x, int y, int width, int height) override;
122 void blitAntiH(int x, int y, const SkAlpha[], const int16_t[]) override;
123 void blitMask(const SkMask&, const SkIRect&) override;
124
125private:
126 SkPMColor* fBuffer;
127 SkBlitRow::Proc32 fProc32;
128 SkBlitRow::Proc32 fProc32Blend;
129 bool fShadeDirectlyIntoDevice;
130
131 // illegal
133
135};
136
137///////////////////////////////////////////////////////////////////////////////////////////////////
138
140 const SkPaint&,
141 const SkMatrix& ctm,
143 sk_sp<SkShader> clipShader,
144 const SkSurfaceProps& props);
145// Use this if you've pre-baked a shader pipeline, including modulating with paint alpha.
147 const SkRasterPipeline& shaderPipeline,
148 bool shader_is_opaque,
149 SkArenaAlloc*, sk_sp<SkShader> clipShader);
150
151#endif
#define SkASSERT(cond)
Definition: SkAssert.h:116
unsigned U8CPU
Definition: SkCPUTypes.h:18
uint32_t SkColor
Definition: SkColor.h:37
uint8_t SkAlpha
Definition: SkColor.h:26
uint32_t SkPMColor
Definition: SkColor.h:205
SkBlitter * SkCreateRasterPipelineBlitter(const SkPixmap &, const SkPaint &, const SkMatrix &ctm, SkArenaAlloc *, sk_sp< SkShader > clipShader, const SkSurfaceProps &props)
void blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) override
SkARGB32_Black_Blitter(const SkPixmap &device, const SkPaint &paint)
void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[]) override
void blitAntiV2(int x, int y, U8CPU a0, U8CPU a1) override
void blitMask(const SkMask &, const SkIRect &) override
SkPMColor fPMColor
void blitRect(int x, int y, int width, int height) override
Blit a solid rectangle one or more pixels wide.
SkARGB32_Blitter(const SkPixmap &device, const SkPaint &paint)
void blitH(int x, int y, int width) override
Blit a horizontal run of one or more pixels.
void blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) override
void blitV(int x, int y, int height, SkAlpha alpha) override
Blit a vertical run of pixels with a constant alpha value.
void blitAntiV2(int x, int y, U8CPU a0, U8CPU a1) override
void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[]) override
void blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) override
void blitMask(const SkMask &, const SkIRect &) override
void blitAntiV2(int x, int y, U8CPU a0, U8CPU a1) override
SkARGB32_Opaque_Blitter(const SkPixmap &device, const SkPaint &paint)
void blitRect(int x, int y, int width, int height) override
Blit a solid rectangle one or more pixels wide.
SkARGB32_Shader_Blitter(const SkPixmap &device, const SkPaint &paint, SkShaderBase::Context *shaderContext)
void blitMask(const SkMask &, const SkIRect &) override
void blitH(int x, int y, int width) override
Blit a horizontal run of one or more pixels.
void blitAntiH(int x, int y, const SkAlpha[], const int16_t[]) override
void blitV(int x, int y, int height, SkAlpha alpha) override
Blit a vertical run of pixels with a constant alpha value.
void(* Proc32)(uint32_t dst[], const SkPMColor src[], int count, U8CPU alpha)
Definition: SkBlitRow.h:27
SkRasterBlitter(const SkPixmap &device)
const SkPixmap fDevice
SkShaderBase::Context * fShaderContext
~SkShaderBlitter() override
sk_sp< SkShader > fShader
SkShaderBlitter(const SkPixmap &device, const SkPaint &paint, SkShaderBase::Context *shaderContext)
Definition: SkBlitter.cpp:790
const Paint & paint
Definition: color_source.cc:38
VkDevice device
Definition: main.cc:53
double y
double x
int32_t height
int32_t width
Definition: SkRect.h:32
Definition: SkMask.h:25