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