Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Unified Diff: src/utils/SkCanvasStack.h

Issue 23865004: Add SkCanvasStack and update the Canvas utilities to use it. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: comments Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/utils/SkCanvasStack.h
diff --git a/src/utils/SkCanvasStack.h b/src/utils/SkCanvasStack.h
new file mode 100644
index 0000000000000000000000000000000000000000..2e2c9b21fa3aaea289d14a1747d4bfe80d9a77da
--- /dev/null
+++ b/src/utils/SkCanvasStack.h
@@ -0,0 +1,52 @@
+
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkCanvasStack_DEFINED
+#define SkCanvasStack_DEFINED
+
+#include "SkNWayCanvas.h"
+#include "SkTArray.h"
+
+class SkCanvasStack : public SkNWayCanvas {
+public:
+ SkCanvasStack(int width, int height);
+ virtual ~SkCanvasStack();
+
+ void pushCanvas(SkCanvas* canvas, const SkIPoint& origin);
+ virtual void removeAll() SK_OVERRIDE;
reed1 2013/09/04 15:00:00 Do we need to expose this guy for Clank, or can we
+
+ /*
+ * The following add/remove canvas methods are overrides from SkNWayCanvas
+ * that do not make sense in the context of our CanvasStack, but since we
+ * can share most of the other implementation of NWay we override those
+ * methods to be no-ops.
+ */
+ virtual void addCanvas(SkCanvas*) SK_OVERRIDE {};
reed1 2013/09/04 15:00:00 SkASSERT(!"don't call addCanvas on a CanvasStack")
+ virtual void removeCanvas(SkCanvas*) SK_OVERRIDE {};
+
+ virtual void setMatrix(const SkMatrix& matrix) SK_OVERRIDE;
+ virtual bool clipRect(const SkRect&, SkRegion::Op, bool) SK_OVERRIDE;
+ virtual bool clipRRect(const SkRRect&, SkRegion::Op, bool) SK_OVERRIDE;
+ virtual bool clipPath(const SkPath&, SkRegion::Op, bool) SK_OVERRIDE;
+ virtual bool clipRegion(const SkRegion& deviceRgn,
+ SkRegion::Op) SK_OVERRIDE;
+
+private:
+ void clipToZOrderedBounds();
+
+ struct CanvasData {
+ SkIPoint origin;
+ SkRegion requiredClip;
+ };
+
+ SkTArray<CanvasData> fCanvasData;
+
+ typedef SkNWayCanvas INHERITED;
+};
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698