Flutter Engine
The Flutter Engine
Classes | Public Types | Public Member Functions | List of all members
flutter::testing::MockCanvas Class Referencefinal

#include <mock_canvas.h>

Inheritance diagram for flutter::testing::MockCanvas:
flutter::DlCanvas

Classes

struct  ClipPathData
 
struct  ClipRectData
 
struct  ClipRRectData
 
struct  ConcatMatrixData
 
struct  DrawCall
 
struct  DrawDisplayListData
 
struct  DrawImageData
 
struct  DrawImageDataNoPaint
 
struct  DrawPaintData
 
struct  DrawPathData
 
struct  DrawRectData
 
struct  DrawShadowData
 
struct  DrawTextData
 
struct  RestoreData
 
struct  SaveData
 
struct  SaveLayerData
 
struct  SetMatrixData
 

Public Types

enum  ClipEdgeStyle { kHardClipEdgeStyle , kSoftClipEdgeStyle }
 
using DrawCallData = std::variant< SaveData, SaveLayerData, RestoreData, ConcatMatrixData, SetMatrixData, DrawRectData, DrawPathData, DrawTextData, DrawImageDataNoPaint, DrawImageData, DrawDisplayListData, DrawShadowData, ClipRectData, ClipRRectData, ClipPathData, DrawPaintData >
 
- Public Types inherited from flutter::DlCanvas
enum class  ClipOp { kDifference , kIntersect }
 
enum class  PointMode { kPoints , kLines , kPolygon }
 
enum class  SrcRectConstraint { kStrict , kFast }
 

Public Member Functions

 MockCanvas ()
 
 MockCanvas (int width, int height)
 
 ~MockCanvas ()
 
const std::vector< DrawCall > & draw_calls () const
 
void reset_draw_calls ()
 
SkISize GetBaseLayerSize () const override
 
SkImageInfo GetImageInfo () const override
 
void Save () override
 
void SaveLayer (const SkRect *bounds, const DlPaint *paint=nullptr, const DlImageFilter *backdrop=nullptr) override
 
void Restore () override
 
int GetSaveCount () const
 
void RestoreToCount (int restore_count)
 
void Transform2DAffine (SkScalar mxx, SkScalar mxy, SkScalar mxt, SkScalar myx, SkScalar myy, SkScalar myt) override
 
void TransformFullPerspective (SkScalar mxx, SkScalar mxy, SkScalar mxz, SkScalar mxt, SkScalar myx, SkScalar myy, SkScalar myz, SkScalar myt, SkScalar mzx, SkScalar mzy, SkScalar mzz, SkScalar mzt, SkScalar mwx, SkScalar mwy, SkScalar mwz, SkScalar mwt) override
 
void Translate (SkScalar tx, SkScalar ty) override
 
void Scale (SkScalar sx, SkScalar sy) override
 
void Rotate (SkScalar degrees) override
 
void Skew (SkScalar sx, SkScalar sy) override
 
void TransformReset () override
 
void Transform (const SkMatrix *matrix) override
 
void Transform (const SkM44 *matrix44) override
 
void SetTransform (const SkMatrix *matrix) override
 
void SetTransform (const SkM44 *matrix44) override
 
SkM44 GetTransformFullPerspective () const override
 
SkMatrix GetTransform () const override
 
void ClipRect (const SkRect &rect, ClipOp clip_op, bool is_aa) override
 
void ClipRRect (const SkRRect &rrect, ClipOp clip_op, bool is_aa) override
 
void ClipPath (const SkPath &path, ClipOp clip_op, bool is_aa) override
 
SkRect GetDestinationClipBounds () const override
 
SkRect GetLocalClipBounds () const override
 
bool QuickReject (const SkRect &bounds) const override
 
void DrawPaint (const DlPaint &paint) override
 
void DrawColor (DlColor color, DlBlendMode mode) override
 
void DrawLine (const SkPoint &p0, const SkPoint &p1, const DlPaint &paint) override
 
void DrawDashedLine (const DlPoint &p0, const DlPoint &p1, DlScalar on_length, DlScalar off_length, const DlPaint &paint) override
 
void DrawRect (const SkRect &rect, const DlPaint &paint) override
 
void DrawOval (const SkRect &bounds, const DlPaint &paint) override
 
void DrawCircle (const SkPoint &center, SkScalar radius, const DlPaint &paint) override
 
void DrawRRect (const SkRRect &rrect, const DlPaint &paint) override
 
void DrawDRRect (const SkRRect &outer, const SkRRect &inner, const DlPaint &paint) override
 
void DrawPath (const SkPath &path, const DlPaint &paint) override
 
