зеркало из https://github.com/mozilla/gecko-dev.git
Bug 810501: Get buffer offset from ThebesLayer when composing with hwc. r=cjones a=blocking-basecamp
This commit is contained in:
Родитель
f8757fa43a
Коммит
d8e46561b4
|
@ -11,6 +11,7 @@
|
||||||
#include "mozilla/layers/ShadowLayers.h"
|
#include "mozilla/layers/ShadowLayers.h"
|
||||||
|
|
||||||
#include "mozilla/TimeStamp.h"
|
#include "mozilla/TimeStamp.h"
|
||||||
|
#include "nsPoint.h"
|
||||||
|
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
@ -473,12 +474,20 @@ enum LayerRenderStateFlags {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct LayerRenderState {
|
struct LayerRenderState {
|
||||||
LayerRenderState() : mSurface(nullptr), mFlags(0)
|
LayerRenderState() : mSurface(nullptr), mFlags(0), mHasOwnOffset(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
LayerRenderState(SurfaceDescriptor* aSurface, uint32_t aFlags = 0)
|
LayerRenderState(SurfaceDescriptor* aSurface, uint32_t aFlags = 0)
|
||||||
: mSurface(aSurface)
|
: mSurface(aSurface)
|
||||||
, mFlags(aFlags)
|
, mFlags(aFlags)
|
||||||
|
, mHasOwnOffset(false)
|
||||||
|
{}
|
||||||
|
|
||||||
|
LayerRenderState(SurfaceDescriptor* aSurface, nsIntPoint aOffset, uint32_t aFlags = 0)
|
||||||
|
: mSurface(aSurface)
|
||||||
|
, mFlags(aFlags)
|
||||||
|
, mOffset(aOffset)
|
||||||
|
, mHasOwnOffset(true)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool YFlipped() const
|
bool YFlipped() const
|
||||||
|
@ -489,6 +498,8 @@ struct LayerRenderState {
|
||||||
|
|
||||||
SurfaceDescriptor* mSurface;
|
SurfaceDescriptor* mSurface;
|
||||||
uint32_t mFlags;
|
uint32_t mFlags;
|
||||||
|
nsIntPoint mOffset;
|
||||||
|
bool mHasOwnOffset;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -98,8 +98,8 @@ public:
|
||||||
|
|
||||||
bool Initialised() { return mInitialised; }
|
bool Initialised() { return mInitialised; }
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual nsIntPoint GetOriginOffset() = 0;
|
virtual nsIntPoint GetOriginOffset() = 0;
|
||||||
|
protected:
|
||||||
|
|
||||||
GLContext* gl() const { return mOGLLayer->gl(); }
|
GLContext* gl() const { return mOGLLayer->gl(); }
|
||||||
|
|
||||||
|
@ -343,7 +343,6 @@ public:
|
||||||
return mTexImage ? mTexImage->GetBackingSurface() : nullptr;
|
return mTexImage ? mTexImage->GetBackingSurface() : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual nsIntPoint GetOriginOffset() {
|
virtual nsIntPoint GetOriginOffset() {
|
||||||
return BufferRect().TopLeft() - BufferRotation();
|
return BufferRect().TopLeft() - BufferRotation();
|
||||||
}
|
}
|
||||||
|
@ -366,6 +365,10 @@ public:
|
||||||
|
|
||||||
virtual PaintState BeginPaint(ContentType aContentType,
|
virtual PaintState BeginPaint(ContentType aContentType,
|
||||||
uint32_t aFlags);
|
uint32_t aFlags);
|
||||||
|
virtual nsIntPoint GetOriginOffset() {
|
||||||
|
return mBufferRect.TopLeft() - mBufferRotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
enum XSide {
|
enum XSide {
|
||||||
|
@ -376,10 +379,6 @@ protected:
|
||||||
};
|
};
|
||||||
nsIntRect GetQuadrantRectangle(XSide aXSide, YSide aYSide);
|
nsIntRect GetQuadrantRectangle(XSide aXSide, YSide aYSide);
|
||||||
|
|
||||||
virtual nsIntPoint GetOriginOffset() {
|
|
||||||
return mBufferRect.TopLeft() - mBufferRotation;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsIntRect mBufferRect;
|
nsIntRect mBufferRect;
|
||||||
nsIntPoint mBufferRotation;
|
nsIntPoint mBufferRotation;
|
||||||
|
@ -902,7 +901,6 @@ public:
|
||||||
return mBufferRotation;
|
return mBufferRotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual nsIntPoint GetOriginOffset() {
|
virtual nsIntPoint GetOriginOffset() {
|
||||||
return mBufferRect.TopLeft() - mBufferRotation;
|
return mBufferRect.TopLeft() - mBufferRotation;
|
||||||
}
|
}
|
||||||
|
@ -1111,7 +1109,7 @@ ShadowThebesLayerOGL::GetRenderState()
|
||||||
}
|
}
|
||||||
uint32_t flags = (mBuffer->Rotation() != nsIntPoint()) ?
|
uint32_t flags = (mBuffer->Rotation() != nsIntPoint()) ?
|
||||||
LAYER_RENDER_STATE_BUFFER_ROTATION : 0;
|
LAYER_RENDER_STATE_BUFFER_ROTATION : 0;
|
||||||
return LayerRenderState(&mBufferDescriptor, flags);
|
return LayerRenderState(&mBufferDescriptor, mBuffer->GetOriginOffset(), flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -174,13 +174,13 @@ HwcComposer2D::GetRotation()
|
||||||
* Sets hwc layer rectangles required for hwc composition
|
* Sets hwc layer rectangles required for hwc composition
|
||||||
*
|
*
|
||||||
* @param aVisible Input. Layer's unclipped visible rectangle
|
* @param aVisible Input. Layer's unclipped visible rectangle
|
||||||
* The origin is the layer's buffer
|
* The origin is the top-left corner of the layer
|
||||||
* @param aTransform Input. Layer's transformation matrix
|
* @param aTransform Input. Layer's transformation matrix
|
||||||
* It transforms from layer space to screen space
|
* It transforms from layer space to screen space
|
||||||
* @param aClip Input. A clipping rectangle.
|
* @param aClip Input. A clipping rectangle.
|
||||||
* The origin is the top-left corner of the screen
|
* The origin is the top-left corner of the screen
|
||||||
* @param aBufferRect Input. The layer's buffer bounds
|
* @param aBufferRect Input. The layer's buffer bounds
|
||||||
* The origin is the buffer itself and hence always (0,0)
|
* The origin is the top-left corner of the layer
|
||||||
* @param aSurceCrop Output. Area of the source to consider,
|
* @param aSurceCrop Output. Area of the source to consider,
|
||||||
* the origin is the top-left corner of the buffer
|
* the origin is the top-left corner of the buffer
|
||||||
* @param aVisibleRegionScreen Output. Visible region in screen space.
|
* @param aVisibleRegionScreen Output. Visible region in screen space.
|
||||||
|
@ -207,9 +207,7 @@ PrepareLayerRects(nsIntRect aVisible, const gfxMatrix& aTransform,
|
||||||
gfxMatrix inverse(aTransform);
|
gfxMatrix inverse(aTransform);
|
||||||
inverse.Invert();
|
inverse.Invert();
|
||||||
gfxRect crop = inverse.TransformBounds(visibleRectScreen);
|
gfxRect crop = inverse.TransformBounds(visibleRectScreen);
|
||||||
// Map to buffer space
|
|
||||||
crop -= visibleRect.TopLeft();
|
|
||||||
gfxRect bufferRect(aBufferRect);
|
|
||||||
//clip to buffer size
|
//clip to buffer size
|
||||||
crop.IntersectRect(crop, aBufferRect);
|
crop.IntersectRect(crop, aBufferRect);
|
||||||
crop.RoundOut();
|
crop.RoundOut();
|
||||||
|
@ -219,11 +217,13 @@ PrepareLayerRects(nsIntRect aVisible, const gfxMatrix& aTransform,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//propagate buffer clipping back to visible rect
|
//propagate buffer clipping back to visible rect
|
||||||
visibleRectScreen = aTransform.TransformBounds(crop + visibleRect.TopLeft());
|
visibleRectScreen = aTransform.TransformBounds(crop);
|
||||||
visibleRectScreen.RoundOut();
|
visibleRectScreen.RoundOut();
|
||||||
|
|
||||||
|
// Map from layer space to buffer space
|
||||||
|
crop -= aBufferRect.TopLeft();
|
||||||
|
|
||||||
aSourceCrop->left = crop.x;
|
aSourceCrop->left = crop.x;
|
||||||
aSourceCrop->top = crop.y;
|
aSourceCrop->top = crop.y;
|
||||||
aSourceCrop->right = crop.x + crop.width;
|
aSourceCrop->right = crop.x + crop.width;
|
||||||
|
@ -326,11 +326,15 @@ HwcComposer2D::PrepareLayerList(Layer* aLayer,
|
||||||
|
|
||||||
nsIntRect bufferRect;
|
nsIntRect bufferRect;
|
||||||
if (fillColor) {
|
if (fillColor) {
|
||||||
bufferRect = nsIntRect(0, 0, visibleRect.width,
|
bufferRect = nsIntRect(visibleRect);
|
||||||
visibleRect.height);
|
|
||||||
} else {
|
} else {
|
||||||
bufferRect = nsIntRect(0, 0, int(buffer->getWidth()),
|
if(state.mHasOwnOffset) {
|
||||||
int(buffer->getHeight()));
|
bufferRect = nsIntRect(state.mOffset.x, state.mOffset.y,
|
||||||
|
int(buffer->getWidth()), int(buffer->getHeight()));
|
||||||
|
} else {
|
||||||
|
bufferRect = nsIntRect(visibleRect.x, visibleRect.y,
|
||||||
|
int(buffer->getWidth()), int(buffer->getHeight()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hwc_layer_t& hwcLayer = mList->hwLayers[current];
|
hwc_layer_t& hwcLayer = mList->hwLayers[current];
|
||||||
|
|
Загрузка…
Ссылка в новой задаче