OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkTrackDevice_DEFINED | 8 #ifndef SkTrackDevice_DEFINED |
9 #define SkTrackDevice_DEFINED | 9 #define SkTrackDevice_DEFINED |
10 | 10 |
11 #include "SkBitmapDevice.h" | 11 #include "SkBitmapDevice.h" |
12 #include "SkTracker.h" | 12 #include "SkTracker.h" |
13 | 13 |
14 /** \class SkTrackDevice | 14 /** \class SkTrackDevice |
15 * | 15 * |
16 * A Track Device is used to track that callstack of an operation that affecte
d some pixels. | 16 * A Track Device is used to track that callstack of an operation that affecte
d some pixels. |
17 * It can be used with SampleApp to investigate bugs (CL not checked in yet). | 17 * It can be used with SampleApp to investigate bugs (CL not checked in yet). |
18 * | 18 * |
| 19 * every drawFoo is implemented as such: |
| 20 * before(); // - collects state of interesting pixels |
| 21 * INHERITED::drawFoo(...); |
| 22 * after(); // - checks if pixels of interest, and issue a breakpoint. |
| 23 * |
19 */ | 24 */ |
20 class SkTrackDevice : public SkBitmapDevice { | 25 class SkTrackDevice : public SkBitmapDevice { |
21 public: | 26 public: |
22 SK_DECLARE_INST_COUNT(SkTrackDevice) | 27 SK_DECLARE_INST_COUNT(SkTrackDevice) |
23 | 28 |
24 SkTrackDevice(const SkBitmap& bitmap) : SkBitmapDevice(bitmap) | 29 SkTrackDevice(const SkBitmap& bitmap) : SkBitmapDevice(bitmap) |
25 , fTracker(NULL) {} | 30 , fTracker(NULL) {} |
26 | 31 |
27 SkTrackDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProper
ties) | 32 SkTrackDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProper
ties) |
28 : SkBitmapDevice(bitmap, deviceProperties) | 33 : SkBitmapDevice(bitmap, deviceProperties) |
29 , fTracker(NULL) {} | 34 , fTracker(NULL) {} |
30 | 35 |
31 SkTrackDevice(SkBitmap::Config config, int width, int height, bool isOpaque
= false) | 36 SkTrackDevice(SkBitmap::Config config, int width, int height, bool isOpaque
= false) |
32 : SkBitmapDevice(config, width, height, isOpaque) | 37 : SkBitmapDevice(config, width, height, isOpaque) |
33 , fTracker(NULL) {} | 38 , fTracker(NULL) {} |
34 | 39 |
35 SkTrackDevice(SkBitmap::Config config, int width, int height, bool isOpaque, | 40 SkTrackDevice(SkBitmap::Config config, int width, int height, bool isOpaque, |
36 const SkDeviceProperties& deviceProperties) | 41 const SkDeviceProperties& deviceProperties) |
37 : SkBitmapDevice(config, width, height, isOpaque, deviceProperties) | 42 : SkBitmapDevice(config, width, height, isOpaque, deviceProperties) |
38 , fTracker(NULL) {} | 43 , fTracker(NULL) {} |
39 | 44 |
40 virtual ~SkTrackDevice() {} | 45 virtual ~SkTrackDevice() {} |
41 | 46 |
| 47 // Install a tracker - we can reuse the tracker between multiple devices, an
d the state of the |
| 48 // tracker is preserved - number and location of poinbts, ... |
42 void installTracker(SkTracker* tracker) { | 49 void installTracker(SkTracker* tracker) { |
43 fTracker = tracker; | 50 fTracker = tracker; |
44 fTracker->newFrame(); | 51 fTracker->newFrame(); |
45 } | 52 } |
46 | 53 |
47 protected: | 54 protected: |
48 virtual void clear(SkColor color) { | 55 virtual void clear(SkColor color) { |
49 before(); | 56 before(); |
50 INHERITED::clear(color); | 57 INHERITED::clear(color); |
51 after(); | 58 after(); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } | 189 } |
183 } | 190 } |
184 | 191 |
185 private: | 192 private: |
186 SkTracker* fTracker; | 193 SkTracker* fTracker; |
187 | 194 |
188 typedef SkBitmapDevice INHERITED; | 195 typedef SkBitmapDevice INHERITED; |
189 }; | 196 }; |
190 | 197 |
191 #endif // SkTrackDevice_DEFINED | 198 #endif // SkTrackDevice_DEFINED |
OLD | NEW |