void DrawArc (const SkRect &bounds, SkScalar start, SkScalar sweep, bool useCenter, const DlPaint &paint) override
 
void DrawPoints (PointMode mode, uint32_t count, const SkPoint pts[], const DlPaint &paint) override
 
void DrawVertices (const DlVertices *vertices, DlBlendMode mode, const DlPaint &paint) override
 
void DrawImage (const sk_sp< DlImage > &image, const SkPoint point, DlImageSampling sampling, const DlPaint *paint=nullptr) override
 
void DrawImageRect (const sk_sp< DlImage > &image, const SkRect &src, const SkRect &dst, DlImageSampling sampling, const DlPaint *paint=nullptr, SrcRectConstraint constraint=SrcRectConstraint::kFast) override
 
void DrawImageNine (const sk_sp< DlImage > &image, const SkIRect &center, const SkRect &dst, DlFilterMode filter, const DlPaint *paint=nullptr) override
 
void DrawAtlas (const sk_sp< DlImage > &atlas, const SkRSXform xform[], const SkRect tex[], const DlColor colors[], int count, DlBlendMode mode, DlImageSampling sampling, const SkRect *cullRect, const DlPaint *paint=nullptr) override
 
void DrawDisplayList (const sk_sp< DisplayList > display_list, SkScalar opacity) override
 
void DrawTextBlob (const sk_sp< SkTextBlob > &blob, SkScalar x, SkScalar y, const DlPaint &paint) override
 
void DrawTextFrame (const std::shared_ptr< impeller::TextFrame > &text_frame, SkScalar x, SkScalar y, const DlPaint &paint) override
 
void DrawShadow (const SkPath &path, const DlColor color, const SkScalar elevation, bool transparent_occluder, SkScalar dpr) override
 
void Flush () override
 
virtual void SetTransform (const SkMatrix *matrix)=0
 
virtual void SetTransform (const SkM44 *matrix44)=0
 
virtual void SetTransform (const SkMatrix &matrix)
 
virtual void SetTransform (const SkM44 &matrix44)
 
virtual void Transform (const SkMatrix *matrix)=0
 
virtual void Transform (const SkM44 *matrix44)=0
 
void Transform (const SkMatrix &matrix)
 
void Transform (const SkM44 &matrix44)
 
- Public Member Functions inherited from flutter::DlCanvas
virtual ~DlCanvas ()=default
 
virtual SkISize GetBaseLayerSize () const =0
 
virtual SkImageInfo GetImageInfo () const =0
 
virtual void Save ()=0
 
virtual void SaveLayer (const SkRect *bounds, const DlPaint *paint=nullptr, const DlImageFilter *backdrop=nullptr)=0
 
virtual void Restore ()=0
 
virtual int GetSaveCount () const =0
 
virtual void RestoreToCount (int restore_count)=0
 
virtual void Translate (SkScalar tx, SkScalar ty)=0
 
virtual void Scale (SkScalar sx, SkScalar sy)=0
 
virtual void Rotate (SkScalar degrees)=0
 
virtual void Skew (SkScalar sx, SkScalar sy)=0
 
virtual void Transform2DAffine (SkScalar mxx, SkScalar mxy, SkScalar mxt, SkScalar myx, SkScalar myy, SkScalar myt)=0
 
virtual void TransformFullPerspective (SkScalar mxx, SkScalar mxy, SkScalar mxz, SkScalar mxt, SkScalar myx, SkScalar myy, SkScalar myz, SkScalar myt, SkScalar mzx, SkScalar mzy, SkScalar mzz, SkScalar mzt, SkScalar mwx, SkScalar mwy, SkScalar mwz, SkScalar mwt)=0
 
virtual void TransformReset ()=0
 
virtual void Transform (const SkMatrix *matrix)=0
 
virtual void Transform (const SkM44 *matrix44)=0
 
void Transform (const SkMatrix &matrix)
 
void Transform (const SkM44 &matrix44)
 
virtual void SetTransform (const SkMatrix *matrix)=0
 
virtual void SetTransform (const SkM44 *matrix44)=0
 
virtual void SetTransform (const SkMatrix &matrix)
 
virtual void SetTransform (const SkM44 &matrix44)
 
virtual SkM44 GetTransformFullPerspective () const =0
 
virtual SkMatrix GetTransform () const =0
 
virtual void ClipRect (const SkRect &rect, ClipOp clip_op=ClipOp::kIntersect, bool is_aa=false)=0
 
virtual void ClipRRect (const SkRRect &rrect, ClipOp clip_op=ClipOp::kIntersect, bool is_aa=false)=0
 
