Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: src/gpu/GrShape.h

Issue 2357643002: Make GrShape compute keys for short paths from path data instead of using the gen id. (Closed)
Patch Set: Address comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrPath.cpp ('k') | src/gpu/GrShape.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/gpu/GrPath.cpp ('k') | src/gpu/GrShape.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698