Skip to content

Commit

Permalink
Make flow::Layer::Paint const. (flutter#4200)
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmaygarde authored Oct 11, 2017
1 parent 0b8efb6 commit a55aa23
Show file tree
Hide file tree
Showing 27 changed files with 32 additions and 27 deletions.
2 changes: 1 addition & 1 deletion flow/layers/backdrop_filter_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ BackdropFilterLayer::BackdropFilterLayer() = default;

BackdropFilterLayer::~BackdropFilterLayer() = default;

void BackdropFilterLayer::Paint(PaintContext& context) {
void BackdropFilterLayer::Paint(PaintContext& context) const {
TRACE_EVENT0("flutter", "BackdropFilterLayer::Paint");
FXL_DCHECK(needs_painting());

Expand Down
2 changes: 1 addition & 1 deletion flow/layers/backdrop_filter_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class BackdropFilterLayer : public ContainerLayer {

void set_filter(sk_sp<SkImageFilter> filter) { filter_ = std::move(filter); }

void Paint(PaintContext& context) override;
void Paint(PaintContext& context) const override;

private:
sk_sp<SkImageFilter> filter_;
Expand Down
2 changes: 1 addition & 1 deletion flow/layers/child_scene_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void ChildSceneLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {
set_needs_system_composite(true);
}

void ChildSceneLayer::Paint(PaintContext& context) {
void ChildSceneLayer::Paint(PaintContext& context) const {
FXL_NOTREACHED() << "This layer never needs painting.";
}

Expand Down
2 changes: 1 addition & 1 deletion flow/layers/child_scene_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ChildSceneLayer : public Layer {

void Preroll(PrerollContext* context, const SkMatrix& matrix) override;

void Paint(PaintContext& context) override;
void Paint(PaintContext& context) const override;

void UpdateScene(SceneUpdateContext& context) override;

Expand Down
2 changes: 1 addition & 1 deletion flow/layers/clip_path_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void ClipPathLayer::UpdateScene(SceneUpdateContext& context) {

#endif // defined(OS_FUCHSIA)

void ClipPathLayer::Paint(PaintContext& context) {
void ClipPathLayer::Paint(PaintContext& context) const {
TRACE_EVENT0("flutter", "ClipPathLayer::Paint");
FXL_DCHECK(needs_painting());

Expand Down
3 changes: 2 additions & 1 deletion flow/layers/clip_path_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class ClipPathLayer : public ContainerLayer {
void set_clip_path(const SkPath& clip_path) { clip_path_ = clip_path; }

void Preroll(PrerollContext* context, const SkMatrix& matrix) override;
void Paint(PaintContext& context) override;

void Paint(PaintContext& context) const override;

#if defined(OS_FUCHSIA)
void UpdateScene(SceneUpdateContext& context) override;
Expand Down
2 changes: 1 addition & 1 deletion flow/layers/clip_rect_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void ClipRectLayer::UpdateScene(SceneUpdateContext& context) {

#endif // defined(OS_FUCHSIA)

void ClipRectLayer::Paint(PaintContext& context) {
void ClipRectLayer::Paint(PaintContext& context) const {
TRACE_EVENT0("flutter", "ClipRectLayer::Paint");
FXL_DCHECK(needs_painting());

Expand Down
2 changes: 1 addition & 1 deletion flow/layers/clip_rect_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ClipRectLayer : public ContainerLayer {
void set_clip_rect(const SkRect& clip_rect) { clip_rect_ = clip_rect; }

void Preroll(PrerollContext* context, const SkMatrix& matrix) override;
void Paint(PaintContext& context) override;
void Paint(PaintContext& context) const override;

#if defined(OS_FUCHSIA)
void UpdateScene(SceneUpdateContext& context) override;
Expand Down
2 changes: 1 addition & 1 deletion flow/layers/clip_rrect_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void ClipRRectLayer::UpdateScene(SceneUpdateContext& context) {

#endif // defined(OS_FUCHSIA)

void ClipRRectLayer::Paint(PaintContext& context) {
void ClipRRectLayer::Paint(PaintContext& context) const {
TRACE_EVENT0("flutter", "ClipRRectLayer::Paint");
FXL_DCHECK(needs_painting());

Expand Down
3 changes: 2 additions & 1 deletion flow/layers/clip_rrect_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class ClipRRectLayer : public ContainerLayer {
void set_clip_rrect(const SkRRect& clip_rrect) { clip_rrect_ = clip_rrect; }

void Preroll(PrerollContext* context, const SkMatrix& matrix) override;
void Paint(PaintContext& context) override;

void Paint(PaintContext& context) const override;

#if defined(OS_FUCHSIA)
void UpdateScene(SceneUpdateContext& context) override;
Expand Down
2 changes: 1 addition & 1 deletion flow/layers/color_filter_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ColorFilterLayer::ColorFilterLayer() = default;

ColorFilterLayer::~ColorFilterLayer() = default;

void ColorFilterLayer::Paint(PaintContext& context) {
void ColorFilterLayer::Paint(PaintContext& context) const {
TRACE_EVENT0("flutter", "ColorFilterLayer::Paint");
FXL_DCHECK(needs_painting());

Expand Down
2 changes: 1 addition & 1 deletion flow/layers/color_filter_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ColorFilterLayer : public ContainerLayer {

void set_blend_mode(SkBlendMode blend_mode) { blend_mode_ = blend_mode; }

void Paint(PaintContext& context) override;
void Paint(PaintContext& context) const override;

private:
SkColor color_;
Expand Down
2 changes: 1 addition & 1 deletion flow/layers/layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class Layer {
const SkRect bounds_;
};

virtual void Paint(PaintContext& context) = 0;
virtual void Paint(PaintContext& context) const = 0;

#if defined(OS_FUCHSIA)
// Updates the system composited scene.
Expand Down
2 changes: 1 addition & 1 deletion flow/layers/layer_tree.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void LayerTree::UpdateScene(SceneUpdateContext& context,
}
#endif

void LayerTree::Paint(CompositorContext::ScopedFrame& frame) {
void LayerTree::Paint(CompositorContext::ScopedFrame& frame) const {
Layer::PaintContext context = {*frame.canvas(), frame.context().frame_time(),
frame.context().engine_time(),
frame.context().memory_usage(),
Expand Down
2 changes: 1 addition & 1 deletion flow/layers/layer_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class LayerTree {
scenic_lib::ContainerNode& container);
#endif

void Paint(CompositorContext::ScopedFrame& frame);
void Paint(CompositorContext::ScopedFrame& frame) const;

Layer* root_layer() const { return root_layer_.get(); }

Expand Down
2 changes: 1 addition & 1 deletion flow/layers/opacity_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ OpacityLayer::OpacityLayer() = default;

OpacityLayer::~OpacityLayer() = default;

void OpacityLayer::Paint(PaintContext& context) {
void OpacityLayer::Paint(PaintContext& context) const {
TRACE_EVENT0("flutter", "OpacityLayer::Paint");
FXL_DCHECK(needs_painting());

Expand Down
2 changes: 1 addition & 1 deletion flow/layers/opacity_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class OpacityLayer : public ContainerLayer {

void set_alpha(int alpha) { alpha_ = alpha; }

void Paint(PaintContext& context) override;
void Paint(PaintContext& context) const override;

// TODO(chinmaygarde): Once MZ-139 is addressed, introduce a new node in the
// session scene hierarchy.
Expand Down
2 changes: 1 addition & 1 deletion flow/layers/performance_overlay_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void VisualizeCounterValuesBytes(SkCanvas& canvas,
PerformanceOverlayLayer::PerformanceOverlayLayer(uint64_t options)
: options_(options) {}

void PerformanceOverlayLayer::Paint(PaintContext& context) {
void PerformanceOverlayLayer::Paint(PaintContext& context) const {
if (!options_)
return;

Expand Down
2 changes: 1 addition & 1 deletion flow/layers/performance_overlay_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class PerformanceOverlayLayer : public Layer {
public:
explicit PerformanceOverlayLayer(uint64_t options);

void Paint(PaintContext& context) override;
void Paint(PaintContext& context) const override;

private:
int options_;
Expand Down
2 changes: 1 addition & 1 deletion flow/layers/physical_model_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void PhysicalModelLayer::UpdateScene(SceneUpdateContext& context) {

#endif // defined(OS_FUCHSIA)

void PhysicalModelLayer::Paint(PaintContext& context) {
void PhysicalModelLayer::Paint(PaintContext& context) const {
TRACE_EVENT0("flutter", "PhysicalModelLayer::Paint");
FXL_DCHECK(needs_painting());

Expand Down
3 changes: 2 additions & 1 deletion flow/layers/physical_model_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class PhysicalModelLayer : public ContainerLayer {
SkScalar dpr);

void Preroll(PrerollContext* context, const SkMatrix& matrix) override;
void Paint(PaintContext& context) override;

void Paint(PaintContext& context) const override;

#if defined(OS_FUCHSIA)
void UpdateScene(SceneUpdateContext& context) override;
Expand Down
2 changes: 1 addition & 1 deletion flow/layers/picture_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void PictureLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {
set_paint_bounds(bounds);
}

void PictureLayer::Paint(PaintContext& context) {
void PictureLayer::Paint(PaintContext& context) const {
TRACE_EVENT0("flutter", "PictureLayer::Paint");
FXL_DCHECK(picture_);
FXL_DCHECK(needs_painting());
Expand Down
3 changes: 2 additions & 1 deletion flow/layers/picture_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ class PictureLayer : public Layer {
SkPicture* picture() const { return picture_.get(); }

void Preroll(PrerollContext* frame, const SkMatrix& matrix) override;
void Paint(PaintContext& context) override;

void Paint(PaintContext& context) const override;

private:
SkPoint offset_;
Expand Down
2 changes: 1 addition & 1 deletion flow/layers/shader_mask_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ShaderMaskLayer::ShaderMaskLayer() = default;

ShaderMaskLayer::~ShaderMaskLayer() = default;

void ShaderMaskLayer::Paint(PaintContext& context) {
void ShaderMaskLayer::Paint(PaintContext& context) const {
TRACE_EVENT0("flutter", "ShaderMaskLayer::Paint");
FXL_DCHECK(needs_painting());

Expand Down
2 changes: 1 addition & 1 deletion flow/layers/shader_mask_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ShaderMaskLayer : public ContainerLayer {

void set_blend_mode(SkBlendMode blend_mode) { blend_mode_ = blend_mode; }

void Paint(PaintContext& context) override;
void Paint(PaintContext& context) const override;

private:
sk_sp<SkShader> shader_;
Expand Down
2 changes: 1 addition & 1 deletion flow/layers/transform_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void TransformLayer::UpdateScene(SceneUpdateContext& context) {

#endif // defined(OS_FUCHSIA)

void TransformLayer::Paint(PaintContext& context) {
void TransformLayer::Paint(PaintContext& context) const {
TRACE_EVENT0("flutter", "TransformLayer::Paint");
FXL_DCHECK(needs_painting());

Expand Down
3 changes: 2 additions & 1 deletion flow/layers/transform_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class TransformLayer : public ContainerLayer {
void set_transform(const SkMatrix& transform) { transform_ = transform; }

void Preroll(PrerollContext* context, const SkMatrix& matrix) override;
void Paint(PaintContext& context) override;

void Paint(PaintContext& context) const override;

#if defined(OS_FUCHSIA)
void UpdateScene(SceneUpdateContext& context) override;
Expand Down

0 comments on commit a55aa23

Please sign in to comment.