• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 Google LLC.
2 #ifndef Decorations_DEFINED
3 #define Decorations_DEFINED
4 
5 #include "include/core/SkCanvas.h"
6 #include "include/core/SkPath.h"
7 #include "modules/skparagraph/include/TextStyle.h"
8 #include "modules/skparagraph/src/TextLine.h"
9 
10 namespace skia {
11 namespace textlayout {
12 
13 class Decorations {
14     public:
15     void paint(SkCanvas* canvas, const TextStyle& textStyle, const TextLine::ClipContext& context, SkScalar baseline);
16 
17     private:
18 
19     void calculateThickness(TextStyle textStyle, sk_sp<SkTypeface> typeface);
20     void calculatePosition(TextDecoration decoration, SkScalar ascent);
21     void calculatePaint(const TextStyle& textStyle);
22     void calculateWaves(const TextStyle& textStyle, SkRect clip);
23     void calculateGaps(const TextLine::ClipContext& context, const SkRect& rect, SkScalar baseline, SkScalar halo);
24 
25     SkScalar fThickness;
26     SkScalar fPosition;
27 
28     SkFontMetrics fFontMetrics;
29     SkPaint fPaint;
30     SkPath fPath;
31 };
32 }  // namespace textlayout
33 }  // namespace skia
34 #endif
35