Make flow::Layer::Paint const. (flutter/engine#4200)

This commit is contained in:
Chinmay Garde
2017-10-11 16:48:31 -07:00
committed by GitHub
parent 5020651ee0
commit eac6438ce8
27 changed files with 32 additions and 27 deletions

View File

@@ -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());

View File

@@ -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_;

View File

@@ -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.";
}

View File

@@ -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;

View File

@@ -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());

View File

@@ -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;

View File

@@ -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());

View File

@@ -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;

View File

@@ -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());

View File

@@ -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;

View File

@@ -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());

View File

@@ -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_;

View File

@@ -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.

View File

@@ -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(),

View File

@@ -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(); }

View File

@@ -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());

View File

@@ -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.

View File

@@ -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;

View File

@@ -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_;

View File

@@ -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());

View File

@@ -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;

View File

@@ -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());

View File

@@ -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_;

View File

@@ -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());

View File

@@ -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_;

View File

@@ -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());

View File

@@ -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;