OLD | NEW |
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 29 matching lines...) Expand all Loading... |
40 SkMatrix mat; | 40 SkMatrix mat; |
41 // We use device coords to compute the texture coordinates. We set our matri
x to be a | 41 // We use device coords to compute the texture coordinates. We set our matri
x to be a |
42 // translation to the devBound, and then a scaling matrix to normalized coor
ds. | 42 // translation to the devBound, and then a scaling matrix to normalized coor
ds. |
43 mat.setIDiv(result->width(), result->height()); | 43 mat.setIDiv(result->width(), result->height()); |
44 mat.preTranslate(SkIntToScalar(-devBound.fLeft), | 44 mat.preTranslate(SkIntToScalar(-devBound.fLeft), |
45 SkIntToScalar(-devBound.fTop)); | 45 SkIntToScalar(-devBound.fTop)); |
46 | 46 |
47 SkIRect domainTexels = SkIRect::MakeWH(devBound.width(), devBound.height()); | 47 SkIRect domainTexels = SkIRect::MakeWH(devBound.width(), devBound.height()); |
48 // This could be a long-lived effect that is cached with the alpha-mask. | 48 // This could be a long-lived effect that is cached with the alpha-mask. |
49 pipelineBuilder->addCoverageProcessor( | 49 pipelineBuilder->addCoverageProcessor( |
50 GrTextureDomainEffect::Create(result, | 50 GrTextureDomainEffect::Create(pipelineBuilder->getProcessorDataManager()
, |
| 51 result, |
51 mat, | 52 mat, |
52 GrTextureDomain::MakeTexelDomain(result, d
omainTexels), | 53 GrTextureDomain::MakeTexelDomain(result, d
omainTexels), |
53 GrTextureDomain::kDecal_Mode, | 54 GrTextureDomain::kDecal_Mode, |
54 GrTextureParams::kNone_FilterMode, | 55 GrTextureParams::kNone_FilterMode, |
55 kDevice_GrCoordSet))->unref(); | 56 kDevice_GrCoordSet))->unref(); |
56 } | 57 } |
57 | 58 |
58 bool path_needs_SW_renderer(GrContext* context, | 59 bool path_needs_SW_renderer(GrContext* context, |
59 const GrDrawTarget* gpu, | 60 const GrDrawTarget* gpu, |
60 const GrPipelineBuilder* pipelineBuilder, | 61 const GrPipelineBuilder* pipelineBuilder, |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 const SkIRect& srcBound) { | 474 const SkIRect& srcBound) { |
474 pipelineBuilder->setRenderTarget(dstMask->asRenderTarget()); | 475 pipelineBuilder->setRenderTarget(dstMask->asRenderTarget()); |
475 | 476 |
476 // We want to invert the coverage here | 477 // We want to invert the coverage here |
477 set_coverage_drawing_xpf(op, false, pipelineBuilder); | 478 set_coverage_drawing_xpf(op, false, pipelineBuilder); |
478 | 479 |
479 SkMatrix sampleM; | 480 SkMatrix sampleM; |
480 sampleM.setIDiv(srcMask->width(), srcMask->height()); | 481 sampleM.setIDiv(srcMask->width(), srcMask->height()); |
481 | 482 |
482 pipelineBuilder->addCoverageProcessor( | 483 pipelineBuilder->addCoverageProcessor( |
483 GrTextureDomainEffect::Create(srcMask, | 484 GrTextureDomainEffect::Create(pipelineBuilder->getProcessorDataManager()
, |
| 485 srcMask, |
484 sampleM, | 486 sampleM, |
485 GrTextureDomain::MakeTexelDomain(srcMask,
srcBound), | 487 GrTextureDomain::MakeTexelDomain(srcMask,
srcBound), |
486 GrTextureDomain::kDecal_Mode, | 488 GrTextureDomain::kDecal_Mode, |
487 GrTextureParams::kNone_FilterMode))->unref
(); | 489 GrTextureParams::kNone_FilterMode))->unref
(); |
488 | 490 |
489 // The color passed in here does not matter since the coverageSetOpXP won't
read it. | 491 // The color passed in here does not matter since the coverageSetOpXP won't
read it. |
490 fClipTarget->drawSimpleRect(pipelineBuilder, | 492 fClipTarget->drawSimpleRect(pipelineBuilder, |
491 GrColor_WHITE, | 493 GrColor_WHITE, |
492 SkMatrix::I(), | 494 SkMatrix::I(), |
493 SkRect::Make(dstBound)); | 495 SkRect::Make(dstBound)); |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 fAACache.purgeResources(); | 1121 fAACache.purgeResources(); |
1120 } | 1122 } |
1121 | 1123 |
1122 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc
ilAttachment, | 1124 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc
ilAttachment, |
1123 GrStencilSettings* settings) { | 1125 GrStencilSettings* settings) { |
1124 if (stencilAttachment) { | 1126 if (stencilAttachment) { |
1125 int stencilBits = stencilAttachment->bits(); | 1127 int stencilBits = stencilAttachment->bits(); |
1126 this->adjustStencilParams(settings, fClipMode, stencilBits); | 1128 this->adjustStencilParams(settings, fClipMode, stencilBits); |
1127 } | 1129 } |
1128 } | 1130 } |
OLD | NEW |