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

Side by Side 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: Respond to reviewer comments 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/picture.cc ('k') | skia/ext/analysis_canvas.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SKIA_EXT_ANALYSIS_CANVAS_H_
6 #define SKIA_EXT_ANALYSIS_CANVAS_H_
7
8 #include "third_party/skia/include/core/SkCanvas.h"
9 #include "third_party/skia/include/core/SkDevice.h"
10
11 namespace skia {
12
13 class SK_API AnalysisDevice : public SkDevice {
14 public:
15 AnalysisDevice(const SkBitmap& bm);
16 };
17
18 // Does not render anything, but gathers statistics about a region
19 // (specified as a clip rectangle) of an SkPicture as the picture is
20 // played back through it.
21 class SK_API AnalysisCanvas : public SkCanvas {
22 public:
23 AnalysisCanvas(SkDevice*, SkRect clip);
24 virtual ~AnalysisCanvas();
25
26 virtual int save(SkCanvas::SaveFlags = kMatrixClip_SaveFlag) SK_OVERRIDE;
27 virtual int saveLayer(const SkRect*, const SkPaint*,
28 SkCanvas::SaveFlags = kARGB_ClipLayer_SaveFlag)
29 SK_OVERRIDE;
30 virtual void restore() SK_OVERRIDE;
31 virtual bool clipRect(const SkRect&, SkRegion::Op, bool) SK_OVERRIDE;
32 virtual bool clipRRect(const SkRRect&, SkRegion::Op, bool) SK_OVERRIDE;
33 virtual bool clipPath(const SkPath&, SkRegion::Op, bool) SK_OVERRIDE;
34 virtual bool clipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE;
35 virtual void clear(SkColor) SK_OVERRIDE;
36 virtual void drawPaint(const SkPaint&) SK_OVERRIDE;
37 virtual void drawPoints(PointMode, size_t, const SkPoint [],
38 const SkPaint&) SK_OVERRIDE;
39 virtual void drawRect(const SkRect&, const SkPaint&) SK_OVERRIDE;
40 virtual void drawOval(const SkRect&, const SkPaint&) SK_OVERRIDE;
41 virtual void drawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE;
42 virtual void drawPath(const SkPath&, const SkPaint&) SK_OVERRIDE;
43 virtual void drawBitmap(const SkBitmap&, SkScalar, SkScalar,
44 const SkPaint&) SK_OVERRIDE;
45 virtual void drawBitmapRectToRect(const SkBitmap&, const SkRect*,
46 const SkRect&, const SkPaint* = NULL)
47 SK_OVERRIDE;
48 virtual void drawBitmapMatrix(const SkBitmap&, const SkMatrix&,
49 const SkPaint* = NULL) SK_OVERRIDE;
50 virtual void drawBitmapNine(const SkBitmap&, const SkIRect&, const SkRect&,
51 const SkPaint* = NULL) SK_OVERRIDE;
52 virtual void drawSprite(const SkBitmap&, int left, int top,
53 const SkPaint* = NULL) SK_OVERRIDE;
54 virtual void drawText(const void*, size_t, SkScalar, SkScalar,
55 const SkPaint&) SK_OVERRIDE;
56 virtual void drawPosText(const void*, size_t, const SkPoint [],
57 const SkPaint&) SK_OVERRIDE;
58 virtual void drawPosTextH(const void*, size_t, const SkScalar [], SkScalar,
59 const SkPaint&) SK_OVERRIDE;
60 virtual void drawTextOnPath(const void*, size_t, const SkPath&,
61 const SkMatrix*, const SkPaint&) SK_OVERRIDE;
62 virtual void drawVertices(VertexMode, int, const SkPoint [],
63 const SkPoint [], const SkColor [], SkXfermode*,
64 const uint16_t [], int, const SkPaint&) SK_OVERRIDE;
65 virtual void drawData(const void*, size_t) SK_OVERRIDE;
66
67 // Returns true if the estimated cost of drawing is below an
68 // arbitrary threshold.
69 bool isCheap() const;
70
71 // Returns the estimated cost of drawing, in arbitrary units.
72 int getEstimatedCost() const;
73
74 // Resets the clip and the cost estimate.
75 void reset(SkRect clip);
76
77 protected:
78
79 int estimatedCost_;
80 SkRect clip_;
81
82 };
83
84 } // namespace skia
85
86 #endif // SKIA_EXT_ANALYSIS_CANVAS_H_
87
OLDNEW
« no previous file with comments | « cc/picture.cc ('k') | skia/ext/analysis_canvas.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698