66 for (
int i = 0;
i < (
int)
ops.size();
i++) {
78 for (
int i = 0;
i < record.
count();
i++) {
93template <>
void Draw::draw(
const NoOp&) {}
95#define DRAW(T, call) template <> void Draw::draw(const T& r) { fCanvas->call; }
96DRAW(Restore, restore())
108template <>
void Draw::draw(
const SaveBehind& r) {
112template <>
void Draw::draw(
const DrawBehind& r) {
116DRAW(SetMatrix, setMatrix(fInitialCTM.asM33() * r.matrix))
117DRAW(SetM44, setMatrix(fInitialCTM * r.
matrix))
120DRAW(Translate, translate(r.
dx, r.dy))
127DRAW(ClipShader, clipShader(r.shader, r.op))
129template <>
void Draw::
draw(const ResetClip& r) {
133DRAW(DrawArc, drawArc(r.oval, r.startAngle, r.sweepAngle, r.useCenter, r.paint))
134DRAW(DrawDRRect, drawDRRect(r.outer, r.inner, r.
paint))
137template <>
void Draw::
draw(const DrawImageLattice& r) {
143 lattice.
fRectTypes = (0 == r.flagCount) ?
nullptr : r.flags;
144 lattice.
fColors = (0 == r.flagCount) ? nullptr : r.colors;
146 fCanvas->drawImageLattice(r.image.get(), lattice, r.dst, r.filter, r.paint);
149DRAW(
DrawImageRect, drawImageRect(r.image.get(), r.src, r.dst, r.sampling, r.paint, r.constraint))
153DRAW(DrawPatch, drawPatch(r.cubics, r.
colors, r.texCoords, r.bmode, r.
paint))
163DRAW(DrawVertices, drawVertices(r.vertices, r.bmode, r.
paint))
165DRAW(DrawShadowRec, private_draw_shadow_rec(r.
path, r.rec))
175template <>
void Draw::draw(
const DrawDrawable& r) {
179 SkASSERT(
nullptr == fDrawablePicts);
182 fCanvas->
drawPicture(fDrawablePicts[r.index], r.matrix,
nullptr);
208 : fCullRect(cullRect)
220 while (!fSaveStack.
empty()) {
221 this->popSaveBlock();
225 while (!fControlIndices.
empty()) {
226 this->popControl(fCullRect);
235 this->trackBounds(op);
253 if (!this->adjustForSaveLayerPaints(&
rect)) {
262 if (!
rect.intersect(fCullRect)) {
278 template <
typename T>
void updateCTM(
const T&) {}
279 void updateCTM(
const Restore& op) { fCTM = op.matrix; }
280 void updateCTM(
const SetMatrix& op) { fCTM = op.matrix; }
281 void updateCTM(
const SetM44& op) { fCTM = op.matrix.asM33(); }
282 void updateCTM(
const Concat44& op) { fCTM.
preConcat(op.matrix.asM33()); }
284 void updateCTM(
const Scale& op) { fCTM.
preScale(op.sx, op.sy); }
285 void updateCTM(
const Translate& op) { fCTM.
preTranslate(op.dx, op.dy); }
289 void trackBounds(
const Save&) { this->pushSaveBlock(
nullptr); }
290 void trackBounds(
const SaveLayer& op) { this->pushSaveBlock(op.paint); }
291 void trackBounds(
const SaveBehind&) { this->pushSaveBlock(
nullptr); }
292 void trackBounds(
const Restore&) {
293 const bool isSaveLayer = fSaveStack.
back().paint !=
nullptr;
294 fBounds[fCurrentOp] = this->popSaveBlock();
295 fMeta [fCurrentOp].
isDraw = isSaveLayer;
298 void trackBounds(
const SetMatrix&) { this->pushControl(); }
299 void trackBounds(
const SetM44&) { this->pushControl(); }
300 void trackBounds(
const Concat&) { this->pushControl(); }
301 void trackBounds(
const Concat44&) { this->pushControl(); }
302 void trackBounds(
const Scale&) { this->pushControl(); }
303 void trackBounds(
const Translate&) { this->pushControl(); }
304 void trackBounds(
const ClipRect&) { this->pushControl(); }
305 void trackBounds(
const ClipRRect&) { this->pushControl(); }
306 void trackBounds(
const ClipPath&) { this->pushControl(); }
307 void trackBounds(
const ClipRegion&) { this->pushControl(); }
308 void trackBounds(
const ClipShader&) { this->pushControl(); }
309 void trackBounds(
const ResetClip&) { this->pushControl(); }
313 template <
typename T>
void trackBounds(
const T& op) {
314 fBounds[fCurrentOp] = this->bounds(op);
315 fMeta [fCurrentOp].
isDraw =
true;
316 this->updateSaveBounds(fBounds[fCurrentOp]);
334 static bool PaintMayAffectTransparentBlack(
const SkPaint*
paint) {
337 if ((
paint->getImageFilter() &&
339 (
paint->getColorFilter() &&
343 const auto bm =
paint->asBlendMode();
353 switch (bm.value()) {
375 SaveBounds sb = fSaveStack.
back();
378 while (sb.controlOps --> 0) {
379 this->popControl(sb.bounds);
383 this->updateSaveBounds(sb.bounds);
391 if (!fSaveStack.
empty()) {
392 fSaveStack.
back().controlOps++;
396 void popControl(
const Bounds& bounds) {
398 fMeta [fControlIndices.
back()].
isDraw =
false;
402 void updateSaveBounds(
const Bounds& bounds) {
404 if (!fSaveStack.
empty()) {
405 fSaveStack.
back().bounds.join(bounds);
409 Bounds bounds(
const DrawPaint&)
const {
return fCullRect; }
410 Bounds bounds(
const DrawBehind&)
const {
return fCullRect; }
440 return op.path.isInverseFillType() ? fCullRect
459 return this->
adjustAndMap(op.vertices->bounds(), &op.paint);
482 op.matrix.mapRect(&
dst);
493 SkRect dst = op.slug->sourceBoundsWithOrigin();
507 bounds.setBounds(op.clip, 4);
514 for (
int i = 0;
i < op.count; ++
i) {
516 if (op.set[
i].fHasClip) {
517 entryBounds.
setBounds(op.dstClips + clipIndex, 4);
520 if (op.set[
i].fMatrixIndex >= 0) {
521 op.preViewMatrices[op.set[
i].fMatrixIndex].mapRect(&entryBounds);
532 if (
paint->canComputeFastBounds()) {
541 bool adjustForSaveLayerPaints(
SkRect*
rect,
int savesToIgnore = 0)
const {
542 for (
int i = fSaveStack.
size() - 1 - savesToIgnore;
i >= 0;
i--) {
544 if (!fSaveStack[
i].ctm.invert(&inverse)) {
548 if (!AdjustForPaint(fSaveStack[
i].
paint,
rect)) {
551 fSaveStack[
i].ctm.mapRect(
rect);
581 for (
int i = 0;
i < record.
count();
i++) {
@ kDstATop
r = d*sa + s*(1-da)
static SkColorFilterBase * as_CFB(SkColorFilter *filter)
static SkImageFilter_Base * as_IFB(SkImageFilter *filter)
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
void SkRecordFillBounds(const SkRect &cullRect, const SkRecord &record, SkRect bounds[], SkBBoxHierarchy::Metadata meta[])
void SkRecordDraw(const SkRecord &record, SkCanvas *canvas, SkPicture const *const drawablePicts[], SkDrawable *const drawables[], int drawableCount, const SkBBoxHierarchy *bbh, SkPicture::AbortCallback *callback)
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
virtual void search(const SkRect &query, std::vector< int > *results) const =0
static void ResetClip(SkCanvas *canvas)
static void DrawBehind(SkCanvas *canvas, const SkPaint &paint)
static int SaveBehind(SkCanvas *canvas, const SkRect *subset)
SkRect getLocalClipBounds() const
void drawDrawable(SkDrawable *drawable, const SkMatrix *matrix=nullptr)
void drawPicture(const SkPicture *picture)
bool affectsTransparentBlack() const
bool affectsTransparentBlack() const
static const SkMatrix & I()
SkMatrix & preTranslate(SkScalar dx, SkScalar dy)
SkMatrix & preConcat(const SkMatrix &other)
SkMatrix & preScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
bool mapRect(SkRect *dst, const SkRect &src, SkApplyPerspectiveClip pc=SkApplyPerspectiveClip::kYes) const
auto visit(int i, F &&f) const -> decltype(f(SkRecords::NoOp()))
FillBounds(const SkRect &cullRect, const SkRecord &record, SkRect bounds[], SkBBoxHierarchy::Metadata meta[])
void setCurrentOp(int currentOp)
void operator()(const T &op)
Bounds adjustAndMap(SkRect rect, const SkPaint *paint) const
void push_back(const T &v)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
static float max(float r, float g, float b)
static void drawPath(SkPath &path, SkCanvas *canvas, SkColor color, const SkRect &clip, SkPaint::Cap cap, SkPaint::Join join, SkPaint::Style style, SkPathFillType fill, SkScalar strokeWidth)
void GetLocalBounds(const SkPath &path, const SkDrawShadowRec &rec, const SkMatrix &ctm, SkRect *bounds)
skia_private::AutoTArray< SkCanvas::ImageSetEntry > set
DRAW(SaveLayer, saveLayer(SkCanvasPriv::ScaledBackdropLayer(r.bounds, r.paint, r.backdrop.get(), r.backdropScale, r.saveLayerFlags, SkCanvas::FilterSpan{const_cast< sk_sp< SkImageFilter > * >(r.filters.data()), r.filters.size()}))) template<> void Draw
experimental_DrawEdgeAAImageSet(r.set.get(), r.count, r.dstClips, r.preViewMatrices, r.sampling, r.paint, r.constraint)) template<> void Draw
clipRRect(r.rrect, r.opAA.op(), r.opAA.aa())) DRAW(ClipRect
SkCanvas::SaveLayerFlags saveLayerFlags
drawTextBlob(r.blob.get(), r.x, r.y, r.paint)) DRAW(DrawSlug
sk_sp< const SkImage > atlas
unsigned useCenter Optional< SkMatrix > matrix
drawSlug(r.slug.get(), r.paint)) DRAW(DrawAtlas
Optional< SkRect > bounds
clipRect(r.rect, r.opAA.op(), r.opAA.aa())) template<> void Draw
PODArray< SkPoint > dstClips
drawAnnotation(r.rect, r.key.c_str(), r.value.get())) DRAW(DrawEdgeAAQuad
sk_sp< const SkImage > image
ClipOpAndAA opAA SkRegion region
sk_sp< const SkPicture > picture
clipPath(r.path, r.opAA.op(), r.opAA.aa())) DRAW(ClipRRect
sk_sp< const SkImageFilter > backdrop
experimental_DrawEdgeAAQuad(r.rect, r.clip, r.aa, r.color, r.mode)) DRAW(DrawEdgeAAImageSet
drawPicture(r.picture.get(), &r.matrix, r.paint)) DRAW(DrawTextBlob
PODArray< SkRSXform > xforms
sk_sp< SkBlender > blender SkRect rect
PODArray< SkMatrix > preViewMatrices
drawAtlas(r.atlas.get(), r.xforms, r.texs, r.colors, r.count, r.mode, r.sampling, r.cull, r.paint)) DRAW(DrawAnnotation
PODArray< SkColor > colors
SkSamplingOptions sampling
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
Optional< SkPaint > paint
void DrawImage(SkCanvas *canvas, const SkImage *image, SkScalar x, SkScalar y, const SkSamplingOptions &sampling={}, const SkPaint *paint=nullptr, SkCanvas::SrcRectConstraint constraint=SkCanvas::kFast_SrcRectConstraint)
SK_API void DrawImageRect(SkCanvas *canvas, const SkImage *image, const SkRect &src, const SkRect &dst, const SkSamplingOptions &sampling={}, const SkPaint *paint=nullptr, SkCanvas::SrcRectConstraint constraint=SkCanvas::kFast_SrcRectConstraint)
static const char * Concat(const char *a, const char *b)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
const myers::Point & get(const myers::Segment &)
skgpu::graphite::DrawAtlas DrawAtlas
int fYCount
number of y-coordinates
const SkIRect * fBounds
source bounds to draw from
const int * fYDivs
y-axis values dividing bitmap
int fXCount
number of x-coordinates
const RectType * fRectTypes
array of fill types
const SkColor * fColors
array of colors
const int * fXDivs
x-axis values dividing bitmap
static SkRect Make(const SkISize &size)
static constexpr SkRect MakeEmpty()
void outset(float dx, float dy)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
void offset(float dx, float dy)
void setBounds(const SkPoint pts[], int count)
void set(const SkIRect &src)