48 static constexpr float kIncrementAlpha[] = {
49 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
50 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
51 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
52 0.0f, 0.0f, 0.0f, 0.0f, 1.0f/255,
65 fOverdrawCanvas{overdrawCanvas},
66 fPainter{props, kN32_SkColorType, nullptr} {}
69 for (
auto [glyph,
pos] : accepted) {
73 fOverdrawCanvas->save();
74 fOverdrawCanvas->resetMatrix();
76 fOverdrawCanvas->restore();
83 void onDrawGlyphRunList(
SkCanvas* canvas,
87 fPainter.drawForBitmapDevice(
88 canvas,
this, glyphRunList,
paint, fOverdrawCanvas->getTotalMatrix());
108 TextDevice
device{
this, props};
110 device.drawGlyphRunList(
this, glyphRunList,
paint);
116 fList[0]->onDrawPatch(cubics, colors, texCoords, blendMode, fPaint);
120 if (0 ==
paint.getColor() && !
paint.getColorFilter() && !
paint.getShader()) {
123 fList[0]->onDrawPaint(this->overdrawPaint(
paint));
128 fList[0]->onDrawBehind(this->overdrawPaint(
paint));
132 fList[0]->onDrawRect(rect, this->overdrawPaint(
paint));
136 fList[0]->onDrawRegion(region, this->overdrawPaint(
paint));
140 fList[0]->onDrawOval(oval, this->overdrawPaint(
paint));
145 fList[0]->onDrawArc(arc, startAngle, sweepAngle, useCenter, this->overdrawPaint(
paint));
150 fList[0]->onDrawDRRect(outer, inner, this->overdrawPaint(
paint));
154 fList[0]->onDrawRRect(rect, this->overdrawPaint(
paint));
164 fList[0]->onDrawVerticesObject(vertices, blendMode, this->overdrawPaint(
paint));
174 storage = this->overdrawPaint(*
paint);
178 fList[0]->onDrawAtlas2(
image, xform, texs, colors,
count, mode, sampling, cull, paintPtr);
182 fList[0]->onDrawPath(path, fPaint);
192 fList[0]->onDrawRect(dst, fPaint);
198 Lattice latticePlusBounds = lattice;
199 if (!latticePlusBounds.
fBounds) {
201 latticePlusBounds.
fBounds = &bounds;
208 while (iter.
next(&ignored, &iterDst)) {
209 fList[0]->onDrawRect(iterDst, fPaint);
212 fList[0]->onDrawRect(dst, fPaint);
217 drawable->
draw(
this, matrix);
229 fList[0]->onDrawRect(bounds, fPaint);
237 fList[0]->onDrawRect(rect, fPaint);
248 for (
int i = 0; i <
count; ++i) {
249 if (set[i].fMatrixIndex >= 0) {
251 fList[0]->concat(preViewMatrices[set[i].fMatrixIndex]);
253 if (set[i].fHasClip) {
257 fList[0]->onDrawRect(set[i].fDstRect, fPaint);
259 if (set[i].fMatrixIndex >= 0) {
static const int points[]
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
bool getProps(SkSurfaceProps *props) const
friend class SkOverdrawCanvas
SkMatrix getTotalMatrix() const
static sk_sp< SkColorFilter > Matrix(const SkColorMatrix &)
void draw(SkCanvas *, const SkMatrix *=nullptr)
bool next(SkIRect *src, SkRect *dst, bool *isFixedColor=nullptr, SkColor *fixedColor=nullptr)
static bool Valid(int imageWidth, int imageHeight, const SkCanvas::Lattice &lattice)
virtual void addCanvas(SkCanvas *)
SkTDArray< SkCanvas * > fList
void onDrawImage2(const SkImage *, SkScalar, SkScalar, const SkSamplingOptions &, const SkPaint *) override
void onDrawTextBlob(const SkTextBlob *, SkScalar, SkScalar, const SkPaint &) override
void onDrawAnnotation(const SkRect &, const char key[], SkData *value) override
void onDrawImageRect2(const SkImage *, const SkRect &, const SkRect &, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint) override
void onDrawImageLattice2(const SkImage *, const Lattice &, const SkRect &, SkFilterMode, const SkPaint *) override
void onDrawOval(const SkRect &, const SkPaint &) override
void onDrawPoints(PointMode, size_t, const SkPoint[], const SkPaint &) override
void onDrawPath(const SkPath &, const SkPaint &) override
void onDrawRRect(const SkRRect &, const SkPaint &) override
void onDrawPatch(const SkPoint[12], const SkColor[4], const SkPoint[4], SkBlendMode, const SkPaint &) override
void onDrawShadowRec(const SkPath &, const SkDrawShadowRec &) override
void onDrawEdgeAAImageSet2(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[], const SkSamplingOptions &, const SkPaint *, SrcRectConstraint) override
void onDrawVerticesObject(const SkVertices *, SkBlendMode, const SkPaint &) override
void onDrawGlyphRunList(const sktext::GlyphRunList &glyphRunList, const SkPaint &paint) override
void onDrawRegion(const SkRegion &, const SkPaint &) override
void onDrawEdgeAAQuad(const SkRect &, const SkPoint[4], SkCanvas::QuadAAFlags, const SkColor4f &, SkBlendMode) override
void onDrawArc(const SkRect &, SkScalar, SkScalar, bool, const SkPaint &) override
void onDrawPaint(const SkPaint &) override
void onDrawRect(const SkRect &, const SkPaint &) override
void onDrawDrawable(SkDrawable *, const SkMatrix *) override
void onDrawPicture(const SkPicture *, const SkMatrix *, const SkPaint *) override
void onDrawDRRect(const SkRRect &, const SkRRect &, const SkPaint &) override
void onDrawBehind(const SkPaint &paint) override
void onDrawAtlas2(const SkImage *, const SkRSXform[], const SkRect[], const SkColor[], int, SkBlendMode, const SkSamplingOptions &, const SkRect *, const SkPaint *) override
void setStyle(Style style)
void setAntiAlias(bool aa)
void setBlendMode(SkBlendMode mode)
void setColorFilter(sk_sp< SkColorFilter > colorFilter)
void setStrokeWidth(SkScalar width)
static SkPath Polygon(const SkPoint pts[], int count, bool isClosed, SkPathFillType=SkPathFillType::kWinding, bool isVolatile=false)
const GlyphRunList & blobToGlyphRunList(const SkTextBlob &blob, SkPoint origin)
void GetLocalBounds(const SkPath &path, const SkDrawShadowRec &rec, const SkMatrix &ctm, SkRect *bounds)
const SkIRect * fBounds
source bounds to draw from
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
static SkRect Make(const SkISize &size)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)