Flutter Engine
The Flutter Engine
SkClipStackDevice.h
Go to the documentation of this file.
1/*
2 * Copyright 2017 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 SkClipStackDevice_DEFINED
9#define SkClipStackDevice_DEFINED
10
11#include "include/core/SkRect.h"
14#include "src/core/SkDevice.h"
15
16#include <cstdint>
17
18class SkPath;
19class SkRRect;
20class SkRegion;
21class SkShader;
22class SkSurfaceProps;
23enum class SkClipOp;
24struct SkImageInfo;
25
27public:
29 : SkDevice(info, props)
30 , fClipStack(fStorage, sizeof(fStorage))
31 {}
32
33 SkClipStack& cs() { return fClipStack; }
34 const SkClipStack& cs() const { return fClipStack; }
35
36 void pushClipStack() override;
37 void popClipStack() override;
38
39 void clipRect(const SkRect& rect, SkClipOp, bool aa) override;
40 void clipRRect(const SkRRect& rrect, SkClipOp, bool aa) override;
41 void clipPath(const SkPath& path, SkClipOp, bool aa) override;
42 void clipRegion(const SkRegion& deviceRgn, SkClipOp) override;
43
44 void replaceClip(const SkIRect& rect) override;
45
46 bool isClipAntiAliased() const override;
47 bool isClipWideOpen() const override;
48 bool isClipEmpty() const override;
49 bool isClipRect() const override;
50
51 void android_utils_clipAsRgn(SkRegion*) const override;
52
53 SkIRect devClipBounds() const override;
54
55private:
56 // empirically determined, adjust as needed to reduce mallocs
57 static constexpr int kPreallocCount = 16;
58
59 void onClipShader(sk_sp<SkShader>) override;
60
61 intptr_t fStorage[kPreallocCount * sizeof(SkClipStack::Element) / sizeof(intptr_t)];
62 SkClipStack fClipStack;
63};
64
65#endif
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
SkClipOp
Definition: SkClipOp.h:13
bool isClipAntiAliased() const override
bool isClipWideOpen() const override
void clipPath(const SkPath &path, SkClipOp, bool aa) override
bool isClipEmpty() const override
void android_utils_clipAsRgn(SkRegion *) const override
void popClipStack() override
void pushClipStack() override
void replaceClip(const SkIRect &rect) override
void clipRRect(const SkRRect &rrect, SkClipOp, bool aa) override
SkClipStack & cs()
void clipRect(const SkRect &rect, SkClipOp, bool aa) override
const SkClipStack & cs() const
SkIRect devClipBounds() const override
void clipRegion(const SkRegion &deviceRgn, SkClipOp) override
bool isClipRect() const override
SkClipStackDevice(const SkImageInfo &info, const SkSurfaceProps &props)
Definition: SkPath.h:59
SkRRect rrect
Definition: SkRecords.h:232
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
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
Definition: SkRect.h:32