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 "GrCaps.h" | 9 #include "GrCaps.h" |
10 #include "GrDrawContext.h" | 10 #include "GrDrawContext.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 arfps->addCoverageFragmentProcessor( | 49 arfps->addCoverageFragmentProcessor( |
50 GrTextureDomainEffect::Create(arfps->getProcessorDataManager(), | 50 GrTextureDomainEffect::Create(result, |
51 result, | |
52 mat, | 51 mat, |
53 GrTextureDomain::MakeTexelDomain(result, d
omainTexels), | 52 GrTextureDomain::MakeTexelDomain(result, d
omainTexels), |
54 GrTextureDomain::kDecal_Mode, | 53 GrTextureDomain::kDecal_Mode, |
55 GrTextureParams::kNone_FilterMode, | 54 GrTextureParams::kNone_FilterMode, |
56 kDevice_GrCoordSet))->unref(); | 55 kDevice_GrCoordSet))->unref(); |
57 } | 56 } |
58 | 57 |
59 bool path_needs_SW_renderer(GrContext* context, | 58 bool path_needs_SW_renderer(GrContext* context, |
60 const GrDrawTarget* gpu, | 59 const GrDrawTarget* gpu, |
61 const GrPipelineBuilder& pipelineBuilder, | 60 const GrPipelineBuilder& pipelineBuilder, |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 const SkIRect& srcBound) { | 473 const SkIRect& srcBound) { |
475 pipelineBuilder->setRenderTarget(dstMask->asRenderTarget()); | 474 pipelineBuilder->setRenderTarget(dstMask->asRenderTarget()); |
476 | 475 |
477 // We want to invert the coverage here | 476 // We want to invert the coverage here |
478 set_coverage_drawing_xpf(op, false, pipelineBuilder); | 477 set_coverage_drawing_xpf(op, false, pipelineBuilder); |
479 | 478 |
480 SkMatrix sampleM; | 479 SkMatrix sampleM; |
481 sampleM.setIDiv(srcMask->width(), srcMask->height()); | 480 sampleM.setIDiv(srcMask->width(), srcMask->height()); |
482 | 481 |
483 pipelineBuilder->addCoverageFragmentProcessor( | 482 pipelineBuilder->addCoverageFragmentProcessor( |
484 GrTextureDomainEffect::Create(pipelineBuilder->getProcessorDataManager()
, | 483 GrTextureDomainEffect::Create(srcMask, |
485 srcMask, | |
486 sampleM, | 484 sampleM, |
487 GrTextureDomain::MakeTexelDomain(srcMask,
srcBound), | 485 GrTextureDomain::MakeTexelDomain(srcMask,
srcBound), |
488 GrTextureDomain::kDecal_Mode, | 486 GrTextureDomain::kDecal_Mode, |
489 GrTextureParams::kNone_FilterMode))->unref
(); | 487 GrTextureParams::kNone_FilterMode))->unref
(); |
490 | 488 |
491 // The color passed in here does not matter since the coverageSetOpXP won't
read it. | 489 // The color passed in here does not matter since the coverageSetOpXP won't
read it. |
492 fDrawTarget->drawNonAARect(*pipelineBuilder, | 490 fDrawTarget->drawNonAARect(*pipelineBuilder, |
493 GrColor_WHITE, | 491 GrColor_WHITE, |
494 SkMatrix::I(), | 492 SkMatrix::I(), |
495 SkRect::Make(dstBound)); | 493 SkRect::Make(dstBound)); |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 | 1132 |
1135 //////////////////////////////////////////////////////////////////////////////// | 1133 //////////////////////////////////////////////////////////////////////////////// |
1136 | 1134 |
1137 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc
ilAttachment, | 1135 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc
ilAttachment, |
1138 GrStencilSettings* settings) { | 1136 GrStencilSettings* settings) { |
1139 if (stencilAttachment) { | 1137 if (stencilAttachment) { |
1140 int stencilBits = stencilAttachment->bits(); | 1138 int stencilBits = stencilAttachment->bits(); |
1141 this->adjustStencilParams(settings, fClipMode, stencilBits); | 1139 this->adjustStencilParams(settings, fClipMode, stencilBits); |
1142 } | 1140 } |
1143 } | 1141 } |
OLD | NEW |