gfx/layers/RenderTrace.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/layers/RenderTrace.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,75 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +// This is a general tool that will let you visualize platform operation.
    1.10 +// Currently used for the layer system, the general syntax allows this
    1.11 +// tools to be adapted to trace other operations.
    1.12 +//
    1.13 +// For the front end see: https://github.com/staktrace/rendertrace
    1.14 +
    1.15 +// Uncomment this line to enable RENDERTRACE
    1.16 +//#define MOZ_RENDERTRACE
    1.17 +
    1.18 +#ifndef GFX_RENDERTRACE_H
    1.19 +#define GFX_RENDERTRACE_H
    1.20 +
    1.21 +#include "gfx3DMatrix.h"
    1.22 +#include "nsRect.h"
    1.23 +
    1.24 +namespace mozilla {
    1.25 +namespace layers {
    1.26 +
    1.27 +class Layer;
    1.28 +
    1.29 +void RenderTraceLayers(Layer *aLayer, const char *aColor, const gfx3DMatrix aRootTransform = gfx3DMatrix(), bool aReset = true);
    1.30 +
    1.31 +void RenderTraceInvalidateStart(Layer *aLayer, const char *aColor, const nsIntRect aRect);
    1.32 +void RenderTraceInvalidateEnd(Layer *aLayer, const char *aColor);
    1.33 +
    1.34 +void renderTraceEventStart(const char *aComment, const char *aColor);
    1.35 +void renderTraceEventEnd(const char *aComment, const char *aColor);
    1.36 +void renderTraceEventEnd(const char *aColor);
    1.37 +
    1.38 +struct RenderTraceScope {
    1.39 +public:
    1.40 +  RenderTraceScope(const char *aComment, const char *aColor)
    1.41 +    : mComment(aComment)
    1.42 +    , mColor(aColor)
    1.43 +  {
    1.44 +    renderTraceEventStart(mComment, mColor);
    1.45 +  }
    1.46 +  ~RenderTraceScope() {
    1.47 +    renderTraceEventEnd(mComment, mColor);
    1.48 +  }
    1.49 +private:
    1.50 +  const char *mComment;
    1.51 +  const char *mColor;
    1.52 +};
    1.53 +
    1.54 +#ifndef MOZ_RENDERTRACE
    1.55 +inline void RenderTraceLayers(Layer *aLayer, const char *aColor, const gfx3DMatrix aRootTransform, bool aReset)
    1.56 +{}
    1.57 +
    1.58 +inline void RenderTraceInvalidateStart(Layer *aLayer, const char *aColor, const nsIntRect aRect)
    1.59 +{}
    1.60 +
    1.61 +inline void RenderTraceInvalidateEnd(Layer *aLayer, const char *aColor)
    1.62 +{}
    1.63 +
    1.64 +inline void renderTraceEventStart(const char *aComment, const char *aColor)
    1.65 +{}
    1.66 +
    1.67 +inline void renderTraceEventEnd(const char *aComment, const char *aColor)
    1.68 +{}
    1.69 +
    1.70 +inline void renderTraceEventEnd(const char *aColor)
    1.71 +{}
    1.72 +
    1.73 +#endif // MOZ_RENDERTRACE
    1.74 +
    1.75 +}
    1.76 +}
    1.77 +
    1.78 +#endif //GFX_RENDERTRACE_H

mercurial