mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 568041. Add user-data API and GetRoot to LayerManager. Move mVisibleRegion into Layer. r=bas,sr=vlad
This commit is contained in:
parent
60499e8fa3
commit
17b78218c8
@ -126,6 +126,7 @@ public:
|
||||
LAYERS_D3D9
|
||||
};
|
||||
|
||||
LayerManager() : mUserData(nsnull) {}
|
||||
virtual ~LayerManager() {}
|
||||
|
||||
/**
|
||||
@ -173,6 +174,10 @@ public:
|
||||
* Set the root layer.
|
||||
*/
|
||||
virtual void SetRoot(Layer* aLayer) = 0;
|
||||
/**
|
||||
* Can be called anytime
|
||||
*/
|
||||
Layer* GetRoot() { return mRoot; }
|
||||
|
||||
/**
|
||||
* CONSTRUCTION PHASE ONLY
|
||||
@ -211,6 +216,15 @@ public:
|
||||
* Layers backend specific functionality is necessary.
|
||||
*/
|
||||
virtual LayersBackend GetBackendType() = 0;
|
||||
|
||||
// This setter and getter can be used anytime. The user data is initially
|
||||
// null.
|
||||
void SetUserData(void* aData) { mUserData = aData; }
|
||||
void* GetUserData() { return mUserData; }
|
||||
|
||||
protected:
|
||||
nsRefPtr<Layer> mRoot;
|
||||
void* mUserData;
|
||||
};
|
||||
|
||||
class ThebesLayer;
|
||||
@ -246,7 +260,7 @@ public:
|
||||
* contribute to the final visible window. This can be an
|
||||
* overapproximation to the true visible region.
|
||||
*/
|
||||
virtual void SetVisibleRegion(const nsIntRegion& aRegion) {}
|
||||
virtual void SetVisibleRegion(const nsIntRegion& aRegion) { mVisibleRegion = aRegion; }
|
||||
|
||||
/**
|
||||
* CONSTRUCTION PHASE ONLY
|
||||
@ -305,13 +319,15 @@ public:
|
||||
float GetOpacity() { return mOpacity; }
|
||||
const nsIntRect* GetClipRect() { return mUseClipRect ? &mClipRect : nsnull; }
|
||||
PRBool IsOpaqueContent() { return mIsOpaqueContent; }
|
||||
const nsIntRegion& GetVisibleRegion() { return mVisibleRegion; }
|
||||
ContainerLayer* GetParent() { return mParent; }
|
||||
Layer* GetNextSibling() { return mNextSibling; }
|
||||
Layer* GetPrevSibling() { return mPrevSibling; }
|
||||
virtual Layer* GetFirstChild() { return nsnull; }
|
||||
const gfx3DMatrix& GetTransform() { return mTransform; }
|
||||
|
||||
// This setter and getter can be used anytime.
|
||||
// This setter and getter can be used anytime. The user data is initially
|
||||
// null.
|
||||
void SetUserData(void* aData) { mUserData = aData; }
|
||||
void* GetUserData() { return mUserData; }
|
||||
|
||||
@ -354,6 +370,7 @@ protected:
|
||||
Layer* mPrevSibling;
|
||||
void* mImplData;
|
||||
void* mUserData;
|
||||
nsIntRegion mVisibleRegion;
|
||||
gfx3DMatrix mTransform;
|
||||
float mOpacity;
|
||||
nsIntRect mClipRect;
|
||||
@ -382,11 +399,18 @@ public:
|
||||
*/
|
||||
virtual void InvalidateRegion(const nsIntRegion& aRegion) = 0;
|
||||
|
||||
/**
|
||||
* Can be used anytime
|
||||
*/
|
||||
const nsIntRegion& GetValidRegion() { return mValidRegion; }
|
||||
|
||||
virtual ThebesLayer* AsThebesLayer() { return this; }
|
||||
|
||||
protected:
|
||||
ThebesLayer(LayerManager* aManager, void* aImplData)
|
||||
: Layer(aManager, aImplData) {}
|
||||
|
||||
nsIntRegion mValidRegion;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -86,8 +86,6 @@ public:
|
||||
MOZ_COUNT_DTOR(BasicImplData);
|
||||
}
|
||||
|
||||
const nsIntRegion& GetVisibleRegion() { return mVisibleRegion; }
|
||||
|
||||
/**
|
||||
* Layers that paint themselves, such as ImageLayers, should paint
|
||||
* in response to this method call. aContext will already have been
|
||||
@ -97,9 +95,6 @@ public:
|
||||
virtual void Paint(gfxContext* aContext,
|
||||
LayerManager::DrawThebesLayerCallback aCallback,
|
||||
void* aCallbackData) {}
|
||||
|
||||
protected:
|
||||
nsIntRegion mVisibleRegion;
|
||||
};
|
||||
|
||||
static BasicImplData*
|
||||
@ -121,7 +116,7 @@ public:
|
||||
{
|
||||
NS_ASSERTION(BasicManager()->InConstruction(),
|
||||
"Can only set properties in construction phase");
|
||||
mVisibleRegion = aRegion;
|
||||
ContainerLayer::SetVisibleRegion(aRegion);
|
||||
}
|
||||
virtual void InsertAfter(Layer* aChild, Layer* aAfter);
|
||||
virtual void RemoveChild(Layer* aChild);
|
||||
@ -234,7 +229,7 @@ public:
|
||||
{
|
||||
NS_ASSERTION(BasicManager()->InConstruction(),
|
||||
"Can only set properties in construction phase");
|
||||
mVisibleRegion = aRegion;
|
||||
ThebesLayer::SetVisibleRegion(aRegion);
|
||||
}
|
||||
virtual void InvalidateRegion(const nsIntRegion& aRegion)
|
||||
{
|
||||
@ -654,7 +649,7 @@ BasicLayerManager::PaintLayer(Layer* aLayer,
|
||||
if (needsGroup) {
|
||||
// If we need to call PushGroup, we should clip to the smallest possible
|
||||
// area first to minimize the size of the temporary surface.
|
||||
nsIntRect bbox = ToData(aLayer)->GetVisibleRegion().GetBounds();
|
||||
nsIntRect bbox = aLayer->GetVisibleRegion().GetBounds();
|
||||
gfxRect deviceRect =
|
||||
mTarget->UserToDevice(gfxRect(bbox.x, bbox.y, bbox.width, bbox.height));
|
||||
deviceRect.RoundOut();
|
||||
|
@ -103,7 +103,6 @@ private:
|
||||
DrawThebesLayerCallback aCallback,
|
||||
void* aCallbackData);
|
||||
|
||||
nsRefPtr<Layer> mRoot;
|
||||
// The default context for BeginTransaction.
|
||||
nsRefPtr<gfxContext> mDefaultTarget;
|
||||
// The context to draw into.
|
||||
|
@ -55,17 +55,12 @@ public:
|
||||
mImplData = static_cast<LayerD3D9*>(this);
|
||||
}
|
||||
|
||||
virtual void SetVisibleRegion(const nsIntRegion& aRegion) { mVisibleRegion = aRegion; }
|
||||
|
||||
// LayerD3D9 Implementation
|
||||
virtual LayerType GetType();
|
||||
|
||||
virtual Layer* GetLayer();
|
||||
|
||||
virtual void RenderLayer();
|
||||
|
||||
protected:
|
||||
nsIntRegion mVisibleRegion;
|
||||
};
|
||||
|
||||
} /* layers */
|
||||
|
@ -59,18 +59,6 @@ ContainerLayerD3D9::~ContainerLayerD3D9()
|
||||
}
|
||||
}
|
||||
|
||||
const nsIntRect&
|
||||
ContainerLayerD3D9::GetVisibleRect()
|
||||
{
|
||||
return mVisibleRect;
|
||||
}
|
||||
|
||||
void
|
||||
ContainerLayerD3D9::SetVisibleRegion(const nsIntRegion &aRegion)
|
||||
{
|
||||
mVisibleRect = aRegion.GetBounds();
|
||||
}
|
||||
|
||||
void
|
||||
ContainerLayerD3D9::InsertAfter(Layer* aChild, Layer* aAfter)
|
||||
{
|
||||
@ -165,11 +153,12 @@ ContainerLayerD3D9::RenderLayer()
|
||||
float renderTargetOffset[] = { 0, 0, 0, 0 };
|
||||
float oldViewMatrix[4][4];
|
||||
|
||||
nsIntRect visibleRect = mVisibleRegion.GetBounds();
|
||||
PRBool useIntermediate = (opacity != 1.0 || !mTransform.IsIdentity());
|
||||
|
||||
if (useIntermediate) {
|
||||
device()->GetRenderTarget(0, getter_AddRefs(previousRenderTarget));
|
||||
device()->CreateTexture(mVisibleRect.width, mVisibleRect.height, 1,
|
||||
device()->CreateTexture(visibleRect.width, visibleRect.height, 1,
|
||||
D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
|
||||
D3DPOOL_DEFAULT, getter_AddRefs(renderTexture),
|
||||
NULL);
|
||||
@ -177,8 +166,8 @@ ContainerLayerD3D9::RenderLayer()
|
||||
renderTexture->GetSurfaceLevel(0, getter_AddRefs(renderSurface));
|
||||
device()->SetRenderTarget(0, renderSurface);
|
||||
device()->GetVertexShaderConstantF(12, previousRenderTargetOffset, 1);
|
||||
renderTargetOffset[0] = (float)GetVisibleRect().x;
|
||||
renderTargetOffset[1] = (float)GetVisibleRect().y;
|
||||
renderTargetOffset[0] = (float)visibleRect.x;
|
||||
renderTargetOffset[1] = (float)visibleRect.y;
|
||||
device()->SetVertexShaderConstantF(12, renderTargetOffset, 1);
|
||||
|
||||
float viewMatrix[4][4];
|
||||
@ -187,8 +176,8 @@ ContainerLayerD3D9::RenderLayer()
|
||||
* <1.0, -1.0> bottomright)
|
||||
*/
|
||||
memset(&viewMatrix, 0, sizeof(viewMatrix));
|
||||
viewMatrix[0][0] = 2.0f / mVisibleRect.width;
|
||||
viewMatrix[1][1] = -2.0f / mVisibleRect.height;
|
||||
viewMatrix[0][0] = 2.0f / visibleRect.width;
|
||||
viewMatrix[1][1] = -2.0f / visibleRect.height;
|
||||
viewMatrix[2][2] = 1.0f;
|
||||
viewMatrix[3][0] = -1.0f;
|
||||
viewMatrix[3][1] = 1.0f;
|
||||
@ -215,11 +204,11 @@ ContainerLayerD3D9::RenderLayer()
|
||||
r.left = 0;
|
||||
r.top = 0;
|
||||
} else {
|
||||
r.left = GetVisibleRect().x;
|
||||
r.top = GetVisibleRect().y;
|
||||
r.left = visibleRect.x;
|
||||
r.top = visibleRect.y;
|
||||
}
|
||||
r.right = r.left + GetVisibleRect().width;
|
||||
r.bottom = r.top + GetVisibleRect().height;
|
||||
r.right = r.left + visibleRect.width;
|
||||
r.bottom = r.top + visibleRect.height;
|
||||
}
|
||||
|
||||
nsRefPtr<IDirect3DSurface9> renderSurface;
|
||||
@ -256,11 +245,11 @@ ContainerLayerD3D9::RenderLayer()
|
||||
* See: http://msdn.microsoft.com/en-us/library/bb219690%28VS.85%29.aspx
|
||||
*/
|
||||
memset(&quadTransform, 0, sizeof(quadTransform));
|
||||
quadTransform[0][0] = (float)GetVisibleRect().width;
|
||||
quadTransform[1][1] = (float)GetVisibleRect().height;
|
||||
quadTransform[0][0] = (float)visibleRect.width;
|
||||
quadTransform[1][1] = (float)visibleRect.height;
|
||||
quadTransform[2][2] = 1.0f;
|
||||
quadTransform[3][0] = (float)GetVisibleRect().x - 0.5f;
|
||||
quadTransform[3][1] = (float)GetVisibleRect().y - 0.5f;
|
||||
quadTransform[3][0] = (float)visibleRect.x - 0.5f;
|
||||
quadTransform[3][1] = (float)visibleRect.y - 0.5f;
|
||||
quadTransform[3][3] = 1.0f;
|
||||
|
||||
device()->SetVertexShaderConstantF(0, &quadTransform[0][0], 4);
|
||||
|
@ -51,14 +51,12 @@ public:
|
||||
ContainerLayerD3D9(LayerManagerD3D9 *aManager);
|
||||
~ContainerLayerD3D9();
|
||||
|
||||
const nsIntRect &GetVisibleRect();
|
||||
nsIntRect GetVisibleRect() { return mVisibleRegion.GetBounds(); }
|
||||
|
||||
/* ContainerLayer implementation */
|
||||
void SetVisibleRegion(const nsIntRegion& aRegion);
|
||||
virtual void InsertAfter(Layer* aChild, Layer* aAfter);
|
||||
|
||||
void InsertAfter(Layer* aChild, Layer* aAfter);
|
||||
|
||||
void RemoveChild(Layer* aChild);
|
||||
virtual void RemoveChild(Layer* aChild);
|
||||
|
||||
/* LayerD3D9 implementation */
|
||||
LayerType GetType();
|
||||
@ -70,9 +68,6 @@ public:
|
||||
PRBool IsEmpty();
|
||||
|
||||
void RenderLayer();
|
||||
|
||||
private:
|
||||
nsIntRect mVisibleRect;
|
||||
};
|
||||
|
||||
} /* layers */
|
||||
|
@ -58,16 +58,15 @@ ThebesLayerD3D9::~ThebesLayerD3D9()
|
||||
void
|
||||
ThebesLayerD3D9::SetVisibleRegion(const nsIntRegion &aRegion)
|
||||
{
|
||||
if (aRegion.GetBounds() == mVisibleRect) {
|
||||
if (aRegion.IsEqual(mVisibleRegion)) {
|
||||
return;
|
||||
}
|
||||
mVisibleRect = aRegion.GetBounds();
|
||||
ThebesLayer::SetVisibleRegion(aRegion);
|
||||
|
||||
device()->CreateTexture(mVisibleRect.width, mVisibleRect.height, 1,
|
||||
mInvalidatedRect = mVisibleRegion.GetBounds();
|
||||
device()->CreateTexture(mInvalidatedRect.width, mInvalidatedRect.height, 1,
|
||||
D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
|
||||
D3DPOOL_DEFAULT, getter_AddRefs(mTexture), NULL);
|
||||
|
||||
mInvalidatedRect = mVisibleRect;
|
||||
}
|
||||
|
||||
|
||||
@ -76,7 +75,7 @@ ThebesLayerD3D9::InvalidateRegion(const nsIntRegion &aRegion)
|
||||
{
|
||||
nsIntRegion invalidatedRegion;
|
||||
invalidatedRegion.Or(aRegion, mInvalidatedRect);
|
||||
invalidatedRegion.And(invalidatedRegion, mVisibleRect);
|
||||
invalidatedRegion.And(invalidatedRegion, mVisibleRegion);
|
||||
mInvalidatedRect = invalidatedRegion.GetBounds();
|
||||
}
|
||||
|
||||
@ -86,20 +85,16 @@ ThebesLayerD3D9::GetType()
|
||||
return TYPE_THEBES;
|
||||
}
|
||||
|
||||
const nsIntRect&
|
||||
ThebesLayerD3D9::GetVisibleRect()
|
||||
{
|
||||
return mVisibleRect;
|
||||
}
|
||||
|
||||
void
|
||||
ThebesLayerD3D9::RenderLayer()
|
||||
{
|
||||
nsIntRect visibleRect = mVisibleRegion.GetBounds();
|
||||
|
||||
if (!mTexture) {
|
||||
device()->CreateTexture(mVisibleRect.width, mVisibleRect.height, 1,
|
||||
device()->CreateTexture(visibleRect.width, visibleRect.height, 1,
|
||||
D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
|
||||
D3DPOOL_DEFAULT, getter_AddRefs(mTexture), NULL);
|
||||
mInvalidatedRect = mVisibleRect;
|
||||
mInvalidatedRect = visibleRect;
|
||||
}
|
||||
if (!mInvalidatedRect.IsEmpty()) {
|
||||
nsIntRegion region = mInvalidatedRect;
|
||||
@ -150,8 +145,8 @@ ThebesLayerD3D9::RenderLayer()
|
||||
tmpTexture->GetSurfaceLevel(0, getter_AddRefs(srcSurface));
|
||||
|
||||
POINT point;
|
||||
point.x = mInvalidatedRect.x - mVisibleRect.x;
|
||||
point.y = mInvalidatedRect.y - mVisibleRect.y;
|
||||
point.x = mInvalidatedRect.x - visibleRect.x;
|
||||
point.y = mInvalidatedRect.y - visibleRect.y;
|
||||
device()->UpdateSurface(srcSurface, NULL, dstSurface, &point);
|
||||
}
|
||||
|
||||
@ -164,11 +159,11 @@ ThebesLayerD3D9::RenderLayer()
|
||||
* See: http://msdn.microsoft.com/en-us/library/bb219690%28VS.85%29.aspx
|
||||
*/
|
||||
memset(&quadTransform, 0, sizeof(quadTransform));
|
||||
quadTransform[0][0] = (float)GetVisibleRect().width;
|
||||
quadTransform[1][1] = (float)GetVisibleRect().height;
|
||||
quadTransform[0][0] = (float)visibleRect.width;
|
||||
quadTransform[1][1] = (float)visibleRect.height;
|
||||
quadTransform[2][2] = 1.0f;
|
||||
quadTransform[3][0] = (float)GetVisibleRect().x - 0.5f;
|
||||
quadTransform[3][1] = (float)GetVisibleRect().y - 0.5f;
|
||||
quadTransform[3][0] = (float)visibleRect.x - 0.5f;
|
||||
quadTransform[3][1] = (float)visibleRect.y - 0.5f;
|
||||
quadTransform[3][3] = 1.0f;
|
||||
|
||||
device()->SetVertexShaderConstantF(0, &quadTransform[0][0], 4);
|
||||
|
@ -67,15 +67,10 @@ public:
|
||||
virtual void CleanResources();
|
||||
|
||||
/* ThebesLayerD3D9 */
|
||||
const nsIntRect &GetVisibleRect();
|
||||
nsIntRect GetVisibleRect() { return mVisibleRegion.GetBounds(); }
|
||||
const nsIntRect &GetInvalidatedRect();
|
||||
|
||||
private:
|
||||
/*
|
||||
* Visible rectangle, this is used to know the size and position of the quad
|
||||
* when doing the rendering of this layer.
|
||||
*/
|
||||
nsIntRect mVisibleRect;
|
||||
/*
|
||||
* Currently invalidated rectangular area.
|
||||
*/
|
||||
|
@ -54,8 +54,6 @@ public:
|
||||
mImplData = static_cast<LayerOGL*>(this);
|
||||
}
|
||||
|
||||
virtual void SetVisibleRegion(const nsIntRegion& aRegion) { mVisibleRegion = aRegion; }
|
||||
|
||||
// LayerOGL Implementation
|
||||
virtual LayerType GetType();
|
||||
|
||||
@ -63,9 +61,6 @@ public:
|
||||
|
||||
virtual void RenderLayer(int aPreviousFrameBuffer,
|
||||
const nsIntPoint& aOffset);
|
||||
|
||||
protected:
|
||||
nsIntRegion mVisibleRegion;
|
||||
};
|
||||
|
||||
} /* layers */
|
||||
|
@ -54,18 +54,6 @@ ContainerLayerOGL::~ContainerLayerOGL()
|
||||
}
|
||||
}
|
||||
|
||||
const nsIntRect&
|
||||
ContainerLayerOGL::GetVisibleRect()
|
||||
{
|
||||
return mVisibleRect;
|
||||
}
|
||||
|
||||
void
|
||||
ContainerLayerOGL::SetVisibleRegion(const nsIntRegion &aRegion)
|
||||
{
|
||||
mVisibleRect = aRegion.GetBounds();
|
||||
}
|
||||
|
||||
void
|
||||
ContainerLayerOGL::InsertAfter(Layer* aChild, Layer* aAfter)
|
||||
{
|
||||
@ -164,15 +152,16 @@ ContainerLayerOGL::RenderLayer(int aPreviousFrameBuffer,
|
||||
|
||||
nsIntPoint childOffset(aOffset);
|
||||
bool needsFramebuffer = false;
|
||||
nsIntRect visibleRect = mVisibleRegion.GetBounds();
|
||||
|
||||
float opacity = GetOpacity();
|
||||
if (opacity != 1.0) {
|
||||
mOGLManager->CreateFBOWithTexture(mVisibleRect.width,
|
||||
mVisibleRect.height,
|
||||
mOGLManager->CreateFBOWithTexture(visibleRect.width,
|
||||
visibleRect.height,
|
||||
&frameBuffer,
|
||||
&containerSurface);
|
||||
childOffset.x = mVisibleRect.x;
|
||||
childOffset.y = mVisibleRect.y;
|
||||
childOffset.x = visibleRect.x;
|
||||
childOffset.y = visibleRect.y;
|
||||
} else {
|
||||
frameBuffer = aPreviousFrameBuffer;
|
||||
}
|
||||
@ -184,12 +173,12 @@ ContainerLayerOGL::RenderLayer(int aPreviousFrameBuffer,
|
||||
while (layerToRender) {
|
||||
const nsIntRect *clipRect = layerToRender->GetLayer()->GetClipRect();
|
||||
if (clipRect) {
|
||||
gl()->fScissor(clipRect->x - mVisibleRect.x,
|
||||
clipRect->y - mVisibleRect.y,
|
||||
gl()->fScissor(clipRect->x - visibleRect.x,
|
||||
clipRect->y - visibleRect.y,
|
||||
clipRect->width,
|
||||
clipRect->height);
|
||||
} else {
|
||||
gl()->fScissor(0, 0, mVisibleRect.width, mVisibleRect.height);
|
||||
gl()->fScissor(0, 0, visibleRect.width, visibleRect.height);
|
||||
}
|
||||
|
||||
layerToRender->RenderLayer(frameBuffer, childOffset);
|
||||
@ -212,7 +201,7 @@ ContainerLayerOGL::RenderLayer(int aPreviousFrameBuffer,
|
||||
ColorTextureLayerProgram *rgb = mOGLManager->GetFBOLayerProgram();
|
||||
|
||||
rgb->Activate();
|
||||
rgb->SetLayerQuadRect(mVisibleRect);
|
||||
rgb->SetLayerQuadRect(visibleRect);
|
||||
rgb->SetLayerTransform(mTransform);
|
||||
rgb->SetLayerOpacity(opacity);
|
||||
rgb->SetRenderOffset(aOffset);
|
||||
@ -220,7 +209,7 @@ ContainerLayerOGL::RenderLayer(int aPreviousFrameBuffer,
|
||||
|
||||
if (rgb->GetTexCoordMultiplierUniformLocation() != -1) {
|
||||
// 2DRect case, get the multiplier right for a sampler2DRect
|
||||
float f[] = { float(mVisibleRect.width), float(mVisibleRect.height) };
|
||||
float f[] = { float(visibleRect.width), float(visibleRect.height) };
|
||||
rgb->SetUniform(rgb->GetTexCoordMultiplierUniformLocation(),
|
||||
2, f);
|
||||
}
|
||||
|
@ -51,10 +51,7 @@ public:
|
||||
ContainerLayerOGL(LayerManagerOGL *aManager);
|
||||
~ContainerLayerOGL();
|
||||
|
||||
const nsIntRect &GetVisibleRect();
|
||||
|
||||
/** ContainerLayer implementation */
|
||||
void SetVisibleRegion(const nsIntRegion& aRegion);
|
||||
nsIntRect GetVisibleRect() { return mVisibleRegion.GetBounds(); }
|
||||
|
||||
void InsertAfter(Layer* aChild, Layer* aAfter);
|
||||
|
||||
@ -72,8 +69,6 @@ public:
|
||||
virtual void RenderLayer(int aPreviousFrameBuffer,
|
||||
const nsIntPoint& aOffset);
|
||||
private:
|
||||
nsIntRect mVisibleRect;
|
||||
|
||||
GLuint mTexture;
|
||||
};
|
||||
|
||||
|
@ -231,7 +231,7 @@ public:
|
||||
BindQuadVBO();
|
||||
QuadVBOVerticesAttrib(aVertAttribIndex);
|
||||
|
||||
if (aTexCoordAttribIndex != -1) {
|
||||
if (aTexCoordAttribIndex != GLuint(-1)) {
|
||||
if (aFlipped)
|
||||
QuadVBOFlippedTexCoordsAttrib(aTexCoordAttribIndex);
|
||||
else
|
||||
@ -246,7 +246,7 @@ public:
|
||||
|
||||
mGLContext->fDisableVertexAttribArray(aVertAttribIndex);
|
||||
|
||||
if (aTexCoordAttribIndex != -1) {
|
||||
if (aTexCoordAttribIndex != GLuint(-1)) {
|
||||
mGLContext->fDisableVertexAttribArray(aTexCoordAttribIndex);
|
||||
}
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ public:
|
||||
void SetUniform(GLuint aUniform, float aFloatValue) {
|
||||
ASSERT_THIS_PROGRAM;
|
||||
|
||||
if (aUniform == -1)
|
||||
if (aUniform == GLuint(-1))
|
||||
return;
|
||||
|
||||
if (!mUniformValues[aUniform].equalsFloat(aFloatValue)) {
|
||||
@ -143,7 +143,7 @@ public:
|
||||
void SetUniform(GLuint aUniform, const gfxRGBA& aColor) {
|
||||
ASSERT_THIS_PROGRAM;
|
||||
|
||||
if (aUniform == -1)
|
||||
if (aUniform == GLuint(-1))
|
||||
return;
|
||||
|
||||
if (!mUniformValues[aUniform].equalsColor(aColor)) {
|
||||
@ -155,7 +155,7 @@ public:
|
||||
void SetUniform(GLuint aUniform, int aLength, float *aFloatValues) {
|
||||
ASSERT_THIS_PROGRAM;
|
||||
|
||||
if (aUniform == -1)
|
||||
if (aUniform == GLuint(-1))
|
||||
return;
|
||||
|
||||
if (!mUniformValues[aUniform].equalsFloatN(aFloatValues, aLength)) {
|
||||
@ -177,7 +177,7 @@ public:
|
||||
void SetUniform(GLuint aUniform, GLint aIntValue) {
|
||||
ASSERT_THIS_PROGRAM;
|
||||
|
||||
if (aUniform == -1)
|
||||
if (aUniform == GLuint(-1))
|
||||
return;
|
||||
|
||||
if (!mUniformValues[aUniform].equalsInt(aIntValue)) {
|
||||
@ -189,7 +189,7 @@ public:
|
||||
void SetMatrixUniform(GLuint aUniform, const float *aFloatValues) {
|
||||
ASSERT_THIS_PROGRAM;
|
||||
|
||||
if (aUniform == -1)
|
||||
if (aUniform == GLuint(-1))
|
||||
return;
|
||||
|
||||
if (!mUniformValues[aUniform].equalsFloatN(aFloatValues, 16)) {
|
||||
|
@ -89,11 +89,12 @@ ThebesLayerOGL::~ThebesLayerOGL()
|
||||
void
|
||||
ThebesLayerOGL::SetVisibleRegion(const nsIntRegion &aRegion)
|
||||
{
|
||||
if (aRegion.GetBounds() == mVisibleRect)
|
||||
if (aRegion.IsEqual(mVisibleRegion))
|
||||
return;
|
||||
|
||||
mVisibleRect = aRegion.GetBounds();
|
||||
mInvalidatedRect = mVisibleRect;
|
||||
ThebesLayer::SetVisibleRegion(aRegion);
|
||||
|
||||
mInvalidatedRect = mVisibleRegion.GetBounds();
|
||||
|
||||
mOGLManager->MakeCurrent();
|
||||
|
||||
@ -110,8 +111,8 @@ ThebesLayerOGL::SetVisibleRegion(const nsIntRegion &aRegion)
|
||||
gl()->fTexImage2D(LOCAL_GL_TEXTURE_2D,
|
||||
0,
|
||||
LOCAL_GL_RGBA,
|
||||
mVisibleRect.width,
|
||||
mVisibleRect.height,
|
||||
mInvalidatedRect.width,
|
||||
mInvalidatedRect.height,
|
||||
0,
|
||||
LOCAL_GL_RGBA,
|
||||
LOCAL_GL_UNSIGNED_BYTE,
|
||||
@ -125,7 +126,7 @@ ThebesLayerOGL::InvalidateRegion(const nsIntRegion &aRegion)
|
||||
{
|
||||
nsIntRegion invalidatedRegion;
|
||||
invalidatedRegion.Or(aRegion, mInvalidatedRect);
|
||||
invalidatedRegion.And(invalidatedRegion, mVisibleRect);
|
||||
invalidatedRegion.And(invalidatedRegion, mVisibleRegion);
|
||||
mInvalidatedRect = invalidatedRegion.GetBounds();
|
||||
}
|
||||
|
||||
@ -135,12 +136,6 @@ ThebesLayerOGL::GetType()
|
||||
return TYPE_THEBES;
|
||||
}
|
||||
|
||||
const nsIntRect&
|
||||
ThebesLayerOGL::GetVisibleRect()
|
||||
{
|
||||
return mVisibleRect;
|
||||
}
|
||||
|
||||
void
|
||||
ThebesLayerOGL::RenderLayer(int aPreviousFrameBuffer,
|
||||
const nsIntPoint& aOffset)
|
||||
@ -152,6 +147,7 @@ ThebesLayerOGL::RenderLayer(int aPreviousFrameBuffer,
|
||||
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
|
||||
|
||||
bool needsTextureBind = true;
|
||||
nsIntRect visibleRect = mVisibleRegion.GetBounds();
|
||||
|
||||
if (!mInvalidatedRect.IsEmpty()) {
|
||||
gfxASurface::gfxImageFormat imageFormat;
|
||||
@ -209,8 +205,8 @@ ThebesLayerOGL::RenderLayer(int aPreviousFrameBuffer,
|
||||
gl()->fBindTexture(LOCAL_GL_TEXTURE_2D, mTexture);
|
||||
gl()->fTexSubImage2D(LOCAL_GL_TEXTURE_2D,
|
||||
0,
|
||||
mInvalidatedRect.x - mVisibleRect.x,
|
||||
mInvalidatedRect.y - mVisibleRect.y,
|
||||
mInvalidatedRect.x - visibleRect.x,
|
||||
mInvalidatedRect.y - visibleRect.y,
|
||||
mInvalidatedRect.width,
|
||||
mInvalidatedRect.height,
|
||||
LOCAL_GL_RGBA,
|
||||
@ -231,7 +227,7 @@ ThebesLayerOGL::RenderLayer(int aPreviousFrameBuffer,
|
||||
: mOGLManager->GetBGRALayerProgram();
|
||||
|
||||
program->Activate();
|
||||
program->SetLayerQuadRect(mVisibleRect);
|
||||
program->SetLayerQuadRect(visibleRect);
|
||||
program->SetLayerOpacity(GetOpacity());
|
||||
program->SetLayerTransform(mTransform);
|
||||
program->SetRenderOffset(aOffset);
|
||||
|
@ -67,15 +67,10 @@ public:
|
||||
const nsIntPoint& aOffset);
|
||||
|
||||
/** ThebesLayerOGL */
|
||||
const nsIntRect &GetVisibleRect();
|
||||
nsIntRect GetVisibleRect() { return mVisibleRegion.GetBounds(); }
|
||||
const nsIntRect &GetInvalidatedRect();
|
||||
|
||||
private:
|
||||
/**
|
||||
* Visible rectangle, this is used to know the size and position of the quad
|
||||
* when doing the rendering of this layer.
|
||||
*/
|
||||
nsIntRect mVisibleRect;
|
||||
/**
|
||||
* Currently invalidated rectangular area.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user