/src/mozilla-central/gfx/layers/RenderTrace.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | // This is a general tool that will let you visualize platform operation. |
8 | | // Currently used for the layer system, the general syntax allows this |
9 | | // tools to be adapted to trace other operations. |
10 | | // |
11 | | // For the front end see: https://github.com/staktrace/rendertrace |
12 | | |
13 | | // Uncomment this line to enable RENDERTRACE |
14 | | //#define MOZ_RENDERTRACE |
15 | | |
16 | | #ifndef GFX_RENDERTRACE_H |
17 | | #define GFX_RENDERTRACE_H |
18 | | |
19 | | #include "nsRect.h" |
20 | | #include "mozilla/gfx/Matrix.h" |
21 | | |
22 | | namespace mozilla { |
23 | | namespace layers { |
24 | | |
25 | | class Layer; |
26 | | |
27 | | void RenderTraceLayers(Layer *aLayer, const char *aColor, const gfx::Matrix4x4 aRootTransform = gfx::Matrix4x4(), bool aReset = true); |
28 | | |
29 | | void RenderTraceInvalidateStart(Layer *aLayer, const char *aColor, const gfx::IntRect aRect); |
30 | | void RenderTraceInvalidateEnd(Layer *aLayer, const char *aColor); |
31 | | |
32 | | void renderTraceEventStart(const char *aComment, const char *aColor); |
33 | | void renderTraceEventEnd(const char *aComment, const char *aColor); |
34 | | void renderTraceEventEnd(const char *aColor); |
35 | | |
36 | | struct RenderTraceScope { |
37 | | public: |
38 | | RenderTraceScope(const char *aComment, const char *aColor) |
39 | | : mComment(aComment) |
40 | | , mColor(aColor) |
41 | 0 | { |
42 | 0 | renderTraceEventStart(mComment, mColor); |
43 | 0 | } |
44 | 0 | ~RenderTraceScope() { |
45 | 0 | renderTraceEventEnd(mComment, mColor); |
46 | 0 | } |
47 | | private: |
48 | | const char *mComment; |
49 | | const char *mColor; |
50 | | }; |
51 | | |
52 | | #ifndef MOZ_RENDERTRACE |
53 | | inline void RenderTraceLayers(Layer *aLayer, const char *aColor, const gfx::Matrix4x4 aRootTransform, bool aReset) |
54 | 0 | {} |
55 | | |
56 | | inline void RenderTraceInvalidateStart(Layer *aLayer, const char *aColor, const gfx::IntRect aRect) |
57 | 0 | {} |
58 | | |
59 | | inline void RenderTraceInvalidateEnd(Layer *aLayer, const char *aColor) |
60 | 0 | {} |
61 | | |
62 | | inline void renderTraceEventStart(const char *aComment, const char *aColor) |
63 | 0 | {} |
64 | | |
65 | | inline void renderTraceEventEnd(const char *aComment, const char *aColor) |
66 | 0 | {} |
67 | | |
68 | | inline void renderTraceEventEnd(const char *aColor) |
69 | 0 | {} |
70 | | |
71 | | #endif // MOZ_RENDERTRACE |
72 | | |
73 | | } // namespace layers |
74 | | } // namespace mozilla |
75 | | |
76 | | #endif //GFX_RENDERTRACE_H |