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

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

Issue 98893006: Make texture domain a helper so that it can be incorporated into other effects. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rename GrTextureDomainEffect.[h|cpp] to GrTextureDomain.[h|cpp] Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « src/effects/SkGpuBlurUtils.cpp ('k') | src/gpu/SkGpuDevice.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"
11 #include "GrAAHairLinePathRenderer.h" 11 #include "GrAAHairLinePathRenderer.h"
12 #include "GrAARectRenderer.h" 12 #include "GrAARectRenderer.h"
13 #include "GrDrawTargetCaps.h" 13 #include "GrDrawTargetCaps.h"
14 #include "GrGpu.h" 14 #include "GrGpu.h"
15 #include "GrPaint.h" 15 #include "GrPaint.h"
16 #include "GrPathRenderer.h" 16 #include "GrPathRenderer.h"
17 #include "GrRenderTarget.h" 17 #include "GrRenderTarget.h"
18 #include "GrStencilBuffer.h" 18 #include "GrStencilBuffer.h"
19 #include "GrSWMaskHelper.h" 19 #include "GrSWMaskHelper.h"
20 #include "effects/GrTextureDomainEffect.h" 20 #include "effects/GrTextureDomain.h"
21 #include "SkRasterClip.h" 21 #include "SkRasterClip.h"
22 #include "SkStrokeRec.h" 22 #include "SkStrokeRec.h"
23 #include "SkTLazy.h" 23 #include "SkTLazy.h"
24 24
25 #define GR_AA_CLIP 1 25 #define GR_AA_CLIP 1
26 26
27 typedef SkClipStack::Element Element; 27 typedef SkClipStack::Element Element;
28 28
29 using namespace GrReducedClip; 29 using namespace GrReducedClip;
30 30
(...skipping 14 matching lines...) Expand all
45 mat.setIDiv(result->width(), result->height()); 45 mat.setIDiv(result->width(), result->height());
46 mat.preTranslate(SkIntToScalar(-devBound.fLeft), 46 mat.preTranslate(SkIntToScalar(-devBound.fLeft),
47 SkIntToScalar(-devBound.fTop)); 47 SkIntToScalar(-devBound.fTop));
48 mat.preConcat(drawState->getViewMatrix()); 48 mat.preConcat(drawState->getViewMatrix());
49 49
50 SkIRect domainTexels = SkIRect::MakeWH(devBound.width(), devBound.height()); 50 SkIRect domainTexels = SkIRect::MakeWH(devBound.width(), devBound.height());
51 // This could be a long-lived effect that is cached with the alpha-mask. 51 // This could be a long-lived effect that is cached with the alpha-mask.
52 drawState->addCoverageEffect( 52 drawState->addCoverageEffect(
53 GrTextureDomainEffect::Create(result, 53 GrTextureDomainEffect::Create(result,
54 mat, 54 mat,
55 GrTextureDomainEffect::MakeTexelDomain(res ult, domainTexels), 55 GrTextureDomain::MakeTexelDomain(result, d omainTexels),
56 GrTextureDomainEffect::kDecal_WrapMode, 56 GrTextureDomain::kDecal_Mode,
57 GrTextureParams::kNone_FilterMode, 57 GrTextureParams::kNone_FilterMode,
58 kPosition_GrCoordSet))->unref(); 58 kPosition_GrCoordSet))->unref();
59 } 59 }
60 60
61 bool path_needs_SW_renderer(GrContext* context, 61 bool path_needs_SW_renderer(GrContext* context,
62 GrGpu* gpu, 62 GrGpu* gpu,
63 const SkPath& origPath, 63 const SkPath& origPath,
64 const SkStrokeRec& stroke, 64 const SkStrokeRec& stroke,
65 bool doAA) { 65 bool doAA) {
66 // the gpu alpha mask will draw the inverse paths as non-inverse to a temp b uffer 66 // the gpu alpha mask will draw the inverse paths as non-inverse to a temp b uffer
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 drawState->setRenderTarget(dstMask->asRenderTarget()); 358 drawState->setRenderTarget(dstMask->asRenderTarget());
359 359
360 setup_boolean_blendcoeffs(drawState, op); 360 setup_boolean_blendcoeffs(drawState, op);
361 361
362 SkMatrix sampleM; 362 SkMatrix sampleM;
363 sampleM.setIDiv(srcMask->width(), srcMask->height()); 363 sampleM.setIDiv(srcMask->width(), srcMask->height());
364 364
365 drawState->addColorEffect( 365 drawState->addColorEffect(
366 GrTextureDomainEffect::Create(srcMask, 366 GrTextureDomainEffect::Create(srcMask,
367 sampleM, 367 sampleM,
368 GrTextureDomainEffect::MakeTexelDomain(src Mask, srcBound), 368 GrTextureDomain::MakeTexelDomain(srcMask, srcBound),
369 GrTextureDomainEffect::kDecal_WrapMode, 369 GrTextureDomain::kDecal_Mode,
370 GrTextureParams::kNone_FilterMode))->unref (); 370 GrTextureParams::kNone_FilterMode))->unref ();
371 fGpu->drawSimpleRect(SkRect::Make(dstBound), NULL); 371 fGpu->drawSimpleRect(SkRect::Make(dstBound), NULL);
372 } 372 }
373 373
374 // get a texture to act as a temporary buffer for AA clip boolean operations 374 // get a texture to act as a temporary buffer for AA clip boolean operations
375 // TODO: given the expense of createTexture we may want to just cache this too 375 // TODO: given the expense of createTexture we may want to just cache this too
376 void GrClipMaskManager::getTemp(int width, int height, GrAutoScratchTexture* tem p) { 376 void GrClipMaskManager::getTemp(int width, int height, GrAutoScratchTexture* tem p) {
377 if (NULL != temp->texture()) { 377 if (NULL != temp->texture()) {
378 // we've already allocated the temp texture 378 // we've already allocated the temp texture
379 return; 379 return;
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 1035
1036 // TODO: dynamically attach a stencil buffer 1036 // TODO: dynamically attach a stencil buffer
1037 int stencilBits = 0; 1037 int stencilBits = 0;
1038 GrStencilBuffer* stencilBuffer = 1038 GrStencilBuffer* stencilBuffer =
1039 drawState.getRenderTarget()->getStencilBuffer(); 1039 drawState.getRenderTarget()->getStencilBuffer();
1040 if (NULL != stencilBuffer) { 1040 if (NULL != stencilBuffer) {
1041 stencilBits = stencilBuffer->bits(); 1041 stencilBits = stencilBuffer->bits();
1042 this->adjustStencilParams(settings, clipMode, stencilBits); 1042 this->adjustStencilParams(settings, clipMode, stencilBits);
1043 } 1043 }
1044 } 1044 }
OLDNEW
« no previous file with comments | « src/effects/SkGpuBlurUtils.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698