Flutter Engine
The Flutter Engine
SkCanvasVirtualEnforcer.h
Go to the documentation of this file.
1/*
2 * Copyright 2018 Google Inc.
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 SkCanvasVirtualEnforcer_DEFINED
9#define SkCanvasVirtualEnforcer_DEFINED
10
12
13// If you would ordinarily want to inherit from Base (eg SkCanvas, SkNWayCanvas), instead
14// inherit from SkCanvasVirtualEnforcer<Base>, which will make the build fail if you forget
15// to override one of SkCanvas' key virtual hooks.
16template <typename Base>
17class SkCanvasVirtualEnforcer : public Base {
18public:
19 using Base::Base;
20
21protected:
22 void onDrawPaint(const SkPaint& paint) override = 0;
23 void onDrawBehind(const SkPaint&) override {} // make zero after android updates
24 void onDrawRect(const SkRect& rect, const SkPaint& paint) override = 0;
25 void onDrawRRect(const SkRRect& rrect, const SkPaint& paint) override = 0;
26 void onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
27 const SkPaint& paint) override = 0;
28 void onDrawOval(const SkRect& rect, const SkPaint& paint) override = 0;
30 const SkPaint& paint) override = 0;
31 void onDrawPath(const SkPath& path, const SkPaint& paint) override = 0;
32 void onDrawRegion(const SkRegion& region, const SkPaint& paint) override = 0;
33
35 const SkPaint& paint) override = 0;
36
37 void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
38 const SkPoint texCoords[4], SkBlendMode mode,
39 const SkPaint& paint) override = 0;
41 const SkPaint& paint) override = 0;
42
43#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
44 // This is under active development for Chrome and not used in Android. Hold off on adding
45 // implementations in Android's SkCanvas subclasses until this stabilizes.
46 void onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
47 SkCanvas::QuadAAFlags aaFlags, const SkColor4f& color, SkBlendMode mode) override {}
48#else
49 void onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
50 SkCanvas::QuadAAFlags aaFlags, const SkColor4f& color, SkBlendMode mode) override = 0;
51#endif
52
53 void onDrawAnnotation(const SkRect& rect, const char key[], SkData* value) override = 0;
54 void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&) override = 0;
55
56 void onDrawDrawable(SkDrawable* drawable, const SkMatrix* matrix) override = 0;
58 const SkPaint* paint) override = 0;
59};
60
61#endif
int count
Definition: FontMgrTest.cpp:50
SkBlendMode
Definition: SkBlendMode.h:38
uint32_t SkColor
Definition: SkColor.h:37
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
Definition: SkPath.cpp:3892
void onDrawPoints(SkCanvas::PointMode mode, size_t count, const SkPoint pts[], const SkPaint &paint) override=0
void onDrawRect(const SkRect &rect, const SkPaint &paint) override=0
void onDrawRegion(const SkRegion &region, const SkPaint &paint) override=0
void onDrawShadowRec(const SkPath &, const SkDrawShadowRec &) override=0
void onDrawPicture(const SkPicture *picture, const SkMatrix *matrix, const SkPaint *paint) override=0
void onDrawBehind(const SkPaint &) override
void onDrawRRect(const SkRRect &rrect, const SkPaint &paint) override=0
void onDrawTextBlob(const SkTextBlob *blob, SkScalar x, SkScalar y, const SkPaint &paint) override=0
void onDrawAnnotation(const SkRect &rect, const char key[], SkData *value) override=0
void onDrawOval(const SkRect &rect, const SkPaint &paint) override=0
void onDrawDrawable(SkDrawable *drawable, const SkMatrix *matrix) override=0
void onDrawArc(const SkRect &rect, SkScalar startAngle, SkScalar sweepAngle, bool useCenter, const SkPaint &paint) override=0
void onDrawDRRect(const SkRRect &outer, const SkRRect &inner, const SkPaint &paint) override=0
void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], const SkPoint texCoords[4], SkBlendMode mode, const SkPaint &paint) override=0
void onDrawPath(const SkPath &path, const SkPaint &paint) override=0
void onDrawPaint(const SkPaint &paint) override=0
void onDrawEdgeAAQuad(const SkRect &rect, const SkPoint clip[4], SkCanvas::QuadAAFlags aaFlags, const SkColor4f &color, SkBlendMode mode) override=0
Definition: SkData.h:25
Definition: SkPath.h:59
const Paint & paint
Definition: color_source.cc:38
DlColor color
float SkScalar
Definition: extension.cpp:12
uint8_t value
double y
double x
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258
ClipOpAndAA opAA SkRegion region
Definition: SkRecords.h:238
sk_sp< const SkPicture > picture
Definition: SkRecords.h:299
SkRRect rrect
Definition: SkRecords.h:232
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
SkScalar startAngle
Definition: SkRecords.h:250
SkScalar sweepAngle
Definition: SkRecords.h:251
PODArray< SkColor > colors
Definition: SkRecords.h:276
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
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