Files
tubestation/gfx/layers/wr/WebRenderTextLayer.cpp
Kartikaya Gupta 342f3e9393 Bug 1359842 - Rename ParentStackingContextBounds to ParentBounds. r=nical
MozReview-Commit-ID: HmvRnzvgRML
2017-04-27 12:04:13 -04:00

49 lines
1.4 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 "WebRenderTextLayer.h"
#include "gfxPrefs.h"
#include "LayersLogging.h"
#include "mozilla/webrender/WebRenderTypes.h"
#include "mozilla/layers/WebRenderBridgeChild.h"
#include "mozilla/gfx/2D.h"
namespace mozilla {
namespace layers {
using namespace mozilla::gfx;
void
WebRenderTextLayer::RenderLayer(wr::DisplayListBuilder& aBuilder)
{
if (mBounds.IsEmpty()) {
return;
}
gfx::Rect rect = GetTransform().TransformBounds(IntRectToRect(mBounds))
- ParentBounds().ToUnknownRect().TopLeft();
gfx::Rect clip;
if (GetClipRect().isSome()) {
clip = IntRectToRect(GetClipRect().ref().ToUnknownRect())
- ParentBounds().ToUnknownRect().TopLeft();
} else {
clip = rect;
}
if (gfxPrefs::LayersDump()) {
printf_stderr("TextLayer %p using rect=%s, clip=%s\n",
this->GetLayer(),
Stringify(rect).c_str(),
Stringify(clip).c_str());
}
WrBridge()->PushGlyphs(aBuilder, mGlyphs, mFont, GetOffsetToParent(), rect, clip);
}
} // namespace layers
} // namespace mozilla