gfx/layers/composite/ColorLayerComposite.cpp

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #include "ColorLayerComposite.h"
michael@0 7 #include "gfxColor.h" // for gfxRGBA
michael@0 8 #include "mozilla/RefPtr.h" // for RefPtr
michael@0 9 #include "mozilla/gfx/Matrix.h" // for Matrix4x4
michael@0 10 #include "mozilla/gfx/Point.h" // for Point
michael@0 11 #include "mozilla/gfx/Rect.h" // for Rect
michael@0 12 #include "mozilla/gfx/Types.h" // for Color
michael@0 13 #include "mozilla/layers/Compositor.h" // for Compositor
michael@0 14 #include "mozilla/layers/CompositorTypes.h" // for DIAGNOSTIC_COLOR
michael@0 15 #include "mozilla/layers/Effects.h" // for Effect, EffectChain, etc
michael@0 16 #include "mozilla/mozalloc.h" // for operator delete, etc
michael@0 17 #include "nsPoint.h" // for nsIntPoint
michael@0 18 #include "nsRect.h" // for nsIntRect
michael@0 19
michael@0 20 namespace mozilla {
michael@0 21 namespace layers {
michael@0 22
michael@0 23 void
michael@0 24 ColorLayerComposite::RenderLayer(const nsIntRect& aClipRect)
michael@0 25 {
michael@0 26 EffectChain effects(this);
michael@0 27 gfxRGBA color(GetColor());
michael@0 28 effects.mPrimaryEffect = new EffectSolidColor(gfx::Color(color.r,
michael@0 29 color.g,
michael@0 30 color.b,
michael@0 31 color.a));
michael@0 32 nsIntRect boundRect = GetBounds();
michael@0 33
michael@0 34 LayerManagerComposite::AutoAddMaskEffect autoMaskEffect(GetMaskLayer(),
michael@0 35 effects);
michael@0 36
michael@0 37 gfx::Rect rect(boundRect.x, boundRect.y,
michael@0 38 boundRect.width, boundRect.height);
michael@0 39 gfx::Rect clipRect(aClipRect.x, aClipRect.y,
michael@0 40 aClipRect.width, aClipRect.height);
michael@0 41
michael@0 42 float opacity = GetEffectiveOpacity();
michael@0 43
michael@0 44 const gfx::Matrix4x4& transform = GetEffectiveTransform();
michael@0 45 mCompositor->DrawQuad(rect, clipRect, effects, opacity, transform);
michael@0 46 mCompositor->DrawDiagnostics(DIAGNOSTIC_COLOR,
michael@0 47 rect, clipRect,
michael@0 48 transform);
michael@0 49 }
michael@0 50
michael@0 51 } /* layers */
michael@0 52 } /* mozilla */

mercurial