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

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

Issue 582963002: Solo gp (Closed) Base URL: https://skia.googlesource.com/skia.git@no_peb
Patch Set: rebase 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 | « src/gpu/GrBitmapTextContext.cpp ('k') | src/gpu/GrContext.cpp » ('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 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrClipMaskManager.h" 9 #include "GrClipMaskManager.h"
10 #include "GrAAConvexPathRenderer.h" 10 #include "GrAAConvexPathRenderer.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // We want to use device coords to compute the texture coordinates. We set o ur matrix to be 44 // We want to use device coords to compute the texture coordinates. We set o ur matrix to be
45 // equal to the view matrix followed by an offset to the devBound, and then a scaling matrix to 45 // equal to the view matrix followed by an offset to the devBound, and then a scaling matrix to
46 // normalized coords. We apply this matrix to the vertex positions rather th an local coords. 46 // normalized coords. We apply this matrix to the vertex positions rather th an local coords.
47 mat.setIDiv(result->width(), result->height()); 47 mat.setIDiv(result->width(), result->height());
48 mat.preTranslate(SkIntToScalar(-devBound.fLeft), 48 mat.preTranslate(SkIntToScalar(-devBound.fLeft),
49 SkIntToScalar(-devBound.fTop)); 49 SkIntToScalar(-devBound.fTop));
50 mat.preConcat(drawState->getViewMatrix()); 50 mat.preConcat(drawState->getViewMatrix());
51 51
52 SkIRect domainTexels = SkIRect::MakeWH(devBound.width(), devBound.height()); 52 SkIRect domainTexels = SkIRect::MakeWH(devBound.width(), devBound.height());
53 // This could be a long-lived effect that is cached with the alpha-mask. 53 // This could be a long-lived effect that is cached with the alpha-mask.
54 drawState->addCoverageEffect( 54 drawState->addCoverageProcessor(
55 GrTextureDomainEffect::Create(result, 55 GrTextureDomainEffect::Create(result,
56 mat, 56 mat,
57 GrTextureDomain::MakeTexelDomain(result, d omainTexels), 57 GrTextureDomain::MakeTexelDomain(result, d omainTexels),
58 GrTextureDomain::kDecal_Mode, 58 GrTextureDomain::kDecal_Mode,
59 GrTextureParams::kNone_FilterMode, 59 GrTextureParams::kNone_FilterMode,
60 kPosition_GrCoordSet))->unref(); 60 kPosition_GrCoordSet))->unref();
61 } 61 }
62 62
63 bool path_needs_SW_renderer(GrContext* context, 63 bool path_needs_SW_renderer(GrContext* context,
64 GrGpu* gpu, 64 GrGpu* gpu,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 break; 147 break;
148 default: 148 default:
149 failed = true; 149 failed = true;
150 break; 150 break;
151 } 151 }
152 if (failed) { 152 if (failed) {
153 break; 153 break;
154 } 154 }
155 155
156 if (!skip) { 156 if (!skip) {
157 GrEffectEdgeType edgeType; 157 GrPrimitiveEdgeType edgeType;
158 if (GR_AA_CLIP && iter.get()->isAA()) { 158 if (GR_AA_CLIP && iter.get()->isAA()) {
159 if (rt->isMultisampled()) { 159 if (rt->isMultisampled()) {
160 // Coverage based AA clips don't place nicely with MSAA. 160 // Coverage based AA clips don't place nicely with MSAA.
161 failed = true; 161 failed = true;
162 break; 162 break;
163 } 163 }
164 edgeType = invert ? kInverseFillAA_GrEffectEdgeType : kFillAA_Gr EffectEdgeType; 164 edgeType =
165 invert ? kInverseFillAA_GrProcessorEdgeType : kFillAA_Gr ProcessorEdgeType;
165 } else { 166 } else {
166 edgeType = invert ? kInverseFillBW_GrEffectEdgeType : kFillBW_Gr EffectEdgeType; 167 edgeType =
168 invert ? kInverseFillBW_GrProcessorEdgeType : kFillBW_Gr ProcessorEdgeType;
167 } 169 }
168 SkAutoTUnref<GrEffect> effect; 170 SkAutoTUnref<GrFragmentProcessor> fp;
169 switch (iter.get()->getType()) { 171 switch (iter.get()->getType()) {
170 case SkClipStack::Element::kPath_Type: 172 case SkClipStack::Element::kPath_Type:
171 effect.reset(GrConvexPolyEffect::Create(edgeType, iter.get() ->getPath(), 173 fp.reset(GrConvexPolyEffect::Create(edgeType, iter.get()->ge tPath(),
172 &clipToRTOffset)); 174 &clipToRTOffset));
173 break; 175 break;
174 case SkClipStack::Element::kRRect_Type: { 176 case SkClipStack::Element::kRRect_Type: {
175 SkRRect rrect = iter.get()->getRRect(); 177 SkRRect rrect = iter.get()->getRRect();
176 rrect.offset(clipToRTOffset.fX, clipToRTOffset.fY); 178 rrect.offset(clipToRTOffset.fX, clipToRTOffset.fY);
177 effect.reset(GrRRectEffect::Create(edgeType, rrect)); 179 fp.reset(GrRRectEffect::Create(edgeType, rrect));
178 break; 180 break;
179 } 181 }
180 case SkClipStack::Element::kRect_Type: { 182 case SkClipStack::Element::kRect_Type: {
181 SkRect rect = iter.get()->getRect(); 183 SkRect rect = iter.get()->getRect();
182 rect.offset(clipToRTOffset.fX, clipToRTOffset.fY); 184 rect.offset(clipToRTOffset.fX, clipToRTOffset.fY);
183 effect.reset(GrConvexPolyEffect::Create(edgeType, rect)); 185 fp.reset(GrConvexPolyEffect::Create(edgeType, rect));
184 break; 186 break;
185 } 187 }
186 default: 188 default:
187 break; 189 break;
188 } 190 }
189 if (effect) { 191 if (fp) {
190 if (!setARE) { 192 if (!setARE) {
191 are->set(fGpu->drawState()); 193 are->set(fGpu->drawState());
192 setARE = true; 194 setARE = true;
193 } 195 }
194 fGpu->drawState()->addCoverageEffect(effect); 196 fGpu->drawState()->addCoverageProcessor(fp);
195 } else { 197 } else {
196 failed = true; 198 failed = true;
197 break; 199 break;
198 } 200 }
199 } 201 }
200 iter.next(); 202 iter.next();
201 } 203 }
202 204
203 if (failed) { 205 if (failed) {
204 are->set(NULL); 206 are->set(NULL);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 GrDrawState* drawState = fGpu->drawState(); 392 GrDrawState* drawState = fGpu->drawState();
391 393
392 drawState->setRenderTarget(target->asRenderTarget()); 394 drawState->setRenderTarget(target->asRenderTarget());
393 395
394 // TODO: Draw rrects directly here. 396 // TODO: Draw rrects directly here.
395 switch (element->getType()) { 397 switch (element->getType()) {
396 case Element::kEmpty_Type: 398 case Element::kEmpty_Type:
397 SkDEBUGFAIL("Should never get here with an empty element."); 399 SkDEBUGFAIL("Should never get here with an empty element.");
398 break; 400 break;
399 case Element::kRect_Type: 401 case Element::kRect_Type:
400 // TODO: Do rects directly to the accumulator using a aa-rect GrEffe ct that covers the 402 // TODO: Do rects directly to the accumulator using a aa-rect GrProc essor that covers
401 // entire mask bounds and writes 0 outside the rect. 403 // the entire mask bounds and writes 0 outside the rect.
402 if (element->isAA()) { 404 if (element->isAA()) {
403 getContext()->getAARectRenderer()->fillAARect(fGpu, 405 getContext()->getAARectRenderer()->fillAARect(fGpu,
404 fGpu, 406 fGpu,
405 element->getRect() , 407 element->getRect() ,
406 SkMatrix::I(), 408 SkMatrix::I(),
407 element->getRect() ); 409 element->getRect() );
408 } else { 410 } else {
409 fGpu->drawSimpleRect(element->getRect()); 411 fGpu->drawSimpleRect(element->getRect());
410 } 412 }
411 return true; 413 return true;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 SkAssertResult(avmr.setIdentity(drawState)); 469 SkAssertResult(avmr.setIdentity(drawState));
468 GrDrawState::AutoRestoreEffects are(drawState); 470 GrDrawState::AutoRestoreEffects are(drawState);
469 471
470 drawState->setRenderTarget(dstMask->asRenderTarget()); 472 drawState->setRenderTarget(dstMask->asRenderTarget());
471 473
472 setup_boolean_blendcoeffs(drawState, op); 474 setup_boolean_blendcoeffs(drawState, op);
473 475
474 SkMatrix sampleM; 476 SkMatrix sampleM;
475 sampleM.setIDiv(srcMask->width(), srcMask->height()); 477 sampleM.setIDiv(srcMask->width(), srcMask->height());
476 478
477 drawState->addColorEffect( 479 drawState->addColorProcessor(
478 GrTextureDomainEffect::Create(srcMask, 480 GrTextureDomainEffect::Create(srcMask,
479 sampleM, 481 sampleM,
480 GrTextureDomain::MakeTexelDomain(srcMask, srcBound), 482 GrTextureDomain::MakeTexelDomain(srcMask, srcBound),
481 GrTextureDomain::kDecal_Mode, 483 GrTextureDomain::kDecal_Mode,
482 GrTextureParams::kNone_FilterMode))->unref (); 484 GrTextureParams::kNone_FilterMode))->unref ();
483 fGpu->drawSimpleRect(SkRect::Make(dstBound)); 485 fGpu->drawSimpleRect(SkRect::Make(dstBound));
484 } 486 }
485 487
486 // get a texture to act as a temporary buffer for AA clip boolean operations 488 // get a texture to act as a temporary buffer for AA clip boolean operations
487 // TODO: given the expense of createTexture we may want to just cache this too 489 // TODO: given the expense of createTexture we may want to just cache this too
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 1140
1139 // TODO: dynamically attach a stencil buffer 1141 // TODO: dynamically attach a stencil buffer
1140 int stencilBits = 0; 1142 int stencilBits = 0;
1141 GrStencilBuffer* stencilBuffer = 1143 GrStencilBuffer* stencilBuffer =
1142 drawState.getRenderTarget()->getStencilBuffer(); 1144 drawState.getRenderTarget()->getStencilBuffer();
1143 if (stencilBuffer) { 1145 if (stencilBuffer) {
1144 stencilBits = stencilBuffer->bits(); 1146 stencilBits = stencilBuffer->bits();
1145 this->adjustStencilParams(settings, clipMode, stencilBits); 1147 this->adjustStencilParams(settings, clipMode, stencilBits);
1146 } 1148 }
1147 } 1149 }
OLDNEW
« no previous file with comments | « src/gpu/GrBitmapTextContext.cpp ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698