aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/Debugger/SkDebugDumper.h
blob: 35b0b23e41926e2e8de19c62207173e29e7d3831 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

/*
 * Copyright 2011 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#ifndef SkDebugDumper_DEFINED
#define SkDebugDumper_DEFINED
#include "SkDumpCanvas.h"
#include "SkEvent.h"

/** Formats the draw commands, and send them to a function-pointer provided
 by the caller.
 */
class SkDebugDumper : public SkDumpCanvas::Dumper {
public:
    SkDebugDumper(SkEventSinkID cID, SkEventSinkID clID, SkEventSinkID ipID);
    // override from baseclass that does the formatting, and in turn calls
    // the function pointer that was passed to the constructor
    virtual void dump(SkDumpCanvas*, SkDumpCanvas::Verb, const char str[],
                      const SkPaint*);
    
    void load() { fInit = true; };
    void unload() { fInit = false; fCount = 0;};
    void disable() { fDisabled = true; };
    void enable() { fDisabled = false; };
private:
    int             fCount;
    bool            fInit;
    bool            fDisabled;
    SkEventSinkID   fContentID;
    SkEventSinkID   fCommandsID;
    SkEventSinkID   fStateID;
    
    typedef SkDumpCanvas::Dumper INHERITED;
};
#endif