OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkGpuDevice.h" | 8 #include "SkGpuDevice.h" |
9 | 9 |
10 #include "GrBlurUtils.h" | 10 #include "GrBlurUtils.h" |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 bool doStroke = paint.getStyle() != SkPaint::kFill_Style; | 481 bool doStroke = paint.getStyle() != SkPaint::kFill_Style; |
482 SkScalar width = paint.getStrokeWidth(); | 482 SkScalar width = paint.getStrokeWidth(); |
483 | 483 |
484 /* | 484 /* |
485 We have special code for hairline strokes, miter-strokes, bevel-stroke | 485 We have special code for hairline strokes, miter-strokes, bevel-stroke |
486 and fills. Anything else we just call our path code. | 486 and fills. Anything else we just call our path code. |
487 */ | 487 */ |
488 bool usePath = doStroke && width > 0 && | 488 bool usePath = doStroke && width > 0 && |
489 (paint.getStrokeJoin() == SkPaint::kRound_Join || | 489 (paint.getStrokeJoin() == SkPaint::kRound_Join || |
490 (paint.getStrokeJoin() == SkPaint::kBevel_Join && rect.isEmp
ty())); | 490 (paint.getStrokeJoin() == SkPaint::kBevel_Join && rect.isEmp
ty())); |
491 // another two reasons we might need to call drawPath... | |
492 | 491 |
493 if (paint.getMaskFilter()) { | 492 // a few other reasons we might need to call drawPath... |
| 493 if (paint.getMaskFilter() || |
| 494 paint.getStyle() == SkPaint::kStrokeAndFill_Style) { // we can't both st
roke and fill rects |
494 usePath = true; | 495 usePath = true; |
495 } | 496 } |
496 | 497 |
497 if (!usePath && paint.isAntiAlias() && !draw.fMatrix->rectStaysRect()) { | 498 if (!usePath && paint.isAntiAlias() && !draw.fMatrix->rectStaysRect()) { |
498 #ifdef SHADER_AA_FILL_RECT | |
499 if (doStroke) { | |
500 #endif | |
501 usePath = true; | |
502 #ifdef SHADER_AA_FILL_RECT | |
503 } else { | |
504 usePath = !draw.fMatrix->preservesRightAngles(); | |
505 } | |
506 #endif | |
507 } | |
508 // until we can both stroke and fill rectangles | |
509 if (paint.getStyle() == SkPaint::kStrokeAndFill_Style) { | |
510 usePath = true; | 499 usePath = true; |
511 } | 500 } |
512 | 501 |
513 GrStrokeInfo strokeInfo(paint); | 502 GrStrokeInfo strokeInfo(paint); |
514 | 503 |
515 const SkPathEffect* pe = paint.getPathEffect(); | 504 const SkPathEffect* pe = paint.getPathEffect(); |
516 if (!usePath && pe && !strokeInfo.isDashed()) { | 505 if (!usePath && pe && !strokeInfo.isDashed()) { |
517 usePath = true; | 506 usePath = true; |
518 } | 507 } |
519 | 508 |
(...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1898 #endif | 1887 #endif |
1899 } | 1888 } |
1900 | 1889 |
1901 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { | 1890 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { |
1902 // We always return a transient cache, so it is freed after each | 1891 // We always return a transient cache, so it is freed after each |
1903 // filter traversal. | 1892 // filter traversal. |
1904 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); | 1893 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); |
1905 } | 1894 } |
1906 | 1895 |
1907 #endif | 1896 #endif |
OLD | NEW |