Move SkSurface::MakeNull to SkSurfaces::Null (flutter/engine#42158)

In https://skia-review.googlesource.com/c/skia/+/696537 (and earlier in
https://skia-review.googlesource.com/c/skia/+/687639), Skia moved all
SkSurface factories. This changes the last calls of the old static
methods to the methods in the `SkSurfaces` namespace

## 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] and the [C++,
Objective-C, Java style guides].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making or feature I am
adding, or Hixie said the PR is test-exempt. See [testing the engine]
for instructions on writing and running engine tests.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] 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/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
This commit is contained in:
Kevin Lubick
2023-05-20 10:11:44 -04:00
committed by GitHub
parent a98b701976
commit 7751d1c5eb
8 changed files with 25 additions and 22 deletions

View File

@@ -10,7 +10,8 @@ namespace flutter {
namespace testing {
sk_sp<DlImage> MockTexture::MakeTestTexture(int w, int h, int checker_size) {
sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(w, h);
sk_sp<SkSurface> surface =
SkSurfaces::Raster(SkImageInfo::MakeN32Premul(w, h));
SkCanvas* canvas = surface->getCanvas();
SkPaint p0, p1;
p0.setStyle(SkPaint::kFill_Style);

View File

@@ -10,6 +10,7 @@
#include "flutter/fml/macros.h"
#include "third_party/skia/include/core/SkSize.h"
#include "third_party/skia/include/core/SkSurface.h"
#include "third_party/skia/include/gpu/mtl/GrMtlTypes.h"
namespace flutter {

View File

@@ -13,6 +13,7 @@
#include "flutter/impeller/aiks/aiks_context.h"
#include "flutter/impeller/renderer/renderer.h"
#include "flutter/shell/gpu/gpu_surface_metal_delegate.h"
#include "third_party/skia/include/gpu/mtl/GrMtlTypes.h"
namespace flutter {

View File

@@ -266,13 +266,13 @@ TEST(AndroidExternalViewEmbedder, SubmitFrame) {
auto surface_factory = std::make_shared<TestAndroidSurfaceFactory>(
[gr_context, window, frame_size, framebuffer_info]() {
auto surface_frame_1 = std::make_unique<SurfaceFrame>(
SkSurface::MakeNull(1000, 1000), framebuffer_info,
SkSurfaces::Null(1000, 1000), framebuffer_info,
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) {
return true;
},
/*frame_size=*/SkISize::Make(800, 600));
auto surface_frame_2 = std::make_unique<SurfaceFrame>(
SkSurface::MakeNull(1000, 1000), framebuffer_info,
SkSurfaces::Null(1000, 1000), framebuffer_info,
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) {
return true;
},
@@ -303,7 +303,7 @@ TEST(AndroidExternalViewEmbedder, SubmitFrame) {
{
auto did_submit_frame = false;
auto surface_frame = std::make_unique<SurfaceFrame>(
SkSurface::MakeNull(1000, 1000), framebuffer_info,
SkSurfaces::Null(1000, 1000), framebuffer_info,
[&did_submit_frame](const SurfaceFrame& surface_frame,
DlCanvas* canvas) mutable {
if (canvas != nullptr) {
@@ -371,7 +371,7 @@ TEST(AndroidExternalViewEmbedder, SubmitFrame) {
auto did_submit_frame = false;
auto surface_frame = std::make_unique<SurfaceFrame>(
SkSurface::MakeNull(1000, 1000), framebuffer_info,
SkSurfaces::Null(1000, 1000), framebuffer_info,
[&did_submit_frame](const SurfaceFrame& surface_frame,
DlCanvas* canvas) mutable {
if (canvas != nullptr) {
@@ -437,7 +437,7 @@ TEST(AndroidExternalViewEmbedder, SubmitFrame) {
auto did_submit_frame = false;
auto surface_frame = std::make_unique<SurfaceFrame>(
SkSurface::MakeNull(1000, 1000), framebuffer_info,
SkSurfaces::Null(1000, 1000), framebuffer_info,
[&did_submit_frame](const SurfaceFrame& surface_frame,
DlCanvas* canvas) mutable {
if (canvas != nullptr) {
@@ -473,7 +473,7 @@ TEST(AndroidExternalViewEmbedder, OverlayCoverTwoPlatformViews) {
auto surface_factory = std::make_shared<TestAndroidSurfaceFactory>(
[gr_context, window, frame_size, framebuffer_info]() {
auto surface_frame_1 = std::make_unique<SurfaceFrame>(
SkSurface::MakeNull(1000, 1000), framebuffer_info,
SkSurfaces::Null(1000, 1000), framebuffer_info,
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) {
return true;
},
@@ -547,7 +547,7 @@ TEST(AndroidExternalViewEmbedder, OverlayCoverTwoPlatformViews) {
.Times(1);
auto surface_frame = std::make_unique<SurfaceFrame>(
SkSurface::MakeNull(1000, 1000), framebuffer_info,
SkSurfaces::Null(1000, 1000), framebuffer_info,
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) mutable {
return true;
},
@@ -571,7 +571,7 @@ TEST(AndroidExternalViewEmbedder, SubmitFrameOverlayComposition) {
auto surface_factory = std::make_shared<TestAndroidSurfaceFactory>(
[gr_context, window, frame_size, framebuffer_info]() {
auto surface_frame_1 = std::make_unique<SurfaceFrame>(
SkSurface::MakeNull(1000, 1000), framebuffer_info,
SkSurfaces::Null(1000, 1000), framebuffer_info,
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) {
return true;
},
@@ -650,7 +650,7 @@ TEST(AndroidExternalViewEmbedder, SubmitFrameOverlayComposition) {
.Times(2);
auto surface_frame = std::make_unique<SurfaceFrame>(
SkSurface::MakeNull(1000, 1000), framebuffer_info,
SkSurfaces::Null(1000, 1000), framebuffer_info,
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) mutable {
return true;
},
@@ -674,7 +674,7 @@ TEST(AndroidExternalViewEmbedder, SubmitFramePlatformViewWithoutAnyOverlay) {
auto surface_factory = std::make_shared<TestAndroidSurfaceFactory>(
[gr_context, window, frame_size, framebuffer_info]() {
auto surface_frame_1 = std::make_unique<SurfaceFrame>(
SkSurface::MakeNull(1000, 1000), framebuffer_info,
SkSurfaces::Null(1000, 1000), framebuffer_info,
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) {
return true;
},
@@ -718,7 +718,7 @@ TEST(AndroidExternalViewEmbedder, SubmitFramePlatformViewWithoutAnyOverlay) {
EXPECT_CALL(*jni_mock, FlutterViewCreateOverlaySurface()).Times(0);
auto surface_frame = std::make_unique<SurfaceFrame>(
SkSurface::MakeNull(1000, 1000), framebuffer_info,
SkSurfaces::Null(1000, 1000), framebuffer_info,
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) mutable {
return true;
},
@@ -762,7 +762,7 @@ TEST(AndroidExternalViewEmbedder, DestroyOverlayLayersOnSizeChange) {
auto surface_factory = std::make_shared<TestAndroidSurfaceFactory>(
[gr_context, window, frame_size, framebuffer_info]() {
auto surface_frame_1 = std::make_unique<SurfaceFrame>(
SkSurface::MakeNull(1000, 1000), framebuffer_info,
SkSurfaces::Null(1000, 1000), framebuffer_info,
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) {
return true;
},
@@ -820,7 +820,7 @@ TEST(AndroidExternalViewEmbedder, DestroyOverlayLayersOnSizeChange) {
SurfaceFrame::FramebufferInfo framebuffer_info;
auto surface_frame = std::make_unique<SurfaceFrame>(
SkSurface::MakeNull(1000, 1000), framebuffer_info,
SkSurfaces::Null(1000, 1000), framebuffer_info,
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) {
return true;
},
@@ -850,7 +850,7 @@ TEST(AndroidExternalViewEmbedder, DoesNotDestroyOverlayLayersOnSizeChange) {
auto surface_factory = std::make_shared<TestAndroidSurfaceFactory>(
[gr_context, window, frame_size, framebuffer_info]() {
auto surface_frame_1 = std::make_unique<SurfaceFrame>(
SkSurface::MakeNull(1000, 1000), framebuffer_info,
SkSurfaces::Null(1000, 1000), framebuffer_info,
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) {
return true;
},
@@ -907,7 +907,7 @@ TEST(AndroidExternalViewEmbedder, DoesNotDestroyOverlayLayersOnSizeChange) {
FlutterViewDisplayOverlaySurface(0, 50, 50, 150, 150));
auto surface_frame = std::make_unique<SurfaceFrame>(
SkSurface::MakeNull(1000, 1000), framebuffer_info,
SkSurfaces::Null(1000, 1000), framebuffer_info,
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) {
return true;
},
@@ -975,7 +975,7 @@ TEST(AndroidExternalViewEmbedder, Teardown) {
[gr_context, window, frame_size]() {
SurfaceFrame::FramebufferInfo framebuffer_info;
auto surface_frame_1 = std::make_unique<SurfaceFrame>(
SkSurface::MakeNull(1000, 1000), framebuffer_info,
SkSurfaces::Null(1000, 1000), framebuffer_info,
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) {
return true;
},
@@ -1020,7 +1020,7 @@ TEST(AndroidExternalViewEmbedder, Teardown) {
SurfaceFrame::FramebufferInfo framebuffer_info;
auto surface_frame = std::make_unique<SurfaceFrame>(
SkSurface::MakeNull(1000, 1000), framebuffer_info,
SkSurfaces::Null(1000, 1000), framebuffer_info,
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
embedder->SubmitFrame(gr_context.get(), std::move(surface_frame));

View File

@@ -2945,7 +2945,7 @@ fml::RefPtr<fml::TaskRunner> CreateNewThread(std::string name) {
// SKSurface is required if the root FlutterView is present.
const SkImageInfo image_info = SkImageInfo::MakeN32Premul(1000, 1000);
sk_sp<SkSurface> mock_sk_surface = SkSurface::MakeRaster(image_info);
sk_sp<SkSurface> mock_sk_surface = SkSurfaces::Raster(image_info);
flutter::SurfaceFrame::FramebufferInfo framebuffer_info;
auto mock_surface = std::make_unique<flutter::SurfaceFrame>(
std::move(mock_sk_surface), framebuffer_info,

View File

@@ -746,7 +746,7 @@ static sk_sp<SkSurface> MakeSkSurfaceFromBackingStore(
kN32_SkColorType, // color type
SkColorSpace::MakeSRGB(), // color space
&surface_properties, // surface properties
static_cast<SkSurface::RenderTargetReleaseProc>(
static_cast<SkSurfaces::RenderTargetReleaseProc>(
framebuffer->destruction_callback), // release proc
framebuffer->user_data // release context
);

View File

@@ -67,7 +67,7 @@ class FakeSurfaceProducerSurface : public SurfaceProducerSurface {
const SkISize& size)
: sysmem_token_request_(std::move(sysmem_token_request)),
buffer_import_token_(std::move(buffer_import_token)),
surface_(SkSurface::MakeNull(size.width(), size.height())) {
surface_(SkSurfaces::Null(size.width(), size.height())) {
zx_status_t acquire_status = zx::event::create(0, &acquire_fence_);
if (acquire_status != ZX_OK) {
FML_LOG(ERROR)

View File

@@ -60,7 +60,7 @@ class FakeSurfaceProducerSurface : public SurfaceProducerSurface {
const SkISize& size,
uint32_t buffer_id)
: session_(session),
surface_(SkSurface::MakeNull(size.width(), size.height())),
surface_(SkSurfaces::Null(size.width(), size.height())),
buffer_id_(buffer_id) {
FML_CHECK(session_);
FML_CHECK(buffer_id_ != 0);