| 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 the callstack of an operation that affected
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: | 19 * every drawFoo is implemented as such: |
| 20 * before(); // - collects state of interesting pixels | 20 * before(); // - collects state of interesting pixels |
| 21 * INHERITED::drawFoo(...); | 21 * INHERITED::drawFoo(...); |
| 22 * after(); // - checks if pixels of interest, and issue a breakpoint. | 22 * after(); // - checks if pixels of interest, and issue a breakpoint. |
| 23 * | 23 * |
| 24 */ | 24 */ |
| 25 // TODO: can this be derived from SkBaseDevice instead? |
| 25 class SkTrackDevice : public SkBitmapDevice { | 26 class SkTrackDevice : public SkBitmapDevice { |
| 26 public: | 27 public: |
| 27 SK_DECLARE_INST_COUNT(SkTrackDevice) | 28 SK_DECLARE_INST_COUNT(SkTrackDevice) |
| 28 | 29 |
| 29 SkTrackDevice(const SkBitmap& bitmap) : SkBitmapDevice(bitmap) | 30 SkTrackDevice(const SkBitmap& bitmap) |
| 30 , fTracker(NULL) {} | 31 : INHERITED(bitmap, SkSurfaceProps(0, kUnknown_SkPixelGeometry)) |
| 32 , fTracker(NULL) { |
| 33 } |
| 31 | 34 |
| 32 virtual ~SkTrackDevice() {} | 35 virtual ~SkTrackDevice() {} |
| 33 | 36 |
| 34 // Install a tracker - we can reuse the tracker between multiple devices, an
d the state of the | 37 // Install a tracker - we can reuse the tracker between multiple devices, an
d the state of the |
| 35 // tracker is preserved - number and location of poinbts, ... | 38 // tracker is preserved - number and location of poinbts, ... |
| 36 void installTracker(SkTracker* tracker) { | 39 void installTracker(SkTracker* tracker) { |
| 37 fTracker = tracker; | 40 fTracker = tracker; |
| 38 fTracker->newFrame(); | 41 fTracker->newFrame(); |
| 39 } | 42 } |
| 40 | 43 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 } | 172 } |
| 170 } | 173 } |
| 171 | 174 |
| 172 private: | 175 private: |
| 173 SkTracker* fTracker; | 176 SkTracker* fTracker; |
| 174 | 177 |
| 175 typedef SkBitmapDevice INHERITED; | 178 typedef SkBitmapDevice INHERITED; |
| 176 }; | 179 }; |
| 177 | 180 |
| 178 #endif // SkTrackDevice_DEFINED | 181 #endif // SkTrackDevice_DEFINED |
| OLD | NEW |