| 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 #include "GrShape.h" | 8 #include "GrShape.h" |
| 9 | 9 |
| 10 GrShape& GrShape::operator=(const GrShape& that) { | 10 GrShape& GrShape::operator=(const GrShape& that) { |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 SkAssertResult(parent.fStyle.applyToPath(fPath.get(), &fillOrHairline, *
srcForParentStyle, | 274 SkAssertResult(parent.fStyle.applyToPath(fPath.get(), &fillOrHairline, *
srcForParentStyle, |
| 275 scale)); | 275 scale)); |
| 276 fStyle.resetToInitStyle(fillOrHairline); | 276 fStyle.resetToInitStyle(fillOrHairline); |
| 277 } | 277 } |
| 278 this->attemptToReduceFromPath(); | 278 this->attemptToReduceFromPath(); |
| 279 this->setInheritedKey(*parentForKey, apply, scale); | 279 this->setInheritedKey(*parentForKey, apply, scale); |
| 280 } | 280 } |
| 281 | 281 |
| 282 static inline bool rrect_path_is_inverse_filled(const SkPath& path, const SkStro
keRec& strokeRec, | 282 static inline bool rrect_path_is_inverse_filled(const SkPath& path, const SkStro
keRec& strokeRec, |
| 283 const SkPathEffect* pe) { | 283 const SkPathEffect* pe) { |
| 284 // Dashing doesn't use the path fill type. Dashing only works with stroking | 284 // This is currently imitating the questionable behavior of the sw-rasterize
r. Inverseness is |
| 285 // respected for stroking but not dashing + stroking. (We make no assumption
s about arbitrary |
| 286 // path effects and preserve the path's inverseness.) |
| 287 // skbug.com/5421 |
| 285 if (pe && pe->asADash(nullptr)) { | 288 if (pe && pe->asADash(nullptr)) { |
| 286 pe = nullptr; | 289 SkDEBUGCODE(SkStrokeRec::Style style = strokeRec.getStyle();) |
| 290 SkASSERT(SkStrokeRec::kStroke_Style == style || SkStrokeRec::kHairline_S
tyle == style); |
| 291 return false; |
| 287 } | 292 } |
| 288 | 293 |
| 289 SkStrokeRec::Style style = strokeRec.getStyle(); | |
| 290 if (!pe && (SkStrokeRec::kStroke_Style == style || SkStrokeRec::kHairline_St
yle == style)) { | |
| 291 // stroking ignores the path fill rule. | |
| 292 return false; | |
| 293 } | |
| 294 return path.isInverseFillType(); | 294 return path.isInverseFillType(); |
| 295 } | 295 } |
| 296 | 296 |
| 297 GrShape::Type GrShape::AttemptToReduceFromPathImpl(const SkPath& path, SkRRect*
rrect, | 297 GrShape::Type GrShape::AttemptToReduceFromPathImpl(const SkPath& path, SkRRect*
rrect, |
| 298 SkPath::Direction* rrectDir, | 298 SkPath::Direction* rrectDir, |
| 299 unsigned* rrectStart, | 299 unsigned* rrectStart, |
| 300 bool* rrectIsInverted, | 300 bool* rrectIsInverted, |
| 301 const SkPathEffect* pe, | 301 const SkPathEffect* pe, |
| 302 const SkStrokeRec& strokeRec)
{ | 302 const SkStrokeRec& strokeRec)
{ |
| 303 if (path.isEmpty()) { | 303 if (path.isEmpty()) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 // Since there is no path effect the dir and start index is imma
terial. | 349 // Since there is no path effect the dir and start index is imma
terial. |
| 350 *rrectDir = kDefaultRRectDir; | 350 *rrectDir = kDefaultRRectDir; |
| 351 *rrectStart = kDefaultRRectStart; | 351 *rrectStart = kDefaultRRectStart; |
| 352 *rrectIsInverted = rrect_path_is_inverse_filled(path, strokeRec,
pe); | 352 *rrectIsInverted = rrect_path_is_inverse_filled(path, strokeRec,
pe); |
| 353 return Type::kRRect; | 353 return Type::kRRect; |
| 354 } | 354 } |
| 355 } | 355 } |
| 356 } | 356 } |
| 357 return Type::kPath; | 357 return Type::kPath; |
| 358 } | 358 } |
| OLD | NEW |