aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/utils/SkNoDrawCanvas.h
diff options
context:
space:
mode:
authorGravatar Florin Malita <fmalita@chromium.org>2016-12-01 12:47:59 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-12-01 18:34:29 +0000
commitee424acbb87bf999be132a437527e656e37541d7 (patch)
treeeef34d6fb29a2a7ebd53c452b37a43f6c4f93686 /include/utils/SkNoDrawCanvas.h
parenta2f7126ed4e705f0fec8227daed651fcdd3ba445 (diff)
SkNoDrawCanvas - a public non-drawing canvas base class
TODO: - convert SkDeferredCanvas, SkLiteRecorder, etc. to the new base - remove unused SkNoSaveLayerCanvas BUG=chromium:668925 R=reed@google.com,mtklein@google.com Change-Id: Ie9af577477a6b9eaa5ef55523287ad1635dca116 Reviewed-on: https://skia-review.googlesource.com/5349 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'include/utils/SkNoDrawCanvas.h')
-rw-r--r--include/utils/SkNoDrawCanvas.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/utils/SkNoDrawCanvas.h b/include/utils/SkNoDrawCanvas.h
new file mode 100644
index 0000000000..376fa7c32e
--- /dev/null
+++ b/include/utils/SkNoDrawCanvas.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkNoDrawCanvas_DEFINED
+#define SkNoDrawCanvas_DEFINED
+
+#include "SkCanvas.h"
+
+// SkNoDrawCanvas is a helper for SkCanvas subclasses which do not need to
+// actually rasterize (e.g., analysis of the draw calls).
+//
+// It provides the following simplifications:
+//
+// * not backed by any device/pixels
+// * conservative clipping (clipping calls only use rectangles)
+//
+class SK_API SkNoDrawCanvas : public SkCanvas {
+public:
+ SkNoDrawCanvas(int width, int height);
+
+protected:
+ SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec& rec) override;
+
+private:
+ typedef SkCanvas INHERITED;
+};
+
+#endif // SkNoSaveLayerCanvas_DEFINED