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/. */
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.
11 // For the front end see: https://github.com/staktrace/rendertrace
13 // Uncomment this line to enable RENDERTRACE
14 //#define MOZ_RENDERTRACE
16 #ifndef GFX_RENDERTRACE_H
17 #define GFX_RENDERTRACE_H
20 #include "mozilla/gfx/Matrix.h"
27 void RenderTraceLayers(Layer
* aLayer
, const char* aColor
,
28 const gfx::Matrix4x4 aRootTransform
= gfx::Matrix4x4(),
31 void RenderTraceInvalidateStart(Layer
* aLayer
, const char* aColor
,
32 const gfx::IntRect aRect
);
33 void RenderTraceInvalidateEnd(Layer
* aLayer
, const char* aColor
);
35 void renderTraceEventStart(const char* aComment
, const char* aColor
);
36 void renderTraceEventEnd(const char* aComment
, const char* aColor
);
37 void renderTraceEventEnd(const char* aColor
);
39 struct RenderTraceScope
{
41 RenderTraceScope(const char* aComment
, const char* aColor
)
42 : mComment(aComment
), mColor(aColor
) {
43 renderTraceEventStart(mComment
, mColor
);
45 ~RenderTraceScope() { renderTraceEventEnd(mComment
, mColor
); }
52 #ifndef MOZ_RENDERTRACE
53 inline void RenderTraceLayers(Layer
* aLayer
, const char* aColor
,
54 const gfx::Matrix4x4 aRootTransform
,
57 inline void RenderTraceInvalidateStart(Layer
* aLayer
, const char* aColor
,
58 const gfx::IntRect aRect
) {}
60 inline void RenderTraceInvalidateEnd(Layer
* aLayer
, const char* aColor
) {}
62 inline void renderTraceEventStart(const char* aComment
, const char* aColor
) {}
64 inline void renderTraceEventEnd(const char* aComment
, const char* aColor
) {}
66 inline void renderTraceEventEnd(const char* aColor
) {}
68 #endif // MOZ_RENDERTRACE
71 } // namespace mozilla
73 #endif // GFX_RENDERTRACE_H