virtual void ClipPath (const SkPath &path, ClipOp clip_op=ClipOp::kIntersect, bool is_aa=false)=0
 
virtual SkRect GetDestinationClipBounds () const =0
 
virtual SkRect GetLocalClipBounds () const =0
 
virtual bool QuickReject (const SkRect &bounds) const =0
 
virtual void DrawPaint (const DlPaint &paint)=0
 
virtual void DrawColor (DlColor color, DlBlendMode mode=DlBlendMode::kSrcOver)=0
 
void Clear (DlColor color)
 
virtual void DrawLine (const SkPoint &p0, const SkPoint &p1, const DlPaint &paint)=0
 
virtual void DrawDashedLine (const DlPoint &p0, const DlPoint &p1, DlScalar on_length, DlScalar off_length, const DlPaint &paint)=0
 
virtual void DrawRect (const SkRect &rect, const DlPaint &paint)=0
 
virtual void DrawOval (const SkRect &bounds, const DlPaint &paint)=0
 
virtual void DrawCircle (const SkPoint &center, SkScalar radius, const DlPaint &paint)=0
 
virtual void DrawRRect (const SkRRect &rrect, const DlPaint &paint)=0
 
virtual void DrawDRRect (const SkRRect &outer, const SkRRect &inner, const DlPaint &paint)=0
 
virtual void DrawPath (const SkPath &path, const DlPaint &paint)=0
 
virtual void DrawArc (const SkRect &bounds, SkScalar start, SkScalar sweep, bool useCenter, const DlPaint &paint)=0
 
virtual void DrawPoints (PointMode mode, uint32_t count, const SkPoint pts[], const DlPaint &paint)=0
 
virtual void DrawVertices (const DlVertices *vertices, DlBlendMode mode, const DlPaint &paint)=0
 
void DrawVertices (const std::shared_ptr< const DlVertices > &vertices, DlBlendMode mode, const DlPaint &paint)
 
virtual void DrawImage (const sk_sp< DlImage > &image, const SkPoint point, DlImageSampling sampling, const DlPaint *paint=nullptr)=0
 
virtual void DrawImageRect (const sk_sp< DlImage > &image, const SkRect &src, const SkRect &dst, DlImageSampling sampling, const DlPaint *paint=nullptr, SrcRectConstraint constraint=SrcRectConstraint::kFast)=0
 
virtual void DrawImageRect (const sk_sp< DlImage > &image, const SkIRect &src, const SkRect &dst, DlImageSampling sampling, const DlPaint *paint=nullptr, SrcRectConstraint constraint=SrcRectConstraint::kFast)
 
void DrawImageRect (const sk_sp< DlImage > &image, const SkRect &dst, DlImageSampling sampling, const DlPaint *paint=nullptr, SrcRectConstraint constraint=SrcRectConstraint::kFast)
 
virtual void DrawImageNine (const sk_sp< DlImage > &image, const SkIRect &center, const SkRect &dst, DlFilterMode filter, const DlPaint *paint=nullptr)=0
 
virtual void DrawAtlas (const sk_sp< DlImage > &atlas, const SkRSXform xform[], const SkRect tex[], const DlColor colors[], int count, DlBlendMode mode, DlImageSampling sampling, const SkRect *cullRect, const DlPaint *paint=nullptr)=0
 
virtual void DrawDisplayList (const sk_sp< DisplayList > display_list, SkScalar opacity=SK_Scalar1)=0
 
virtual void DrawTextFrame (const std::shared_ptr< impeller::TextFrame > &text_frame, SkScalar x, SkScalar y, const DlPaint &paint)=0
 
virtual void DrawTextBlob (const sk_sp< SkTextBlob > &blob, SkScalar x, SkScalar y, const DlPaint &paint)=0
 
virtual void DrawShadow (const SkPath &path, const DlColor color, const SkScalar elevation, bool transparent_occluder, SkScalar dpr)=0
 
virtual void Flush ()=0
 

Additional Inherited Members

- Static Public Member Functions inherited from flutter::DlCanvas
static SkRect ComputeShadowBounds (const SkPath &path, float elevation, SkScalar dpr, const SkMatrix &ctm)
 
- Static Public Attributes inherited from flutter::DlCanvas
static constexpr SkScalar kShadowLightHeight = 600
 
static constexpr SkScalar kShadowLightRadius = 800
 

Detailed Description

Definition at line 37 of file mock_canvas.h.

Member Typedef Documentation

◆ DrawCallData

Definition at line 135 of file mock_canvas.h.

Member Enumeration Documentation

◆ ClipEdgeStyle

