skia2/experimental/sksg/SkSGGeometryNode.h
Florin Malita 2a2dfcbb42 [sksg] Fix paint inval
Paint nodes contribute to invalidation.  Hoist the inval logic from
geometry nodes to draw nodes.

TBR=
Change-Id: Iab33086c377ef4940a84dae3cdccb2c9bdbee99c
Reviewed-on: https://skia-review.googlesource.com/89901
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-12-29 00:41:00 +00:00

54 lines
1.0 KiB
C++

/*
* 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