michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: // This is a general tool that will let you visualize platform operation. michael@0: // Currently used for the layer system, the general syntax allows this michael@0: // tools to be adapted to trace other operations. michael@0: // michael@0: // For the front end see: https://github.com/staktrace/rendertrace michael@0: michael@0: // Uncomment this line to enable RENDERTRACE michael@0: //#define MOZ_RENDERTRACE michael@0: michael@0: #ifndef GFX_RENDERTRACE_H michael@0: #define GFX_RENDERTRACE_H michael@0: michael@0: #include "gfx3DMatrix.h" michael@0: #include "nsRect.h" michael@0: michael@0: namespace mozilla { michael@0: namespace layers { michael@0: michael@0: class Layer; michael@0: michael@0: void RenderTraceLayers(Layer *aLayer, const char *aColor, const gfx3DMatrix aRootTransform = gfx3DMatrix(), bool aReset = true); michael@0: michael@0: void RenderTraceInvalidateStart(Layer *aLayer, const char *aColor, const nsIntRect aRect); michael@0: void RenderTraceInvalidateEnd(Layer *aLayer, const char *aColor); michael@0: michael@0: void renderTraceEventStart(const char *aComment, const char *aColor); michael@0: void renderTraceEventEnd(const char *aComment, const char *aColor); michael@0: void renderTraceEventEnd(const char *aColor); michael@0: michael@0: struct RenderTraceScope { michael@0: public: michael@0: RenderTraceScope(const char *aComment, const char *aColor) michael@0: : mComment(aComment) michael@0: , mColor(aColor) michael@0: { michael@0: renderTraceEventStart(mComment, mColor); michael@0: } michael@0: ~RenderTraceScope() { michael@0: renderTraceEventEnd(mComment, mColor); michael@0: } michael@0: private: michael@0: const char *mComment; michael@0: const char *mColor; michael@0: }; michael@0: michael@0: #ifndef MOZ_RENDERTRACE michael@0: inline void RenderTraceLayers(Layer *aLayer, const char *aColor, const gfx3DMatrix aRootTransform, bool aReset) michael@0: {} michael@0: michael@0: inline void RenderTraceInvalidateStart(Layer *aLayer, const char *aColor, const nsIntRect aRect) michael@0: {} michael@0: michael@0: inline void RenderTraceInvalidateEnd(Layer *aLayer, const char *aColor) michael@0: {} michael@0: michael@0: inline void renderTraceEventStart(const char *aComment, const char *aColor) michael@0: {} michael@0: michael@0: inline void renderTraceEventEnd(const char *aComment, const char *aColor) michael@0: {} michael@0: michael@0: inline void renderTraceEventEnd(const char *aColor) michael@0: {} michael@0: michael@0: #endif // MOZ_RENDERTRACE michael@0: michael@0: } michael@0: } michael@0: michael@0: #endif //GFX_RENDERTRACE_H