Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit b716cbb

Browse files
author
Emmanuel Garcia
authored
Reland unobstructed platform views (#17336)
1 parent 946df02 commit b716cbb

21 files changed

+881
-136
lines changed

flow/embedded_views.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@
66

77
namespace flutter {
88

9-
bool ExternalViewEmbedder::SubmitFrame(GrContext* context) {
9+
bool ExternalViewEmbedder::SubmitFrame(GrContext* context,
10+
SkCanvas* background_canvas) {
1011
return false;
1112
};
1213

14+
void ExternalViewEmbedder::FinishFrame(){};
15+
1316
void MutatorsStack::PushClipRect(const SkRect& rect) {
1417
std::shared_ptr<Mutator> element = std::make_shared<Mutator>(rect);
1518
vector_.push_back(element);

flow/embedded_views.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,10 @@ class ExternalViewEmbedder {
248248
// Must be called on the UI thread.
249249
virtual SkCanvas* CompositeEmbeddedView(int view_id) = 0;
250250

251-
virtual bool SubmitFrame(GrContext* context);
251+
virtual bool SubmitFrame(GrContext* context, SkCanvas* background_canvas);
252+
253+
// This is called after submitting the embedder frame and the surface frame.
254+
virtual void FinishFrame();
252255

253256
FML_DISALLOW_COPY_AND_ASSIGN(ExternalViewEmbedder);
254257

flow/layers/picture_layer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void PictureLayer::Paint(PaintContext& context) const {
5959
return;
6060
}
6161
}
62-
context.leaf_nodes_canvas->drawPicture(picture());
62+
picture()->playback(context.leaf_nodes_canvas);
6363
}
6464

6565
} // namespace flutter

flow/layers/picture_layer_unittests.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,6 @@ TEST_F(PictureLayerTest, SimplePicture) {
9494
1, MockCanvas::SetMatrixData{RasterCache::GetIntegralTransCTM(
9595
layer_offset_matrix)}},
9696
#endif
97-
MockCanvas::DrawCall{
98-
1, MockCanvas::DrawPictureData{mock_picture->serialize(), SkPaint(),
99-
SkMatrix()}},
10097
MockCanvas::DrawCall{1, MockCanvas::RestoreData{0}}});
10198
EXPECT_EQ(mock_canvas().draw_calls(), expected_draw_calls);
10299
}

shell/common/rasterizer.cc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,9 +342,17 @@ RasterStatus Rasterizer::DrawToSurface(flutter::LayerTree& layer_tree) {
342342
if (raster_status == RasterStatus::kFailed) {
343343
return raster_status;
344344
}
345-
frame->Submit();
346345
if (external_view_embedder != nullptr) {
347-
external_view_embedder->SubmitFrame(surface_->GetContext());
346+
external_view_embedder->SubmitFrame(surface_->GetContext(),
347+
root_surface_canvas);
348+
// The external view embedder may mutate the root surface canvas while
349+
// submitting the frame.
350+
// Therefore, submit the final frame after asking the external view
351+
// embedder to submit the frame.
352+
frame->Submit();
353+
external_view_embedder->FinishFrame();
354+
} else {
355+
frame->Submit();
348356
}
349357

350358
FireNextFrameCallbackIfPresent();

shell/platform/darwin/ios/framework/Source/FlutterOverlayView.mm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ - (instancetype)init {
3939
if (self) {
4040
self.layer.opaque = NO;
4141
self.userInteractionEnabled = NO;
42+
self.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
4243
}
4344

4445
return self;

0 commit comments

Comments
 (0)