michael@0: /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "ColorLayerComposite.h" michael@0: #include "gfxColor.h" // for gfxRGBA michael@0: #include "mozilla/RefPtr.h" // for RefPtr michael@0: #include "mozilla/gfx/Matrix.h" // for Matrix4x4 michael@0: #include "mozilla/gfx/Point.h" // for Point michael@0: #include "mozilla/gfx/Rect.h" // for Rect michael@0: #include "mozilla/gfx/Types.h" // for Color michael@0: #include "mozilla/layers/Compositor.h" // for Compositor michael@0: #include "mozilla/layers/CompositorTypes.h" // for DIAGNOSTIC_COLOR michael@0: #include "mozilla/layers/Effects.h" // for Effect, EffectChain, etc michael@0: #include "mozilla/mozalloc.h" // for operator delete, etc michael@0: #include "nsPoint.h" // for nsIntPoint michael@0: #include "nsRect.h" // for nsIntRect michael@0: michael@0: namespace mozilla { michael@0: namespace layers { michael@0: michael@0: void michael@0: ColorLayerComposite::RenderLayer(const nsIntRect& aClipRect) michael@0: { michael@0: EffectChain effects(this); michael@0: gfxRGBA color(GetColor()); michael@0: effects.mPrimaryEffect = new EffectSolidColor(gfx::Color(color.r, michael@0: color.g, michael@0: color.b, michael@0: color.a)); michael@0: nsIntRect boundRect = GetBounds(); michael@0: michael@0: LayerManagerComposite::AutoAddMaskEffect autoMaskEffect(GetMaskLayer(), michael@0: effects); michael@0: michael@0: gfx::Rect rect(boundRect.x, boundRect.y, michael@0: boundRect.width, boundRect.height); michael@0: gfx::Rect clipRect(aClipRect.x, aClipRect.y, michael@0: aClipRect.width, aClipRect.height); michael@0: michael@0: float opacity = GetEffectiveOpacity(); michael@0: michael@0: const gfx::Matrix4x4& transform = GetEffectiveTransform(); michael@0: mCompositor->DrawQuad(rect, clipRect, effects, opacity, transform); michael@0: mCompositor->DrawDiagnostics(DIAGNOSTIC_COLOR, michael@0: rect, clipRect, michael@0: transform); michael@0: } michael@0: michael@0: } /* layers */ michael@0: } /* mozilla */