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

Commit c0f1e3b

Browse files
Change the shadow elevation parameter to floating point (#3637)
1 parent 8d6ded4 commit c0f1e3b

File tree

8 files changed

+12
-12
lines changed

8 files changed

+12
-12
lines changed

flow/layers/physical_model_layer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void PhysicalModelLayer::Paint(PaintContext& context) {
7272
}
7373

7474
void PhysicalModelLayer::DrawShadow(SkCanvas* canvas, const SkPath& path,
75-
SkColor color, int elevation,
75+
SkColor color, double elevation,
7676
bool transparentOccluder) {
7777
SkShadowFlags flags = transparentOccluder ?
7878
SkShadowFlags::kTransparentOccluder_ShadowFlag :

flow/layers/physical_model_layer.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ class PhysicalModelLayer : public ContainerLayer {
1515
~PhysicalModelLayer() override;
1616

1717
void set_rrect(const SkRRect& rrect) { rrect_ = rrect; }
18-
void set_elevation(int elevation) { elevation_ = elevation; }
18+
void set_elevation(double elevation) { elevation_ = elevation; }
1919
void set_color(SkColor color) { color_ = color; }
2020

2121
static void DrawShadow(SkCanvas* canvas, const SkPath& path,
22-
SkColor color, int elevation, bool transparentOccluder);
22+
SkColor color, double elevation, bool transparentOccluder);
2323

2424
protected:
2525
void Preroll(PrerollContext* context, const SkMatrix& matrix) override;
@@ -32,7 +32,7 @@ class PhysicalModelLayer : public ContainerLayer {
3232

3333
private:
3434
SkRRect rrect_;
35-
int elevation_;
35+
double elevation_;
3636
SkColor color_;
3737
};
3838

lib/ui/compositing.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,11 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
132132
/// Rasterization will be clipped to the given shape.
133133
///
134134
/// See [pop] for details about the operation stack.
135-
void pushPhysicalModel({ RRect rrect, int elevation, Color color }) {
135+
void pushPhysicalModel({ RRect rrect, double elevation, Color color }) {
136136
_pushPhysicalModel(rrect._value, elevation, color.value);
137137
}
138138
void _pushPhysicalModel(Float32List rrect,
139-
int elevation,
139+
double elevation,
140140
int color) native "SceneBuilder_pushPhysicalModel";
141141

142142
/// Ends the effect of the most recently pushed operation.

lib/ui/compositing/scene_builder.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ void SceneBuilder::pushShaderMask(Shader* shader,
155155
}
156156

157157
void SceneBuilder::pushPhysicalModel(const RRect& rrect,
158-
int elevation,
158+
double elevation,
159159
int color) {
160160
SkRect cullRect;
161161
if (!cullRect.intersect(rrect.sk_rrect.rect(), m_cullRects.top()))

lib/ui/compositing/scene_builder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class SceneBuilder : public ftl::RefCountedThreadSafe<SceneBuilder>,
4646
double maskRectTop,
4747
double maskRectBottom,
4848
int blendMode);
49-
void pushPhysicalModel(const RRect& rrect, int elevation, int color);
49+
void pushPhysicalModel(const RRect& rrect, double elevation, int color);
5050

5151
void pop();
5252

lib/ui/painting.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,13 +1608,13 @@ class Canvas extends NativeFieldWrapperClass2 {
16081608
/// Draws a shadow for a [Path] representing the given material elevation.
16091609
///
16101610
/// transparentOccluder should be true if the occluding object is not opaque.
1611-
void drawShadow(Path path, Color color, int elevation, bool transparentOccluder) {
1611+
void drawShadow(Path path, Color color, double elevation, bool transparentOccluder) {
16121612
_drawShadow(path, color.value, elevation, transparentOccluder);
16131613
}
16141614

16151615
void _drawShadow(Path path,
16161616
int color,
1617-
int elevation,
1617+
double elevation,
16181618
bool transparentOccluder) native "Canvas_drawShadow";
16191619
}
16201620

lib/ui/painting/canvas.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ void Canvas::drawAtlas(const Paint& paint,
380380

381381
void Canvas::drawShadow(const CanvasPath* path,
382382
SkColor color,
383-
int elevation,
383+
double elevation,
384384
bool transparentOccluder) {
385385
flow::PhysicalModelLayer::DrawShadow(canvas_,
386386
path->path(),

lib/ui/painting/canvas.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class Canvas : public ftl::RefCountedThreadSafe<Canvas>,
159159

160160
void drawShadow(const CanvasPath* path,
161161
SkColor color,
162-
int elevation,
162+
double elevation,
163163
bool transparentOccluder);
164164

165165
SkCanvas* canvas() const { return canvas_; }

0 commit comments

Comments
 (0)