Enumerator
kHardClipEdgeStyle 
kSoftClipEdgeStyle 

Definition at line 39 of file mock_canvas.h.

Constructor & Destructor Documentation

◆ MockCanvas() [1/2]

flutter::testing::MockCanvas::MockCanvas ( )

Definition at line 19 of file mock_canvas.cc.

constexpr SkISize kSize
Definition: mock_canvas.cc:17
int32_t fHeight
Definition: SkSize.h:18
int32_t fWidth
Definition: SkSize.h:17

◆ MockCanvas() [2/2]

flutter::testing::MockCanvas::MockCanvas ( int  width,
int  height 
)

Definition at line 21 of file mock_canvas.cc.

22 : base_layer_size_({width, height}), current_layer_(0) {
23 state_stack_.emplace_back(DlRect::MakeXYWH(0, 0, width, height), DlMatrix());
24}
impeller::Matrix DlMatrix
int32_t height
int32_t width
static constexpr TRect MakeXYWH(Type x, Type y, Type width, Type height)
Definition: rect.h:136

◆ ~MockCanvas()

flutter::testing::MockCanvas::~MockCanvas ( )

Definition at line 26 of file mock_canvas.cc.

26 {
27 EXPECT_EQ(current_layer_, 0);
28}

Member Function Documentation

◆ ClipPath()

