From c0f1e3b47b42d9db6f1422ebe17345e22425033d Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Thu, 27 Apr 2017 10:52:13 -0700 Subject: [PATCH] Change the shadow elevation parameter to floating point (#3637) --- flow/layers/physical_model_layer.cc | 2 +- flow/layers/physical_model_layer.h | 6 +++--- lib/ui/compositing.dart | 4 ++-- lib/ui/compositing/scene_builder.cc | 2 +- lib/ui/compositing/scene_builder.h | 2 +- lib/ui/painting.dart | 4 ++-- lib/ui/painting/canvas.cc | 2 +- lib/ui/painting/canvas.h | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/flow/layers/physical_model_layer.cc b/flow/layers/physical_model_layer.cc index b77482ee70..e02c803b74 100644 --- a/flow/layers/physical_model_layer.cc +++ b/flow/layers/physical_model_layer.cc @@ -72,7 +72,7 @@ void PhysicalModelLayer::Paint(PaintContext& context) { } void PhysicalModelLayer::DrawShadow(SkCanvas* canvas, const SkPath& path, - SkColor color, int elevation, + SkColor color, double elevation, bool transparentOccluder) { SkShadowFlags flags = transparentOccluder ? SkShadowFlags::kTransparentOccluder_ShadowFlag : diff --git a/flow/layers/physical_model_layer.h b/flow/layers/physical_model_layer.h index bdd10971f6..138dd8171f 100644 --- a/flow/layers/physical_model_layer.h +++ b/flow/layers/physical_model_layer.h @@ -15,11 +15,11 @@ class PhysicalModelLayer : public ContainerLayer { ~PhysicalModelLayer() override; void set_rrect(const SkRRect& rrect) { rrect_ = rrect; } - void set_elevation(int elevation) { elevation_ = elevation; } + void set_elevation(double elevation) { elevation_ = elevation; } void set_color(SkColor color) { color_ = color; } static void DrawShadow(SkCanvas* canvas, const SkPath& path, - SkColor color, int elevation, bool transparentOccluder); + SkColor color, double elevation, bool transparentOccluder); protected: void Preroll(PrerollContext* context, const SkMatrix& matrix) override; @@ -32,7 +32,7 @@ class PhysicalModelLayer : public ContainerLayer { private: SkRRect rrect_; - int elevation_; + double elevation_; SkColor color_; }; diff --git a/lib/ui/compositing.dart b/lib/ui/compositing.dart index cab886f5c2..e65e55235b 100644 --- a/lib/ui/compositing.dart +++ b/lib/ui/compositing.dart @@ -132,11 +132,11 @@ class SceneBuilder extends NativeFieldWrapperClass2 { /// Rasterization will be clipped to the given shape. /// /// See [pop] for details about the operation stack. - void pushPhysicalModel({ RRect rrect, int elevation, Color color }) { + void pushPhysicalModel({ RRect rrect, double elevation, Color color }) { _pushPhysicalModel(rrect._value, elevation, color.value); } void _pushPhysicalModel(Float32List rrect, - int elevation, + double elevation, int color) native "SceneBuilder_pushPhysicalModel"; /// Ends the effect of the most recently pushed operation. diff --git a/lib/ui/compositing/scene_builder.cc b/lib/ui/compositing/scene_builder.cc index 13f2fc29f1..205292377b 100644 --- a/lib/ui/compositing/scene_builder.cc +++ b/lib/ui/compositing/scene_builder.cc @@ -155,7 +155,7 @@ void SceneBuilder::pushShaderMask(Shader* shader, } void SceneBuilder::pushPhysicalModel(const RRect& rrect, - int elevation, + double elevation, int color) { SkRect cullRect; if (!cullRect.intersect(rrect.sk_rrect.rect(), m_cullRects.top())) diff --git a/lib/ui/compositing/scene_builder.h b/lib/ui/compositing/scene_builder.h index 0166800cf5..dc4fb31eca 100644 --- a/lib/ui/compositing/scene_builder.h +++ b/lib/ui/compositing/scene_builder.h @@ -46,7 +46,7 @@ class SceneBuilder : public ftl::RefCountedThreadSafe, double maskRectTop, double maskRectBottom, int blendMode); - void pushPhysicalModel(const RRect& rrect, int elevation, int color); + void pushPhysicalModel(const RRect& rrect, double elevation, int color); void pop(); diff --git a/lib/ui/painting.dart b/lib/ui/painting.dart index 1e635ffcb2..bfd612cc8e 100644 --- a/lib/ui/painting.dart +++ b/lib/ui/painting.dart @@ -1608,13 +1608,13 @@ class Canvas extends NativeFieldWrapperClass2 { /// Draws a shadow for a [Path] representing the given material elevation. /// /// transparentOccluder should be true if the occluding object is not opaque. - void drawShadow(Path path, Color color, int elevation, bool transparentOccluder) { + void drawShadow(Path path, Color color, double elevation, bool transparentOccluder) { _drawShadow(path, color.value, elevation, transparentOccluder); } void _drawShadow(Path path, int color, - int elevation, + double elevation, bool transparentOccluder) native "Canvas_drawShadow"; } diff --git a/lib/ui/painting/canvas.cc b/lib/ui/painting/canvas.cc index 34d48d0c35..43add7a989 100644 --- a/lib/ui/painting/canvas.cc +++ b/lib/ui/painting/canvas.cc @@ -380,7 +380,7 @@ void Canvas::drawAtlas(const Paint& paint, void Canvas::drawShadow(const CanvasPath* path, SkColor color, - int elevation, + double elevation, bool transparentOccluder) { flow::PhysicalModelLayer::DrawShadow(canvas_, path->path(), diff --git a/lib/ui/painting/canvas.h b/lib/ui/painting/canvas.h index a47b28d8dd..f10e3ac283 100644 --- a/lib/ui/painting/canvas.h +++ b/lib/ui/painting/canvas.h @@ -159,7 +159,7 @@ class Canvas : public ftl::RefCountedThreadSafe, void drawShadow(const CanvasPath* path, SkColor color, - int elevation, + double elevation, bool transparentOccluder); SkCanvas* canvas() const { return canvas_; } -- GitLab