blob: a687b19aeaaad4c0e62c7f78d9140704f0f3a8b8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkSGGeometryNode_DEFINED
#define SkSGGeometryNode_DEFINED
#include "SkSGNode.h"
#include "SkRect.h"
class SkCanvas;
class SkPaint;
namespace sksg {
/**
* Base class for nodes which provide 'geometry' (as opposed to paint)
* for drawing.
*
* Think SkRect, SkPath, etc.
*/
class GeometryNode : public Node {
public:
void draw(SkCanvas*, const SkPaint&) const;
// SkPath asPath() const; // unused for now
protected:
GeometryNode();
virtual void onDraw(SkCanvas*, const SkPaint&) const = 0;
virtual SkRect onComputeBounds() const = 0;
// virtual SkPath onAsPath() const = 0; // unused for now
void onRevalidate(InvalidationController*, const SkMatrix&) override;
private:
friend class Draw; // wants to know the cached bounds.
SkRect fBounds;
typedef Node INHERITED;
};
} // namespace sksg
#endif // SkSGGeometryNode_DEFINED
|