mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
b68dfa645a
Backed out changeset ea2367c19da3 (bug 952977) Backed out changeset c401c8748eb3 (bug 952977) Backed out changeset a93e9ff1043b (bug 952977) Backed out changeset 765b7f67163e (bug 952977) Backed out changeset 3d8cf4f5777f (bug 952977) Backed out changeset 8993710a3ab3 (bug 952977) Backed out changeset 1298c39b745a (bug 952977) Backed out changeset be0b899fbe5e (bug 952977) Backed out changeset f69bea1f1feb (bug 952977) Backed out changeset 1a745777f07e (bug 952977) Backed out changeset 5ad1d18dfe17 (bug 952977)
89 lines
2.6 KiB
C++
89 lines
2.6 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* 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/. */
|
|
|
|
#include "RenderTrace.h"
|
|
|
|
// If rendertrace is off let's no compile this code
|
|
#ifdef MOZ_RENDERTRACE
|
|
#include "Layers.h"
|
|
|
|
|
|
namespace mozilla {
|
|
namespace layers {
|
|
|
|
static int colorId = 0;
|
|
|
|
static gfx::Matrix4x4 GetRootTransform(Layer *aLayer) {
|
|
gfx::Matrix4x4 layerTrans = aLayer->GetTransform();
|
|
layerTrans.ProjectTo2D();
|
|
if (aLayer->GetParent() != nullptr) {
|
|
return GetRootTransform(aLayer->GetParent()) * layerTrans;
|
|
}
|
|
return layerTrans;
|
|
}
|
|
|
|
void RenderTraceLayers(Layer *aLayer, const char *aColor, const gfx3DMatrix aRootTransform, bool aReset) {
|
|
if (!aLayer)
|
|
return;
|
|
|
|
gfx3DMatrix trans = aRootTransform * aLayer->GetTransform();
|
|
trans.ProjectTo2D();
|
|
nsIntRect clipRect = aLayer->GetEffectiveVisibleRegion().GetBounds();
|
|
gfxRect rect(clipRect.x, clipRect.y, clipRect.width, clipRect.height);
|
|
trans.TransformBounds(rect);
|
|
|
|
if (strcmp(aLayer->Name(), "ContainerLayer") != 0 &&
|
|
strcmp(aLayer->Name(), "ContainerLayerComposite") != 0) {
|
|
printf_stderr("%s RENDERTRACE %u rect #%02X%s %i %i %i %i\n",
|
|
aLayer->Name(), (int)PR_IntervalNow(),
|
|
colorId, aColor,
|
|
(int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height);
|
|
}
|
|
|
|
colorId++;
|
|
|
|
for (Layer* child = aLayer->GetFirstChild();
|
|
child; child = child->GetNextSibling()) {
|
|
RenderTraceLayers(child, aColor, aRootTransform, false);
|
|
}
|
|
|
|
if (aReset) colorId = 0;
|
|
}
|
|
|
|
void RenderTraceInvalidateStart(Layer *aLayer, const char *aColor, const nsIntRect aRect) {
|
|
gfx::Matrix4x4 trans = GetRootTransform(aLayer);
|
|
gfx::Rect rect(aRect.x, aRect.y, aRect.width, aRect.height);
|
|
trans.TransformBounds(rect);
|
|
|
|
printf_stderr("%s RENDERTRACE %u fillrect #%s %i %i %i %i\n",
|
|
aLayer->Name(), (int)PR_IntervalNow(),
|
|
aColor,
|
|
(int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height);
|
|
}
|
|
void RenderTraceInvalidateEnd(Layer *aLayer, const char *aColor) {
|
|
// Clear with an empty rect
|
|
RenderTraceInvalidateStart(aLayer, aColor, nsIntRect());
|
|
}
|
|
|
|
void renderTraceEventStart(const char *aComment, const char *aColor) {
|
|
printf_stderr("%s RENDERTRACE %u fillrect #%s 0 0 10 10\n",
|
|
aComment, (int)PR_IntervalNow(), aColor);
|
|
}
|
|
|
|
void renderTraceEventEnd(const char *aComment, const char *aColor) {
|
|
printf_stderr("%s RENDERTRACE %u fillrect #%s 0 0 0 0\n",
|
|
aComment, (int)PR_IntervalNow(), aColor);
|
|
}
|
|
|
|
void renderTraceEventEnd(const char *aColor) {
|
|
renderTraceEventEnd("", aColor);
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
#endif
|
|
|