mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Bug 993004 - Fix the clipping of tiles when the screen is rotated. r=botond
This commit is contained in:
parent
d907b73914
commit
66001e57a2
@ -107,18 +107,33 @@ Compositor::DrawDiagnostics(DiagnosticFlags aFlags,
|
||||
gfx::Rect
|
||||
Compositor::ClipRectInLayersCoordinates(gfx::Rect aClip) const {
|
||||
gfx::Rect result;
|
||||
aClip = aClip + GetCurrentRenderTarget()->GetOrigin();
|
||||
gfx::IntSize destSize = GetWidgetSize();
|
||||
|
||||
switch (mScreenRotation) {
|
||||
case ROTATION_90:
|
||||
case ROTATION_270:
|
||||
result = gfx::Rect(aClip.y, aClip.x, aClip.height, aClip.width);
|
||||
break;
|
||||
case ROTATION_0:
|
||||
case ROTATION_180:
|
||||
default:
|
||||
result = aClip;
|
||||
break;
|
||||
case ROTATION_90:
|
||||
result = gfx::Rect(aClip.y,
|
||||
destSize.width - aClip.x - aClip.width,
|
||||
aClip.height, aClip.width);
|
||||
break;
|
||||
case ROTATION_270:
|
||||
result = gfx::Rect(destSize.height - aClip.y - aClip.height,
|
||||
aClip.x,
|
||||
aClip.height, aClip.width);
|
||||
break;
|
||||
case ROTATION_180:
|
||||
result = gfx::Rect(destSize.width - aClip.x - aClip.width,
|
||||
destSize.height - aClip.y - aClip.height,
|
||||
aClip.width, aClip.height);
|
||||
break;
|
||||
// ScreenRotation has a sentinel value, need to catch it in the switch
|
||||
// statement otherwise the build fails (-WError)
|
||||
default: {}
|
||||
}
|
||||
return result + GetCurrentRenderTarget()->GetOrigin();
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -500,6 +500,7 @@ public:
|
||||
// In addition, the clip rect needs to be offset by the rendering origin.
|
||||
// This becomes important if intermediate surfaces are used.
|
||||
gfx::Rect ClipRectInLayersCoordinates(gfx::Rect aClip) const;
|
||||
|
||||
protected:
|
||||
void DrawDiagnosticsInternal(DiagnosticFlags aFlags,
|
||||
const gfx::Rect& aVisibleRect,
|
||||
@ -528,6 +529,8 @@ protected:
|
||||
|
||||
ScreenRotation mScreenRotation;
|
||||
|
||||
virtual gfx::IntSize GetWidgetSize() const = 0;
|
||||
|
||||
private:
|
||||
static LayersBackend sBackend;
|
||||
|
||||
|
@ -378,6 +378,7 @@ BasicCompositor::BeginFrame(const nsIntRegion& aInvalidRegion,
|
||||
{
|
||||
nsIntRect intRect;
|
||||
mWidget->GetClientBounds(intRect);
|
||||
mWidgetSize = gfx::ToIntSize(intRect.Size());
|
||||
|
||||
// The result of GetClientBounds is shifted over by the size of the window
|
||||
// manager styling. We want to ignore that.
|
||||
|
@ -125,9 +125,12 @@ public:
|
||||
gfx::DrawTarget *GetDrawTarget() { return mDrawTarget; }
|
||||
|
||||
private:
|
||||
|
||||
virtual gfx::IntSize GetWidgetSize() const MOZ_OVERRIDE { return mWidgetSize; }
|
||||
|
||||
// Widget associated with this compositor
|
||||
nsIWidget *mWidget;
|
||||
nsIntSize mWidgetSize;
|
||||
gfx::IntSize mWidgetSize;
|
||||
|
||||
// The final destination surface
|
||||
RefPtr<gfx::DrawTarget> mDrawTarget;
|
||||
|
@ -157,6 +157,8 @@ private:
|
||||
void SetPSForEffect(Effect *aEffect, MaskType aMaskType, gfx::SurfaceFormat aFormat);
|
||||
void PaintToTarget();
|
||||
|
||||
virtual gfx::IntSize GetWidgetSize() const MOZ_OVERRIDE { return gfx::ToIntSize(mSize); }
|
||||
|
||||
RefPtr<ID3D11DeviceContext> mContext;
|
||||
RefPtr<ID3D11Device> mDevice;
|
||||
RefPtr<IDXGISwapChain> mSwapChain;
|
||||
|
@ -153,6 +153,8 @@ private:
|
||||
|
||||
void ReportFailure(const nsACString &aMsg, HRESULT aCode);
|
||||
|
||||
virtual gfx::IntSize GetWidgetSize() const MOZ_OVERRIDE { return mSize; }
|
||||
|
||||
/* Device manager instance for this compositor */
|
||||
nsRefPtr<DeviceManagerD3D9> mDeviceManager;
|
||||
|
||||
|
@ -285,6 +285,11 @@ private:
|
||||
const gfx::Matrix4x4 &aTransformi,
|
||||
GLuint aDrawMode);
|
||||
|
||||
virtual gfx::IntSize GetWidgetSize() const MOZ_OVERRIDE
|
||||
{
|
||||
return gfx::ToIntSize(mWidgetSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Context target, nullptr when drawing directly to our swap chain.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user