From bc8eb90c27ff49691e748e8161bf921e8e053992 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Tue, 29 Mar 2022 13:22:31 -0700 Subject: [PATCH] Use display list images. (flutter/engine#102) --- engine/src/flutter/impeller/BUILD.gn | 8 +++ .../flutter/impeller/aiks/aiks_unittests.cc | 2 +- engine/src/flutter/impeller/aiks/canvas.cc | 14 ++-- engine/src/flutter/impeller/aiks/canvas.h | 11 ++- .../impeller/aiks/paint_pass_delegate.cc | 2 +- .../flutter/impeller/display_list/BUILD.gn | 2 + .../display_list/display_list_dispatcher.cc | 70 +++++++++++++++---- .../display_list/display_list_dispatcher.h | 10 +-- .../display_list_image_impeller.cc | 53 ++++++++++++++ .../display_list_image_impeller.h | 43 ++++++++++++ .../display_list/display_list_unittests.cc | 9 +++ .../contents/filters/filter_contents.cc | 4 +- .../entity/contents/texture_contents.cc | 18 +++-- .../entity/contents/texture_contents.h | 14 ++-- engine/src/flutter/impeller/geometry/rect.h | 2 +- .../playground/imgui/imgui_impl_impeller.cc | 2 +- .../backend/metal/device_buffer_mtl.mm | 2 +- .../renderer/backend/metal/texture_mtl.mm | 2 +- .../impeller/renderer/texture_descriptor.h | 2 +- .../backends/skia/text_render_context_skia.cc | 2 +- 20 files changed, 227 insertions(+), 45 deletions(-) create mode 100644 engine/src/flutter/impeller/display_list/display_list_image_impeller.cc create mode 100644 engine/src/flutter/impeller/display_list/display_list_image_impeller.h diff --git a/engine/src/flutter/impeller/BUILD.gn b/engine/src/flutter/impeller/BUILD.gn index 8e372e58f6..c7ae5aa956 100644 --- a/engine/src/flutter/impeller/BUILD.gn +++ b/engine/src/flutter/impeller/BUILD.gn @@ -2,8 +2,16 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("tools/impeller.gni") + config("impeller_public_config") { include_dirs = [ ".." ] + + defines = [] + + if (impeller_supports_platform) { + defines += [ "IMPELLER_SUPPORTS_PLATFORM=1" ] + } } group("impeller") { diff --git a/engine/src/flutter/impeller/aiks/aiks_unittests.cc b/engine/src/flutter/impeller/aiks/aiks_unittests.cc index bc7bbb9f5c..e554bb30ac 100644 --- a/engine/src/flutter/impeller/aiks/aiks_unittests.cc +++ b/engine/src/flutter/impeller/aiks/aiks_unittests.cc @@ -67,7 +67,7 @@ TEST_F(AiksTest, CanRenderImageRect) { Canvas canvas; Paint paint; auto image = std::make_shared(CreateTextureForFixture("kalimba.jpg")); - auto source_rect = IRect::MakeSize(image->GetSize()); + auto source_rect = Rect::MakeSize(Size(image->GetSize())); // Render the bottom right quarter of the source image in a stretched rect. source_rect.size.width /= 2; diff --git a/engine/src/flutter/impeller/aiks/canvas.cc b/engine/src/flutter/impeller/aiks/canvas.cc index 550fd48b4a..a4afb84e09 100644 --- a/engine/src/flutter/impeller/aiks/canvas.cc +++ b/engine/src/flutter/impeller/aiks/canvas.cc @@ -200,22 +200,24 @@ void Canvas::DrawPicture(Picture picture) { void Canvas::DrawImage(std::shared_ptr image, Point offset, - Paint paint) { + Paint paint, + SamplerDescriptor sampler) { if (!image) { return; } - const auto source = IRect::MakeSize(image->GetSize()); + const auto source = Rect::MakeSize(Size(image->GetSize())); const auto dest = Rect::MakeXYWH(offset.x, offset.y, source.size.width, source.size.height); - DrawImageRect(image, source, dest, std::move(paint)); + DrawImageRect(image, source, dest, std::move(paint), std::move(sampler)); } void Canvas::DrawImageRect(std::shared_ptr image, - IRect source, + Rect source, Rect dest, - Paint paint) { + Paint paint, + SamplerDescriptor sampler) { if (!image || source.size.IsEmpty() || dest.size.IsEmpty()) { return; } @@ -229,10 +231,12 @@ void Canvas::DrawImageRect(std::shared_ptr image, auto contents = std::make_shared(); contents->SetTexture(image->GetTexture()); contents->SetSourceRect(source); + contents->SetSamplerDescriptor(std::move(sampler)); Entity entity; entity.SetPath(PathBuilder{}.AddRect(dest).TakePath()); entity.SetBlendMode(paint.blend_mode); + entity.SetStencilDepth(GetStencilDepth()); entity.SetContents(contents); entity.SetTransformation(GetCurrentTransformation()); diff --git a/engine/src/flutter/impeller/aiks/canvas.h b/engine/src/flutter/impeller/aiks/canvas.h index 295d3ea6fe..30eed9b6f0 100644 --- a/engine/src/flutter/impeller/aiks/canvas.h +++ b/engine/src/flutter/impeller/aiks/canvas.h @@ -18,6 +18,7 @@ #include "impeller/geometry/path.h" #include "impeller/geometry/point.h" #include "impeller/geometry/vector.h" +#include "impeller/renderer/sampler_descriptor.h" #include "impeller/typographer/glyph_atlas.h" #include "impeller/typographer/text_frame.h" @@ -65,12 +66,16 @@ class Canvas { void DrawCircle(Point center, Scalar radius, Paint paint); - void DrawImage(std::shared_ptr image, Point offset, Paint paint); + void DrawImage(std::shared_ptr image, + Point offset, + Paint paint, + SamplerDescriptor sampler = {}); void DrawImageRect(std::shared_ptr image, - IRect source, + Rect source, Rect dest, - Paint paint); + Paint paint, + SamplerDescriptor sampler = {}); void ClipPath( Path path, diff --git a/engine/src/flutter/impeller/aiks/paint_pass_delegate.cc b/engine/src/flutter/impeller/aiks/paint_pass_delegate.cc index f17ba65554..1e7b38cbd5 100644 --- a/engine/src/flutter/impeller/aiks/paint_pass_delegate.cc +++ b/engine/src/flutter/impeller/aiks/paint_pass_delegate.cc @@ -35,7 +35,7 @@ std::shared_ptr PaintPassDelegate::CreateContentsForSubpassTarget( std::shared_ptr target) { auto contents = std::make_shared(); contents->SetTexture(target); - contents->SetSourceRect(IRect::MakeSize(target->GetSize())); + contents->SetSourceRect(Rect::MakeSize(Size(target->GetSize()))); contents->SetOpacity(paint_.color.alpha); return contents; } diff --git a/engine/src/flutter/impeller/display_list/BUILD.gn b/engine/src/flutter/impeller/display_list/BUILD.gn index e3f51afb35..79d711c5a8 100644 --- a/engine/src/flutter/impeller/display_list/BUILD.gn +++ b/engine/src/flutter/impeller/display_list/BUILD.gn @@ -8,6 +8,8 @@ impeller_component("display_list") { sources = [ "display_list_dispatcher.cc", "display_list_dispatcher.h", + "display_list_image_impeller.cc", + "display_list_image_impeller.h", ] public_deps = [ diff --git a/engine/src/flutter/impeller/display_list/display_list_dispatcher.cc b/engine/src/flutter/impeller/display_list/display_list_dispatcher.cc index 6dba4f2fbd..c4d61dafc8 100644 --- a/engine/src/flutter/impeller/display_list/display_list_dispatcher.cc +++ b/engine/src/flutter/impeller/display_list/display_list_dispatcher.cc @@ -564,28 +564,71 @@ void DisplayListDispatcher::drawVertices(const sk_sp vertices, } // |flutter::Dispatcher| -void DisplayListDispatcher::drawImage(const sk_sp image, +void DisplayListDispatcher::drawImage(const sk_sp image, const SkPoint point, const SkSamplingOptions& sampling, bool render_with_attributes) { - // Needs https://github.com/flutter/flutter/issues/95434 - UNIMPLEMENTED; + if (!image) { + return; + } + + auto texture = image->impeller_texture(); + if (!texture) { + return; + } + + const auto size = texture->GetSize(); + const auto src = SkRect::MakeWH(size.width, size.height); + const auto dest = + SkRect::MakeXYWH(point.fX, point.fY, size.width, size.height); + + drawImageRect( + image, // image + src, // source rect + dest, // destination rect + sampling, // sampling options + render_with_attributes, // render with attributes + SkCanvas::SrcRectConstraint::kStrict_SrcRectConstraint // constraint + ); +} + +static impeller::SamplerDescriptor ToSamplerDescriptor( + const SkSamplingOptions& options) { + impeller::SamplerDescriptor desc; + switch (options.filter) { + case SkFilterMode::kNearest: + desc.min_filter = desc.mag_filter = impeller::MinMagFilter::kNearest; + desc.label = "Nearest Sampler"; + break; + case SkFilterMode::kLinear: + desc.min_filter = desc.mag_filter = impeller::MinMagFilter::kLinear; + desc.label = "Linear Sampler"; + break; + default: + break; + } + return desc; } // |flutter::Dispatcher| void DisplayListDispatcher::drawImageRect( - const sk_sp image, + const sk_sp image, const SkRect& src, const SkRect& dst, const SkSamplingOptions& sampling, bool render_with_attributes, SkCanvas::SrcRectConstraint constraint) { - // Needs https://github.com/flutter/flutter/issues/95434 - UNIMPLEMENTED; + canvas_.DrawImageRect( + std::make_shared(image->impeller_texture()), // image + ToRect(src), // source rect + ToRect(dst), // destination rect + paint_, // paint + ToSamplerDescriptor(sampling) // sampling + ); } // |flutter::Dispatcher| -void DisplayListDispatcher::drawImageNine(const sk_sp image, +void DisplayListDispatcher::drawImageNine(const sk_sp image, const SkIRect& center, const SkRect& dst, SkFilterMode filter, @@ -595,17 +638,18 @@ void DisplayListDispatcher::drawImageNine(const sk_sp image, } // |flutter::Dispatcher| -void DisplayListDispatcher::drawImageLattice(const sk_sp image, - const SkCanvas::Lattice& lattice, - const SkRect& dst, - SkFilterMode filter, - bool render_with_attributes) { +void DisplayListDispatcher::drawImageLattice( + const sk_sp image, + const SkCanvas::Lattice& lattice, + const SkRect& dst, + SkFilterMode filter, + bool render_with_attributes) { // Needs https://github.com/flutter/flutter/issues/95434 UNIMPLEMENTED; } // |flutter::Dispatcher| -void DisplayListDispatcher::drawAtlas(const sk_sp atlas, +void DisplayListDispatcher::drawAtlas(const sk_sp atlas, const SkRSXform xform[], const SkRect tex[], const SkColor colors[], diff --git a/engine/src/flutter/impeller/display_list/display_list_dispatcher.h b/engine/src/flutter/impeller/display_list/display_list_dispatcher.h index 4e84ee69af..1c15eed83c 100644 --- a/engine/src/flutter/impeller/display_list/display_list_dispatcher.h +++ b/engine/src/flutter/impeller/display_list/display_list_dispatcher.h @@ -172,13 +172,13 @@ class DisplayListDispatcher final : public flutter::Dispatcher { flutter::DlBlendMode mode) override; // |flutter::Dispatcher| - void drawImage(const sk_sp image, + void drawImage(const sk_sp image, const SkPoint point, const SkSamplingOptions& sampling, bool render_with_attributes) override; // |flutter::Dispatcher| - void drawImageRect(const sk_sp image, + void drawImageRect(const sk_sp image, const SkRect& src, const SkRect& dst, const SkSamplingOptions& sampling, @@ -186,21 +186,21 @@ class DisplayListDispatcher final : public flutter::Dispatcher { SkCanvas::SrcRectConstraint constraint) override; // |flutter::Dispatcher| - void drawImageNine(const sk_sp image, + void drawImageNine(const sk_sp image, const SkIRect& center, const SkRect& dst, SkFilterMode filter, bool render_with_attributes) override; // |flutter::Dispatcher| - void drawImageLattice(const sk_sp image, + void drawImageLattice(const sk_sp image, const SkCanvas::Lattice& lattice, const SkRect& dst, SkFilterMode filter, bool render_with_attributes) override; // |flutter::Dispatcher| - void drawAtlas(const sk_sp atlas, + void drawAtlas(const sk_sp atlas, const SkRSXform xform[], const SkRect tex[], const SkColor colors[], diff --git a/engine/src/flutter/impeller/display_list/display_list_image_impeller.cc b/engine/src/flutter/impeller/display_list/display_list_image_impeller.cc new file mode 100644 index 0000000000..b4627c0da6 --- /dev/null +++ b/engine/src/flutter/impeller/display_list/display_list_image_impeller.cc @@ -0,0 +1,53 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "impeller/display_list/display_list_image_impeller.h" + +namespace impeller { + +sk_sp DlImageImpeller::Make(std::shared_ptr texture) { + if (!texture) { + return nullptr; + } + return sk_sp(new DlImageImpeller(std::move(texture))); +} + +DlImageImpeller::DlImageImpeller(std::shared_ptr texture) + : texture_(std::move(texture)) {} + +// |DlImage| +DlImageImpeller::~DlImageImpeller() = default; + +// |DlImage| +sk_sp DlImageImpeller::skia_image() const { + return nullptr; +}; + +// |DlImage| +std::shared_ptr DlImageImpeller::impeller_texture() const { + return texture_; +} + +// |DlImage| +bool DlImageImpeller::isTextureBacked() const { + // Impeller textures are always ... textures :/ + return true; +} + +// |DlImage| +SkISize DlImageImpeller::dimensions() const { + const auto size = texture_ ? texture_->GetSize() : ISize{}; + return SkISize::Make(size.width, size.height); +} + +// |DlImage| +size_t DlImageImpeller::GetApproximateByteSize() const { + auto size = sizeof(this); + if (texture_) { + size += texture_->GetTextureDescriptor().GetByteSizeOfBaseMipLevel(); + } + return size; +} + +} // namespace impeller diff --git a/engine/src/flutter/impeller/display_list/display_list_image_impeller.h b/engine/src/flutter/impeller/display_list/display_list_image_impeller.h new file mode 100644 index 0000000000..652b861f85 --- /dev/null +++ b/engine/src/flutter/impeller/display_list/display_list_image_impeller.h @@ -0,0 +1,43 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#pragma once + +#include "flutter/display_list/display_list_image.h" +#include "flutter/fml/macros.h" +#include "impeller/renderer/texture.h" + +namespace impeller { + +class DlImageImpeller final : public flutter::DlImage { + public: + static sk_sp Make(std::shared_ptr texture); + + // |DlImage| + ~DlImageImpeller() override; + + // |DlImage| + sk_sp skia_image() const override; + + // |DlImage| + std::shared_ptr impeller_texture() const override; + + // |DlImage| + bool isTextureBacked() const override; + + // |DlImage| + SkISize dimensions() const override; + + // |DlImage| + size_t GetApproximateByteSize() const override; + + private: + std::shared_ptr texture_; + + explicit DlImageImpeller(std::shared_ptr texture); + + FML_DISALLOW_COPY_AND_ASSIGN(DlImageImpeller); +}; + +} // namespace impeller diff --git a/engine/src/flutter/impeller/display_list/display_list_unittests.cc b/engine/src/flutter/impeller/display_list/display_list_unittests.cc index ecfaf36e23..d8487de313 100644 --- a/engine/src/flutter/impeller/display_list/display_list_unittests.cc +++ b/engine/src/flutter/impeller/display_list/display_list_unittests.cc @@ -4,6 +4,7 @@ #include "flutter/display_list/display_list_builder.h" #include "flutter/testing/testing.h" +#include "impeller/display_list/display_list_image_impeller.h" #include "impeller/display_list/display_list_playground.h" #include "third_party/skia/include/core/SkPathBuilder.h" @@ -27,6 +28,14 @@ TEST_F(DisplayListTest, CanDrawTextBlob) { ASSERT_TRUE(OpenPlaygroundHere(builder.Build())); } +TEST_F(DisplayListTest, CanDrawImage) { + auto texture = CreateTextureForFixture("embarcadero.jpg"); + flutter::DisplayListBuilder builder; + builder.drawImage(DlImageImpeller::Make(texture), SkPoint::Make(100, 100), + SkSamplingOptions{}, true); + ASSERT_TRUE(OpenPlaygroundHere(builder.Build())); +} + TEST_F(DisplayListTest, CapsAndJoins) { flutter::DisplayListBuilder builder; diff --git a/engine/src/flutter/impeller/entity/contents/filters/filter_contents.cc b/engine/src/flutter/impeller/entity/contents/filters/filter_contents.cc index b799fc2ae4..e270857d81 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/filter_contents.cc +++ b/engine/src/flutter/impeller/entity/contents/filters/filter_contents.cc @@ -99,7 +99,7 @@ bool FilterContents::Render(const ContentContext& renderer, auto contents = std::make_shared(); contents->SetTexture(snapshot.texture); - contents->SetSourceRect(IRect::MakeSize(snapshot.texture->GetSize())); + contents->SetSourceRect(Rect::MakeSize(Size(snapshot.texture->GetSize()))); Entity e; e.SetPath(PathBuilder{}.AddRect(GetBounds(entity)).GetCurrentPath()); @@ -162,7 +162,7 @@ static std::optional ResolveSnapshotForInput( const ContentContext& renderer, RenderPass& pass) -> bool { TextureContents contents; contents.SetTexture(texture); - contents.SetSourceRect(IRect::MakeSize(texture->GetSize())); + contents.SetSourceRect(Rect::MakeSize(Size(texture->GetSize()))); Entity sub_entity; sub_entity.SetPath(entity.GetPath()); sub_entity.SetBlendMode(Entity::BlendMode::kSource); diff --git a/engine/src/flutter/impeller/entity/contents/texture_contents.cc b/engine/src/flutter/impeller/entity/contents/texture_contents.cc index e2397aaff6..024140093b 100644 --- a/engine/src/flutter/impeller/entity/contents/texture_contents.cc +++ b/engine/src/flutter/impeller/entity/contents/texture_contents.cc @@ -96,20 +96,28 @@ bool TextureContents::Render(const ContentContext& renderer, cmd.stencil_reference = entity.GetStencilDepth(); cmd.BindVertices(vertex_builder.CreateVertexBuffer(host_buffer)); VS::BindFrameInfo(cmd, host_buffer.EmplaceUniform(frame_info)); - FS::BindTextureSampler( - cmd, texture_, - renderer.GetContext()->GetSamplerLibrary()->GetSampler({})); + FS::BindTextureSampler(cmd, texture_, + renderer.GetContext()->GetSamplerLibrary()->GetSampler( + sampler_descriptor_)); pass.AddCommand(std::move(cmd)); return true; } -void TextureContents::SetSourceRect(const IRect& source_rect) { +void TextureContents::SetSourceRect(const Rect& source_rect) { source_rect_ = source_rect; } -const IRect& TextureContents::GetSourceRect() const { +const Rect& TextureContents::GetSourceRect() const { return source_rect_; } +void TextureContents::SetSamplerDescriptor(SamplerDescriptor desc) { + sampler_descriptor_ = std::move(desc); +} + +const SamplerDescriptor& TextureContents::GetSamplerDescriptor() const { + return sampler_descriptor_; +} + } // namespace impeller diff --git a/engine/src/flutter/impeller/entity/contents/texture_contents.h b/engine/src/flutter/impeller/entity/contents/texture_contents.h index c94be1f39a..7b994a6c06 100644 --- a/engine/src/flutter/impeller/entity/contents/texture_contents.h +++ b/engine/src/flutter/impeller/entity/contents/texture_contents.h @@ -10,6 +10,7 @@ #include "flutter/fml/macros.h" #include "impeller/entity/contents/contents.h" +#include "impeller/renderer/sampler_descriptor.h" namespace impeller { @@ -25,12 +26,16 @@ class TextureContents final : public Contents { std::shared_ptr GetTexture() const; - void SetSourceRect(const IRect& source_rect); + void SetSamplerDescriptor(SamplerDescriptor desc); + + const SamplerDescriptor& GetSamplerDescriptor() const; + + void SetSourceRect(const Rect& source_rect); + + const Rect& GetSourceRect() const; void SetOpacity(Scalar opacity); - const IRect& GetSourceRect() const; - // |Contents| bool Render(const ContentContext& renderer, const Entity& entity, @@ -38,7 +43,8 @@ class TextureContents final : public Contents { public: std::shared_ptr texture_; - IRect source_rect_; + SamplerDescriptor sampler_descriptor_ = {}; + Rect source_rect_; Scalar opacity_ = 1.0f; FML_DISALLOW_COPY_AND_ASSIGN(TextureContents); diff --git a/engine/src/flutter/impeller/geometry/rect.h b/engine/src/flutter/impeller/geometry/rect.h index 5d5f4224b1..dd12a5c69a 100644 --- a/engine/src/flutter/impeller/geometry/rect.h +++ b/engine/src/flutter/impeller/geometry/rect.h @@ -58,7 +58,7 @@ struct TRect { auto right = points[0].x; auto bottom = points[0].y; if (points.size() > 1) { - for (uint i = 1; i < points.size(); i++) { + for (size_t i = 1; i < points.size(); i++) { left = std::min(left, points[i].x); top = std::min(top, points[i].y); right = std::max(right, points[i].x); diff --git a/engine/src/flutter/impeller/playground/imgui/imgui_impl_impeller.cc b/engine/src/flutter/impeller/playground/imgui/imgui_impl_impeller.cc index 245397fc0f..682ee9bb38 100644 --- a/engine/src/flutter/impeller/playground/imgui/imgui_impl_impeller.cc +++ b/engine/src/flutter/impeller/playground/imgui/imgui_impl_impeller.cc @@ -78,7 +78,7 @@ bool ImGui_ImplImpeller_Init(std::shared_ptr context) { "Could not allocate ImGui font texture."); [[maybe_unused]] bool uploaded = bd->font_texture->SetContents( - pixels, texture_descriptor.GetSizeOfBaseMipLevel()); + pixels, texture_descriptor.GetByteSizeOfBaseMipLevel()); IM_ASSERT(uploaded && "Could not upload ImGui font texture to device memory."); } diff --git a/engine/src/flutter/impeller/renderer/backend/metal/device_buffer_mtl.mm b/engine/src/flutter/impeller/renderer/backend/metal/device_buffer_mtl.mm index 3f47629aa2..58e74fefd8 100644 --- a/engine/src/flutter/impeller/renderer/backend/metal/device_buffer_mtl.mm +++ b/engine/src/flutter/impeller/renderer/backend/metal/device_buffer_mtl.mm @@ -29,7 +29,7 @@ std::shared_ptr DeviceBufferMTL::MakeTexture(TextureDescriptor desc, } // Avoid overruns. - if (offset + desc.GetSizeOfBaseMipLevel() > size_) { + if (offset + desc.GetByteSizeOfBaseMipLevel() > size_) { VALIDATION_LOG << "Avoiding buffer overrun when creating texture."; return nullptr; } diff --git a/engine/src/flutter/impeller/renderer/backend/metal/texture_mtl.mm b/engine/src/flutter/impeller/renderer/backend/metal/texture_mtl.mm index ec6040f8ad..a2cfab4080 100644 --- a/engine/src/flutter/impeller/renderer/backend/metal/texture_mtl.mm +++ b/engine/src/flutter/impeller/renderer/backend/metal/texture_mtl.mm @@ -38,7 +38,7 @@ bool TextureMTL::SetContents(const uint8_t* contents, size_t length) { const auto& desc = GetTextureDescriptor(); // Out of bounds access. - if (length != desc.GetSizeOfBaseMipLevel()) { + if (length != desc.GetByteSizeOfBaseMipLevel()) { return false; } diff --git a/engine/src/flutter/impeller/renderer/texture_descriptor.h b/engine/src/flutter/impeller/renderer/texture_descriptor.h index 20b9a367dd..38bf7db7e3 100644 --- a/engine/src/flutter/impeller/renderer/texture_descriptor.h +++ b/engine/src/flutter/impeller/renderer/texture_descriptor.h @@ -25,7 +25,7 @@ struct TextureDescriptor { static_cast(TextureUsage::kShaderRead); SampleCount sample_count = SampleCount::kCount1; - constexpr size_t GetSizeOfBaseMipLevel() const { + constexpr size_t GetByteSizeOfBaseMipLevel() const { if (!IsValid()) { return 0u; } diff --git a/engine/src/flutter/impeller/typographer/backends/skia/text_render_context_skia.cc b/engine/src/flutter/impeller/typographer/backends/skia/text_render_context_skia.cc index c93906d501..d5b82a6124 100644 --- a/engine/src/flutter/impeller/typographer/backends/skia/text_render_context_skia.cc +++ b/engine/src/flutter/impeller/typographer/backends/skia/text_render_context_skia.cc @@ -166,7 +166,7 @@ static std::shared_ptr UploadGlyphTextureAtlas( texture_descriptor.size = ISize::MakeWH(atlas_size, atlas_size); if (pixmap.rowBytes() * pixmap.height() != - texture_descriptor.GetSizeOfBaseMipLevel()) { + texture_descriptor.GetByteSizeOfBaseMipLevel()) { return nullptr; }