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/GrTextureDomain.h" | 12 #include "effects/GrTextureDomain.h" |
13 #include "effects/GrSimpleTextureEffect.h" | 13 #include "effects/GrSimpleTextureEffect.h" |
14 | 14 |
15 #include "GrContext.h" | 15 #include "GrContext.h" |
16 #include "GrBitmapTextContext.h" | 16 #include "GrBitmapTextContext.h" |
17 #include "GrDistanceFieldTextContext.h" | 17 #include "GrDistanceFieldTextContext.h" |
18 #include "GrLayerCache.h" | 18 #include "GrLayerCache.h" |
19 #include "GrLayerHoister.h" | 19 #include "GrLayerHoister.h" |
20 #include "GrPictureUtils.h" | 20 #include "GrPictureUtils.h" |
21 #include "GrRecordReplaceDraw.h" | 21 #include "GrRecordReplaceDraw.h" |
22 #include "GrStrokeInfo.h" | 22 #include "GrStrokeInfo.h" |
23 #include "GrTracing.h" | 23 #include "GrTracing.h" |
24 #include "GrGpu.h" | |
24 | 25 |
25 #include "SkGrTexturePixelRef.h" | 26 #include "SkGrTexturePixelRef.h" |
26 | 27 |
27 #include "SkDeviceImageFilterProxy.h" | 28 #include "SkDeviceImageFilterProxy.h" |
28 #include "SkDrawProcs.h" | 29 #include "SkDrawProcs.h" |
29 #include "SkGlyphCache.h" | 30 #include "SkGlyphCache.h" |
30 #include "SkImageFilter.h" | 31 #include "SkImageFilter.h" |
31 #include "SkMaskFilter.h" | 32 #include "SkMaskFilter.h" |
32 #include "SkPathEffect.h" | 33 #include "SkPathEffect.h" |
33 #include "SkPicture.h" | 34 #include "SkPicture.h" |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
640 bool create_mask_GPU(GrContext* context, | 641 bool create_mask_GPU(GrContext* context, |
641 const SkRect& maskRect, | 642 const SkRect& maskRect, |
642 const SkPath& devPath, | 643 const SkPath& devPath, |
643 const GrStrokeInfo& strokeInfo, | 644 const GrStrokeInfo& strokeInfo, |
644 bool doAA, | 645 bool doAA, |
645 GrAutoScratchTexture* mask) { | 646 GrAutoScratchTexture* mask) { |
646 GrTextureDesc desc; | 647 GrTextureDesc desc; |
647 desc.fFlags = kRenderTarget_GrTextureFlagBit; | 648 desc.fFlags = kRenderTarget_GrTextureFlagBit; |
648 desc.fWidth = SkScalarCeilToInt(maskRect.width()); | 649 desc.fWidth = SkScalarCeilToInt(maskRect.width()); |
649 desc.fHeight = SkScalarCeilToInt(maskRect.height()); | 650 desc.fHeight = SkScalarCeilToInt(maskRect.height()); |
651 // try multisampled target if possible | |
bsalomon
2014/10/02 16:59:16
Why don't we just pass the sample count of the SkG
| |
652 int maxSampleCnt = context->getGpu()->caps()->maxSampleCount(); | |
653 desc.fSampleCnt = maxSampleCnt >= 4 ? 4 : maxSampleCnt; | |
650 // We actually only need A8, but it often isn't supported as a | 654 // We actually only need A8, but it often isn't supported as a |
651 // render target so default to RGBA_8888 | 655 // render target so default to RGBA_8888 |
652 desc.fConfig = kRGBA_8888_GrPixelConfig; | 656 desc.fConfig = kRGBA_8888_GrPixelConfig; |
653 if (context->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) { | 657 |
658 bool msaa = desc.fSampleCnt > 0; | |
659 if (context->isConfigRenderable(kAlpha_8_GrPixelConfig, msaa)) { | |
654 desc.fConfig = kAlpha_8_GrPixelConfig; | 660 desc.fConfig = kAlpha_8_GrPixelConfig; |
655 } | 661 } |
656 | 662 |
657 mask->set(context, desc); | 663 mask->set(context, desc); |
658 if (NULL == mask->texture()) { | 664 if (NULL == mask->texture()) { |
659 return false; | 665 return false; |
660 } | 666 } |
661 | 667 |
662 GrTexture* maskTexture = mask->texture(); | 668 GrTexture* maskTexture = mask->texture(); |
663 SkRect clipRect = SkRect::MakeWH(maskRect.width(), maskRect.height()); | 669 SkRect clipRect = SkRect::MakeWH(maskRect.width(), maskRect.height()); |
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1881 GrLayerHoister::UnlockLayers(fContext->getLayerCache(), picture); | 1887 GrLayerHoister::UnlockLayers(fContext->getLayerCache(), picture); |
1882 | 1888 |
1883 return true; | 1889 return true; |
1884 } | 1890 } |
1885 | 1891 |
1886 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { | 1892 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { |
1887 // We always return a transient cache, so it is freed after each | 1893 // We always return a transient cache, so it is freed after each |
1888 // filter traversal. | 1894 // filter traversal. |
1889 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); | 1895 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); |
1890 } | 1896 } |
OLD | NEW |