Make flow/... compatible with .clang_tidy. (flutter/engine#48148)
This commit is contained in:
@@ -47,13 +47,7 @@ void DiffContext::EndSubtree() {
|
||||
state_stack_.pop_back();
|
||||
}
|
||||
|
||||
DiffContext::State::State()
|
||||
: dirty(false),
|
||||
rect_index(0),
|
||||
integral_transform(false),
|
||||
clip_tracker_save_count(0),
|
||||
has_filter_bounds_adjustment(false),
|
||||
has_texture(false) {}
|
||||
DiffContext::State::State() {}
|
||||
|
||||
void DiffContext::PushTransform(const SkMatrix& transform) {
|
||||
clip_tracker_.transform(transform);
|
||||
|
||||
@@ -208,9 +208,9 @@ class DiffContext {
|
||||
struct State {
|
||||
State();
|
||||
|
||||
bool dirty;
|
||||
bool dirty = false;
|
||||
|
||||
size_t rect_index;
|
||||
size_t rect_index = 0;
|
||||
|
||||
// In order to replicate paint process closely, DiffContext needs to take
|
||||
// into account that some layers are painted with transform translation
|
||||
@@ -221,17 +221,17 @@ class DiffContext {
|
||||
// during paint. This means the integral coordinates must be applied after
|
||||
// culling before painting the layer content (either the layer itself, or
|
||||
// when starting subtree to paint layer children).
|
||||
bool integral_transform;
|
||||
bool integral_transform = false;
|
||||
|
||||
// Used to restoring clip tracker when popping state.
|
||||
int clip_tracker_save_count;
|
||||
int clip_tracker_save_count = 0;
|
||||
|
||||
// Whether this subtree has filter bounds adjustment function. If so,
|
||||
// it will need to be removed from stack when subtree is closed.
|
||||
bool has_filter_bounds_adjustment;
|
||||
bool has_filter_bounds_adjustment = false;
|
||||
|
||||
// Whether there is a texture layer in this subtree.
|
||||
bool has_texture;
|
||||
bool has_texture = false;
|
||||
};
|
||||
|
||||
void MakeCurrentTransformIntegral();
|
||||
|
||||
@@ -11,8 +11,7 @@ namespace flutter {
|
||||
Layer::Layer()
|
||||
: paint_bounds_(SkRect::MakeEmpty()),
|
||||
unique_id_(NextUniqueID()),
|
||||
original_layer_id_(unique_id_),
|
||||
subtree_has_platform_view_(false) {}
|
||||
original_layer_id_(unique_id_) {}
|
||||
|
||||
Layer::~Layer() = default;
|
||||
|
||||
|
||||
@@ -266,7 +266,7 @@ class Layer {
|
||||
SkRect paint_bounds_;
|
||||
uint64_t unique_id_;
|
||||
uint64_t original_layer_id_;
|
||||
bool subtree_has_platform_view_;
|
||||
bool subtree_has_platform_view_ = false;
|
||||
|
||||
static uint64_t NextUniqueID();
|
||||
|
||||
|
||||
@@ -15,8 +15,7 @@ namespace flutter {
|
||||
OpacityLayer::OpacityLayer(SkAlpha alpha, const SkPoint& offset)
|
||||
: CacheableContainerLayer(std::numeric_limits<int>::max(), true),
|
||||
alpha_(alpha),
|
||||
offset_(offset),
|
||||
children_can_accept_opacity_(false) {}
|
||||
offset_(offset) {}
|
||||
|
||||
void OpacityLayer::Diff(DiffContext* context, const Layer* old_layer) {
|
||||
DiffContext::AutoSubtreeRestore subtree(context);
|
||||
|
||||
@@ -50,7 +50,7 @@ class OpacityLayer : public CacheableContainerLayer {
|
||||
private:
|
||||
SkAlpha alpha_;
|
||||
SkPoint offset_;
|
||||
bool children_can_accept_opacity_;
|
||||
bool children_can_accept_opacity_ = false;
|
||||
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(OpacityLayer);
|
||||
};
|
||||
|
||||
@@ -71,8 +71,7 @@ void RasterCacheResult::draw(DlCanvas& canvas,
|
||||
RasterCache::RasterCache(size_t access_threshold,
|
||||
size_t display_list_cache_limit_per_frame)
|
||||
: access_threshold_(access_threshold),
|
||||
display_list_cache_limit_per_frame_(display_list_cache_limit_per_frame),
|
||||
checkerboard_images_(false) {}
|
||||
display_list_cache_limit_per_frame_(display_list_cache_limit_per_frame) {}
|
||||
|
||||
/// @note Procedure doesn't copy all closures.
|
||||
std::unique_ptr<RasterCacheResult> RasterCache::Rasterize(
|
||||
|
||||
@@ -264,7 +264,7 @@ class RasterCache {
|
||||
RasterCacheMetrics layer_metrics_;
|
||||
RasterCacheMetrics picture_metrics_;
|
||||
mutable RasterCacheKey::Map<Entry> cache_;
|
||||
bool checkerboard_images_;
|
||||
bool checkerboard_images_ = false;
|
||||
|
||||
void TraceStatsToTimeline() const;
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
|
||||
#include "flutter/display_list/dl_canvas.h"
|
||||
#include "flutter/flow/raster_cache_key.h"
|
||||
@@ -31,7 +32,7 @@ class RasterCacheItem {
|
||||
explicit RasterCacheItem(RasterCacheKeyID key_id,
|
||||
CacheState cache_state = CacheState::kNone,
|
||||
unsigned child_entries = 0)
|
||||
: key_id_(key_id),
|
||||
: key_id_(std::move(key_id)),
|
||||
cache_state_(cache_state),
|
||||
child_items_(child_entries) {}
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ class UnrefQueue : public fml::RefCountedThreadSafe<UnrefQueue<T>> {
|
||||
}
|
||||
|
||||
if (context) {
|
||||
for (GrBackendTexture texture : textures) {
|
||||
for (const GrBackendTexture& texture : textures) {
|
||||
context->deleteBackendTexture(texture);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,9 +9,7 @@ namespace flutter {
|
||||
static const size_t kMaxSamples = 120;
|
||||
|
||||
Stopwatch::Stopwatch(const RefreshRateUpdater& updater)
|
||||
: refresh_rate_updater_(updater),
|
||||
start_(fml::TimePoint::Now()),
|
||||
current_sample_(0) {
|
||||
: refresh_rate_updater_(updater), start_(fml::TimePoint::Now()) {
|
||||
const fml::TimeDelta delta = fml::TimeDelta::Zero();
|
||||
laps_.resize(kMaxSamples, delta);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ class Stopwatch {
|
||||
const RefreshRateUpdater& refresh_rate_updater_;
|
||||
fml::TimePoint start_;
|
||||
std::vector<fml::TimeDelta> laps_;
|
||||
size_t current_sample_;
|
||||
size_t current_sample_ = 0;
|
||||
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(Stopwatch);
|
||||
};
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#ifndef FLUTTER_SHELL_DIFF_CONTEXT_TEST_H_
|
||||
#define FLUTTER_SHELL_DIFF_CONTEXT_TEST_H_
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "flutter/flow/layers/container_layer.h"
|
||||
#include "flutter/flow/layers/display_list_layer.h"
|
||||
#include "flutter/flow/layers/opacity_layer.h"
|
||||
@@ -58,7 +60,7 @@ class DiffContextTest : public LayerTest {
|
||||
|
||||
std::shared_ptr<ContainerLayer> CreateContainerLayer(
|
||||
std::shared_ptr<Layer> l) {
|
||||
return CreateContainerLayer({l});
|
||||
return CreateContainerLayer({std::move(l)});
|
||||
}
|
||||
|
||||
std::shared_ptr<OpacityLayer> CreateOpacityLater(
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include "flutter/flow/diff_context.h"
|
||||
#include "flutter/flow/layers/cacheable_layer.h"
|
||||
#include "flutter/flow/layers/container_layer.h"
|
||||
@@ -28,11 +29,11 @@ class MockLayer : public Layer {
|
||||
|
||||
static std::shared_ptr<MockLayer> Make(SkPath path,
|
||||
DlPaint paint = DlPaint()) {
|
||||
return std::make_shared<MockLayer>(path, paint);
|
||||
return std::make_shared<MockLayer>(std::move(path), std::move(paint));
|
||||
}
|
||||
|
||||
static std::shared_ptr<MockLayer> MakeOpacityCompatible(SkPath path) {
|
||||
auto mock_layer = std::make_shared<MockLayer>(path, DlPaint());
|
||||
auto mock_layer = std::make_shared<MockLayer>(std::move(path), DlPaint());
|
||||
mock_layer->set_fake_opacity_compatible(true);
|
||||
return mock_layer;
|
||||
}
|
||||
@@ -152,10 +153,10 @@ class MockLayerCacheableItem : public LayerRasterCacheItem {
|
||||
};
|
||||
class MockCacheableLayer : public MockLayer {
|
||||
public:
|
||||
explicit MockCacheableLayer(SkPath path,
|
||||
explicit MockCacheableLayer(const SkPath& path,
|
||||
DlPaint paint = DlPaint(),
|
||||
int render_limit = 3)
|
||||
: MockLayer(path, paint) {
|
||||
: MockLayer(path, std::move(paint)) {
|
||||
raster_cache_item_ =
|
||||
std::make_unique<MockLayerCacheableItem>(this, render_limit);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user