2017-10-28 02:10:06 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2012-05-21 15:12:37 +04:00
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2012-02-18 02:05:03 +04:00
|
|
|
|
|
|
|
// This is a general tool that will let you visualize platform operation.
|
|
|
|
// Currently used for the layer system, the general syntax allows this
|
|
|
|
// tools to be adapted to trace other operations.
|
|
|
|
//
|
|
|
|
// For the front end see: https://github.com/staktrace/rendertrace
|
|
|
|
|
|
|
|
// Uncomment this line to enable RENDERTRACE
|
2012-02-25 02:41:16 +04:00
|
|
|
//#define MOZ_RENDERTRACE
|
2012-02-18 02:05:03 +04:00
|
|
|
|
|
|
|
#ifndef GFX_RENDERTRACE_H
|
2012-02-25 02:41:16 +04:00
|
|
|
#define GFX_RENDERTRACE_H
|
2012-02-18 02:05:03 +04:00
|
|
|
|
2012-02-22 05:20:14 +04:00
|
|
|
#include "nsRect.h"
|
2014-08-01 16:31:49 +04:00
|
|
|
#include "mozilla/gfx/Matrix.h"
|
2012-02-22 05:20:14 +04:00
|
|
|
|
2012-02-18 02:05:03 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
|
|
|
class Layer;
|
|
|
|
|
2014-08-01 16:31:49 +04:00
|
|
|
void RenderTraceLayers(Layer *aLayer, const char *aColor,
|
|
|
|
const gfx::Matrix4x4 aRootTransform = gfx::Matrix4x4(),
|
|
|
|
bool aReset = true);
|
2012-02-18 02:05:03 +04:00
|
|
|
|
2015-05-07 12:07:53 +03:00
|
|
|
void RenderTraceInvalidateStart(Layer *aLayer, const char *aColor,
|
|
|
|
const gfx::IntRect aRect);
|
2012-02-18 02:05:03 +04:00
|
|
|
void RenderTraceInvalidateEnd(Layer *aLayer, const char *aColor);
|
|
|
|
|
2012-02-25 02:41:16 +04:00
|
|
|
void renderTraceEventStart(const char *aComment, const char *aColor);
|
|
|
|
void renderTraceEventEnd(const char *aComment, const char *aColor);
|
|
|
|
void renderTraceEventEnd(const char *aColor);
|
|
|
|
|
2012-02-27 23:31:29 +04:00
|
|
|
struct RenderTraceScope {
|
|
|
|
public:
|
|
|
|
RenderTraceScope(const char *aComment, const char *aColor)
|
|
|
|
: mComment(aComment), mColor(aColor) {
|
|
|
|
renderTraceEventStart(mComment, mColor);
|
|
|
|
}
|
|
|
|
~RenderTraceScope() { renderTraceEventEnd(mComment, mColor); }
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2012-02-27 23:31:29 +04:00
|
|
|
private:
|
|
|
|
const char *mComment;
|
|
|
|
const char *mColor;
|
|
|
|
};
|
|
|
|
|
2012-02-22 05:20:14 +04:00
|
|
|
#ifndef MOZ_RENDERTRACE
|
2014-08-01 16:31:49 +04:00
|
|
|
inline void RenderTraceLayers(Layer *aLayer, const char *aColor,
|
|
|
|
const gfx::Matrix4x4 aRootTransform,
|
|
|
|
bool aReset) {}
|
2012-02-22 05:20:14 +04:00
|
|
|
|
2015-05-07 12:07:53 +03:00
|
|
|
inline void RenderTraceInvalidateStart(Layer *aLayer, const char *aColor,
|
|
|
|
const gfx::IntRect aRect) {}
|
2012-02-22 05:20:14 +04:00
|
|
|
|
|
|
|
inline void RenderTraceInvalidateEnd(Layer *aLayer, const char *aColor) {}
|
|
|
|
|
2012-02-25 02:41:16 +04:00
|
|
|
inline void renderTraceEventStart(const char *aComment, const char *aColor) {}
|
|
|
|
|
|
|
|
inline void renderTraceEventEnd(const char *aComment, const char *aColor) {}
|
|
|
|
|
|
|
|
inline void renderTraceEventEnd(const char *aColor) {}
|
|
|
|
|
2012-02-22 05:20:14 +04:00
|
|
|
#endif // MOZ_RENDERTRACE
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|
2012-02-18 02:05:03 +04:00
|
|
|
|
|
|
|
#endif // GFX_RENDERTRACE_H
|