Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 4bc45a3

Browse files
kjlubickharryterkelsen
authored andcommitted
Migrate GrMipmapped->skgpu::Mipmapped (#45881)
Skia's Graphite and Ganesh backend coalesced two enums regarding mipmaps into one and deprecated the public Ganesh version. This migrates Flutter to use the preferred type. No functional changes expected. See also https://skia-review.googlesource.com/c/skia/+/753567 ## 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 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 [test-exempt]: https://github.com/flutter/flutter/wiki/Tree-hygiene#tests [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
1 parent 5497f66 commit 4bc45a3

File tree

8 files changed

+23
-15
lines changed

8 files changed

+23
-15
lines changed

lib/web_ui/skwasm/image.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "third_party/skia/include/core/SkImage.h"
1313
#include "third_party/skia/include/core/SkImageInfo.h"
1414
#include "third_party/skia/include/core/SkPicture.h"
15+
#include "third_party/skia/include/gpu/GpuTypes.h"
1516
#include "third_party/skia/include/gpu/GrBackendSurface.h"
1617
#include "third_party/skia/include/gpu/GrDirectContext.h"
1718
#include "third_party/skia/include/gpu/ganesh/GrExternalTextureGenerator.h"
@@ -90,7 +91,7 @@ class TextureSourceImageGenerator : public GrExternalTextureGenerator {
9091

9192
std::unique_ptr<GrExternalTexture> generateExternalTexture(
9293
GrRecordingContext* context,
93-
GrMipMapped mipmapped) override {
94+
skgpu::Mipmapped mipmapped) override {
9495
GrGLTextureInfo glInfo;
9596
glInfo.fID = skwasm_createGlTextureFromTextureSource(
9697
_textureSourceWrapper->getTextureSource(), fInfo.width(),

shell/common/rasterizer.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "third_party/skia/include/core/SkSize.h"
2828
#include "third_party/skia/include/core/SkSurface.h"
2929
#include "third_party/skia/include/encode/SkPngEncoder.h"
30+
#include "third_party/skia/include/gpu/GpuTypes.h"
3031
#include "third_party/skia/include/gpu/GrBackendSurface.h"
3132
#include "third_party/skia/include/gpu/GrDirectContext.h"
3233
#include "third_party/skia/include/gpu/GrTypes.h"
@@ -346,7 +347,7 @@ std::unique_ptr<Rasterizer::GpuImageResult> Rasterizer::MakeSkiaGpuImage(
346347

347348
GrBackendTexture texture = context->createBackendTexture(
348349
image_info.width(), image_info.height(), image_info.colorType(),
349-
GrMipmapped::kNo, GrRenderable::kYes);
350+
skgpu::Mipmapped::kNo, GrRenderable::kYes);
350351
if (!texture.isValid()) {
351352
result = std::make_unique<SnapshotDelegate::GpuImageResult>(
352353
GrBackendTexture(), nullptr, nullptr,

shell/gpu/gpu_surface_metal_skia.mm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "third_party/skia/include/core/SkSize.h"
2525
#include "third_party/skia/include/core/SkSurface.h"
2626
#include "third_party/skia/include/core/SkSurfaceProps.h"
27+
#include "third_party/skia/include/gpu/GpuTypes.h"
2728
#include "third_party/skia/include/gpu/GrBackendSurface.h"
2829
#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
2930
#include "third_party/skia/include/ports/SkCFObject.h"
@@ -44,7 +45,7 @@
4445
SkSurface::ReleaseContext release_context) {
4546
GrMtlTextureInfo info;
4647
info.fTexture.reset([texture retain]);
47-
GrBackendTexture backend_texture(texture.width, texture.height, GrMipmapped::kNo, info);
48+
GrBackendTexture backend_texture(texture.width, texture.height, skgpu::Mipmapped::kNo, info);
4849
return SkSurfaces::WrapBackendTexture(
4950
context, backend_texture, origin, static_cast<int>(sample_cnt), color_type,
5051
std::move(color_space), props, release_proc, release_context);

shell/platform/darwin/graphics/FlutterDarwinExternalTextureMetal.mm

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "third_party/skia/include/core/SkColorSpace.h"
1111
#include "third_party/skia/include/core/SkImage.h"
1212
#include "third_party/skia/include/core/SkYUVAInfo.h"
13+
#include "third_party/skia/include/gpu/GpuTypes.h"
1314
#include "third_party/skia/include/gpu/GrBackendSurface.h"
1415
#include "third_party/skia/include/gpu/GrDirectContext.h"
1516
#include "third_party/skia/include/gpu/GrYUVABackendTextures.h"
@@ -295,15 +296,15 @@ @implementation FlutterDarwinExternalTextureSkImageWrapper
295296
GrBackendTexture skiaBackendTextures[2];
296297
skiaBackendTextures[0] = GrBackendTexture(/*width=*/width,
297298
/*height=*/height,
298-
/*mipMapped=*/GrMipMapped::kNo,
299+
/*mipMapped=*/skgpu::Mipmapped::kNo,
299300
/*textureInfo=*/ySkiaTextureInfo);
300301

301302
GrMtlTextureInfo uvSkiaTextureInfo;
302303
uvSkiaTextureInfo.fTexture = sk_cfp<const void*>{(__bridge_retained const void*)uvTex};
303304

304305
skiaBackendTextures[1] = GrBackendTexture(/*width=*/width,
305306
/*height=*/height,
306-
/*mipMapped=*/GrMipMapped::kNo,
307+
/*mipMapped=*/skgpu::Mipmapped::kNo,
307308
/*textureInfo=*/uvSkiaTextureInfo);
308309
SkYUVAInfo yuvaInfo(skiaBackendTextures[0].dimensions(), SkYUVAInfo::PlaneConfig::kY_UV,
309310
SkYUVAInfo::Subsampling::k444, colorSpace);
@@ -324,7 +325,7 @@ GrYUVABackendTextures yuvaBackendTextures(yuvaInfo, skiaBackendTextures,
324325

325326
GrBackendTexture skiaBackendTexture(/*width=*/width,
326327
/*height=*/height,
327-
/*mipMapped=*/GrMipMapped ::kNo,
328+
/*mipMapped=*/skgpu::Mipmapped ::kNo,
328329
/*textureInfo=*/skiaTextureInfo);
329330

330331
return SkImages::BorrowTextureFrom(grContext, skiaBackendTexture, kTopLeft_GrSurfaceOrigin,

shell/platform/embedder/embedder.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "third_party/dart/runtime/bin/elf_loader.h"
2121
#include "third_party/dart/runtime/include/dart_native_api.h"
2222
#include "third_party/skia/include/core/SkSurface.h"
23+
#include "third_party/skia/include/gpu/GpuTypes.h"
2324
#include "third_party/skia/include/gpu/GrBackendSurface.h"
2425
#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
2526

@@ -924,10 +925,10 @@ static sk_sp<SkSurface> MakeSkSurfaceFromBackingStore(
924925
sk_cfp<FlutterMetalTextureHandle> mtl_texture;
925926
mtl_texture.retain(metal->texture.texture);
926927
texture_info.fTexture = mtl_texture;
927-
GrBackendTexture backend_texture(config.size.width, //
928-
config.size.height, //
929-
GrMipMapped::kNo, //
930-
texture_info //
928+
GrBackendTexture backend_texture(config.size.width, //
929+
config.size.height, //
930+
skgpu::Mipmapped::kNo, //
931+
texture_info //
931932
);
932933

933934
SkSurfaceProps surface_properties(0, kUnknown_SkPixelGeometry);

shell/platform/embedder/tests/embedder_metal_unittests.mm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "flutter/testing/testing.h"
2222

2323
#include "third_party/skia/include/core/SkSurface.h"
24+
#include "third_party/skia/include/gpu/GpuTypes.h"
2425
#include "third_party/skia/include/gpu/GrBackendSurface.h"
2526
#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
2627

@@ -63,8 +64,8 @@
6364
void* texture) {
6465
GrMtlTextureInfo info;
6566
info.fTexture.reset([(id<MTLTexture>)texture retain]);
66-
GrBackendTexture backend_texture(texture_size.width(), texture_size.height(), GrMipmapped::kNo,
67-
info);
67+
GrBackendTexture backend_texture(texture_size.width(), texture_size.height(),
68+
skgpu::Mipmapped::kNo, info);
6869

6970
return SkSurfaces::WrapBackendTexture(skia_context.get(), backend_texture,
7071
kTopLeft_GrSurfaceOrigin, 1, kBGRA_8888_SkColorType,

shell/platform/embedder/tests/embedder_test_backingstore_producer.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "third_party/skia/include/core/SkImageInfo.h"
1212
#include "third_party/skia/include/core/SkSize.h"
1313
#include "third_party/skia/include/core/SkSurface.h"
14+
#include "third_party/skia/include/gpu/GpuTypes.h"
1415
#include "third_party/skia/include/gpu/GrBackendSurface.h"
1516
#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
1617
#include "third_party/skia/include/gpu/ganesh/gl/GrGLBackendSurface.h"
@@ -281,7 +282,7 @@ bool EmbedderTestBackingStoreProducer::CreateMTLTexture(
281282
GrMtlTextureInfo skia_texture_info;
282283
skia_texture_info.fTexture.reset(SkCFSafeRetain(texture_info.texture));
283284
GrBackendTexture backend_texture(surface_size.width(), surface_size.height(),
284-
GrMipmapped::kNo, skia_texture_info);
285+
skgpu::Mipmapped::kNo, skia_texture_info);
285286

286287
sk_sp<SkSurface> surface = SkSurfaces::WrapBackendTexture(
287288
context_.get(), backend_texture, kTopLeft_GrSurfaceOrigin, 1,

testing/test_metal_surface_impl.mm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "third_party/skia/include/core/SkRefCnt.h"
1616
#include "third_party/skia/include/core/SkSize.h"
1717
#include "third_party/skia/include/core/SkSurface.h"
18+
#include "third_party/skia/include/gpu/GpuTypes.h"
1819
#include "third_party/skia/include/gpu/GrBackendSurface.h"
1920
#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
2021

@@ -26,8 +27,8 @@
2627

2728
GrMtlTextureInfo skia_texture_info;
2829
skia_texture_info.fTexture.reset([texture retain]);
29-
GrBackendTexture backend_texture(surface_size.width(), surface_size.height(), GrMipmapped::kNo,
30-
skia_texture_info);
30+
GrBackendTexture backend_texture(surface_size.width(), surface_size.height(),
31+
skgpu::Mipmapped::kNo, skia_texture_info);
3132

3233
sk_sp<SkSurface> surface = SkSurfaces::WrapBackendTexture(
3334
test_metal_context_.GetSkiaContext().get(), backend_texture, kTopLeft_GrSurfaceOrigin, 1,

0 commit comments

Comments
 (0)