gfx/layers/composite/ColorLayerComposite.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/layers/composite/ColorLayerComposite.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,52 @@
     1.4 +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "ColorLayerComposite.h"
    1.10 +#include "gfxColor.h"                   // for gfxRGBA
    1.11 +#include "mozilla/RefPtr.h"             // for RefPtr
    1.12 +#include "mozilla/gfx/Matrix.h"         // for Matrix4x4
    1.13 +#include "mozilla/gfx/Point.h"          // for Point
    1.14 +#include "mozilla/gfx/Rect.h"           // for Rect
    1.15 +#include "mozilla/gfx/Types.h"          // for Color
    1.16 +#include "mozilla/layers/Compositor.h"  // for Compositor
    1.17 +#include "mozilla/layers/CompositorTypes.h"  // for DIAGNOSTIC_COLOR
    1.18 +#include "mozilla/layers/Effects.h"     // for Effect, EffectChain, etc
    1.19 +#include "mozilla/mozalloc.h"           // for operator delete, etc
    1.20 +#include "nsPoint.h"                    // for nsIntPoint
    1.21 +#include "nsRect.h"                     // for nsIntRect
    1.22 +
    1.23 +namespace mozilla {
    1.24 +namespace layers {
    1.25 +
    1.26 +void
    1.27 +ColorLayerComposite::RenderLayer(const nsIntRect& aClipRect)
    1.28 +{
    1.29 +  EffectChain effects(this);
    1.30 +  gfxRGBA color(GetColor());
    1.31 +  effects.mPrimaryEffect = new EffectSolidColor(gfx::Color(color.r,
    1.32 +                                                           color.g,
    1.33 +                                                           color.b,
    1.34 +                                                           color.a));
    1.35 +  nsIntRect boundRect = GetBounds();
    1.36 +
    1.37 +  LayerManagerComposite::AutoAddMaskEffect autoMaskEffect(GetMaskLayer(),
    1.38 +                                                          effects);
    1.39 +
    1.40 +  gfx::Rect rect(boundRect.x, boundRect.y,
    1.41 +                 boundRect.width, boundRect.height);
    1.42 +  gfx::Rect clipRect(aClipRect.x, aClipRect.y,
    1.43 +                     aClipRect.width, aClipRect.height);
    1.44 +
    1.45 +  float opacity = GetEffectiveOpacity();
    1.46 +
    1.47 +  const gfx::Matrix4x4& transform = GetEffectiveTransform();
    1.48 +  mCompositor->DrawQuad(rect, clipRect, effects, opacity, transform);
    1.49 +  mCompositor->DrawDiagnostics(DIAGNOSTIC_COLOR,
    1.50 +                               rect, clipRect,
    1.51 +                               transform);
    1.52 +}
    1.53 +
    1.54 +} /* layers */
    1.55 +} /* mozilla */

mercurial