Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the size of Overlay FlutterImageView in HC mode #38393

Merged
merged 13 commits into from
Jan 5, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ void AndroidExternalViewEmbedder::SubmitFrame(
for (const SkRect& rect : intersection_rects) {
joined_rect.join(rect);
}

// Get the intersection rect between the current rect
// and the platform view rect.
joined_rect.intersect(current_view_rect);
Nayuta403 marked this conversation as resolved.
Show resolved Hide resolved
}
if (!joined_rect.isEmpty()) {
// Subpixels in the platform may not align with the canvas subpixels.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ TEST(AndroidExternalViewEmbedder, SubmitFrame) {
0, 150, 150, 300, 300, 300, 300, stack1));
// The JNI call to display the overlay surface.
EXPECT_CALL(*jni_mock,
FlutterViewDisplayOverlaySurface(0, 50, 50, 200, 200));
FlutterViewDisplayOverlaySurface(0, 150, 150, 100, 100));

auto did_submit_frame = false;
auto surface_frame = std::make_unique<SurfaceFrame>(
Expand Down Expand Up @@ -491,7 +491,7 @@ TEST(AndroidExternalViewEmbedder, SubmitFrame) {
0, 150, 150, 300, 300, 300, 300, stack1));
// The JNI call to display the overlay surface.
EXPECT_CALL(*jni_mock,
FlutterViewDisplayOverlaySurface(0, 50, 50, 200, 200));
FlutterViewDisplayOverlaySurface(0, 150, 150, 100, 100));

auto did_submit_frame = false;
auto surface_frame = std::make_unique<SurfaceFrame>(
Expand Down Expand Up @@ -776,7 +776,7 @@ TEST(AndroidExternalViewEmbedder, DestroyOverlayLayersOnSizeChange) {
EXPECT_CALL(*jni_mock, FlutterViewOnDisplayPlatformView(0, 0, 0, 200, 200,
300, 300, stack1));
EXPECT_CALL(*jni_mock,
FlutterViewDisplayOverlaySurface(0, 50, 50, 200, 200));
FlutterViewDisplayOverlaySurface(0, 50, 50, 150, 150));

SurfaceFrame::FramebufferInfo framebuffer_info;
auto surface_frame = std::make_unique<SurfaceFrame>(
Expand Down Expand Up @@ -865,7 +865,7 @@ TEST(AndroidExternalViewEmbedder, DoesNotDestroyOverlayLayersOnSizeChange) {
EXPECT_CALL(*jni_mock, FlutterViewOnDisplayPlatformView(0, 0, 0, 200, 200,
300, 300, stack1));
EXPECT_CALL(*jni_mock,
FlutterViewDisplayOverlaySurface(0, 50, 50, 200, 200));
FlutterViewDisplayOverlaySurface(0, 50, 50, 150, 150));

auto surface_frame = std::make_unique<SurfaceFrame>(
SkSurface::MakeNull(1000, 1000), framebuffer_info,
Expand Down