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 "effects/GrBicubicEffect.h" | 10 #include "effects/GrBicubicEffect.h" |
11 #include "effects/GrDashingEffect.h" | 11 #include "effects/GrDashingEffect.h" |
12 #include "effects/GrPorterDuffXferProcessor.h" | |
13 #include "effects/GrTextureDomain.h" | 12 #include "effects/GrTextureDomain.h" |
14 #include "effects/GrSimpleTextureEffect.h" | 13 #include "effects/GrSimpleTextureEffect.h" |
15 | 14 |
16 #include "GrContext.h" | 15 #include "GrContext.h" |
17 #include "GrBitmapTextContext.h" | 16 #include "GrBitmapTextContext.h" |
18 #include "GrDistanceFieldTextContext.h" | 17 #include "GrDistanceFieldTextContext.h" |
19 #include "GrLayerHoister.h" | 18 #include "GrLayerHoister.h" |
20 #include "GrRecordReplaceDraw.h" | 19 #include "GrRecordReplaceDraw.h" |
21 #include "GrStrokeInfo.h" | 20 #include "GrStrokeInfo.h" |
22 #include "GrTracing.h" | 21 #include "GrTracing.h" |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
672 SkRect clipRect = SkRect::MakeWH(maskRect.width(), maskRect.height()); | 671 SkRect clipRect = SkRect::MakeWH(maskRect.width(), maskRect.height()); |
673 | 672 |
674 GrContext::AutoRenderTarget art(context, mask->asRenderTarget()); | 673 GrContext::AutoRenderTarget art(context, mask->asRenderTarget()); |
675 GrContext::AutoClip ac(context, clipRect); | 674 GrContext::AutoClip ac(context, clipRect); |
676 | 675 |
677 context->clear(NULL, 0x0, true, mask->asRenderTarget()); | 676 context->clear(NULL, 0x0, true, mask->asRenderTarget()); |
678 | 677 |
679 GrPaint tempPaint; | 678 GrPaint tempPaint; |
680 if (doAA) { | 679 if (doAA) { |
681 tempPaint.setAntiAlias(true); | 680 tempPaint.setAntiAlias(true); |
682 // AA uses the "coverage" stages on GrDrawTarget. Coverage with a dst | 681 tempPaint.setCoverageSetOpXPFactory(SkRegion::kUnion_Op); |
bsalomon
2015/02/14 20:45:59
I know we spent time figuring out that this is uni
bsalomon
2015/02/17 13:58:13
Also, we should install this XP unconditionally. I
egdaniel
2015/02/17 14:43:01
Do we still want to set aa on the paint? Should it
| |
683 // blend coeff of zero requires dual source blending support in order | |
684 // to properly blend partially covered pixels. This means the AA | |
685 // code path may not be taken. So we use a dst blend coeff of ISA. We | |
686 // could special case AA draws to a dst surface with known alpha=0 to | |
687 // use a zero dst coeff when dual source blending isn't available. | |
688 tempPaint.setPorterDuffXPFactory(kOne_GrBlendCoeff, kISC_GrBlendCoeff); | |
689 } | 682 } |
690 | 683 |
691 // Draw the mask into maskTexture with the path's top-left at the origin usi ng tempPaint. | 684 // Draw the mask into maskTexture with the path's top-left at the origin usi ng tempPaint. |
692 SkMatrix translate; | 685 SkMatrix translate; |
693 translate.setTranslate(-maskRect.fLeft, -maskRect.fTop); | 686 translate.setTranslate(-maskRect.fLeft, -maskRect.fTop); |
694 context->drawPath(tempPaint, translate, devPath, strokeInfo); | 687 context->drawPath(tempPaint, translate, devPath, strokeInfo); |
695 return mask; | 688 return mask; |
696 } | 689 } |
697 | 690 |
698 SkBitmap wrap_texture(GrTexture* texture) { | 691 SkBitmap wrap_texture(GrTexture* texture) { |
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1904 #endif | 1897 #endif |
1905 } | 1898 } |
1906 | 1899 |
1907 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { | 1900 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { |
1908 // We always return a transient cache, so it is freed after each | 1901 // We always return a transient cache, so it is freed after each |
1909 // filter traversal. | 1902 // filter traversal. |
1910 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); | 1903 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); |
1911 } | 1904 } |
1912 | 1905 |
1913 #endif | 1906 #endif |
OLD | NEW |