| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrShape_DEFINED | 8 #ifndef GrShape_DEFINED |
| 9 #define GrShape_DEFINED | 9 #define GrShape_DEFINED |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 * to geometric information and is included in the new shape's key. When the sam
e style is applied | 27 * to geometric information and is included in the new shape's key. When the sam
e style is applied |
| 28 * to two shapes that reflect the same underlying geometry the computed keys of
the stylized shapes | 28 * to two shapes that reflect the same underlying geometry the computed keys of
the stylized shapes |
| 29 * will be the same. | 29 * will be the same. |
| 30 * | 30 * |
| 31 * Currently this can only be constructed from a path, rect, or rrect though it
can become a path | 31 * Currently this can only be constructed from a path, rect, or rrect though it
can become a path |
| 32 * applying style to the geometry. The idea is to expand this to cover most or a
ll of the geometries | 32 * applying style to the geometry. The idea is to expand this to cover most or a
ll of the geometries |
| 33 * that have SkCanvas::draw APIs. | 33 * that have SkCanvas::draw APIs. |
| 34 */ | 34 */ |
| 35 class GrShape { | 35 class GrShape { |
| 36 public: | 36 public: |
| 37 // Keys for paths may be extracted from the path data for small paths. Clien
ts aren't supposed |
| 38 // to have to worry about this. This value is exposed for unit tests. |
| 39 static constexpr int kMaxKeyFromDataVerbCnt = 10; |
| 40 |
| 37 GrShape() { this->initType(Type::kEmpty); } | 41 GrShape() { this->initType(Type::kEmpty); } |
| 38 | 42 |
| 39 explicit GrShape(const SkPath& path) : GrShape(path, GrStyle::SimpleFill())
{} | 43 explicit GrShape(const SkPath& path) : GrShape(path, GrStyle::SimpleFill())
{} |
| 40 | 44 |
| 41 explicit GrShape(const SkRRect& rrect) : GrShape(rrect, GrStyle::SimpleFill(
)) {} | 45 explicit GrShape(const SkRRect& rrect) : GrShape(rrect, GrStyle::SimpleFill(
)) {} |
| 42 | 46 |
| 43 explicit GrShape(const SkRect& rect) : GrShape(rect, GrStyle::SimpleFill())
{} | 47 explicit GrShape(const SkRect& rect) : GrShape(rect, GrStyle::SimpleFill())
{} |
| 44 | 48 |
| 45 GrShape(const SkPath& path, const GrStyle& style) : fStyle(style) { | 49 GrShape(const SkPath& path, const GrStyle& style) : fStyle(style) { |
| 46 this->initType(Type::kPath, &path); | 50 this->initType(Type::kPath, &path); |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 } fPathData; | 454 } fPathData; |
| 451 struct { | 455 struct { |
| 452 SkPoint fPts[2]; | 456 SkPoint fPts[2]; |
| 453 bool fInverted; | 457 bool fInverted; |
| 454 } fLineData; | 458 } fLineData; |
| 455 }; | 459 }; |
| 456 GrStyle fStyle; | 460 GrStyle fStyle; |
| 457 SkAutoSTArray<8, uint32_t> fInheritedKey; | 461 SkAutoSTArray<8, uint32_t> fInheritedKey; |
| 458 }; | 462 }; |
| 459 #endif | 463 #endif |
| OLD | NEW |