Skip to content

Commit

Permalink
[Tizen] Revert "Make the context current before accessing GL in MakeS…
Browse files Browse the repository at this point in the history
…kiaGpuImage" (flutter-tizen#363)

This reverts commit c7894a6.
  • Loading branch information
swift-kim authored and xiaowei-guan committed May 31, 2024
1 parent 9911ac8 commit f50ea2a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 19 deletions.
4 changes: 0 additions & 4 deletions shell/common/fixtures/shell_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,6 @@ void scene_with_red_box() {
PlatformDispatcher.instance.scheduleFrame();
}

@pragma('vm:external-name', 'NativeOnBeforeToImageSync')
external void onBeforeToImageSync();


@pragma('vm:entry-point')
Future<void> toImageSync() async {
Expand All @@ -354,7 +351,6 @@ Future<void> toImageSync() async {
canvas.drawPaint(Paint()..color = const Color(0xFFAAAAAA));
final Picture picture = recorder.endRecording();

onBeforeToImageSync();
final Image image = picture.toImageSync(20, 25);
expect(image.width, 20);
expect(image.height, 25);
Expand Down
17 changes: 7 additions & 10 deletions shell/common/rasterizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -356,27 +356,24 @@ std::unique_ptr<Rasterizer::GpuImageResult> Rasterizer::MakeSkiaGpuImage(
TRACE_EVENT0("flutter", "Rasterizer::MakeGpuImage");
FML_DCHECK(display_list);

// TODO(dnfield): the Linux embedding is in a rough state right now and
// I can't seem to get the GPU path working on it.
// https://github.com/flutter/flutter/issues/108835
#if FML_OS_LINUX
return MakeBitmapImage(display_list, image_info);
#endif

std::unique_ptr<SnapshotDelegate::GpuImageResult> result;
delegate_.GetIsGpuDisabledSyncSwitch()->Execute(
fml::SyncSwitch::Handlers()
.SetIfTrue([&result, &image_info, &display_list] {
// TODO(dnfield): This isn't safe if display_list contains any GPU
// resources like an SkImage_gpu.
result = MakeBitmapImage(display_list, image_info);
})
.SetIfFalse([&result, &image_info, &display_list,
surface = surface_.get(),
gpu_image_behavior = gpu_image_behavior_] {
if (!surface ||
gpu_image_behavior == MakeGpuImageBehavior::kBitmap) {
// TODO(dnfield): This isn't safe if display_list contains any GPU
// resources like an SkImage_gpu.
result = MakeBitmapImage(display_list, image_info);
return;
}

auto context_switch = surface->MakeRenderContextCurrent();
if (!context_switch->GetResult()) {
result = MakeBitmapImage(display_list, image_info);
return;
}
Expand Down
5 changes: 0 additions & 5 deletions shell/common/shell_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4074,11 +4074,6 @@ TEST_F(ShellTest, PictureToImageSync) {
}),
});

AddNativeCallback("NativeOnBeforeToImageSync",
CREATE_NATIVE_ENTRY([&](auto args) {
// nop
}));

fml::CountDownLatch latch(2);
AddNativeCallback("NotifyNative", CREATE_NATIVE_ENTRY([&](auto args) {
// Teardown and set up rasterizer again.
Expand Down

0 comments on commit f50ea2a

Please sign in to comment.