| 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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 } | 669 } |
| 671 | 670 |
| 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 tempPaint.setAntiAlias(doAA); |
| 681 tempPaint.setAntiAlias(true); | 680 tempPaint.setCoverageSetOpXPFactory(SkRegion::kReplace_Op); |
| 682 // AA uses the "coverage" stages on GrDrawTarget. Coverage with a dst | |
| 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 } | |
| 690 | 681 |
| 691 // Draw the mask into maskTexture with the path's top-left at the origin usi
ng tempPaint. | 682 // Draw the mask into maskTexture with the path's top-left at the origin usi
ng tempPaint. |
| 692 SkMatrix translate; | 683 SkMatrix translate; |
| 693 translate.setTranslate(-maskRect.fLeft, -maskRect.fTop); | 684 translate.setTranslate(-maskRect.fLeft, -maskRect.fTop); |
| 694 context->drawPath(tempPaint, translate, devPath, strokeInfo); | 685 context->drawPath(tempPaint, translate, devPath, strokeInfo); |
| 695 return mask; | 686 return mask; |
| 696 } | 687 } |
| 697 | 688 |
| 698 SkBitmap wrap_texture(GrTexture* texture) { | 689 SkBitmap wrap_texture(GrTexture* texture) { |
| 699 SkBitmap result; | 690 SkBitmap result; |
| (...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1904 #endif | 1895 #endif |
| 1905 } | 1896 } |
| 1906 | 1897 |
| 1907 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { | 1898 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { |
| 1908 // We always return a transient cache, so it is freed after each | 1899 // We always return a transient cache, so it is freed after each |
| 1909 // filter traversal. | 1900 // filter traversal. |
| 1910 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); | 1901 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); |
| 1911 } | 1902 } |
| 1912 | 1903 |
| 1913 #endif | 1904 #endif |
| OLD | NEW |