1 // Copyright 2013 The Flutter Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef FLUTTER_FLOW_LAYERS_PHYSICAL_SHAPE_LAYER_H_ 6 #define FLUTTER_FLOW_LAYERS_PHYSICAL_SHAPE_LAYER_H_ 7 8 #include "flutter/flow/layers/container_layer.h" 9 10 namespace flutter { 11 12 class PhysicalShapeLayer : public ContainerLayer { 13 public: 14 PhysicalShapeLayer(SkColor color, 15 SkColor shadow_color, 16 SkScalar device_pixel_ratio, 17 float viewport_depth, 18 float elevation, 19 const SkPath& path, 20 Clip clip_behavior); 21 ~PhysicalShapeLayer() override; 22 23 static void DrawShadow(SkCanvas* canvas, 24 const SkPath& path, 25 SkColor color, 26 float elevation, 27 bool transparentOccluder, 28 SkScalar dpr); 29 30 void Preroll(PrerollContext* context, const SkMatrix& matrix) override; 31 32 void Paint(PaintContext& context) const override; 33 34 #if defined(OS_FUCHSIA) 35 void UpdateScene(SceneUpdateContext& context) override; 36 #endif // defined(OS_FUCHSIA) 37 38 private: 39 SkColor color_; 40 SkColor shadow_color_; 41 SkScalar device_pixel_ratio_; 42 float viewport_depth_; 43 float elevation_ = 0.0f; 44 float total_elevation_ = 0.0f; 45 SkPath path_; 46 bool isRect_; 47 SkRRect frameRRect_; 48 Clip clip_behavior_; 49 50 friend class PhysicalShapeLayer_TotalElevation_Test; 51 }; 52 53 } // namespace flutter 54 55 #endif // FLUTTER_FLOW_LAYERS_PHYSICAL_SHAPE_LAYER_H_ 56