Files
palemoon27/gfx/layers/basic/BasicColorLayer.cpp
T
roytam1 f39d19c93e import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1196462 - Add a pref to highlight checkerboarded areas for debugging. r=kats (ffd1d24515)
- Bug 1207944 (part 1) - Pass a gfx::Color& instead of a gfxRGBA& to SetDeviceColor(). r=jwatt. (117317c610)
- Bug 1207944 (part 2) - Pass a gfx::Color& instead of a gfxRGBA& to GetDeviceColor(). r=jwatt. (82739fb35a)
- Bug 1207944 (part 3) - Add a gfxContext::SetColor method that takes a gfx::Color&. r=jwatt. (65d081203d)
- Bug 1207944 (part 4) - Use SetColor(const Color&) when setting from an nscolor. r=jwatt. (4e3ca8e36b)
- Bug 1207944 (part 5) - Use SetColor(const Color&) when setting from a constructed gfxRGBA. r=jwatt. (d4583dbee1)
- Bug 1207944 (part 6) - Use gfx::Color instead of gfxRGBA in ColorStop. r=jwatt. (74ad3407a2)
- Bug 1207944 (part 7) - Use gfx::Color instead of gfxRGBA in BlurCache. r=jwatt. (1402a3f334)
- Bug 1207944 (part 8) - Change nsDisplayBackgroundColor::mColor from gfxRGBA to gfx::Color. r=jwatt. (42259ef66b)
- Bug 1207944 (part 9) - Remove SetColor(const gfxRGBA&). r=jwatt. (064879c237)
- Bug 1208283 (part 1) - Change gfxPattern's single-arg constructor to take a gfx::Color& instead of a gfxRGBA&. r=jwatt. (1aa348d966)
- Bug 1208283 (part 2) - Change ColorLayer::mColor, ColorLayerProperties::mColor, ReadbackLayer::mBackgroundColor from gfxRBGA to gfx::Color. r=jwatt. (859d5c4a45)
- Bug 1208283 (part 3) - Remove the ToDeviceColor() that takes a gfxRGBA. r=jwatt. (525cd78338)
- Bug 1208283 (part 4) - Change FrameMetrics::mBackgroundColor from gfxRGBA to gfx::Color. r=jwatt. (49e3c39013)
- Bug 1208283 (part 5) - Pass a gfx::Color instead of a gfxRGBA to PaintRectToSurface(). r=jwatt. (04997ce877)
- Bug 1157669 - Assert aGroupTarget is not null in PaintSelfOrChildren method. r=nical (7f3cc9c792)
- Bug 1208300 (part 4) - Remove gfxRGBA and some related things. r=jwatt. (c158d04b63)
- Bug 1207931 - Remove no-longer-needed SetBackgroundColor IPC message. r=mattwoodrow. (a54d91bf53)
- Bug 1206904 - Work around APZ crashes when dealing with nested content processes. r=botond (3252333fb4)
- Bug 1189611 - Improve the APZ minimap position and ignore trivial APZ. r=kats (12c5ff5215)
- Bug 1196412 - Correctly scale canvas layers that have a transform applied to fill the screen, r=vlad (5036fd706c)
- Bug 1189473 - Don't paint the tiles in the APZ minimap. r=mstange (fc3db414f7)
- Bug 1189924 - Add a background color to the APZ minimap. r=kats (dd347db883)
- add some dead stuff back in (de8fe1d1a0)
- Treat mix-blend-mode layers as transparent for occlusion culling. (bug 1207041, r=mstange) (c3c3844d7b)
2022-08-26 09:36:24 +08:00

85 lines
2.7 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "BasicLayersImpl.h" // for FillRectWithMask, etc
#include "Layers.h" // for ColorLayer, etc
#include "BasicImplData.h" // for BasicImplData
#include "BasicLayers.h" // for BasicLayerManager
#include "gfxContext.h" // for gfxContext, etc
#include "gfxRect.h" // for gfxRect
#include "gfx2DGlue.h"
#include "mozilla/mozalloc.h" // for operator new
#include "nsAutoPtr.h" // for nsRefPtr
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsDebug.h" // for NS_ASSERTION
#include "nsISupportsImpl.h" // for Layer::AddRef, etc
#include "nsRect.h" // for mozilla::gfx::IntRect
#include "nsRegion.h" // for nsIntRegion
#include "mozilla/gfx/PathHelpers.h"
using namespace mozilla::gfx;
namespace mozilla {
namespace layers {
class BasicColorLayer : public ColorLayer, public BasicImplData {
public:
explicit BasicColorLayer(BasicLayerManager* aLayerManager) :
ColorLayer(aLayerManager, static_cast<BasicImplData*>(this))
{
MOZ_COUNT_CTOR(BasicColorLayer);
}
protected:
virtual ~BasicColorLayer()
{
MOZ_COUNT_DTOR(BasicColorLayer);
}
public:
virtual void SetVisibleRegion(const nsIntRegion& aRegion) override
{
NS_ASSERTION(BasicManager()->InConstruction(),
"Can only set properties in construction phase");
ColorLayer::SetVisibleRegion(aRegion);
}
virtual void Paint(DrawTarget* aDT,
const gfx::Point& aDeviceOffset,
Layer* aMaskLayer) override
{
if (IsHidden()) {
return;
}
Rect snapped(mBounds.x, mBounds.y, mBounds.width, mBounds.height);
MaybeSnapToDevicePixels(snapped, *aDT, true);
// Clip drawing in case we're using (unbounded) operator source.
aDT->PushClipRect(snapped);
FillRectWithMask(aDT, aDeviceOffset, snapped, mColor,
DrawOptions(GetEffectiveOpacity(), GetEffectiveOperator(this)),
aMaskLayer);
aDT->PopClip();
}
protected:
BasicLayerManager* BasicManager()
{
return static_cast<BasicLayerManager*>(mManager);
}
};
already_AddRefed<ColorLayer>
BasicLayerManager::CreateColorLayer()
{
NS_ASSERTION(InConstruction(), "Only allowed in construction phase");
nsRefPtr<ColorLayer> layer = new BasicColorLayer(this);
return layer.forget();
}
} // namespace layers
} // namespace mozilla