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

Unified Diff: skia/ext/analysis_canvas.h

Issue 12213018: Implementation for cc::Picture::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
index 983c0df7d3c377a78c44c9487db8c20a3058d6ff..0f592851a5728466a2ea8656b3127e5c1a192e93 100644
--- a/skia/ext/analysis_canvas.h
+++ b/skia/ext/analysis_canvas.h
@@ -10,9 +10,64 @@
namespace skia {
-class SK_API AnalysisDevice : public SkDevice {
+class AnalysisDevice;
+
+class AnalysisDevice : public SkDevice {
public:
AnalysisDevice(const SkBitmap& bm);
+ virtual ~AnalysisDevice();
+
+ int getEstimatedCost() const;
+
+ protected:
+ virtual void clear(SkColor color) OVERRIDE;
+ virtual void drawPaint(const SkDraw&, const SkPaint& paint) OVERRIDE;
+ virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode,
+ size_t count, const SkPoint[],
+ const SkPaint& paint) OVERRIDE;
+ virtual void drawRect(const SkDraw&, const SkRect& r,
+ const SkPaint& paint) OVERRIDE;
+ virtual void drawOval(const SkDraw&, const SkRect& oval,
+ const SkPaint& paint) OVERRIDE;
+ virtual void drawPath(const SkDraw&, const SkPath& path,
+ const SkPaint& paint,
+ const SkMatrix* prePathMatrix = NULL,
+ bool pathIsMutable = false) OVERRIDE;
+ virtual void drawBitmap(const SkDraw&, const SkBitmap& bitmap,
+ const SkIRect* srcRectOrNull,
+ const SkMatrix& matrix, const SkPaint& paint)
+ OVERRIDE;
+ virtual void drawSprite(const SkDraw&, const SkBitmap& bitmap,
+ int x, int y, const SkPaint& paint) OVERRIDE;
+ virtual void drawBitmapRect(const SkDraw&, const SkBitmap&,
+ const SkRect* srcOrNull, const SkRect& dst,
+ const SkPaint& paint) OVERRIDE;
+ virtual void drawText(const SkDraw&, const void* text, size_t len,
+ SkScalar x, SkScalar y, const SkPaint& paint)
+ OVERRIDE;
+ virtual void drawPosText(const SkDraw& draw, const void* text, size_t len,
+ const SkScalar pos[], SkScalar constY,
+ int scalarsPerPos, const SkPaint& paint) OVERRIDE;
+ virtual void drawTextOnPath(const SkDraw&, const void* text, size_t len,
+ const SkPath& path, const SkMatrix* matrix,
+ const SkPaint& paint) OVERRIDE;
+#ifdef SK_BUILD_FOR_ANDROID
+ virtual void drawPosTextOnPath(const SkDraw& draw, const void* text,
+ size_t len,
+ const SkPoint pos[], const SkPaint& paint,
+ const SkPath& path, const SkMatrix* matrix)
+ OVERRIDE;
+#endif
+ virtual void drawVertices(const SkDraw&, SkCanvas::VertexMode,
+ int vertexCount,
+ const SkPoint verts[], const SkPoint texs[],
+ const SkColor colors[], SkXfermode* xmode,
+ const uint16_t indices[], int indexCount,
+ const SkPaint& paint) OVERRIDE;
+ virtual void drawDevice(const SkDraw&, SkDevice*, int x, int y,
+ const SkPaint&) OVERRIDE;
+
+ int estimatedCost_;
};
// Does not render anything, but gathers statistics about a region
@@ -20,49 +75,11 @@ class SK_API AnalysisDevice : public SkDevice {
// played back through it.
class SK_API AnalysisCanvas : public SkCanvas {
public:
- AnalysisCanvas(SkDevice*, SkRect clip);
+ AnalysisCanvas(AnalysisDevice*);
virtual ~AnalysisCanvas();
- virtual int save(SkCanvas::SaveFlags = kMatrixClip_SaveFlag) SK_OVERRIDE;
- virtual int saveLayer(const SkRect*, const SkPaint*,
- SkCanvas::SaveFlags = kARGB_ClipLayer_SaveFlag)
- SK_OVERRIDE;
- virtual void restore() SK_OVERRIDE;
- virtual bool clipRect(const SkRect&, SkRegion::Op, bool) SK_OVERRIDE;
- virtual bool clipRRect(const SkRRect&, SkRegion::Op, bool) SK_OVERRIDE;
- virtual bool clipPath(const SkPath&, SkRegion::Op, bool) SK_OVERRIDE;
- virtual bool clipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE;
- virtual void clear(SkColor) SK_OVERRIDE;
- virtual void drawPaint(const SkPaint&) SK_OVERRIDE;
- virtual void drawPoints(PointMode, size_t, const SkPoint [],
- const SkPaint&) SK_OVERRIDE;
- virtual void drawRect(const SkRect&, const SkPaint&) SK_OVERRIDE;
- virtual void drawOval(const SkRect&, const SkPaint&) SK_OVERRIDE;
- virtual void drawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE;
- virtual void drawPath(const SkPath&, const SkPaint&) SK_OVERRIDE;
- virtual void drawBitmap(const SkBitmap&, SkScalar, SkScalar,
- const SkPaint&) SK_OVERRIDE;
- virtual void drawBitmapRectToRect(const SkBitmap&, const SkRect*,
- const SkRect&, const SkPaint* = NULL)
- SK_OVERRIDE;
- virtual void drawBitmapMatrix(const SkBitmap&, const SkMatrix&,
- const SkPaint* = NULL) SK_OVERRIDE;
- virtual void drawBitmapNine(const SkBitmap&, const SkIRect&, const SkRect&,
- const SkPaint* = NULL) SK_OVERRIDE;
- virtual void drawSprite(const SkBitmap&, int left, int top,
- const SkPaint* = NULL) SK_OVERRIDE;
- virtual void drawText(const void*, size_t, SkScalar, SkScalar,
- const SkPaint&) SK_OVERRIDE;
- virtual void drawPosText(const void*, size_t, const SkPoint [],
- const SkPaint&) SK_OVERRIDE;
- virtual void drawPosTextH(const void*, size_t, const SkScalar [], SkScalar,
- const SkPaint&) SK_OVERRIDE;
- virtual void drawTextOnPath(const void*, size_t, const SkPath&,
- const SkMatrix*, const SkPaint&) SK_OVERRIDE;
- virtual void drawVertices(VertexMode, int, const SkPoint [],
- const SkPoint [], const SkColor [], SkXfermode*,
- const uint16_t [], int, const SkPaint&) SK_OVERRIDE;
- virtual void drawData(const void*, size_t) SK_OVERRIDE;
+ // Creates a canvas and its supporting data structures.
+ //static AnalysisCanvas* Create(int width, int height);
// Returns true if the estimated cost of drawing is below an
// arbitrary threshold.
@@ -71,14 +88,18 @@ class SK_API AnalysisCanvas : public SkCanvas {
// 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_;
+ virtual bool clipRect(const SkRect& rect,
+ SkRegion::Op op = SkRegion::kIntersect_Op,
+ bool doAntiAlias = false) OVERRIDE;
+ virtual bool clipPath(const SkPath& path,
+ SkRegion::Op op = SkRegion::kIntersect_Op,
+ bool doAntiAlias = false) OVERRIDE;
+ virtual bool clipRRect(const SkRRect& rrect,
+ SkRegion::Op op = SkRegion::kIntersect_Op,
+ bool doAntiAlias = false) OVERRIDE;
+ virtual int saveLayer(const SkRect* bounds, const SkPaint*,
+ SkCanvas::SaveFlags flags) OVERRIDE;
};
} // namespace skia
« 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