Change the shadow elevation parameter to floating point (flutter/engine#3637)
This commit is contained in:
@@ -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 :
|
||||
|
||||
@@ -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_;
|
||||
};
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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()))
|
||||
|
||||
@@ -46,7 +46,7 @@ class SceneBuilder : public ftl::RefCountedThreadSafe<SceneBuilder>,
|
||||
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();
|
||||
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -159,7 +159,7 @@ class Canvas : public ftl::RefCountedThreadSafe<Canvas>,
|
||||
|
||||
void drawShadow(const CanvasPath* path,
|
||||
SkColor color,
|
||||
int elevation,
|
||||
double elevation,
|
||||
bool transparentOccluder);
|
||||
|
||||
SkCanvas* canvas() const { return canvas_; }
|
||||
|
||||
Reference in New Issue
Block a user