void flutter::testing::MockCanvas::ClipPath ( const SkPath path,
ClipOp  clip_op,
bool  is_aa 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 224 of file mock_canvas.cc.

224 {
226 draw_calls_.emplace_back(
227 DrawCall{current_layer_, ClipPathData{path, op, style}});
228 state_stack_.back().clipPath(path, op, is_aa);
229}
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
Definition: switches.h:57

◆ ClipRect()

void flutter::testing::MockCanvas::ClipRect ( const SkRect rect,
ClipOp  clip_op,
bool  is_aa 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 210 of file mock_canvas.cc.

210 {
212 draw_calls_.emplace_back(
213 DrawCall{current_layer_, ClipRectData{rect, op, style}});
214 state_stack_.back().clipRect(rect, op, is_aa);
215}
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350

◆ ClipRRect()

void flutter::testing::MockCanvas::ClipRRect ( const SkRRect rrect,
ClipOp  clip_op,
bool  is_aa 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 217 of file mock_canvas.cc.

217 {
219 draw_calls_.emplace_back(
220 DrawCall{current_layer_, ClipRRectData{rrect, op, style}});
221 state_stack_.back().clipRRect(rrect, op, is_aa);
222}
SkRRect rrect
Definition: SkRecords.h:232

◆ draw_calls()

const std::vector< DrawCall > & flutter::testing::MockCanvas::draw_calls ( ) const
inline

Definition at line 162 of file mock_canvas.h.

162{ return draw_calls_; }

◆ DrawArc()

void flutter::testing::MockCanvas::DrawArc ( const SkRect bounds,
SkScalar  start,
SkScalar  sweep,
bool  useCenter,
const DlPaint paint 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 286 of file mock_canvas.cc.

290 {
291 FML_DCHECK(false);
292}
#define FML_DCHECK(condition)
Definition: logging.h:103

◆ DrawAtlas()

void flutter::testing::MockCanvas::DrawAtlas ( const sk_sp< DlImage > &  atlas,
const SkRSXform  xform[],
const SkRect  tex[],
const DlColor  colors[],
int  count,
DlBlendMode  mode,
DlImageSampling  sampling,
const SkRect cullRect,
const DlPaint paint = nullptr 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 319 of file mock_canvas.cc.

327 {
328 FML_DCHECK(false);
329}

◆ DrawCircle()

void flutter::testing::MockCanvas::DrawCircle ( const SkPoint center,
SkScalar  radius,
const DlPaint paint 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 280 of file mock_canvas.cc.

282 {
283 FML_DCHECK(false);
284}

◆ DrawColor()

void flutter::testing::MockCanvas::DrawColor ( DlColor  color,
DlBlendMode  mode 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 251 of file mock_canvas.cc.

251 {
252 DrawPaint(DlPaint(color).setBlendMode(mode));
253}
void DrawPaint(const DlPaint &paint) override
Definition: mock_canvas.cc:247
DlColor color
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
Definition: switches.h:228
flutter::DlPaint DlPaint

◆ DrawDashedLine()

void flutter::testing::MockCanvas::DrawDashedLine ( const DlPoint p0,
const DlPoint p1,
DlScalar  on_length,
DlScalar  off_length,
const DlPaint paint 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 261 of file mock_canvas.cc.

265 {
266 FML_DCHECK(false);
267}

◆ DrawDisplayList()

void flutter::testing::MockCanvas::DrawDisplayList ( const sk_sp< DisplayList display_list,
SkScalar  opacity 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 204 of file mock_canvas.cc.

205 {
206 draw_calls_.emplace_back(
207 DrawCall{current_layer_, DrawDisplayListData{display_list, opacity}});
208}

◆ DrawDRRect()

void flutter::testing::MockCanvas::DrawDRRect ( const SkRRect outer,
const SkRRect inner,
const DlPaint paint 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 243 of file mock_canvas.cc.

243 {
244 FML_DCHECK(false);
245}

◆ DrawImage()

void flutter::testing::MockCanvas::DrawImage ( const sk_sp< DlImage > &  image,
const SkPoint  point,
DlImageSampling  sampling,
const DlPaint paint = nullptr 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 189 of file mock_canvas.cc.

192 {
193 if (paint) {
194 draw_calls_.emplace_back(
195 DrawCall{current_layer_,
196 DrawImageData{image, point.fX, point.fY, options, *paint}});
197 } else {
198 draw_calls_.emplace_back(
199 DrawCall{current_layer_,
200 DrawImageDataNoPaint{image, point.fX, point.fY, options}});
201 }
202}
const char * options
const Paint & paint
Definition: color_source.cc:38
sk_sp< const SkImage > image
Definition: SkRecords.h:269
float fX
x-axis value
Definition: SkPoint_impl.h:164
float fY
y-axis value
Definition: SkPoint_impl.h:165

◆ DrawImageNine()

void flutter::testing::MockCanvas::DrawImageNine ( const sk_sp< DlImage > &  image,
const SkIRect center,
const SkRect dst,
DlFilterMode  filter,
const DlPaint paint = nullptr 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 307 of file mock_canvas.cc.

311 {
312 FML_DCHECK(false);
313}

◆ DrawImageRect()

void flutter::testing::MockCanvas::DrawImageRect ( const sk_sp< DlImage > &  image,
const SkRect src,
const SkRect dst,
DlImageSampling  sampling,
const DlPaint paint = nullptr,
SrcRectConstraint  constraint = SrcRectConstraint::kFast 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 298 of file mock_canvas.cc.

303 {
304 FML_DCHECK(false);
305}

◆ DrawLine()

void flutter::testing::MockCanvas::DrawLine ( const SkPoint p0,
const SkPoint p1,
const DlPaint paint 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 255 of file mock_canvas.cc.

257 {
258 FML_DCHECK(false);
259}

◆ DrawOval()

void flutter::testing::MockCanvas::DrawOval ( const SkRect bounds,
const DlPaint paint 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 276 of file mock_canvas.cc.

276 {
277 FML_DCHECK(false);
278}

◆ DrawPaint()

void flutter::testing::MockCanvas::DrawPaint ( const DlPaint paint)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 247 of file mock_canvas.cc.

247 {
248 draw_calls_.emplace_back(DrawCall{current_layer_, DrawPaintData{paint}});
249}

◆ DrawPath()

void flutter::testing::MockCanvas::DrawPath ( const SkPath path,
const DlPaint paint 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 175 of file mock_canvas.cc.

175 {
176 draw_calls_.emplace_back(DrawCall{current_layer_, DrawPathData{path, paint}});
177}

◆ DrawPoints()

void flutter::testing::MockCanvas::DrawPoints ( PointMode  mode,
uint32_t  count,
const SkPoint  pts[],
const DlPaint paint 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 269 of file mock_canvas.cc.

272 {
273 FML_DCHECK(false);
274}

◆ DrawRect()

void flutter::testing::MockCanvas::DrawRect ( const SkRect rect,
const DlPaint paint 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 171 of file mock_canvas.cc.

171 {
172 draw_calls_.emplace_back(DrawCall{current_layer_, DrawRectData{rect, paint}});
173}

◆ DrawRRect()

void flutter::testing::MockCanvas::DrawRRect ( const SkRRect rrect,
const DlPaint paint 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 294 of file mock_canvas.cc.

294 {
295 FML_DCHECK(false);
296}

◆ DrawShadow()

void flutter::testing::MockCanvas::DrawShadow ( const SkPath path,
const DlColor  color,
const SkScalar  elevation,
bool  transparent_occluder,
SkScalar  dpr 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 179 of file mock_canvas.cc.

183 {
184 draw_calls_.emplace_back(DrawCall{
185 current_layer_,
186 DrawShadowData{path, color, elevation, transparent_occluder, dpr}});
187}

◆ DrawTextBlob()

void flutter::testing::MockCanvas::DrawTextBlob ( const sk_sp< SkTextBlob > &  blob,
SkScalar  x,
SkScalar  y,
const DlPaint paint 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 142 of file mock_canvas.cc.

145 {
146 // This duplicates existing logic in SkCanvas::onDrawPicture
147 // that should probably be split out so it doesn't need to be here as well.
148 // SkRect storage;
149 // if (paint.canComputeFastBounds()) {
150 // storage = text->bounds().makeOffset(x, y);
151 // SkRect tmp;
152 // if (this->quickReject(paint.computeFastBounds(storage, &tmp))) {
153 // return;
154 // }
155 // }
156
157 draw_calls_.emplace_back(DrawCall{
158 current_layer_, DrawTextData{text ? text->serialize(SkSerialProcs{})
160 paint, SkPoint::Make(x, y)}});
161}
static sk_sp< SkData > MakeUninitialized(size_t length)
Definition: SkData.cpp:116
std::u16string text
double y
double x
static constexpr SkPoint Make(float x, float y)
Definition: SkPoint_impl.h:173

◆ DrawTextFrame()

void flutter::testing::MockCanvas::DrawTextFrame ( const std::shared_ptr< impeller::TextFrame > &  text_frame,
SkScalar  x,
SkScalar  y,
const DlPaint paint 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 163 of file mock_canvas.cc.

167 {
168 FML_DCHECK(false);
169}

◆ DrawVertices()

void flutter::testing::MockCanvas::DrawVertices ( const DlVertices vertices,
DlBlendMode  mode,
const DlPaint paint 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 315 of file mock_canvas.cc.

315 {
316 FML_DCHECK(false);
317}

◆ Flush()

void flutter::testing::MockCanvas::Flush ( )
overridevirtual

Implements flutter::DlCanvas.

Definition at line 331 of file mock_canvas.cc.

331 {
332 FML_DCHECK(false);
333}

◆ GetBaseLayerSize()

SkISize flutter::testing::MockCanvas::GetBaseLayerSize ( ) const
overridevirtual

Implements flutter::DlCanvas.

Definition at line 30 of file mock_canvas.cc.

30 {
31 return base_layer_size_;
32}

◆ GetDestinationClipBounds()

SkRect flutter::testing::MockCanvas::GetDestinationClipBounds ( ) const
overridevirtual

Conservative estimate of the bounds of all outstanding clip operations measured in the coordinate space within which this DisplayList will be rendered.

Implements flutter::DlCanvas.

Definition at line 231 of file mock_canvas.cc.

231 {
232 return state_stack_.back().device_cull_rect();
233}

◆ GetImageInfo()

SkImageInfo flutter::testing::MockCanvas::GetImageInfo ( ) const
overridevirtual

Implements flutter::DlCanvas.

Definition at line 34 of file mock_canvas.cc.

34 {
36 return SkImageInfo::MakeUnknown(size.width(), size.height());
37}
SkISize GetBaseLayerSize() const override
Definition: mock_canvas.cc:30
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
Definition: SkSize.h:16
static SkImageInfo MakeUnknown()
Definition: SkImageInfo.h:357

◆ GetLocalClipBounds()

SkRect flutter::testing::MockCanvas::GetLocalClipBounds ( ) const
overridevirtual

Conservative estimate of the bounds of all outstanding clip operations transformed into the local coordinate space in which currently recorded rendering operations are interpreted.

Implements flutter::DlCanvas.

Definition at line 235 of file mock_canvas.cc.

235 {
236 return state_stack_.back().local_cull_rect();
237}

◆ GetSaveCount()

int flutter::testing::MockCanvas::GetSaveCount ( ) const
inlinevirtual

Implements flutter::DlCanvas.

Definition at line 173 of file mock_canvas.h.

173{ return current_layer_; }

◆ GetTransform()

SkMatrix flutter::testing::MockCanvas::GetTransform ( ) const
overridevirtual

Returns the 3x3 partial perspective transform representing all transform operations executed so far in this DisplayList within the enclosing save stack.

Implements flutter::DlCanvas.

Definition at line 138 of file mock_canvas.cc.

138 {
139 return state_stack_.back().matrix_3x3();
140}

◆ GetTransformFullPerspective()

SkM44 flutter::testing::MockCanvas::GetTransformFullPerspective ( ) const
overridevirtual

Returns the 4x4 full perspective transform representing all transform operations executed so far in this DisplayList within the enclosing save stack.

Implements flutter::DlCanvas.

Definition at line 134 of file mock_canvas.cc.

134 {
135 return state_stack_.back().matrix_4x4();
136}

◆ QuickReject()

bool flutter::testing::MockCanvas::QuickReject ( const SkRect bounds) const
overridevirtual

Return true iff the supplied bounds are easily shown to be outside of the current clip bounds. This method may conservatively return false if it cannot make the determination.

Implements flutter::DlCanvas.

Definition at line 239 of file mock_canvas.cc.

239 {
240 return state_stack_.back().content_culled(bounds);
241}
Optional< SkRect > bounds
Definition: SkRecords.h:189

◆ reset_draw_calls()

void flutter::testing::MockCanvas::reset_draw_calls ( )
inline

Definition at line 163 of file mock_canvas.h.

163{ draw_calls_.clear(); }

◆ Restore()

void flutter::testing::MockCanvas::Restore ( )
overridevirtual

Implements flutter::DlCanvas.

Definition at line 60 of file mock_canvas.cc.

60 {
61 FML_DCHECK(current_layer_ > 0);
62
63 draw_calls_.emplace_back(
64 DrawCall{current_layer_, RestoreData{current_layer_ - 1}});
65 state_stack_.pop_back();
66 current_layer_--; // Must go here; func params order of eval is undefined
67}

◆ RestoreToCount()

void flutter::testing::MockCanvas::RestoreToCount ( int  restore_count)
inlinevirtual

Implements flutter::DlCanvas.

Definition at line 174 of file mock_canvas.h.

174 {
175 while (current_layer_ > restore_count) {
176 Restore();
177 }
178 }

◆ Rotate()

void flutter::testing::MockCanvas::Rotate ( SkScalar  degrees)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 126 of file mock_canvas.cc.

126 {
127 this->Transform(SkMatrix::RotateDeg(degrees));
128}
static SkMatrix RotateDeg(SkScalar deg)
Definition: SkMatrix.h:104
void Transform(const SkMatrix *matrix) override
Definition: mock_canvas.cc:91

◆ Save()

void flutter::testing::MockCanvas::Save ( )
overridevirtual

Implements flutter::DlCanvas.

Definition at line 39 of file mock_canvas.cc.

39 {
40 draw_calls_.emplace_back(
41 DrawCall{current_layer_, SaveData{current_layer_ + 1}});
42 state_stack_.emplace_back(state_stack_.back());
43 current_layer_++; // Must go here; func params order of eval is undefined
44}

◆ SaveLayer()

void flutter::testing::MockCanvas::SaveLayer ( const SkRect bounds,
const DlPaint paint = nullptr,
const DlImageFilter backdrop = nullptr 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 46 of file mock_canvas.cc.

48 {
49 // saveLayer calls this prior to running, so we use it to track saveLayer
50 // calls
51 draw_calls_.emplace_back(DrawCall{
52 current_layer_,
53 SaveLayerData{bounds ? *bounds : SkRect(), paint ? *paint : DlPaint(),
54 backdrop ? backdrop->shared() : nullptr,
55 current_layer_ + 1}});
56 state_stack_.emplace_back(state_stack_.back());
57 current_layer_++; // Must go here; func params order of eval is undefined
58}
sk_sp< const SkImageFilter > backdrop
Definition: SkRecords.h:191

◆ Scale()

void flutter::testing::MockCanvas::Scale ( SkScalar  sx,
SkScalar  sy 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 122 of file mock_canvas.cc.

122 {
123 this->Transform(SkM44::Scale(x, y));
124}
static SkM44 Scale(SkScalar x, SkScalar y, SkScalar z=1)
Definition: SkM44.h:232

◆ SetTransform() [1/6]

virtual void flutter::DlCanvas::SetTransform ( const SkM44 matrix44)
inlinevirtual

Reimplemented from flutter::DlCanvas.

Definition at line 94 of file dl_canvas.h.

94{ SetTransform(&matrix44); }
void SetTransform(const SkMatrix *matrix) override
Definition: mock_canvas.cc:102

◆ SetTransform() [2/6]

void flutter::testing::MockCanvas::SetTransform ( const SkM44 matrix44)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 108 of file mock_canvas.cc.

108 {
109 draw_calls_.emplace_back(DrawCall{current_layer_, SetMatrixData{*matrix}});
110 state_stack_.back().setTransform(*matrix);
111}
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258

◆ SetTransform() [3/6]

virtual void flutter::DlCanvas::SetTransform ( const SkM44 matrix44)
virtual

Implements flutter::DlCanvas.

◆ SetTransform() [4/6]

virtual void flutter::DlCanvas::SetTransform ( const SkMatrix matrix)
inlinevirtual

Reimplemented from flutter::DlCanvas.

Definition at line 93 of file dl_canvas.h.

◆ SetTransform() [5/6]

void flutter::testing::MockCanvas::SetTransform ( const SkMatrix matrix)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 102 of file mock_canvas.cc.

102 {
103 draw_calls_.emplace_back(
104 DrawCall{current_layer_, SetMatrixData{SkM44(*matrix)}});
105 state_stack_.back().setTransform(*matrix);
106}
Definition: SkM44.h:150

◆ SetTransform() [6/6]

virtual void flutter::DlCanvas::SetTransform ( const SkMatrix matrix)
virtual

Implements flutter::DlCanvas.

◆ Skew()

void flutter::testing::MockCanvas::Skew ( SkScalar  sx,
SkScalar  sy 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 130 of file mock_canvas.cc.

130 {
131 this->Transform(SkMatrix::Skew(sx, sy));
132}
static SkMatrix Skew(SkScalar kx, SkScalar ky)
Definition: SkMatrix.h:124

◆ Transform() [1/6]

void flutter::DlCanvas::Transform ( const SkM44 matrix44)
inline

Definition at line 90 of file dl_canvas.h.

90{ Transform(&matrix44); }

◆ Transform() [2/6]

void flutter::testing::MockCanvas::Transform ( const SkM44 matrix44)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 97 of file mock_canvas.cc.

97 {
98 draw_calls_.emplace_back(DrawCall{current_layer_, ConcatMatrixData{*matrix}});
99 state_stack_.back().transform(*matrix);
100}

◆ Transform() [3/6]

virtual void flutter::DlCanvas::Transform ( const SkM44 matrix44)
virtual

Implements flutter::DlCanvas.

◆ Transform() [4/6]

void flutter::DlCanvas::Transform ( const SkMatrix matrix)
inline

Definition at line 89 of file dl_canvas.h.

89{ Transform(&matrix); }

◆ Transform() [5/6]

void flutter::testing::MockCanvas::Transform ( const SkMatrix matrix)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 91 of file mock_canvas.cc.

91 {
92 draw_calls_.emplace_back(
93 DrawCall{current_layer_, ConcatMatrixData{SkM44(*matrix)}});
94 state_stack_.back().transform(*matrix);
95}

◆ Transform() [6/6]

virtual void flutter::DlCanvas::Transform ( const SkMatrix matrix)
virtual

Implements flutter::DlCanvas.

◆ Transform2DAffine()

void flutter::testing::MockCanvas::Transform2DAffine ( SkScalar  mxx,
SkScalar  mxy,
SkScalar  mxt,
SkScalar  myx,
SkScalar  myy,
SkScalar  myt 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 72 of file mock_canvas.cc.

73 {
74 Transform(SkMatrix::MakeAll(mxx, mxy, mxt, myx, myy, myt, 0, 0, 1));
75}
static SkMatrix MakeAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, SkScalar skewY, SkScalar scaleY, SkScalar transY, SkScalar pers0, SkScalar pers1, SkScalar pers2)
Definition: SkMatrix.h:179

◆ TransformFullPerspective()

void flutter::testing::MockCanvas::TransformFullPerspective ( SkScalar  mxx,
SkScalar  mxy,
SkScalar  mxz,
SkScalar  mxt,
SkScalar  myx,
SkScalar  myy,
SkScalar  myz,
SkScalar  myt,
SkScalar  mzx,
SkScalar  mzy,
SkScalar  mzz,
SkScalar  mzt,
SkScalar  mwx,
SkScalar  mwy,
SkScalar  mwz,
SkScalar  mwt 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 78 of file mock_canvas.cc.

82 {
83 Transform(SkM44(mxx, mxy, mxz, mxt,
84 myx, myy, myz, myt,
85 mzx, mzy, mzz, mzt,
86 mwx, mwy, mwz, mwt));
87}

◆ TransformReset()

void flutter::testing::MockCanvas::TransformReset ( )
overridevirtual

Implements flutter::DlCanvas.

Definition at line 113 of file mock_canvas.cc.

113 {
114 draw_calls_.emplace_back(DrawCall{current_layer_, SetMatrixData{SkM44()}});
115 state_stack_.back().setIdentity();
116}

◆ Translate()

void flutter::testing::MockCanvas::Translate ( SkScalar  tx,
SkScalar  ty 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 118 of file mock_canvas.cc.

118 {
119 this->Transform(SkM44::Translate(x, y));
120}
static SkM44 Translate(SkScalar x, SkScalar y, SkScalar z=0)
Definition: SkM44.h:225

The documentation for this class was generated from the following files: