From 519b237ee64eb3c17de897501059b6fb176fa6e0 Mon Sep 17 00:00:00 2001 From: Kevin Lubick Date: Thu, 1 Jun 2023 14:08:46 -0400 Subject: [PATCH] Clean up Skia includes around SkSurfaceCharacterization (#42485) While contemplating a change to SkSurfaceCharacterization, I was curious who was using this. Flutter #included it, but never actually seemed to use it. Thus, I removed includes of it and other unnecessary #includes in those same files, as well as addressing follow-on compile errors. ## 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]. [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 --- flow/layer_snapshot_store.h | 5 ----- flow/layers/offscreen_surface.cc | 11 ++++------- flow/testing/mock_raster_cache.h | 4 +++- shell/common/rasterizer.cc | 6 +++++- shell/common/rasterizer_unittests.cc | 1 + shell/platform/embedder/pixel_formats.cc | 4 ++++ 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/flow/layer_snapshot_store.h b/flow/layer_snapshot_store.h index 2406335605cc5..2c38c859f4809 100644 --- a/flow/layer_snapshot_store.h +++ b/flow/layer_snapshot_store.h @@ -11,13 +11,8 @@ #include "flutter/fml/time/time_delta.h" #include "third_party/skia/include/core/SkData.h" -#include "third_party/skia/include/core/SkPictureRecorder.h" #include "third_party/skia/include/core/SkRect.h" #include "third_party/skia/include/core/SkRefCnt.h" -#include "third_party/skia/include/core/SkSerialProcs.h" -#include "third_party/skia/include/core/SkSurface.h" -#include "third_party/skia/include/core/SkSurfaceCharacterization.h" -#include "third_party/skia/include/utils/SkBase64.h" namespace flutter { diff --git a/flow/layers/offscreen_surface.cc b/flow/layers/offscreen_surface.cc index 36a722ecd80a8..58046292d282a 100644 --- a/flow/layers/offscreen_surface.cc +++ b/flow/layers/offscreen_surface.cc @@ -5,15 +5,13 @@ #include "flutter/flow/layers/offscreen_surface.h" #include "third_party/skia/include/core/SkColorSpace.h" +#include "third_party/skia/include/core/SkData.h" #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkImageInfo.h" -#include "third_party/skia/include/core/SkPictureRecorder.h" #include "third_party/skia/include/core/SkPixmap.h" -#include "third_party/skia/include/core/SkSerialProcs.h" -#include "third_party/skia/include/core/SkSurfaceCharacterization.h" #include "third_party/skia/include/encode/SkPngEncoder.h" +#include "third_party/skia/include/gpu/GrDirectContext.h" #include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h" -#include "third_party/skia/include/utils/SkBase64.h" namespace flutter { @@ -24,9 +22,8 @@ static sk_sp CreateSnapshotSurface(GrDirectContext* surface_context, if (surface_context) { // There is a rendering surface that may contain textures that are going to // be referenced in the layer tree about to be drawn. - return SkSurfaces::RenderTarget( - reinterpret_cast(surface_context), - skgpu::Budgeted::kNo, image_info); + return SkSurfaces::RenderTarget(surface_context, skgpu::Budgeted::kNo, + image_info); } // There is no rendering surface, assume no GPU textures are present and diff --git a/flow/testing/mock_raster_cache.h b/flow/testing/mock_raster_cache.h index 392914f5b26ef..4f625ad6df938 100644 --- a/flow/testing/mock_raster_cache.h +++ b/flow/testing/mock_raster_cache.h @@ -11,7 +11,9 @@ #include "flutter/flow/raster_cache_item.h" #include "flutter/flow/testing/mock_layer.h" #include "flutter/testing/mock_canvas.h" -#include "third_party/skia/include/core/SkImage.h" +#include "third_party/skia/include/core/SkColorSpace.h" +#include "third_party/skia/include/core/SkRefCnt.h" +#include "third_party/skia/include/core/SkSize.h" namespace flutter { namespace testing { diff --git a/shell/common/rasterizer.cc b/shell/common/rasterizer.cc index 4f2e25106c1aa..145ae60bb2833 100644 --- a/shell/common/rasterizer.cc +++ b/shell/common/rasterizer.cc @@ -15,13 +15,17 @@ #include "flutter/fml/time/time_point.h" #include "flutter/shell/common/serialization_callbacks.h" #include "fml/make_copyable.h" +#include "third_party/skia/include/core/SkColorSpace.h" +#include "third_party/skia/include/core/SkData.h" +#include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkImageInfo.h" #include "third_party/skia/include/core/SkMatrix.h" #include "third_party/skia/include/core/SkPictureRecorder.h" +#include "third_party/skia/include/core/SkRect.h" #include "third_party/skia/include/core/SkSerialProcs.h" #include "third_party/skia/include/core/SkSize.h" #include "third_party/skia/include/core/SkSurface.h" -#include "third_party/skia/include/core/SkSurfaceCharacterization.h" +#include "third_party/skia/include/gpu/GrDirectContext.h" #include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h" #include "third_party/skia/include/utils/SkBase64.h" diff --git a/shell/common/rasterizer_unittests.cc b/shell/common/rasterizer_unittests.cc index 89ae3c5400180..53de96c86bd4e 100644 --- a/shell/common/rasterizer_unittests.cc +++ b/shell/common/rasterizer_unittests.cc @@ -15,6 +15,7 @@ #include "flutter/shell/common/thread_host.h" #include "flutter/testing/testing.h" +#include "third_party/skia/include/core/SkColorSpace.h" #include "third_party/skia/include/core/SkSurface.h" #include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h" diff --git a/shell/platform/embedder/pixel_formats.cc b/shell/platform/embedder/pixel_formats.cc index 79acbb2e72833..611ac5624c231 100644 --- a/shell/platform/embedder/pixel_formats.cc +++ b/shell/platform/embedder/pixel_formats.cc @@ -5,6 +5,10 @@ #include "flutter/shell/platform/embedder/pixel_formats.h" #include "flutter/shell/platform/embedder/embedder.h" +#include "third_party/skia/include/core/SkColorSpace.h" +#include "third_party/skia/include/core/SkColorType.h" +#include "third_party/skia/include/core/SkImageInfo.h" + std::optional getSkColorType(FlutterSoftwarePixelFormat pixfmt) { switch (pixfmt) { case kFlutterSoftwarePixelFormatGray8: