gfx/layers/composite/ColorLayerComposite.cpp

branch
TOR_BUG_9701
changeset 8
97036ab72558
equal deleted inserted replaced
-1:000000000000 0:ea981bec65e2
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 "gfxColor.h" // for gfxRGBA
8 #include "mozilla/RefPtr.h" // for RefPtr
9 #include "mozilla/gfx/Matrix.h" // for Matrix4x4
10 #include "mozilla/gfx/Point.h" // for Point
11 #include "mozilla/gfx/Rect.h" // for Rect
12 #include "mozilla/gfx/Types.h" // for Color
13 #include "mozilla/layers/Compositor.h" // for Compositor
14 #include "mozilla/layers/CompositorTypes.h" // for DIAGNOSTIC_COLOR
15 #include "mozilla/layers/Effects.h" // for Effect, EffectChain, etc
16 #include "mozilla/mozalloc.h" // for operator delete, etc
17 #include "nsPoint.h" // for nsIntPoint
18 #include "nsRect.h" // for nsIntRect
19
20 namespace mozilla {
21 namespace layers {
22
23 void
24 ColorLayerComposite::RenderLayer(const nsIntRect& aClipRect)
25 {
26 EffectChain effects(this);
27 gfxRGBA color(GetColor());
28 effects.mPrimaryEffect = new EffectSolidColor(gfx::Color(color.r,
29 color.g,
30 color.b,
31 color.a));
32 nsIntRect boundRect = GetBounds();
33
34 LayerManagerComposite::AutoAddMaskEffect autoMaskEffect(GetMaskLayer(),
35 effects);
36
37 gfx::Rect rect(boundRect.x, boundRect.y,
38 boundRect.width, boundRect.height);
39 gfx::Rect clipRect(aClipRect.x, aClipRect.y,
40 aClipRect.width, aClipRect.height);
41
42 float opacity = GetEffectiveOpacity();
43
44 const gfx::Matrix4x4& transform = GetEffectiveTransform();
45 mCompositor->DrawQuad(rect, clipRect, effects, opacity, transform);
46 mCompositor->DrawDiagnostics(DIAGNOSTIC_COLOR,
47 rect, clipRect,
48 transform);
49 }
50
51 } /* layers */
52 } /* mozilla */

mercurial