Flutter Engine
physical_shape_layer.h
Go to the documentation of this file.
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 
13  public:
14  PhysicalShapeLayer(SkColor color,
15  SkColor shadow_color,
16  float elevation,
17  const SkPath& path,
18  Clip clip_behavior);
19 
20  static SkRect ComputeShadowBounds(const SkRect& bounds,
21  float elevation,
22  float pixel_ratio);
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  bool UsesSaveLayer() const {
35  return clip_behavior_ == Clip::antiAliasWithSaveLayer;
36  }
37 
38  float elevation() const { return elevation_; }
39 
40  private:
41  SkColor color_;
42  SkColor shadow_color_;
43  float elevation_ = 0.0f;
44  SkPath path_;
45  Clip clip_behavior_;
46 };
47 
48 } // namespace flutter
49 
50 #endif // FLUTTER_FLOW_LAYERS_PHYSICAL_SHAPE_LAYER_H_
DEF_SWITCHES_START snapshot asset path
Definition: switches.h:32
static SkRect ComputeShadowBounds(const SkRect &bounds, float elevation, float pixel_ratio)
void Preroll(PrerollContext *context, const SkMatrix &matrix) override
void Paint(PaintContext &context) const override
static void DrawShadow(SkCanvas *canvas, const SkPath &path, SkColor color, float elevation, bool transparentOccluder, SkScalar dpr)
Clip
Definition: layer.h:41
PhysicalShapeLayer(SkColor color, SkColor shadow_color, float elevation, const SkPath &path, Clip clip_behavior)