Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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/. */
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
20 namespace mozilla {
21 namespace layers {
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();
34 LayerManagerComposite::AutoAddMaskEffect autoMaskEffect(GetMaskLayer(),
35 effects);
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);
42 float opacity = GetEffectiveOpacity();
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 }
51 } /* layers */
52 } /* mozilla */