mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-20 08:51:04 +00:00
Bug 1750443 - Stop rounding buffer clips, r=gfx-reviewers,lsalzman
Rounding the values to integers appears to be to aggressive in some situations. The rounding was introduced to work around floating point errors under the assumption that we'd always end up with integer values. However, apparently we sometimes compute values `<0.5`, making us end up with `0`, triggering a protocol errer. Replace that with an intersection with the actual buffer size. This will slightly increase wire communication, but should avoid the crashes. Differential Revision: https://phabricator.services.mozilla.com/D137249
This commit is contained in:
parent
b025d96056
commit
21149596d5
@ -206,8 +206,6 @@ bool NativeLayerRootWayland::CommitToScreen(const MutexAutoLock& aProofOfLock) {
|
||||
|
||||
auto transform2DInversed = transform2D.Inverse();
|
||||
Rect bufferClip = transform2DInversed.TransformBounds(surfaceRectClipped);
|
||||
// avoid floating point issues - we always expect integer values here
|
||||
bufferClip.Round();
|
||||
layer->SetViewportSourceRect(bufferClip);
|
||||
|
||||
layer->Commit();
|
||||
@ -698,11 +696,14 @@ void NativeLayerWayland::SetSubsurfacePosition(int aX, int aY) {
|
||||
void NativeLayerWayland::SetViewportSourceRect(const Rect aSourceRect) {
|
||||
MutexAutoLock lock(mMutex);
|
||||
|
||||
if (aSourceRect == mViewportSourceRect) {
|
||||
Rect bufferRect = Rect(0, 0, mSize.width, mSize.height);
|
||||
Rect sourceRect = aSourceRect.Intersect(bufferRect);
|
||||
|
||||
if (mViewportSourceRect == sourceRect) {
|
||||
return;
|
||||
}
|
||||
|
||||
mViewportSourceRect = aSourceRect;
|
||||
mViewportSourceRect = sourceRect;
|
||||
wp_viewport_set_source(mViewport, wl_fixed_from_double(mViewportSourceRect.x),
|
||||
wl_fixed_from_double(mViewportSourceRect.y),
|
||||
wl_fixed_from_double(mViewportSourceRect.width),
|
||||
|
Loading…
x
Reference in New Issue
Block a user