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

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

Issue 1144013007: Remove GrContext from GrClipMaskCache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more Created 5 years, 6 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 | « src/gpu/GrClipMaskManager.h ('k') | src/gpu/GrDrawTarget.h » ('j') | 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 2012 Google Inc. 2 * Copyright 2012 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 "GrClipMaskManager.h" 8 #include "GrClipMaskManager.h"
9 #include "GrAAConvexPathRenderer.h" 9 #include "GrAAConvexPathRenderer.h"
10 #include "GrAAHairLinePathRenderer.h" 10 #include "GrAAHairLinePathRenderer.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // last (false) parameter disallows use of the SW path renderer 70 // last (false) parameter disallows use of the SW path renderer
71 GrPathRendererChain::DrawType type = doAA ? 71 GrPathRendererChain::DrawType type = doAA ?
72 GrPathRendererChain::kColorAntiAlias_Dr awType : 72 GrPathRendererChain::kColorAntiAlias_Dr awType :
73 GrPathRendererChain::kColor_DrawType; 73 GrPathRendererChain::kColor_DrawType;
74 74
75 return NULL == context->getPathRenderer(gpu, pipelineBuilder, viewMatrix, *p ath, stroke, 75 return NULL == context->getPathRenderer(gpu, pipelineBuilder, viewMatrix, *p ath, stroke,
76 false, type); 76 false, type);
77 } 77 }
78 } 78 }
79 79
80 GrClipMaskManager::GrClipMaskManager(GrClipTarget* clipTarget)
81 : fCurrClipMaskType(kNone_ClipMaskType)
82 , fAACache(clipTarget->getContext()->resourceProvider())
83 , fClipTarget(clipTarget)
84 , fClipMode(kIgnoreClip_StencilClipMode) {
85 }
86
87 GrContext* GrClipMaskManager::getContext() { return fClipTarget->getContext(); }
88
80 /* 89 /*
81 * This method traverses the clip stack to see if the GrSoftwarePathRenderer 90 * This method traverses the clip stack to see if the GrSoftwarePathRenderer
82 * will be used on any element. If so, it returns true to indicate that the 91 * will be used on any element. If so, it returns true to indicate that the
83 * entire clip should be rendered in SW and then uploaded en masse to the gpu. 92 * entire clip should be rendered in SW and then uploaded en masse to the gpu.
84 */ 93 */
85 bool GrClipMaskManager::useSWOnlyPath(const GrPipelineBuilder* pipelineBuilder, 94 bool GrClipMaskManager::useSWOnlyPath(const GrPipelineBuilder* pipelineBuilder,
86 const SkVector& clipToMaskOffset, 95 const SkVector& clipToMaskOffset,
87 const GrReducedClip::ElementList& elements ) { 96 const GrReducedClip::ElementList& elements ) {
88 // TODO: generalize this function so that when 97 // TODO: generalize this function so that when
89 // a clip gets complex enough it can just be done in SW regardless 98 // a clip gets complex enough it can just be done in SW regardless
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 1112
1104 fCurrClipMaskType = kAlpha_ClipMaskType; 1113 fCurrClipMaskType = kAlpha_ClipMaskType;
1105 return result; 1114 return result;
1106 } 1115 }
1107 1116
1108 //////////////////////////////////////////////////////////////////////////////// 1117 ////////////////////////////////////////////////////////////////////////////////
1109 void GrClipMaskManager::purgeResources() { 1118 void GrClipMaskManager::purgeResources() {
1110 fAACache.purgeResources(); 1119 fAACache.purgeResources();
1111 } 1120 }
1112 1121
1113 void GrClipMaskManager::setClipTarget(GrClipTarget* clipTarget) {
1114 fClipTarget = clipTarget;
1115 fAACache.setContext(clipTarget->getContext());
1116 }
1117
1118 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc ilAttachment, 1122 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc ilAttachment,
1119 GrStencilSettings* settings) { 1123 GrStencilSettings* settings) {
1120 if (stencilAttachment) { 1124 if (stencilAttachment) {
1121 int stencilBits = stencilAttachment->bits(); 1125 int stencilBits = stencilAttachment->bits();
1122 this->adjustStencilParams(settings, fClipMode, stencilBits); 1126 this->adjustStencilParams(settings, fClipMode, stencilBits);
1123 } 1127 }
1124 } 1128 }
OLDNEW
« no previous file with comments | « src/gpu/GrClipMaskManager.h ('k') | src/gpu/GrDrawTarget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698