| 1 | /* | 
|---|
| 2 | * Copyright 2020 Google Inc. | 
|---|
| 3 | * | 
|---|
| 4 | * Use of this source code is governed by a BSD-style license that can be | 
|---|
| 5 | * found in the LICENSE file. | 
|---|
| 6 | */ | 
|---|
| 7 |  | 
|---|
| 8 | #ifndef GrSDFTOptions_DEFINED | 
|---|
| 9 | #define GrSDFTOptions_DEFINED | 
|---|
| 10 |  | 
|---|
| 11 | #include "include/core/SkFont.h" | 
|---|
| 12 | #include "include/core/SkScalar.h" | 
|---|
| 13 |  | 
|---|
| 14 | class SkMatrix; | 
|---|
| 15 | class SkSurfaceProps; | 
|---|
| 16 |  | 
|---|
| 17 | class GrSDFTOptions { | 
|---|
| 18 | public: | 
|---|
| 19 | GrSDFTOptions(SkScalar min, SkScalar max); | 
|---|
| 20 |  | 
|---|
| 21 | bool canDrawAsDistanceFields(const SkPaint&, const SkFont&, const SkMatrix& viewMatrix, | 
|---|
| 22 | const SkSurfaceProps& props, | 
|---|
| 23 | bool contextSupportsDistanceFieldText) const; | 
|---|
| 24 | SkFont getSDFFont(const SkFont& font, | 
|---|
| 25 | const SkMatrix& viewMatrix, | 
|---|
| 26 | SkScalar* ) const; | 
|---|
| 27 | std::pair<SkScalar, SkScalar> computeSDFMinMaxScale( | 
|---|
| 28 | SkScalar textSize, const SkMatrix& viewMatrix) const; | 
|---|
| 29 | private: | 
|---|
| 30 | // Below this size (in device space) distance field text will not be used. | 
|---|
| 31 | const SkScalar fMinDistanceFieldFontSize; | 
|---|
| 32 |  | 
|---|
| 33 | // Above this size (in device space) distance field text will not be used and glyphs will | 
|---|
| 34 | // be rendered from outline as individual paths. | 
|---|
| 35 | const SkScalar fMaxDistanceFieldFontSize; | 
|---|
| 36 | }; | 
|---|
| 37 |  | 
|---|
| 38 | #endif  // GrSDFTOptions_DEFINED | 
|---|
| 39 |  | 
|---|