mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
b18dc950c7
--HG-- rename : gfx/layers/ipc/ShadowLayersChild.cpp => gfx/layers/ipc/LayerTransactionChild.cpp rename : gfx/layers/ipc/ShadowLayersChild.h => gfx/layers/ipc/LayerTransactionChild.h rename : gfx/layers/ipc/ShadowLayersParent.cpp => gfx/layers/ipc/LayerTransactionParent.cpp rename : gfx/layers/ipc/ShadowLayersParent.h => gfx/layers/ipc/LayerTransactionParent.h rename : gfx/layers/ipc/PLayers.ipdl => gfx/layers/ipc/PLayerTransaction.ipdl
179 lines
5.4 KiB
C++
179 lines
5.4 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/. */
|
|
|
|
#ifndef GFX_BASICTHEBESLAYER_H
|
|
#define GFX_BASICTHEBESLAYER_H
|
|
|
|
#include "mozilla/layers/PLayerTransactionParent.h"
|
|
#include "BasicLayersImpl.h"
|
|
#include "mozilla/layers/ContentClient.h"
|
|
|
|
namespace mozilla {
|
|
namespace layers {
|
|
|
|
class BasicThebesLayer : public ThebesLayer, public BasicImplData {
|
|
public:
|
|
typedef ThebesLayerBuffer::PaintState PaintState;
|
|
typedef ThebesLayerBuffer::ContentType ContentType;
|
|
|
|
BasicThebesLayer(BasicLayerManager* aLayerManager) :
|
|
ThebesLayer(aLayerManager, static_cast<BasicImplData*>(this)),
|
|
mContentClient(nullptr)
|
|
{
|
|
MOZ_COUNT_CTOR(BasicThebesLayer);
|
|
}
|
|
virtual ~BasicThebesLayer()
|
|
{
|
|
MOZ_COUNT_DTOR(BasicThebesLayer);
|
|
}
|
|
|
|
virtual void SetVisibleRegion(const nsIntRegion& aRegion)
|
|
{
|
|
NS_ASSERTION(BasicManager()->InConstruction(),
|
|
"Can only set properties in construction phase");
|
|
ThebesLayer::SetVisibleRegion(aRegion);
|
|
}
|
|
virtual void InvalidateRegion(const nsIntRegion& aRegion)
|
|
{
|
|
NS_ASSERTION(BasicManager()->InConstruction(),
|
|
"Can only set properties in construction phase");
|
|
mInvalidRegion.Or(mInvalidRegion, aRegion);
|
|
mInvalidRegion.SimplifyOutward(10);
|
|
mValidRegion.Sub(mValidRegion, mInvalidRegion);
|
|
}
|
|
|
|
virtual void PaintThebes(gfxContext* aContext,
|
|
Layer* aMaskLayer,
|
|
LayerManager::DrawThebesLayerCallback aCallback,
|
|
void* aCallbackData,
|
|
ReadbackProcessor* aReadback);
|
|
|
|
virtual void ClearCachedResources()
|
|
{
|
|
if (mContentClient) {
|
|
mContentClient->Clear();
|
|
}
|
|
mValidRegion.SetEmpty();
|
|
}
|
|
|
|
virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface)
|
|
{
|
|
if (!BasicManager()->IsRetained()) {
|
|
// Don't do any snapping of our transform, since we're just going to
|
|
// draw straight through without intermediate buffers.
|
|
mEffectiveTransform = GetLocalTransform()*aTransformToSurface;
|
|
if (gfxPoint(0,0) != mResidualTranslation) {
|
|
mResidualTranslation = gfxPoint(0,0);
|
|
mValidRegion.SetEmpty();
|
|
}
|
|
ComputeEffectiveTransformForMaskLayer(aTransformToSurface);
|
|
return;
|
|
}
|
|
ThebesLayer::ComputeEffectiveTransforms(aTransformToSurface);
|
|
}
|
|
|
|
BasicLayerManager* BasicManager()
|
|
{
|
|
return static_cast<BasicLayerManager*>(mManager);
|
|
}
|
|
|
|
protected:
|
|
virtual void
|
|
PaintBuffer(gfxContext* aContext,
|
|
const nsIntRegion& aRegionToDraw,
|
|
const nsIntRegion& aExtendedRegionToDraw,
|
|
const nsIntRegion& aRegionToInvalidate,
|
|
bool aDidSelfCopy,
|
|
LayerManager::DrawThebesLayerCallback aCallback,
|
|
void* aCallbackData)
|
|
{
|
|
if (!aCallback) {
|
|
BasicManager()->SetTransactionIncomplete();
|
|
return;
|
|
}
|
|
aCallback(this, aContext, aExtendedRegionToDraw, aRegionToInvalidate,
|
|
aCallbackData);
|
|
// Everything that's visible has been validated. Do this instead of just
|
|
// OR-ing with aRegionToDraw, since that can lead to a very complex region
|
|
// here (OR doesn't automatically simplify to the simplest possible
|
|
// representation of a region.)
|
|
nsIntRegion tmp;
|
|
tmp.Or(mVisibleRegion, aExtendedRegionToDraw);
|
|
mValidRegion.Or(mValidRegion, tmp);
|
|
}
|
|
|
|
RefPtr<ContentClient> mContentClient;
|
|
};
|
|
|
|
class BasicShadowableThebesLayer : public BasicThebesLayer,
|
|
public BasicShadowableLayer
|
|
{
|
|
typedef BasicThebesLayer Base;
|
|
public:
|
|
BasicShadowableThebesLayer(BasicShadowLayerManager* aManager)
|
|
: BasicThebesLayer(aManager)
|
|
{
|
|
MOZ_COUNT_CTOR(BasicShadowableThebesLayer);
|
|
}
|
|
virtual ~BasicShadowableThebesLayer();
|
|
|
|
virtual void PaintThebes(gfxContext* aContext,
|
|
Layer* aMaskLayer,
|
|
LayerManager::DrawThebesLayerCallback aCallback,
|
|
void* aCallbackData,
|
|
ReadbackProcessor* aReadback);
|
|
|
|
virtual void ClearCachedResources() MOZ_OVERRIDE
|
|
{
|
|
BasicThebesLayer::ClearCachedResources();
|
|
DestroyBackBuffer();
|
|
// Don't try to read back from this, it soon may be invalid.
|
|
// mROFrontBuffer = null_t();
|
|
// mFrontAndBackBufferDiffer = false;
|
|
}
|
|
|
|
virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
|
|
{
|
|
aAttrs = ThebesLayerAttributes(GetValidRegion());
|
|
}
|
|
|
|
virtual Layer* AsLayer() { return this; }
|
|
virtual ShadowableLayer* AsShadowableLayer() { return this; }
|
|
|
|
virtual CompositableClient* GetCompositableClient() MOZ_OVERRIDE
|
|
{
|
|
return mContentClient;
|
|
}
|
|
|
|
virtual void Disconnect();
|
|
|
|
virtual BasicShadowableThebesLayer* AsThebes() { return this; }
|
|
|
|
private:
|
|
BasicShadowLayerManager* BasicManager()
|
|
{
|
|
return static_cast<BasicShadowLayerManager*>(mManager);
|
|
}
|
|
|
|
virtual void
|
|
PaintBuffer(gfxContext* aContext,
|
|
const nsIntRegion& aRegionToDraw,
|
|
const nsIntRegion& aExtendedRegionToDraw,
|
|
const nsIntRegion& aRegionToInvalidate,
|
|
bool aDidSelfCopy,
|
|
LayerManager::DrawThebesLayerCallback aCallback,
|
|
void* aCallbackData) MOZ_OVERRIDE;
|
|
|
|
void DestroyBackBuffer()
|
|
{
|
|
mContentClient = nullptr;
|
|
}
|
|
};
|
|
|
|
}
|
|
}
|
|
|
|
#endif
|