1 /*
2  * Copyright 2015 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef VisualDebugModule_DEFINED
9 #define VisualDebugModule_DEFINED
10 
11 #include "VisualModule.h"
12 
13 #include "SkDebugCanvas.h"
14 #include "VisualBench.h"
15 #include "VisualBenchmarkStream.h"
16 
17 class VisualDebugModule : public VisualModule {
18 public:
19     VisualDebugModule(VisualBench* owner);
20     void draw(SkCanvas* canvas) override;
21     bool onHandleChar(SkUnichar unichar) override;
22 
23 private:
24     enum State {
25         kInit_State,
26         kPlay_State,
27         kNext_State,
28     };
29 
30     bool advanceIfNecessary(SkCanvas*);
31 
32     State fState;
33     SkAutoTUnref<SkDebugCanvas> fDebugCanvas;
34     int fIndex;
35 
36     // support framework
37     VisualBench* fOwner;
38     SkAutoTDelete<VisualBenchmarkStream> fBenchmarkStream;
39 
40     typedef VisualModule INHERITED;
41 };
42 
43 #endif
44