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>
diff --git a/include/utils/SkNoDrawCanvas.h b/include/utils/SkNoDrawCanvas.h
new file mode 100644
index 0000000..376fa7c
--- /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