Skip to content

Commit 7e21dbd

Browse files
swift-kimJSUYA
authored andcommitted
[Tizen] Revert "Make the context current before accessing GL in MakeSkiaGpuImage" (#363)
This reverts commit c7894a6.
1 parent 2f51863 commit 7e21dbd

File tree

3 files changed

+28
-18
lines changed

3 files changed

+28
-18
lines changed

shell/common/fixtures/shell_test.dart

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,27 @@ void frameCallback(
334334
}
335335
}
336336

337-
@pragma('vm:external-name', 'NativeOnBeforeToImageSync')
338-
external void onBeforeToImageSync();
337+
Picture CreateRedBox(Size size) {
338+
Paint paint = Paint()
339+
..color = Color.fromARGB(255, 255, 0, 0)
340+
..style = PaintingStyle.fill;
341+
PictureRecorder baseRecorder = PictureRecorder();
342+
Canvas canvas = Canvas(baseRecorder);
343+
canvas.drawRect(Rect.fromLTRB(0.0, 0.0, size.width, size.height), paint);
344+
return baseRecorder.endRecording();
345+
}
346+
347+
@pragma('vm:entry-point')
348+
void scene_with_red_box() {
349+
PlatformDispatcher.instance.onBeginFrame = (Duration duration) {
350+
SceneBuilder builder = SceneBuilder();
351+
builder.pushOffset(0.0, 0.0);
352+
builder.addPicture(Offset(0.0, 0.0), CreateRedBox(Size(2.0, 2.0)));
353+
builder.pop();
354+
PlatformDispatcher.instance.views.first.render(builder.build());
355+
};
356+
PlatformDispatcher.instance.scheduleFrame();
357+
}
339358

340359
@pragma('vm:entry-point')
341360
Future<void> toImageSync() async {
@@ -344,7 +363,6 @@ Future<void> toImageSync() async {
344363
canvas.drawPaint(Paint()..color = const Color(0xFFAAAAAA));
345364
final Picture picture = recorder.endRecording();
346365

347-
onBeforeToImageSync();
348366
final Image image = picture.toImageSync(20, 25);
349367
expect(image.width, 20);
350368
expect(image.height, 25);

shell/common/rasterizer.cc

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -370,27 +370,24 @@ std::unique_ptr<Rasterizer::GpuImageResult> Rasterizer::MakeSkiaGpuImage(
370370
TRACE_EVENT0("flutter", "Rasterizer::MakeGpuImage");
371371
FML_DCHECK(display_list);
372372

373+
// TODO(dnfield): the Linux embedding is in a rough state right now and
374+
// I can't seem to get the GPU path working on it.
375+
// https://github.com/flutter/flutter/issues/108835
376+
#if FML_OS_LINUX
377+
return MakeBitmapImage(display_list, image_info);
378+
#endif
379+
373380
std::unique_ptr<SnapshotDelegate::GpuImageResult> result;
374381
delegate_.GetIsGpuDisabledSyncSwitch()->Execute(
375382
fml::SyncSwitch::Handlers()
376383
.SetIfTrue([&result, &image_info, &display_list] {
377-
// TODO(dnfield): This isn't safe if display_list contains any GPU
378-
// resources like an SkImage_gpu.
379384
result = MakeBitmapImage(display_list, image_info);
380385
})
381386
.SetIfFalse([&result, &image_info, &display_list,
382387
surface = surface_.get(),
383388
gpu_image_behavior = gpu_image_behavior_] {
384389
if (!surface ||
385390
gpu_image_behavior == MakeGpuImageBehavior::kBitmap) {
386-
// TODO(dnfield): This isn't safe if display_list contains any GPU
387-
// resources like an SkImage_gpu.
388-
result = MakeBitmapImage(display_list, image_info);
389-
return;
390-
}
391-
392-
auto context_switch = surface->MakeRenderContextCurrent();
393-
if (!context_switch->GetResult()) {
394391
result = MakeBitmapImage(display_list, image_info);
395392
return;
396393
}

shell/common/shell_unittests.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3961,11 +3961,6 @@ TEST_F(ShellTest, PictureToImageSync) {
39613961
}),
39623962
});
39633963

3964-
AddNativeCallback("NativeOnBeforeToImageSync",
3965-
CREATE_NATIVE_ENTRY([&](auto args) {
3966-
// nop
3967-
}));
3968-
39693964
fml::CountDownLatch latch(2);
39703965
AddNativeCallback("NotifyNative", CREATE_NATIVE_ENTRY([&](auto args) {
39713966
// Teardown and set up rasterizer again.

0 commit comments

Comments
 (0)