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

Side by Side Diff: src/core/SkBBoxRecord.h

Issue 12545009: Adding option in SkPicture to record device-space bounds of draw commands. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 7 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #ifndef SkBBoxRecord_DEFINED 9 #ifndef SkBBoxRecord_DEFINED
10 #define SkBBoxRecord_DEFINED 10 #define SkBBoxRecord_DEFINED
11 11
12 #include "SkPictureRecord.h" 12 #include "SkPictureRecord.h"
13 13
14 /** 14 /**
15 * This is an abstract SkPictureRecord subclass that intercepts draw calls and computes an 15 * This is an abstract SkPictureRecord subclass that intercepts draw calls and computes an
16 * axis-aligned bounding box for each draw that it sees, subclasses implement h andleBBox() 16 * axis-aligned bounding box for each draw that it sees, subclasses implement h andleBBox()
17 * which will be called every time we get a new bounding box. 17 * which will be called every time we get a new bounding box.
18 */ 18 */
19 class SkBBoxRecord : public SkPictureRecord { 19 class SkBBoxRecord : public SkPictureRecord {
20 public: 20 public:
21 21
22 SkBBoxRecord(uint32_t recordFlags, SkDevice* device) 22 SkBBoxRecord(uint32_t recordFlags, SkDevice* device)
23 : INHERITED(recordFlags, device) { } 23 : INHERITED(recordFlags, device) { }
24 virtual ~SkBBoxRecord() { } 24 virtual ~SkBBoxRecord() { }
25 25
26 /** 26 /**
27 * This is called each time we get a bounding box, it will be axis-aligned, 27 * This is called each time we get a bounding box, it will be axis-aligned,
28 * in device coordinates, and expanded to include stroking, shadows, etc. 28 * in device coordinates, and expanded to include stroking, shadows, etc.
29 */ 29 */
30 #if SK_RECORD_BOUNDS_IN_PICTURE
31 virtual void handleBBox(uint32_t offset) = 0;
32 #else
30 virtual void handleBBox(const SkRect& bbox) = 0; 33 virtual void handleBBox(const SkRect& bbox) = 0;
34 #endif
31 35
32 virtual void drawOval(const SkRect& rect, const SkPaint& paint) SK_OVERRIDE; 36 virtual void drawOval(const SkRect& rect, const SkPaint& paint) SK_OVERRIDE;
33 virtual void drawRRect(const SkRRect& rrect, const SkPaint& paint) SK_OVERRI DE; 37 virtual void drawRRect(const SkRRect& rrect, const SkPaint& paint) SK_OVERRI DE;
34 virtual void drawRect(const SkRect& rect, const SkPaint& paint) SK_OVERRIDE; 38 virtual void drawRect(const SkRect& rect, const SkPaint& paint) SK_OVERRIDE;
35 virtual void drawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE; 39 virtual void drawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE;
36 virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[], 40 virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
37 const SkPaint& paint) SK_OVERRIDE; 41 const SkPaint& paint) SK_OVERRIDE;
38 virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE; 42 virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
39 virtual void clear(SkColor) SK_OVERRIDE; 43 virtual void clear(SkColor) SK_OVERRIDE;
40 virtual void drawText(const void* text, size_t byteLength, SkScalar x, SkSca lar y, 44 virtual void drawText(const void* text, size_t byteLength, SkScalar x, SkSca lar y,
(...skipping 28 matching lines...) Expand all
69 * Takes a bounding box in current canvas view space, accounts for stroking and effects, and 73 * Takes a bounding box in current canvas view space, accounts for stroking and effects, and
70 * computes an axis-aligned bounding box in device coordinates, then passes it to handleBBox() 74 * computes an axis-aligned bounding box in device coordinates, then passes it to handleBBox()
71 * returns false if the draw is completely clipped out, and may safely be ig nored. 75 * returns false if the draw is completely clipped out, and may safely be ig nored.
72 **/ 76 **/
73 bool transformBounds(const SkRect& bounds, const SkPaint* paint); 77 bool transformBounds(const SkRect& bounds, const SkPaint* paint);
74 78
75 typedef SkPictureRecord INHERITED; 79 typedef SkPictureRecord INHERITED;
76 }; 80 };
77 81
78 #endif 82 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698