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 SkPath& path,
21  float elevation,
22  SkScalar dpr,
23  const SkMatrix& ctm);
24  static void DrawShadow(SkCanvas* canvas,
25  const SkPath& path,
26  SkColor color,
27  float elevation,
28  bool transparentOccluder,
29  SkScalar dpr);
30 
31 #ifdef FLUTTER_ENABLE_DIFF_CONTEXT
32 
33  void Diff(DiffContext* context, const Layer* old_layer) override;
34 
35 #endif // FLUTTER_ENABLE_DIFF_CONTEXT
36 
37  void Preroll(PrerollContext* context, const SkMatrix& matrix) override;
38 
39  void Paint(PaintContext& context) const override;
40 
41  bool UsesSaveLayer() const {
42  return clip_behavior_ == Clip::antiAliasWithSaveLayer;
43  }
44 
45  float elevation() const { return elevation_; }
46 
47  private:
48  SkColor color_;
49  SkColor shadow_color_;
50  float elevation_ = 0.0f;
51  SkPath path_;
52  Clip clip_behavior_;
53 };
54 
55 } // namespace flutter
56 
57 #endif // FLUTTER_FLOW_LAYERS_PHYSICAL_SHAPE_LAYER_H_
DEF_SWITCHES_START snapshot asset path
Definition: switches.h:32
static SkRect ComputeShadowBounds(const SkPath &path, float elevation, SkScalar dpr, const SkMatrix &ctm)
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:40
PhysicalShapeLayer(SkColor color, SkColor shadow_color, float elevation, const SkPath &path, Clip clip_behavior)