Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion flow/layers/clip_path_layer_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "flutter/flow/testing/layer_test.h"
#include "flutter/flow/testing/mock_embedder.h"
#include "flutter/flow/testing/mock_layer.h"
#include "flutter/fml/macros.h"
#include "gtest/gtest.h"

// TODO(zanderso): https://github.com/flutter/flutter/issues/127701
Expand Down
12 changes: 4 additions & 8 deletions flow/layers/display_list_raster_cache_item.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
#include "flutter/flow/raster_cache_util.h"
#include "third_party/skia/include/gpu/GrDirectContext.h"

// TODO(zanderso): https://github.com/flutter/flutter/issues/127701
// NOLINTBEGIN(bugprone-unchecked-optional-access)

namespace flutter {

static bool IsDisplayListWorthRasterizing(
Expand Down Expand Up @@ -152,8 +149,10 @@ bool DisplayListRasterCacheItem::TryToPrepareRasterCache(
// display_list or picture_list to calculate the memory they used, we
// shouldn't cache the current node if the memory is more significant than the
// limit.
auto id = GetId();
FML_DCHECK(id.has_value());
if (cache_state_ == kNone || !context.raster_cache || parent_cached ||
!context.raster_cache->GenerateNewCacheInThisFrame()) {
!context.raster_cache->GenerateNewCacheInThisFrame() || !id.has_value()) {
return false;
}
SkRect bounds = display_list_->bounds().makeOffset(offset_.x(), offset_.y());
Expand All @@ -167,11 +166,8 @@ bool DisplayListRasterCacheItem::TryToPrepareRasterCache(
// clang-format on
};
return context.raster_cache->UpdateCacheEntry(
GetId().value(), r_context,
[display_list = display_list_](DlCanvas* canvas) {
id.value(), r_context, [display_list = display_list_](DlCanvas* canvas) {
canvas->DrawDisplayList(display_list);
});
}
} // namespace flutter

// NOLINTEND(bugprone-unchecked-optional-access)
7 changes: 2 additions & 5 deletions fml/message_loop_task_queues.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
#include "flutter/fml/task_source.h"
#include "flutter/fml/thread_local.h"

// TODO(zanderso): https://github.com/flutter/flutter/issues/127701
// NOLINTBEGIN(bugprone-unchecked-optional-access)

namespace fml {

const size_t TaskQueueId::kUnmerged = ULONG_MAX;
Expand Down Expand Up @@ -396,9 +393,9 @@ TaskSource::TopTask MessageLoopTaskQueues::PeekNextTaskUnlocked(
// At least one task at the top because PeekNextTaskUnlocked() is called after
// HasPendingTasksUnlocked()
FML_CHECK(top_task.has_value());
// Covered by FML_CHECK.
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
return top_task.value();
}

} // namespace fml

// NOLINTEND(bugprone-unchecked-optional-access)
31 changes: 17 additions & 14 deletions impeller/aiks/canvas.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
#include "impeller/entity/geometry/geometry.h"
#include "impeller/geometry/path_builder.h"

// TODO(zanderso): https://github.com/flutter/flutter/issues/127701
// NOLINTBEGIN(bugprone-unchecked-optional-access)

namespace impeller {

Canvas::Canvas() {
Expand Down Expand Up @@ -187,18 +184,18 @@ void Canvas::DrawPaint(const Paint& paint) {
bool Canvas::AttemptDrawBlurredRRect(const Rect& rect,
Scalar corner_radius,
const Paint& paint) {
if (paint.color_source.GetType() != ColorSource::Type::kColor ||
paint.style != Paint::Style::kFill) {
Paint new_paint = paint;
if (new_paint.color_source.GetType() != ColorSource::Type::kColor ||
new_paint.style != Paint::Style::kFill) {
return false;
}

if (!paint.mask_blur_descriptor.has_value() ||
paint.mask_blur_descriptor->style != FilterContents::BlurStyle::kNormal) {
if (!new_paint.mask_blur_descriptor.has_value() ||
new_paint.mask_blur_descriptor->style !=
FilterContents::BlurStyle::kNormal) {
return false;
}

Paint new_paint = paint;

// For symmetrically mask blurred solid RRects, absorb the mask blur and use
// a faster SDF approximation.

Expand Down Expand Up @@ -530,7 +527,11 @@ void Canvas::DrawTextFrame(const TextFrame& text_frame,
entity.SetTransformation(GetCurrentTransformation());

Entity test;
auto cvg = text_contents->GetCoverage(test).value();
auto maybe_cvg = text_contents->GetCoverage(test);
FML_CHECK(maybe_cvg.has_value());
// Covered by FML_CHECK.
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
auto cvg = maybe_cvg.value();
color_text_contents->SetTextPosition(cvg.origin + position);

text_contents->SetOffset(-cvg.origin);
Expand Down Expand Up @@ -612,8 +613,12 @@ void Canvas::DrawVertices(const std::shared_ptr<VerticesGeometry>& vertices,
if (size.has_value()) {
src_coverage = Rect::MakeXYWH(0, 0, size->width, size->height);
} else {
src_coverage = vertices->GetTextureCoordinateCoverge().value_or(
vertices->GetCoverage(Matrix{}).value());
auto cvg = vertices->GetCoverage(Matrix{});
FML_CHECK(cvg.has_value());
src_coverage =
// Covered by FML_CHECK.
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
vertices->GetTextureCoordinateCoverge().value_or(cvg.value());
}
src_contents =
src_paint.CreateContentsForGeometry(Geometry::MakeRect(src_coverage));
Expand Down Expand Up @@ -661,5 +666,3 @@ void Canvas::DrawAtlas(const std::shared_ptr<Image>& atlas,
}

} // namespace impeller

// NOLINTEND(bugprone-unchecked-optional-access)
8 changes: 3 additions & 5 deletions impeller/display_list/dl_image_impeller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
#include "impeller/aiks/aiks_context.h"
#include "impeller/entity/contents/filters/filter_contents.h"

// TODO(zanderso): https://github.com/flutter/flutter/issues/127701
// NOLINTBEGIN(bugprone-unchecked-optional-access)

namespace impeller {

sk_sp<DlImageImpeller> DlImageImpeller::Make(std::shared_ptr<Texture> texture,
Expand Down Expand Up @@ -40,6 +37,9 @@ sk_sp<DlImageImpeller> DlImageImpeller::MakeFromYUVTextures(
std::nullopt, // sampler_descriptor
true, // msaa_enabled
"MakeYUVToRGBFilter Snapshot"); // label
if (!snapshot.has_value()) {
return nullptr;
}
return impeller::DlImageImpeller::Make(snapshot->texture);
}

Expand Down Expand Up @@ -94,5 +94,3 @@ size_t DlImageImpeller::GetApproximateByteSize() const {
}

} // namespace impeller

// NOLINTEND(bugprone-unchecked-optional-access)
8 changes: 3 additions & 5 deletions impeller/entity/contents/contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
#include "impeller/renderer/command_buffer.h"
#include "impeller/renderer/render_pass.h"

// TODO(zanderso): https://github.com/flutter/flutter/issues/127701
// NOLINTBEGIN(bugprone-unchecked-optional-access)

namespace impeller {

ContentContextOptions OptionsFromPass(const RenderPass& pass) {
Expand Down Expand Up @@ -79,6 +76,9 @@ std::optional<Snapshot> Contents::RenderToSnapshot(

if (coverage_limit.has_value()) {
coverage = coverage->Intersection(*coverage_limit);
if (!coverage.has_value()) {
return std::nullopt;
}
}

auto texture = renderer.MakeSubpass(
Expand Down Expand Up @@ -151,5 +151,3 @@ void Contents::SetColorSourceSize(Size size) {
}

} // namespace impeller

// NOLINTEND(bugprone-unchecked-optional-access)
8 changes: 3 additions & 5 deletions impeller/entity/contents/tiled_texture_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
#include "impeller/renderer/render_pass.h"
#include "impeller/renderer/sampler_library.h"

// TODO(zanderso): https://github.com/flutter/flutter/issues/127701
// NOLINTBEGIN(bugprone-unchecked-optional-access)

namespace impeller {

static std::optional<SamplerAddressMode> TileModeToAddressMode(
Expand Down Expand Up @@ -66,6 +63,9 @@ void TiledTextureContents::SetColorFilter(
std::optional<std::shared_ptr<Texture>>
TiledTextureContents::CreateFilterTexture(
const ContentContext& renderer) const {
if (!color_filter_.has_value()) {
return std::nullopt;
}
const ColorFilterProc& filter = color_filter_.value();
auto color_filter_contents = filter(FilterInput::Make(texture_));
auto snapshot = color_filter_contents->RenderToSnapshot(
Expand Down Expand Up @@ -198,5 +198,3 @@ bool TiledTextureContents::Render(const ContentContext& renderer,
}

} // namespace impeller

// NOLINTEND(bugprone-unchecked-optional-access)
13 changes: 6 additions & 7 deletions impeller/playground/imgui/imgui_impl_impeller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@
#include "impeller/renderer/render_pass.h"
#include "impeller/renderer/sampler_library.h"

// TODO(zanderso): https://github.com/flutter/flutter/issues/127701
// NOLINTBEGIN(bugprone-unchecked-optional-access)

struct ImGui_ImplImpeller_Data {
std::shared_ptr<impeller::Context> context;
std::shared_ptr<impeller::Texture> font_texture;
Expand Down Expand Up @@ -97,8 +94,12 @@ bool ImGui_ImplImpeller_Init(
auto desc = impeller::PipelineBuilder<impeller::ImguiRasterVertexShader,
impeller::ImguiRasterFragmentShader>::
MakeDefaultPipelineDescriptor(*context);
desc->ClearStencilAttachments();
desc->ClearDepthAttachment();
IM_ASSERT(desc.has_value() && "Could not create Impeller pipeline");
if (desc.has_value()) { // Needed to silence clang-tidy check
// bugprone-unchecked-optional-access.
desc->ClearStencilAttachments();
desc->ClearDepthAttachment();
}

bd->pipeline =
context->GetPipelineLibrary()->GetPipeline(std::move(desc)).Get();
Expand Down Expand Up @@ -272,5 +273,3 @@ void ImGui_ImplImpeller_RenderDrawData(ImDrawData* draw_data,
index_buffer_offset += draw_list_idx_bytes;
}
}

// NOLINTEND(bugprone-unchecked-optional-access)
9 changes: 2 additions & 7 deletions impeller/renderer/capabilities.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@

#include "impeller/renderer/capabilities.h"

// TODO(zanderso): https://github.com/flutter/flutter/issues/127701
// NOLINTBEGIN(bugprone-unchecked-optional-access)

namespace impeller {

Capabilities::Capabilities() = default;
Expand Down Expand Up @@ -218,11 +215,9 @@ std::unique_ptr<Capabilities> CapabilitiesBuilder::Build() {
supports_read_from_onscreen_texture_, //
supports_read_from_resolve_, //
supports_decal_tile_mode_, //
*default_color_format_, //
*default_stencil_format_ //
default_color_format_.value_or(PixelFormat::kUnknown), //
default_stencil_format_.value_or(PixelFormat::kUnknown) //
));
}

} // namespace impeller

// NOLINTEND(bugprone-unchecked-optional-access)
10 changes: 3 additions & 7 deletions shell/common/rasterizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
#include "third_party/skia/include/utils/SkBase64.h"

// TODO(zanderso): https://github.com/flutter/flutter/issues/127701
// NOLINTBEGIN(bugprone-unchecked-optional-access)

namespace flutter {

// The rasterizer will tell Skia to purge cached resources that have not been
Expand Down Expand Up @@ -589,9 +586,10 @@ RasterStatus Rasterizer::DrawToSurfaceUnsafe(
(!raster_thread_merger_ || raster_thread_merger_->IsMerged());

damage = std::make_unique<FrameDamage>();
if (frame->framebuffer_info().existing_damage && !force_full_repaint) {
auto existing_damage = frame->framebuffer_info().existing_damage;
if (existing_damage.has_value() && !force_full_repaint) {
damage->SetPreviousLayerTree(last_layer_tree_.get());
damage->AddAdditionalDamage(*frame->framebuffer_info().existing_damage);
damage->AddAdditionalDamage(existing_damage.value());
damage->SetClipAlignment(
frame->framebuffer_info().horizontal_clip_alignment,
frame->framebuffer_info().vertical_clip_alignment);
Expand Down Expand Up @@ -870,5 +868,3 @@ Rasterizer::Screenshot::Screenshot(const Screenshot& other) = default;
Rasterizer::Screenshot::~Screenshot() = default;

} // namespace flutter

// NOLINTEND(bugprone-unchecked-optional-access)
7 changes: 2 additions & 5 deletions shell/platform/embedder/embedder_external_view_embedder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
#include "flutter/shell/platform/embedder/embedder_render_target.h"
#include "third_party/skia/include/gpu/GrDirectContext.h"

// TODO(zanderso): https://github.com/flutter/flutter/issues/127701
// NOLINTBEGIN(bugprone-unchecked-optional-access)

namespace flutter {

EmbedderExternalViewEmbedder::EmbedderExternalViewEmbedder(
Expand Down Expand Up @@ -227,6 +224,8 @@ void EmbedderExternalViewEmbedder::SubmitFrame(
const auto& external_view = pending_views_.at(view_id);
if (external_view->HasPlatformView()) {
presented_layers.PushPlatformViewLayer(
// Covered by HasPlatformView().
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
external_view->GetViewIdentifier()
.platform_view_id.value(), // view id
*external_view->GetEmbeddedViewParams() // view params
Expand Down Expand Up @@ -267,5 +266,3 @@ void EmbedderExternalViewEmbedder::SubmitFrame(
}

} // namespace flutter

// NOLINTEND(bugprone-unchecked-optional-access)