Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 : * This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #include "WebRenderTextLayer.h"
7 :
8 : #include "gfxPrefs.h"
9 : #include "LayersLogging.h"
10 : #include "mozilla/webrender/WebRenderTypes.h"
11 : #include "mozilla/layers/ScrollingLayersHelper.h"
12 : #include "mozilla/layers/WebRenderBridgeChild.h"
13 :
14 : #include "mozilla/gfx/2D.h"
15 :
16 : namespace mozilla {
17 : namespace layers {
18 :
19 : using namespace mozilla::gfx;
20 :
21 : void
22 0 : WebRenderTextLayer::RenderLayer(wr::DisplayListBuilder& aBuilder,
23 : const StackingContextHelper& aSc)
24 : {
25 0 : if (mBounds.IsEmpty()) {
26 0 : return;
27 : }
28 :
29 0 : ScrollingLayersHelper scroller(this, aBuilder, aSc);
30 :
31 : LayerRect rect = LayerRect::FromUnknownRect(
32 : // I am not 100% sure this is correct, but it probably is. Because:
33 : // the bounds are in layer space, and when gecko composites layers it
34 : // applies the transform to the layer before compositing. However with
35 : // WebRender compositing, we don't pass the transform on this layer to
36 : // WR, so WR has no way of knowing about the transformed bounds unless
37 : // we apply it here. The glyphs that we push to WR should already be
38 : // taking the transform into account.
39 0 : GetTransform().TransformBounds(IntRectToRect(mBounds))
40 0 : );
41 0 : DumpLayerInfo("TextLayer", rect);
42 :
43 0 : WrBridge()->PushGlyphs(aBuilder, mGlyphs, mFont, aSc, rect, rect);
44 : }
45 :
46 : } // namespace layers
47 : } // namespace mozilla
|