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

Commit 7f0d20d

Browse files
authored
Make flow/... compatible with .clang_tidy. (#48148)
1 parent 739b2fe commit 7f0d20d

14 files changed

+26
-33
lines changed

flow/diff_context.cc

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,7 @@ void DiffContext::EndSubtree() {
4747
state_stack_.pop_back();
4848
}
4949

50-
DiffContext::State::State()
51-
: dirty(false),
52-
rect_index(0),
53-
integral_transform(false),
54-
clip_tracker_save_count(0),
55-
has_filter_bounds_adjustment(false),
56-
has_texture(false) {}
50+
DiffContext::State::State() {}
5751

5852
void DiffContext::PushTransform(const SkMatrix& transform) {
5953
clip_tracker_.transform(transform);

flow/diff_context.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,9 @@ class DiffContext {
208208
struct State {
209209
State();
210210

211-
bool dirty;
211+
bool dirty = false;
212212

213-
size_t rect_index;
213+
size_t rect_index = 0;
214214

215215
// In order to replicate paint process closely, DiffContext needs to take
216216
// into account that some layers are painted with transform translation
@@ -221,17 +221,17 @@ class DiffContext {
221221
// during paint. This means the integral coordinates must be applied after
222222
// culling before painting the layer content (either the layer itself, or
223223
// when starting subtree to paint layer children).
224-
bool integral_transform;
224+
bool integral_transform = false;
225225

226226
// Used to restoring clip tracker when popping state.
227-
int clip_tracker_save_count;
227+
int clip_tracker_save_count = 0;
228228

229229
// Whether this subtree has filter bounds adjustment function. If so,
230230
// it will need to be removed from stack when subtree is closed.
231-
bool has_filter_bounds_adjustment;
231+
bool has_filter_bounds_adjustment = false;
232232

233233
// Whether there is a texture layer in this subtree.
234-
bool has_texture;
234+
bool has_texture = false;
235235
};
236236

237237
void MakeCurrentTransformIntegral();

flow/layers/layer.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ namespace flutter {
1111
Layer::Layer()
1212
: paint_bounds_(SkRect::MakeEmpty()),
1313
unique_id_(NextUniqueID()),
14-
original_layer_id_(unique_id_),
15-
subtree_has_platform_view_(false) {}
14+
original_layer_id_(unique_id_) {}
1615

1716
Layer::~Layer() = default;
1817

flow/layers/layer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ class Layer {
266266
SkRect paint_bounds_;
267267
uint64_t unique_id_;
268268
uint64_t original_layer_id_;
269-
bool subtree_has_platform_view_;
269+
bool subtree_has_platform_view_ = false;
270270

271271
static uint64_t NextUniqueID();
272272

flow/layers/opacity_layer.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ namespace flutter {
1515
OpacityLayer::OpacityLayer(SkAlpha alpha, const SkPoint& offset)
1616
: CacheableContainerLayer(std::numeric_limits<int>::max(), true),
1717
alpha_(alpha),
18-
offset_(offset),
19-
children_can_accept_opacity_(false) {}
18+
offset_(offset) {}
2019

2120
void OpacityLayer::Diff(DiffContext* context, const Layer* old_layer) {
2221
DiffContext::AutoSubtreeRestore subtree(context);

flow/layers/opacity_layer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class OpacityLayer : public CacheableContainerLayer {
5050
private:
5151
SkAlpha alpha_;
5252
SkPoint offset_;
53-
bool children_can_accept_opacity_;
53+
bool children_can_accept_opacity_ = false;
5454

5555
FML_DISALLOW_COPY_AND_ASSIGN(OpacityLayer);
5656
};

flow/raster_cache.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ void RasterCacheResult::draw(DlCanvas& canvas,
7171
RasterCache::RasterCache(size_t access_threshold,
7272
size_t display_list_cache_limit_per_frame)
7373
: access_threshold_(access_threshold),
74-
display_list_cache_limit_per_frame_(display_list_cache_limit_per_frame),
75-
checkerboard_images_(false) {}
74+
display_list_cache_limit_per_frame_(display_list_cache_limit_per_frame) {}
7675

7776
/// @note Procedure doesn't copy all closures.
7877
std::unique_ptr<RasterCacheResult> RasterCache::Rasterize(

flow/raster_cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ class RasterCache {
264264
RasterCacheMetrics layer_metrics_;
265265
RasterCacheMetrics picture_metrics_;
266266
mutable RasterCacheKey::Map<Entry> cache_;
267-
bool checkerboard_images_;
267+
bool checkerboard_images_ = false;
268268

269269
void TraceStatsToTimeline() const;
270270

flow/raster_cache_item.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include <memory>
99
#include <optional>
10+
#include <utility>
1011

1112
#include "flutter/display_list/dl_canvas.h"
1213
#include "flutter/flow/raster_cache_key.h"
@@ -31,7 +32,7 @@ class RasterCacheItem {
3132
explicit RasterCacheItem(RasterCacheKeyID key_id,
3233
CacheState cache_state = CacheState::kNone,
3334
unsigned child_entries = 0)
34-
: key_id_(key_id),
35+
: key_id_(std::move(key_id)),
3536
cache_state_(cache_state),
3637
child_items_(child_entries) {}
3738

flow/skia_gpu_object.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class UnrefQueue : public fml::RefCountedThreadSafe<UnrefQueue<T>> {
121121
}
122122

123123
if (context) {
124-
for (GrBackendTexture texture : textures) {
124+
for (const GrBackendTexture& texture : textures) {
125125
context->deleteBackendTexture(texture);
126126
}
127127

0 commit comments

Comments
 (0)