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

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: 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..6ed797f9771b2ca264f2c918a0530f5e53f5500d
--- /dev/null
+++ b/skia/ext/analysis_canvas.h
@@ -0,0 +1,73 @@
+// 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"
+
+namespace skia {
+
+// 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(SkRect clip);
+ virtual ~AnalysisCanvas();
+
+ virtual int save(SkCanvas::SaveFlags = kMatrixClip_SaveFlag);
+ 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_
+
« cc/picture.cc ('K') | « cc/picture.cc ('k') | skia/ext/analysis_canvas.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698