Bug 993004 - Fix the clipping of tiles when the screen is rotated. r=botond

This commit is contained in:
Nicolas Silva
2014-04-25 11:51:17 +02:00
parent ba337f2a9b
commit 7023ba146a
7 changed files with 39 additions and 8 deletions

View File

@@ -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