gecko/gfx/layers/client/ClientColorLayer.cpp
Matt Woodrow c727739057 Bug 867474 - Split BasicShadowableLayerManager into a separate ClientLayerManager. r=nrc
--HG--
rename : gfx/layers/basic/BasicCanvasLayer.cpp => gfx/layers/CopyableCanvasLayer.cpp
rename : gfx/layers/basic/BasicCanvasLayer.h => gfx/layers/CopyableCanvasLayer.h
rename : gfx/layers/basic/BasicCanvasLayer.cpp => gfx/layers/client/ClientCanvasLayer.cpp
rename : gfx/layers/basic/BasicCanvasLayer.h => gfx/layers/client/ClientCanvasLayer.h
rename : gfx/layers/basic/BasicColorLayer.cpp => gfx/layers/client/ClientColorLayer.cpp
rename : gfx/layers/basic/BasicContainerLayer.cpp => gfx/layers/client/ClientContainerLayer.cpp
rename : gfx/layers/basic/BasicContainerLayer.h => gfx/layers/client/ClientContainerLayer.h
rename : gfx/layers/basic/BasicImageLayer.cpp => gfx/layers/client/ClientImageLayer.cpp
rename : gfx/layers/basic/BasicLayerManager.cpp => gfx/layers/client/ClientLayerManager.cpp
rename : gfx/layers/basic/BasicLayers.h => gfx/layers/client/ClientLayerManager.h
rename : gfx/layers/basic/BasicThebesLayer.cpp => gfx/layers/client/ClientThebesLayer.cpp
rename : gfx/layers/basic/BasicThebesLayer.h => gfx/layers/client/ClientThebesLayer.h
rename : gfx/layers/basic/BasicTiledThebesLayer.cpp => gfx/layers/client/ClientTiledThebesLayer.cpp
rename : gfx/layers/basic/BasicTiledThebesLayer.h => gfx/layers/client/ClientTiledThebesLayer.h
2013-05-01 17:03:25 +12:00

73 lines
1.8 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 "ClientLayerManager.h"
#include "mozilla/layers/LayerTransaction.h"
using namespace mozilla::gfx;
namespace mozilla {
namespace layers {
class ClientColorLayer : public ColorLayer,
public ClientLayer {
public:
ClientColorLayer(ClientLayerManager* aLayerManager) :
ColorLayer(aLayerManager, static_cast<ClientLayer*>(this))
{
MOZ_COUNT_CTOR(ClientColorLayer);
}
virtual ~ClientColorLayer()
{
MOZ_COUNT_DTOR(ClientColorLayer);
}
virtual void SetVisibleRegion(const nsIntRegion& aRegion)
{
NS_ASSERTION(ClientManager()->InConstruction(),
"Can only set properties in construction phase");
ColorLayer::SetVisibleRegion(aRegion);
}
virtual void RenderLayer()
{
if (GetMaskLayer()) {
ToClientLayer(GetMaskLayer())->RenderLayer();
}
}
virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
{
aAttrs = ColorLayerAttributes(GetColor());
}
virtual Layer* AsLayer() { return this; }
virtual ShadowableLayer* AsShadowableLayer() { return this; }
virtual void Disconnect()
{
ClientLayer::Disconnect();
}
protected:
ClientLayerManager* ClientManager()
{
return static_cast<ClientLayerManager*>(mManager);
}
};
already_AddRefed<ColorLayer>
ClientLayerManager::CreateColorLayer()
{
NS_ASSERTION(InConstruction(), "Only allowed in construction phase");
nsRefPtr<ClientColorLayer> layer =
new ClientColorLayer(this);
CREATE_SHADOW(Color);
return layer.forget();
}
}
}