2012-06-28 23:01:34 -07:00
|
|
|
/* -*- 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
|
|
|
|
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "Layers.h" // for ThebesLayer, LayerManager, etc
|
2013-11-26 16:29:46 -08:00
|
|
|
#include "RotatedBuffer.h" // for RotatedContentBuffer, etc
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "BasicImplData.h" // for BasicImplData
|
|
|
|
#include "BasicLayers.h" // for BasicLayerManager
|
|
|
|
#include "gfx3DMatrix.h" // for gfx3DMatrix
|
|
|
|
#include "gfxPoint.h" // for gfxPoint
|
|
|
|
#include "mozilla/RefPtr.h" // for RefPtr
|
|
|
|
#include "mozilla/gfx/BasePoint.h" // for BasePoint
|
|
|
|
#include "mozilla/layers/ContentClient.h" // for ContentClientBasic
|
|
|
|
#include "mozilla/mozalloc.h" // for operator delete
|
|
|
|
#include "nsDebug.h" // for NS_ASSERTION
|
|
|
|
#include "nsRegion.h" // for nsIntRegion
|
|
|
|
#include "nsTraceRefcnt.h" // for MOZ_COUNT_CTOR, etc
|
|
|
|
class gfxContext;
|
2012-06-28 23:01:34 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2013-08-11 16:17:23 -07:00
|
|
|
class ReadbackProcessor;
|
|
|
|
|
2012-06-28 23:01:34 -07:00
|
|
|
class BasicThebesLayer : public ThebesLayer, public BasicImplData {
|
|
|
|
public:
|
2013-11-26 16:29:46 -08:00
|
|
|
typedef RotatedContentBuffer::PaintState PaintState;
|
|
|
|
typedef RotatedContentBuffer::ContentType ContentType;
|
2012-06-28 23:01:34 -07:00
|
|
|
|
|
|
|
BasicThebesLayer(BasicLayerManager* aLayerManager) :
|
2013-08-16 06:18:36 -07:00
|
|
|
ThebesLayer(aLayerManager,
|
|
|
|
static_cast<BasicImplData*>(MOZ_THIS_IN_INITIALIZER_LIST())),
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
mContentClient(nullptr)
|
2012-06-28 23:01:34 -07:00
|
|
|
{
|
|
|
|
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");
|
2012-08-28 22:48:43 -07:00
|
|
|
mInvalidRegion.Or(mInvalidRegion, aRegion);
|
|
|
|
mInvalidRegion.SimplifyOutward(10);
|
|
|
|
mValidRegion.Sub(mValidRegion, mInvalidRegion);
|
2012-06-28 23:01:34 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual void PaintThebes(gfxContext* aContext,
|
|
|
|
Layer* aMaskLayer,
|
|
|
|
LayerManager::DrawThebesLayerCallback aCallback,
|
|
|
|
void* aCallbackData,
|
|
|
|
ReadbackProcessor* aReadback);
|
|
|
|
|
2013-10-14 20:23:21 -07:00
|
|
|
virtual void Validate(LayerManager::DrawThebesLayerCallback aCallback,
|
|
|
|
void* aCallbackData) MOZ_OVERRIDE;
|
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
virtual void ClearCachedResources()
|
|
|
|
{
|
|
|
|
if (mContentClient) {
|
|
|
|
mContentClient->Clear();
|
|
|
|
}
|
|
|
|
mValidRegion.SetEmpty();
|
|
|
|
}
|
2014-01-27 07:28:18 -08:00
|
|
|
|
2014-01-27 07:28:04 -08:00
|
|
|
virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface)
|
2012-06-28 23:01:34 -07:00
|
|
|
{
|
|
|
|
if (!BasicManager()->IsRetained()) {
|
|
|
|
// Don't do any snapping of our transform, since we're just going to
|
|
|
|
// draw straight through without intermediate buffers.
|
2014-01-27 07:28:18 -08:00
|
|
|
mEffectiveTransform = GetLocalTransform() * aTransformToSurface;
|
2012-06-28 23:01:34 -07:00
|
|
|
if (gfxPoint(0,0) != mResidualTranslation) {
|
|
|
|
mResidualTranslation = gfxPoint(0,0);
|
|
|
|
mValidRegion.SetEmpty();
|
|
|
|
}
|
|
|
|
ComputeEffectiveTransformForMaskLayer(aTransformToSurface);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ThebesLayer::ComputeEffectiveTransforms(aTransformToSurface);
|
|
|
|
}
|
|
|
|
|
|
|
|
BasicLayerManager* BasicManager()
|
|
|
|
{
|
|
|
|
return static_cast<BasicLayerManager*>(mManager);
|
|
|
|
}
|
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
protected:
|
2012-06-28 23:01:34 -07:00
|
|
|
virtual void
|
|
|
|
PaintBuffer(gfxContext* aContext,
|
|
|
|
const nsIntRegion& aRegionToDraw,
|
|
|
|
const nsIntRegion& aExtendedRegionToDraw,
|
|
|
|
const nsIntRegion& aRegionToInvalidate,
|
|
|
|
bool aDidSelfCopy,
|
2013-11-06 11:10:50 -08:00
|
|
|
DrawRegionClip aClip,
|
2012-06-28 23:01:34 -07:00
|
|
|
LayerManager::DrawThebesLayerCallback aCallback,
|
|
|
|
void* aCallbackData)
|
|
|
|
{
|
|
|
|
if (!aCallback) {
|
|
|
|
BasicManager()->SetTransactionIncomplete();
|
|
|
|
return;
|
|
|
|
}
|
2013-11-06 11:10:50 -08:00
|
|
|
aCallback(this, aContext, aExtendedRegionToDraw, aClip,
|
|
|
|
aRegionToInvalidate, aCallbackData);
|
2012-06-28 23:01:34 -07:00
|
|
|
// 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);
|
|
|
|
}
|
|
|
|
|
2013-05-15 20:45:42 -07:00
|
|
|
RefPtr<ContentClientBasic> mContentClient;
|
2012-06-28 23:01:34 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|