Index: skia/ext/analysis_canvas.h |
diff --git a/skia/ext/analysis_canvas.h b/skia/ext/analysis_canvas.h |
index 78d72ff9381ff5a5974708e81ac47ab152915777..66d92746f069c010678af007b996a05001d270b9 100644 |
--- a/skia/ext/analysis_canvas.h |
+++ b/skia/ext/analysis_canvas.h |
@@ -9,29 +9,23 @@ |
#include "third_party/skia/include/core/SkBitmapDevice.h" |
#include "third_party/skia/include/core/SkCanvas.h" |
#include "third_party/skia/include/core/SkPicture.h" |
+#include "ui/gfx/rect.h" |
namespace skia { |
class AnalysisDevice; |
-// 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. |
-// To use: create a SkBitmap with kNo_Config, create an AnalysisDevice |
-// using that bitmap, and create an AnalysisCanvas using the device. |
-// Play a picture into the canvas, and then check result. |
-class SK_API AnalysisCanvas : public SkCanvas, public SkDrawPictureCallback { |
+// Gathers statistics about a region of an SkPicture as the picture is played |
+// back and rastered through it. |
+class SK_API AnalysisCanvas : public SkCanvas { |
public: |
- AnalysisCanvas(AnalysisDevice*); |
+ explicit AnalysisCanvas(AnalysisDevice* device); |
virtual ~AnalysisCanvas(); |
// Returns true when a SkColor can be used to represent result. |
bool GetColorIfSolid(SkColor* color) const; |
bool HasText() const; |
- // SkDrawPictureCallback override. |
- virtual bool abortDrawing() OVERRIDE; |
- |
// SkCanvas overrides. |
virtual bool clipRect(const SkRect& rect, |
SkRegion::Op op = SkRegion::kIntersect_Op, |
@@ -63,7 +57,8 @@ class SK_API AnalysisCanvas : public SkCanvas, public SkDrawPictureCallback { |
// to be derived from SkBaseDevice (rather than SkBitmapDevice) |
class SK_API AnalysisDevice : public SkBitmapDevice { |
public: |
- AnalysisDevice(const SkBitmap& bitmap); |
+ // |analysis_rect| is in device space. |
+ AnalysisDevice(const SkBitmap& bitmap, gfx::Rect analysis_rect); |
virtual ~AnalysisDevice(); |
bool GetColorIfSolid(SkColor* color) const; |
@@ -72,6 +67,8 @@ class SK_API AnalysisDevice : public SkBitmapDevice { |
void SetForceNotSolid(bool flag); |
void SetForceNotTransparent(bool flag); |
+ gfx::Rect AnalysisRect() const { return analysis_rect_; } |
+ |
protected: |
// SkBaseDevice overrides. |
virtual void clear(SkColor color) OVERRIDE; |
@@ -154,6 +151,11 @@ class SK_API AnalysisDevice : public SkBitmapDevice { |
private: |
typedef SkBitmapDevice INHERITED; |
+ void AnalyzeDrawRect(const SkDraw& draw, |
+ const SkRect& rect, |
+ const SkPaint& paint); |
+ |
+ gfx::Rect analysis_rect_; |
bool is_forced_not_solid_; |
bool is_forced_not_transparent_; |
bool is_solid_color_; |