Skip to content

Commit 81e1d5e

Browse files
authored
[skia] Add missing param to makeRasterImage calls (flutter#172122)
Skia's makeRasterImage takes a (now required) `GrDirectContext` param. This updates Flutter to provide something there - either nullptr or a context that seemed to be related. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
1 parent adca65f commit 81e1d5e

14 files changed

+20
-16
lines changed

engine/src/flutter/display_list/testing/dl_test_surface_provider.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ bool DlSurfaceProvider::Snapshot(std::string& filename) const {
4444
if (!image) {
4545
return false;
4646
}
47-
auto raster = image->makeRasterImage();
47+
auto raster = image->makeRasterImage(nullptr);
4848
if (!raster) {
4949
return false;
5050
}

engine/src/flutter/flow/layers/offscreen_surface.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static sk_sp<SkData> GetRasterData(const sk_sp<SkSurface>& offscreen_surface,
4747

4848
// Copy the GPU image snapshot into CPU memory.
4949
// TODO (https://github.com/flutter/flutter/issues/13498)
50-
auto cpu_snapshot = potentially_gpu_snapshot->makeRasterImage();
50+
auto cpu_snapshot = potentially_gpu_snapshot->makeRasterImage(nullptr);
5151
if (!cpu_snapshot) {
5252
FML_LOG(ERROR) << "Screenshot: unable to make raster image";
5353
return nullptr;

engine/src/flutter/lib/ui/painting/image_decoder_skia.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static sk_sp<SkImage> ResizeRasterImage(const sk_sp<SkImage>& image,
4141
}
4242

4343
if (image->dimensions() == resized_dimensions) {
44-
return image->makeRasterImage();
44+
return image->makeRasterImage(nullptr);
4545
}
4646

4747
const auto scaled_image_info =
@@ -92,7 +92,7 @@ static sk_sp<SkImage> ImageFromDecompressedData(
9292

9393
if (!target_width && !target_height) {
9494
// No resizing requested. Just rasterize the image.
95-
return image->makeRasterImage();
95+
return image->makeRasterImage(nullptr);
9696
}
9797

9898
return ResizeRasterImage(image, SkISize::Make(target_width, target_height),
@@ -110,7 +110,7 @@ sk_sp<SkImage> ImageDecoderSkia::ImageFromCompressedData(
110110
if (!descriptor->should_resize(target_width, target_height)) {
111111
// No resizing requested. Just decode & rasterize the image.
112112
sk_sp<SkImage> image = descriptor->image();
113-
return image ? image->makeRasterImage() : nullptr;
113+
return image ? image->makeRasterImage(nullptr) : nullptr;
114114
}
115115

116116
const SkISize source_dimensions = descriptor->image_info().dimensions();

engine/src/flutter/lib/ui/painting/image_encoding_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ sk_sp<SkImage> ConvertToRasterUsingResourceContext(
5353
return nullptr;
5454
}
5555

56-
return snapshot->makeRasterImage();
56+
return snapshot->makeRasterImage(resource_context.get());
5757
}
5858

5959
} // namespace flutter

engine/src/flutter/lib/ui/painting/image_encoding_skia.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ void ConvertImageToRasterSkia(
4545
return;
4646
}
4747

48-
if (sk_sp<SkImage> raster_image = image->makeRasterImage()) {
48+
if (sk_sp<SkImage> raster_image =
49+
image->makeRasterImage(resource_context.get())) {
4950
// The image can be converted to a raster image.
5051
encode_task(raster_image);
5152
return;

engine/src/flutter/shell/common/snapshot_controller_skia.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ sk_sp<SkImage> DrawSnapshot(
4242

4343
{
4444
TRACE_EVENT0("flutter", "DeviceHostTransfer");
45-
if (auto raster_image = device_snapshot->makeRasterImage()) {
45+
if (auto raster_image = device_snapshot->makeRasterImage(nullptr)) {
4646
return raster_image;
4747
}
4848
}

engine/src/flutter/shell/platform/embedder/tests/embedder_test_compositor_gl.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ bool EmbedderTestCompositorGL::UpdateOffscrenComposition(
130130
}
131131

132132
if (next_scene_callback_) {
133-
auto last_composition_snapshot = last_composition_->makeRasterImage();
133+
auto last_composition_snapshot =
134+
last_composition_->makeRasterImage(nullptr);
134135
FML_CHECK(last_composition_snapshot);
135136
auto callback = next_scene_callback_;
136137
next_scene_callback_ = nullptr;

engine/src/flutter/shell/platform/embedder/tests/embedder_test_compositor_metal.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
}
112112

113113
if (next_scene_callback_) {
114-
auto last_composition_snapshot = last_composition_->makeRasterImage();
114+
auto last_composition_snapshot = last_composition_->makeRasterImage(nullptr);
115115
FML_CHECK(last_composition_snapshot);
116116
auto callback = next_scene_callback_;
117117
next_scene_callback_ = nullptr;

engine/src/flutter/shell/platform/embedder/tests/embedder_test_compositor_software.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ bool EmbedderTestCompositorSoftware::UpdateOffscrenComposition(
107107
}
108108

109109
if (next_scene_callback_) {
110-
auto last_composition_snapshot = last_composition_->makeRasterImage();
110+
auto last_composition_snapshot =
111+
last_composition_->makeRasterImage(nullptr);
111112
FML_CHECK(last_composition_snapshot);
112113
auto callback = next_scene_callback_;
113114
next_scene_callback_ = nullptr;

engine/src/flutter/shell/platform/embedder/tests/embedder_test_compositor_vulkan.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ bool EmbedderTestCompositorVulkan::UpdateOffscrenComposition(
119119
}
120120

121121
if (next_scene_callback_) {
122-
auto last_composition_snapshot = last_composition_->makeRasterImage();
122+
auto last_composition_snapshot =
123+
last_composition_->makeRasterImage(nullptr);
123124
FML_CHECK(last_composition_snapshot);
124125
auto callback = next_scene_callback_;
125126
next_scene_callback_ = nullptr;

0 commit comments

Comments
 (0)