Flutter Engine
The Flutter Engine
Classes | Namespaces | Macros | Functions
SkRecordDraw.cpp File Reference
#include "src/core/SkRecordDraw.h"
#include "include/core/SkBBHFactory.h"
#include "include/core/SkBlendMode.h"
#include "include/core/SkBlender.h"
#include "include/core/SkImage.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkMesh.h"
#include "include/core/SkPaint.h"
#include "include/core/SkRRect.h"
#include "include/core/SkRect.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkRegion.h"
#include "include/core/SkScalar.h"
#include "include/core/SkShader.h"
#include "include/core/SkString.h"
#include "include/core/SkTextBlob.h"
#include "include/core/SkVertices.h"
#include "include/private/base/SkAssert.h"
#include "include/private/base/SkPoint_impl.h"
#include "include/private/base/SkTDArray.h"
#include "include/private/base/SkTemplates.h"
#include "include/private/chromium/Slug.h"
#include "src/core/SkCanvasPriv.h"
#include "src/core/SkDrawShadowInfo.h"
#include "src/core/SkImageFilter_Base.h"
#include "src/core/SkRecord.h"
#include "src/core/SkRecords.h"
#include "src/effects/colorfilters/SkColorFilterBase.h"
#include "src/utils/SkPatchUtils.h"
#include <algorithm>
#include <optional>
#include <vector>

Go to the source code of this file.

Classes

class  SkRecords::FillBounds
 

Namespaces

namespace  SkRecords
 

Macros

#define DRAW(T, call)   template <> void Draw::draw(const T& r) { fCanvas->call; }
 

Functions

void SkRecordDraw (const SkRecord &record, SkCanvas *canvas, SkPicture const *const drawablePicts[], SkDrawable *const drawables[], int drawableCount, const SkBBoxHierarchy *bbh, SkPicture::AbortCallback *callback)
 
 SkRecords::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
 
 SkRecords::DRAW (SetMatrix, setMatrix(fInitialCTM.asM33() *r.matrix)) DRAW(ClipPath
 
 SkRecords::clipPath (r.path, r.opAA.op(), r.opAA.aa())) DRAW(ClipRRect
 
 SkRecords::clipRRect (r.rrect, r.opAA.op(), r.opAA.aa())) DRAW(ClipRect
 
 SkRecords::clipRect (r.rect, r.opAA.op(), r.opAA.aa())) template<> void Draw
 
 SkRecords::DRAW (DrawImage, drawImage(r.image.get(), r.left, r.top, r.sampling, r.paint)) template<> void Draw
 
 SkRecords::DRAW (DrawImageRect, drawImageRect(r.image.get(), r.src, r.dst, r.sampling, r.paint, r.constraint)) DRAW(DrawPicture
 
 SkRecords::drawPicture (r.picture.get(), &r.matrix, r.paint)) DRAW(DrawTextBlob
 
 SkRecords::drawTextBlob (r.blob.get(), r.x, r.y, r.paint)) DRAW(DrawSlug
 
 SkRecords::drawSlug (r.slug.get(), r.paint)) DRAW(DrawAtlas
 
 SkRecords::drawAtlas (r.atlas.get(), r.xforms, r.texs, r.colors, r.count, r.mode, r.sampling, r.cull, r.paint)) DRAW(DrawAnnotation
 
 SkRecords::drawAnnotation (r.rect, r.key.c_str(), r.value.get())) DRAW(DrawEdgeAAQuad
 
 SkRecords::experimental_DrawEdgeAAQuad (r.rect, r.clip, r.aa, r.color, r.mode)) DRAW(DrawEdgeAAImageSet
 
 SkRecords::experimental_DrawEdgeAAImageSet (r.set.get(), r.count, r.dstClips, r.preViewMatrices, r.sampling, r.paint, r.constraint)) template<> void Draw
 
void SkRecordFillBounds (const SkRect &cullRect, const SkRecord &record, SkRect bounds[], SkBBoxHierarchy::Metadata meta[])
 

Macro Definition Documentation

◆ DRAW

#define DRAW (   T,
  call 
)    template <> void Draw::draw(const T& r) { fCanvas->call; }

Definition at line 95 of file SkRecordDraw.cpp.

Function Documentation

◆ SkRecordDraw()

void SkRecordDraw ( const SkRecord record,
SkCanvas canvas,
SkPicture const *const  drawablePicts[],
SkDrawable *const  drawables[],
int  drawableCount,
const SkBBoxHierarchy bbh,
SkPicture::AbortCallback callback 
)

Definition at line 45 of file SkRecordDraw.cpp.

51 {
52 SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/);
53
54 if (bbh) {
55 // Draw only ops that affect pixels in the canvas's current clip.
56 // The SkRecord and BBH were recorded in identity space. This canvas
57 // is not necessarily in that same space. getLocalClipBounds() returns us
58 // this canvas' clip bounds transformed back into identity space, which
59 // lets us query the BBH.
60 SkRect query = canvas->getLocalClipBounds();
61
62 std::vector<int> ops;
63 bbh->search(query, &ops);
64
65 SkRecords::Draw draw(canvas, drawablePicts, drawables, drawableCount);
66 for (int i = 0; i < (int)ops.size(); i++) {
67 if (callback && callback->abort()) {
68 return;
69 }
70 // This visit call uses the SkRecords::Draw::operator() to call
71 // methods on the |canvas|, wrapped by methods defined with the
72 // DRAW() macro.
73 record.visit(ops[i], draw);
74 }
75 } else {
76 // Draw all ops.
77 SkRecords::Draw draw(canvas, drawablePicts, drawables, drawableCount);
78 for (int i = 0; i < record.count(); i++) {
79 if (callback && callback->abort()) {
80 return;
81 }
82 // This visit call uses the SkRecords::Draw::operator() to call
83 // methods on the |canvas|, wrapped by methods defined with the
84 // DRAW() macro.
85 record.visit(i, draw);
86 }
87 }
88}
SkPathOp ops[]
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
virtual void search(const SkRect &query, std::vector< int > *results) const =0
SkRect getLocalClipBounds() const
Definition: SkCanvas.cpp:1586
auto visit(int i, F &&f) const -> decltype(f(SkRecords::NoOp()))
Definition: SkRecord.h:45
int count() const
Definition: SkRecord.h:38
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback

◆ SkRecordFillBounds()

void SkRecordFillBounds ( const SkRect cullRect,
const SkRecord record,
SkRect  bounds[],
SkBBoxHierarchy::Metadata  meta[] 
)

Definition at line 577 of file SkRecordDraw.cpp.

578 {
579 {
580 SkRecords::FillBounds visitor(cullRect, record, bounds, meta);
581 for (int i = 0; i < record.count(); i++) {
582 visitor.setCurrentOp(i);
583 record.visit(i, visitor);
584 }
585 }
586}
Optional< SkRect > bounds
Definition: SkRecords.h:189