Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Side by Side Diff: src/gpu/SkGpuDevice.cpp

Issue 616923004: Create MSAA render target for blur mask texture (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 return draw_mask(context, maskRect, grp, texture); 637 return draw_mask(context, maskRect, grp, texture);
637 } 638 }
638 639
639 // Create a mask of 'devPath' and place the result in 'mask'. Return true on 640 // Create a mask of 'devPath' and place the result in 'mask'. Return true on
640 // success; false otherwise. 641 // success; false otherwise.
641 bool create_mask_GPU(GrContext* context, 642 bool create_mask_GPU(GrContext* context,
642 const SkRect& maskRect, 643 const SkRect& maskRect,
643 const SkPath& devPath, 644 const SkPath& devPath,
644 const GrStrokeInfo& strokeInfo, 645 const GrStrokeInfo& strokeInfo,
645 bool doAA, 646 bool doAA,
646 GrAutoScratchTexture* mask) { 647 GrAutoScratchTexture* mask,
648 int SampleCnt) {
647 GrTextureDesc desc; 649 GrTextureDesc desc;
648 desc.fFlags = kRenderTarget_GrTextureFlagBit; 650 desc.fFlags = kRenderTarget_GrTextureFlagBit;
649 desc.fWidth = SkScalarCeilToInt(maskRect.width()); 651 desc.fWidth = SkScalarCeilToInt(maskRect.width());
650 desc.fHeight = SkScalarCeilToInt(maskRect.height()); 652 desc.fHeight = SkScalarCeilToInt(maskRect.height());
653 desc.fSampleCnt = SampleCnt;
651 // 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
652 // render target so default to RGBA_8888 655 // render target so default to RGBA_8888
653 desc.fConfig = kRGBA_8888_GrPixelConfig; 656 desc.fConfig = kRGBA_8888_GrPixelConfig;
654 if (context->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) { 657
658 if (context->isConfigRenderable(kAlpha_8_GrPixelConfig,
659 desc.fSampleCnt > 0)) {
655 desc.fConfig = kAlpha_8_GrPixelConfig; 660 desc.fConfig = kAlpha_8_GrPixelConfig;
656 } 661 }
657 662
658 mask->set(context, desc); 663 mask->set(context, desc);
659 if (NULL == mask->texture()) { 664 if (NULL == mask->texture()) {
660 return false; 665 return false;
661 } 666 }
662 667
663 GrTexture* maskTexture = mask->texture(); 668 GrTexture* maskTexture = mask->texture();
664 SkRect clipRect = SkRect::MakeWH(maskRect.width(), maskRect.height()); 669 SkRect clipRect = SkRect::MakeWH(maskRect.width(), maskRect.height());
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 if (paint.getMaskFilter()->directFilterMaskGPU(fContext, &grPaint, 783 if (paint.getMaskFilter()->directFilterMaskGPU(fContext, &grPaint,
779 stroke, *devPathPtr)) { 784 stroke, *devPathPtr)) {
780 // the mask filter was able to draw itself directly, so there's nothing 785 // the mask filter was able to draw itself directly, so there's nothing
781 // left to do. 786 // left to do.
782 return; 787 return;
783 } 788 }
784 789
785 GrAutoScratchTexture mask; 790 GrAutoScratchTexture mask;
786 791
787 if (create_mask_GPU(fContext, maskRect, *devPathPtr, strokeInfo, 792 if (create_mask_GPU(fContext, maskRect, *devPathPtr, strokeInfo,
788 grPaint.isAntiAlias(), &mask)) { 793 grPaint.isAntiAlias(), &mask, fRenderTarget->num Samples())) {
789 GrTexture* filtered; 794 GrTexture* filtered;
790 795
791 if (paint.getMaskFilter()->filterMaskGPU(mask.texture(), 796 if (paint.getMaskFilter()->filterMaskGPU(mask.texture(),
792 ctm, maskRect, &filtere d, true)) { 797 ctm, maskRect, &filtere d, true)) {
793 // filterMaskGPU gives us ownership of a ref to the result 798 // filterMaskGPU gives us ownership of a ref to the result
794 SkAutoTUnref<GrTexture> atu(filtered); 799 SkAutoTUnref<GrTexture> atu(filtered);
795 800
796 // If the scratch texture that we used as the filter src als o holds the filter 801 // If the scratch texture that we used as the filter src als o holds the filter
797 // result then we must detach so that this texture isn't rec ycled for a later 802 // result then we must detach so that this texture isn't rec ycled for a later
798 // draw. 803 // draw.
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after
1870 GrLayerHoister::UnlockLayers(fContext->getLayerCache(), atlased, nonAtlased, recycled); 1875 GrLayerHoister::UnlockLayers(fContext->getLayerCache(), atlased, nonAtlased, recycled);
1871 1876
1872 return true; 1877 return true;
1873 } 1878 }
1874 1879
1875 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { 1880 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {
1876 // We always return a transient cache, so it is freed after each 1881 // We always return a transient cache, so it is freed after each
1877 // filter traversal. 1882 // filter traversal.
1878 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); 1883 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize);
1879 } 1884 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698