Line data Source code
1 : /* -*- Mode: C++; tab-width: 20; 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 "ColorLayerComposite.h"
7 : #include "mozilla/RefPtr.h" // for RefPtr
8 : #include "mozilla/gfx/Matrix.h" // for Matrix4x4
9 : #include "mozilla/gfx/Point.h" // for Point
10 : #include "mozilla/gfx/Rect.h" // for Rect
11 : #include "mozilla/gfx/Types.h" // for Color
12 : #include "mozilla/layers/Compositor.h" // for Compositor
13 : #include "mozilla/layers/CompositorTypes.h" // for DiagnosticFlags::COLOR
14 : #include "mozilla/layers/Effects.h" // for Effect, EffectChain, etc
15 : #include "mozilla/mozalloc.h" // for operator delete, etc
16 :
17 : namespace mozilla {
18 : namespace layers {
19 :
20 : using namespace mozilla::gfx;
21 :
22 : void
23 24 : ColorLayerComposite::RenderLayer(const gfx::IntRect& aClipRect,
24 : const Maybe<gfx::Polygon>& aGeometry)
25 : {
26 24 : Rect rect(GetBounds());
27 :
28 24 : const Matrix4x4& transform = GetEffectiveTransform();
29 :
30 24 : RenderWithAllMasks(this, mCompositor, aClipRect,
31 24 : [&](EffectChain& effectChain, const IntRect& clipRect) {
32 72 : GenEffectChain(effectChain);
33 :
34 48 : mCompositor->DrawGeometry(rect, clipRect, effectChain,
35 48 : GetEffectiveOpacity(), transform, aGeometry);
36 72 : });
37 :
38 24 : mCompositor->DrawDiagnostics(DiagnosticFlags::COLOR, rect, aClipRect,
39 24 : transform);
40 24 : }
41 :
42 : void
43 24 : ColorLayerComposite::GenEffectChain(EffectChain& aEffect)
44 : {
45 24 : aEffect.mLayerRef = this;
46 48 : aEffect.mPrimaryEffect = new EffectSolidColor(GetColor());
47 24 : }
48 :
49 : } // namespace layers
50 : } // namespace mozilla
|