Fix hybrid composition case and enable test (flutter/engine#26272)

This commit is contained in:
Emmanuel Garcia 2021-05-19 20:44:03 -07:00 committed by GitHub
parent dbd751e2b0
commit 562e87e3f4
3 changed files with 24 additions and 15 deletions

View File

@ -125,22 +125,19 @@ void AndroidExternalViewEmbedder::SubmitFrame(
joined_rect.join(rect);
}
}
if (joined_rect.isEmpty()) {
continue;
if (!joined_rect.isEmpty()) {
// Subpixels in the platform may not align with the canvas subpixels.
//
// To workaround it, round the floating point bounds and make the rect
// slightly larger.
//
// For example, {0.3, 0.5, 3.1, 4.7} becomes {0, 0, 4, 5}.
joined_rect.set(joined_rect.roundOut());
overlay_layers.insert({view_id, joined_rect});
// Clip the background canvas, so it doesn't contain any of the pixels
// drawn on the overlay layer.
background_canvas->clipRect(joined_rect, SkClipOp::kDifference);
}
// Subpixels in the platform may not align with the canvas subpixels.
//
// To workaround it, round the floating point bounds and make the rect
// slightly larger.
//
// For example, {0.3, 0.5, 3.1, 4.7} becomes {0, 0, 4, 5}.
joined_rect.set(joined_rect.roundOut());
overlay_layers.insert({view_id, joined_rect});
// Clip the background canvas, so it doesn't contain any of the pixels
// drawn on the overlay layer.
background_canvas->clipRect(joined_rect, SkClipOp::kDifference);
background_canvas->drawPicture(pictures.at(view_id));
}
// Submit the background canvas frame before switching the GL context to

View File

@ -96,4 +96,10 @@ public class PlatformTextureUiTests {
intent.putExtra("scenario", "platform_view_two_intersecting_overlays");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
@Test
public void testPlatformViewWithoutOverlayIntersection() throws Exception {
intent.putExtra("scenario", "platform_view_no_overlay_intersection");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
}

View File

@ -96,4 +96,10 @@ public class PlatformViewUiTests {
intent.putExtra("scenario", "platform_view_two_intersecting_overlays");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
@Test
public void testPlatformViewWithoutOverlayIntersection() throws Exception {
intent.putExtra("scenario", "platform_view_no_overlay_intersection");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
}