Bug 1690340 - Part 2: Use the new naming for the developer tools menu items. r=jdescottes
[gecko.git] / gfx / layers / RenderTrace.h
blob404ba1ea1d6db1865ccc0c3890df7d6d9cc1c1e6
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
19 #include "nsRect.h"
20 #include "mozilla/gfx/Matrix.h"
22 namespace mozilla {
23 namespace layers {
25 class Layer;
27 void RenderTraceLayers(Layer* aLayer, const char* aColor,
28 const gfx::Matrix4x4 aRootTransform = gfx::Matrix4x4(),
29 bool aReset = true);
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 {
40 public:
41 RenderTraceScope(const char* aComment, const char* aColor)
42 : mComment(aComment), mColor(aColor) {
43 renderTraceEventStart(mComment, mColor);
45 ~RenderTraceScope() { renderTraceEventEnd(mComment, mColor); }
47 private:
48 const char* mComment;
49 const char* mColor;
52 #ifndef MOZ_RENDERTRACE
53 inline void RenderTraceLayers(Layer* aLayer, const char* aColor,
54 const gfx::Matrix4x4 aRootTransform,
55 bool aReset) {}
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
70 } // namespace layers
71 } // namespace mozilla
73 #endif // GFX_RENDERTRACE_H