mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 780920, part 1: LayerManagerOGL needs to account for the world transform when reading back into a non-default target. r=roc
This commit is contained in:
parent
e7375c4784
commit
9582a20f31
@ -871,6 +871,9 @@ LayerManagerOGL::Render()
|
||||
if (mIsRenderingToEGLSurface) {
|
||||
rect = nsIntRect(0, 0, mSurfaceSize.width, mSurfaceSize.height);
|
||||
} else {
|
||||
// FIXME/bug XXXXXX this races with rotation changes on the main
|
||||
// thread, and undoes all the care we take with layers txns being
|
||||
// sent atomically with rotation changes
|
||||
mWidget->GetClientBounds(rect);
|
||||
}
|
||||
WorldTransformRect(rect);
|
||||
@ -1186,7 +1189,7 @@ LayerManagerOGL::CopyToTarget(gfxContext *aTarget)
|
||||
if (mIsRenderingToEGLSurface) {
|
||||
rect = nsIntRect(0, 0, mSurfaceSize.width, mSurfaceSize.height);
|
||||
} else {
|
||||
mWidget->GetClientBounds(rect);
|
||||
rect = nsIntRect(0, 0, mWidgetSize.width, mWidgetSize.height);
|
||||
}
|
||||
GLint width = rect.width;
|
||||
GLint height = rect.height;
|
||||
@ -1219,9 +1222,15 @@ LayerManagerOGL::CopyToTarget(gfxContext *aTarget)
|
||||
|
||||
mGLContext->ReadPixelsIntoImageSurface(imageSurface);
|
||||
|
||||
// Map from GL space to Cairo space and reverse the world transform.
|
||||
gfxMatrix glToCairoTransform = mWorldMatrix;
|
||||
glToCairoTransform.Invert();
|
||||
glToCairoTransform.Scale(1.0, -1.0);
|
||||
glToCairoTransform.Translate(-gfxPoint(0.0, height));
|
||||
|
||||
gfxContextAutoSaveRestore restore(aTarget);
|
||||
aTarget->SetOperator(gfxContext::OPERATOR_SOURCE);
|
||||
aTarget->Scale(1.0, -1.0);
|
||||
aTarget->Translate(-gfxPoint(0.0, height));
|
||||
aTarget->SetMatrix(glToCairoTransform);
|
||||
aTarget->SetSource(imageSurface);
|
||||
aTarget->Paint();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user