epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2011 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
yangsu@google.com | a8a42e2 | 2011-06-16 20:49:55 +0000 | [diff] [blame] | 8 | #ifndef SkDebugDumper_DEFINED |
| 9 | #define SkDebugDumper_DEFINED |
yangsu@google.com | ef7bdfa | 2011-08-12 14:27:47 +0000 | [diff] [blame] | 10 | #include "SkDumpCanvas.h" |
yangsu@google.com | a8a42e2 | 2011-06-16 20:49:55 +0000 | [diff] [blame] | 11 | #include "SkEvent.h" |
| 12 | |
yangsu@google.com | a8a42e2 | 2011-06-16 20:49:55 +0000 | [diff] [blame] | 13 | /** Formats the draw commands, and send them to a function-pointer provided |
| 14 | by the caller. |
| 15 | */ |
yangsu@google.com | ef7bdfa | 2011-08-12 14:27:47 +0000 | [diff] [blame] | 16 | class SkDebugDumper : public SkDumpCanvas::Dumper { |
yangsu@google.com | a8a42e2 | 2011-06-16 20:49:55 +0000 | [diff] [blame] | 17 | public: |
| 18 | SkDebugDumper(SkEventSinkID cID, SkEventSinkID clID, SkEventSinkID ipID); |
| 19 | // override from baseclass that does the formatting, and in turn calls |
| 20 | // the function pointer that was passed to the constructor |
yangsu@google.com | ef7bdfa | 2011-08-12 14:27:47 +0000 | [diff] [blame] | 21 | virtual void dump(SkDumpCanvas*, SkDumpCanvas::Verb, const char str[], |
yangsu@google.com | a8a42e2 | 2011-06-16 20:49:55 +0000 | [diff] [blame] | 22 | const SkPaint*); |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 23 | |
yangsu@google.com | a8a42e2 | 2011-06-16 20:49:55 +0000 | [diff] [blame] | 24 | void load() { fInit = true; }; |
| 25 | void unload() { fInit = false; fCount = 0;}; |
| 26 | void disable() { fDisabled = true; }; |
| 27 | void enable() { fDisabled = false; }; |
| 28 | private: |
| 29 | int fCount; |
| 30 | bool fInit; |
| 31 | bool fDisabled; |
| 32 | SkEventSinkID fContentID; |
yangsu@google.com | ef7bdfa | 2011-08-12 14:27:47 +0000 | [diff] [blame] | 33 | SkEventSinkID fCommandsID; |
| 34 | SkEventSinkID fStateID; |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 35 | |
yangsu@google.com | ef7bdfa | 2011-08-12 14:27:47 +0000 | [diff] [blame] | 36 | typedef SkDumpCanvas::Dumper INHERITED; |
yangsu@google.com | a8a42e2 | 2011-06-16 20:49:55 +0000 | [diff] [blame] | 37 | }; |
caryclark@google.com | 9da0cea3 | 2012-06-06 12:11:33 +0000 | [diff] [blame] | 38 | #endif |