From cd12d3417cb21edb7b09901df791882f48df51eb Mon Sep 17 00:00:00 2001 From: Matej Knopp Date: Thu, 22 Jun 2023 10:16:41 +0200 Subject: [PATCH] Rename num_rects -> rects_count --- .../framework/Source/FlutterCompositor.mm | 2 +- shell/platform/embedder/embedder.h | 2 +- shell/platform/embedder/embedder_layers.cc | 2 +- .../embedder/tests/embedder_assertions.h | 4 +- .../embedder/tests/embedder_gl_unittests.cc | 62 +++++++++---------- .../tests/embedder_metal_unittests.mm | 10 +-- .../embedder/tests/embedder_unittests.cc | 14 ++--- 7 files changed, 48 insertions(+), 48 deletions(-) diff --git a/shell/platform/darwin/macos/framework/Source/FlutterCompositor.mm b/shell/platform/darwin/macos/framework/Source/FlutterCompositor.mm index 0065494114d6c..114b8f2c8800d 100644 --- a/shell/platform/darwin/macos/framework/Source/FlutterCompositor.mm +++ b/shell/platform/darwin/macos/framework/Source/FlutterCompositor.mm @@ -61,7 +61,7 @@ if (present_info != nullptr && present_info->paint_region != nullptr) { auto paint_region = present_info->paint_region; info.paintRegion = std::vector( - paint_region->rects, paint_region->rects + paint_region->num_rects); + paint_region->rects, paint_region->rects + paint_region->rects_count); } [surfaces addObject:info]; } diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index 4796a72158460..cb15284e1772e 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -1572,7 +1572,7 @@ typedef struct { /// The size of this struct. Must be sizeof(FlutterRegion). size_t struct_size; /// Number of rectangles in the region. - size_t num_rects; + size_t rects_count; /// The rectangles that make up the region. FlutterRect* rects; } FlutterRegion; diff --git a/shell/platform/embedder/embedder_layers.cc b/shell/platform/embedder/embedder_layers.cc index 40835ceadbcdf..2b1035908550c 100644 --- a/shell/platform/embedder/embedder_layers.cc +++ b/shell/platform/embedder/embedder_layers.cc @@ -54,7 +54,7 @@ void EmbedderLayers::PushBackingStoreLayer( auto paint_region = std::make_unique(); paint_region->struct_size = sizeof(FlutterRegion); paint_region->rects = paint_region_rects->data(); - paint_region->num_rects = paint_region_rects->size(); + paint_region->rects_count = paint_region_rects->size(); rects_referenced_.push_back(std::move(paint_region_rects)); auto present_info = std::make_unique(); diff --git a/shell/platform/embedder/tests/embedder_assertions.h b/shell/platform/embedder/tests/embedder_assertions.h index fce27c4fbeb4b..79c3490e8af7d 100644 --- a/shell/platform/embedder/tests/embedder_assertions.h +++ b/shell/platform/embedder/tests/embedder_assertions.h @@ -117,8 +117,8 @@ inline bool operator==(const FlutterSoftwareBackingStore2& a, } inline bool operator==(const FlutterRegion& a, const FlutterRegion& b) { - if (a.struct_size == b.struct_size && a.num_rects == b.num_rects) { - for (size_t i = 0; i < a.num_rects; i++) { + if (a.struct_size == b.struct_size && a.rects_count == b.rects_count) { + for (size_t i = 0; i < a.rects_count; i++) { if (!(a.rects[i] == b.rects[i])) { return false; } diff --git a/shell/platform/embedder/tests/embedder_gl_unittests.cc b/shell/platform/embedder/tests/embedder_gl_unittests.cc index 381bc4836a009..d233f836d9a74 100644 --- a/shell/platform/embedder/tests/embedder_gl_unittests.cc +++ b/shell/platform/embedder/tests/embedder_gl_unittests.cc @@ -108,7 +108,7 @@ TEST_F(EmbedderTest, CompositorMustBeAbleToRenderToOpenGLFramebuffer) { }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -154,7 +154,7 @@ TEST_F(EmbedderTest, CompositorMustBeAbleToRenderToOpenGLFramebuffer) { }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -229,7 +229,7 @@ TEST_F(EmbedderTest, RasterCacheDisabledWithPlatformViews) { }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -275,7 +275,7 @@ TEST_F(EmbedderTest, RasterCacheDisabledWithPlatformViews) { }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -361,7 +361,7 @@ TEST_F(EmbedderTest, RasterCacheEnabled) { }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -444,7 +444,7 @@ TEST_F(EmbedderTest, CompositorMustBeAbleToRenderToOpenGLTexture) { }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -490,7 +490,7 @@ TEST_F(EmbedderTest, CompositorMustBeAbleToRenderToOpenGLTexture) { }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -566,7 +566,7 @@ TEST_F(EmbedderTest, CompositorMustBeAbleToRenderToSoftwareBuffer) { }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -611,7 +611,7 @@ TEST_F(EmbedderTest, CompositorMustBeAbleToRenderToSoftwareBuffer) { }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -687,7 +687,7 @@ TEST_F(EmbedderTest, CompositorMustBeAbleToRenderKnownScene) { }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -734,7 +734,7 @@ TEST_F(EmbedderTest, CompositorMustBeAbleToRenderKnownScene) { }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -781,7 +781,7 @@ TEST_F(EmbedderTest, CompositorMustBeAbleToRenderKnownScene) { }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -912,7 +912,7 @@ TEST_F(EmbedderTest, CustomCompositorMustWorkWithCustomTaskRunner) { }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -941,7 +941,7 @@ TEST_F(EmbedderTest, CustomCompositorMustWorkWithCustomTaskRunner) { }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -972,7 +972,7 @@ TEST_F(EmbedderTest, CustomCompositorMustWorkWithCustomTaskRunner) { }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -1068,7 +1068,7 @@ TEST_F(EmbedderTest, CompositorMustBeAbleToRenderWithRootLayerOnly) { }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -1149,7 +1149,7 @@ TEST_F(EmbedderTest, CompositorMustBeAbleToRenderWithPlatformLayerOnBottom) { }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -1283,7 +1283,7 @@ TEST_F(EmbedderTest, }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -1330,7 +1330,7 @@ TEST_F(EmbedderTest, }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -1377,7 +1377,7 @@ TEST_F(EmbedderTest, }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -1672,7 +1672,7 @@ TEST_P(EmbedderTestMultiBackend, }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -1718,7 +1718,7 @@ TEST_P(EmbedderTestMultiBackend, }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -1813,7 +1813,7 @@ TEST_F(EmbedderTest, CanRenderGradientWithCompositorOnNonRootLayerWithXform) { }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -1860,7 +1860,7 @@ TEST_F(EmbedderTest, CanRenderGradientWithCompositorOnNonRootLayerWithXform) { }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -2184,7 +2184,7 @@ TEST_P(EmbedderTestMultiBackend, }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -2230,7 +2230,7 @@ TEST_P(EmbedderTestMultiBackend, }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -2307,7 +2307,7 @@ TEST_F( }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -2354,7 +2354,7 @@ TEST_F( }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -2504,7 +2504,7 @@ TEST_P(EmbedderTestMultiBackend, PlatformViewMutatorsAreValid) { }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -2614,7 +2614,7 @@ TEST_F(EmbedderTest, PlatformViewMutatorsAreValidWithPixelRatio) { }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -2730,7 +2730,7 @@ TEST_F(EmbedderTest, }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { diff --git a/shell/platform/embedder/tests/embedder_metal_unittests.mm b/shell/platform/embedder/tests/embedder_metal_unittests.mm index 2acdb9749d58f..f3666d9fee4c4 100644 --- a/shell/platform/embedder/tests/embedder_metal_unittests.mm +++ b/shell/platform/embedder/tests/embedder_metal_unittests.mm @@ -151,7 +151,7 @@ GrBackendTexture backend_texture(texture_size.width(), texture_size.height(), Gr }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -196,7 +196,7 @@ GrBackendTexture backend_texture(texture_size.width(), texture_size.height(), Gr }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -339,7 +339,7 @@ GrBackendTexture backend_texture(texture_size.width(), texture_size.height(), Gr }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -385,7 +385,7 @@ GrBackendTexture backend_texture(texture_size.width(), texture_size.height(), Gr }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -431,7 +431,7 @@ GrBackendTexture backend_texture(texture_size.width(), texture_size.height(), Gr }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { diff --git a/shell/platform/embedder/tests/embedder_unittests.cc b/shell/platform/embedder/tests/embedder_unittests.cc index d3ab68244562f..17a57be9b42c3 100644 --- a/shell/platform/embedder/tests/embedder_unittests.cc +++ b/shell/platform/embedder/tests/embedder_unittests.cc @@ -676,7 +676,7 @@ TEST_F(EmbedderTest, }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -723,7 +723,7 @@ TEST_F(EmbedderTest, }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -770,7 +770,7 @@ TEST_F(EmbedderTest, }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -894,7 +894,7 @@ TEST_F(EmbedderTest, NoLayerCreatedForTransparentOverlayOnTopOfPlatformLayer) { }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -1030,7 +1030,7 @@ TEST_F(EmbedderTest, NoLayerCreatedForNoOverlayOnTopOfPlatformLayer) { }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -1310,7 +1310,7 @@ TEST_F(EmbedderTest, VerifyB143464703WithSoftwareBackend) { }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = { @@ -1356,7 +1356,7 @@ TEST_F(EmbedderTest, VerifyB143464703WithSoftwareBackend) { }; FlutterRegion paint_region = { .struct_size = sizeof(FlutterRegion), - .num_rects = 1, + .rects_count = 1, .rects = paint_region_rects, }; FlutterBackingStorePresentInfo present_info = {