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

Unified Diff: skia/ext/analysis_canvas.h

Issue 12184010: skia::AnalysisCanvas: implementation for IsCheapInRect(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Wrote device boilerplate Created 7 years, 10 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: skia/ext/analysis_canvas.h
diff --git a/skia/ext/analysis_canvas.h b/skia/ext/analysis_canvas.h
new file mode 100644
index 0000000000000000000000000000000000000000..bd57af7adb1186c281e72d2215c1500e2d294778
--- /dev/null
+++ b/skia/ext/analysis_canvas.h
@@ -0,0 +1,79 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SKIA_EXT_ANALYSIS_CANVAS_H_
+#define SKIA_EXT_ANALYSIS_CANVAS_H_
+
+#include "third_party/skia/include/core/SkCanvas.h"
+#include "third_party/skia/include/core/SkDevice.h"
+
+namespace skia {
+
+class SK_API AnalysisDevice : public SkDevice {
+ public:
+ AnalysisDevice(const SkBitmap& bm);
+};
+
+// Does not render anything, but gathers statistics about a region
+// (specified as a clip rectangle) of an SkPicture as the picture is
+// played back through it.
+class SK_API AnalysisCanvas : public SkCanvas {
+ public:
+ AnalysisCanvas(SkDevice*, SkRect clip);
+ virtual ~AnalysisCanvas();
+
+ virtual int save(SkCanvas::SaveFlags = kMatrixClip_SaveFlag);
Justin Novosad 2013/02/04 22:08:04 SK_OVERRIDE on all the virtuals please!
Tom Hudson 2013/02/05 10:23:24 Done. However, as much as I love SK_OVERRIDE, thi
+ virtual int saveLayer(const SkRect*, const SkPaint*,
+ SkCanvas::SaveFlags = kARGB_ClipLayer_SaveFlag);
+ virtual void restore();
+ virtual bool clipRect(const SkRect&, SkRegion::Op, bool);
+ virtual bool clipRRect(const SkRRect&, SkRegion::Op, bool);
+ virtual bool clipPath(const SkPath&, SkRegion::Op, bool);
+ virtual bool clipRegion(const SkRegion&, SkRegion::Op);
+ virtual void clear(SkColor);
+ virtual void drawPaint(const SkPaint&);
+ virtual void drawPoints(PointMode, size_t, const SkPoint [], const SkPaint&);
+ virtual void drawRect(const SkRect&, const SkPaint&);
+ virtual void drawOval(const SkRect&, const SkPaint&);
+ virtual void drawRRect(const SkRRect&, const SkPaint&);
+ virtual void drawPath(const SkPath&, const SkPaint&);
+ virtual void drawBitmap(const SkBitmap&, SkScalar, SkScalar, const SkPaint&);
+ virtual void drawBitmapRectToRect(const SkBitmap&, const SkRect*,
+ const SkRect&, const SkPaint* = NULL);
+ virtual void drawBitmapMatrix(const SkBitmap&, const SkMatrix&,
+ const SkPaint* = NULL);
+ virtual void drawBitmapNine(const SkBitmap&, const SkIRect&, const SkRect&,
+ const SkPaint* = NULL);
+ virtual void drawSprite(const SkBitmap&, int left, int top,
+ const SkPaint* = NULL);
+ virtual void drawText(const void*, size_t, SkScalar, SkScalar,
+ const SkPaint&);
+ virtual void drawPosText(const void*, size_t, const SkPoint [],
+ const SkPaint&);
+ virtual void drawPosTextH(const void*, size_t, const SkScalar [], SkScalar,
+ const SkPaint&);
+ virtual void drawTextOnPath(const void*, size_t, const SkPath&,
+ const SkMatrix*, const SkPaint&);
+ virtual void drawVertices(VertexMode, int, const SkPoint [],
+ const SkPoint [], const SkColor [], SkXfermode*,
+ const uint16_t [], int, const SkPaint&);
+ virtual void drawData(const void*, size_t);
+
+ // Returns the estimated cost of drawing, in arbitrary units.
+ int getEstimatedCost() const;
+
+ // Resets the clip and the cost estimate.
+ void reset(SkRect clip);
+
+ protected:
+
+ int estimatedCost_;
+ SkRect clip_;
+
+};
+
+} // namespace skia
+
+#endif // SKIA_EXT_ANALYSIS_CANVAS_H_
+

Powered by Google App Engine
This is Rietveld 408576698