| 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 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 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->addCoverageProcessor( | 49 arfps->addCoverageFragmentProcessor( |
| 50 GrTextureDomainEffect::Create(arfps->getProcessorDataManager(), | 50 GrTextureDomainEffect::Create(arfps->getProcessorDataManager(), |
| 51 result, | 51 result, |
| 52 mat, | 52 mat, |
| 53 GrTextureDomain::MakeTexelDomain(result, d
omainTexels), | 53 GrTextureDomain::MakeTexelDomain(result, d
omainTexels), |
| 54 GrTextureDomain::kDecal_Mode, | 54 GrTextureDomain::kDecal_Mode, |
| 55 GrTextureParams::kNone_FilterMode, | 55 GrTextureParams::kNone_FilterMode, |
| 56 kDevice_GrCoordSet))->unref(); | 56 kDevice_GrCoordSet))->unref(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 bool path_needs_SW_renderer(GrContext* context, | 59 bool path_needs_SW_renderer(GrContext* context, |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 case SkClipStack::Element::kRect_Type: { | 193 case SkClipStack::Element::kRect_Type: { |
| 194 SkRect rect = iter.get()->getRect(); | 194 SkRect rect = iter.get()->getRect(); |
| 195 rect.offset(clipToRTOffset.fX, clipToRTOffset.fY); | 195 rect.offset(clipToRTOffset.fX, clipToRTOffset.fY); |
| 196 fp.reset(GrConvexPolyEffect::Create(edgeType, rect)); | 196 fp.reset(GrConvexPolyEffect::Create(edgeType, rect)); |
| 197 break; | 197 break; |
| 198 } | 198 } |
| 199 default: | 199 default: |
| 200 break; | 200 break; |
| 201 } | 201 } |
| 202 if (fp) { | 202 if (fp) { |
| 203 arfps->addCoverageProcessor(fp); | 203 arfps->addCoverageFragmentProcessor(fp); |
| 204 } else { | 204 } else { |
| 205 failed = true; | 205 failed = true; |
| 206 break; | 206 break; |
| 207 } | 207 } |
| 208 } | 208 } |
| 209 iter.next(); | 209 iter.next(); |
| 210 } | 210 } |
| 211 | 211 |
| 212 if (failed) { | 212 if (failed) { |
| 213 arfps->set(NULL); | 213 arfps->set(NULL); |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 const SkIRect& dstBound, | 481 const SkIRect& dstBound, |
| 482 const SkIRect& srcBound) { | 482 const SkIRect& srcBound) { |
| 483 pipelineBuilder->setRenderTarget(dstMask->asRenderTarget()); | 483 pipelineBuilder->setRenderTarget(dstMask->asRenderTarget()); |
| 484 | 484 |
| 485 // We want to invert the coverage here | 485 // We want to invert the coverage here |
| 486 set_coverage_drawing_xpf(op, false, pipelineBuilder); | 486 set_coverage_drawing_xpf(op, false, pipelineBuilder); |
| 487 | 487 |
| 488 SkMatrix sampleM; | 488 SkMatrix sampleM; |
| 489 sampleM.setIDiv(srcMask->width(), srcMask->height()); | 489 sampleM.setIDiv(srcMask->width(), srcMask->height()); |
| 490 | 490 |
| 491 pipelineBuilder->addCoverageProcessor( | 491 pipelineBuilder->addCoverageFragmentProcessor( |
| 492 GrTextureDomainEffect::Create(pipelineBuilder->getProcessorDataManager()
, | 492 GrTextureDomainEffect::Create(pipelineBuilder->getProcessorDataManager()
, |
| 493 srcMask, | 493 srcMask, |
| 494 sampleM, | 494 sampleM, |
| 495 GrTextureDomain::MakeTexelDomain(srcMask,
srcBound), | 495 GrTextureDomain::MakeTexelDomain(srcMask,
srcBound), |
| 496 GrTextureDomain::kDecal_Mode, | 496 GrTextureDomain::kDecal_Mode, |
| 497 GrTextureParams::kNone_FilterMode))->unref
(); | 497 GrTextureParams::kNone_FilterMode))->unref
(); |
| 498 | 498 |
| 499 // The color passed in here does not matter since the coverageSetOpXP won't
read it. | 499 // The color passed in here does not matter since the coverageSetOpXP won't
read it. |
| 500 fClipTarget->drawNonAARect(*pipelineBuilder, | 500 fClipTarget->drawNonAARect(*pipelineBuilder, |
| 501 GrColor_WHITE, | 501 GrColor_WHITE, |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 fAACache.purgeResources(); | 1150 fAACache.purgeResources(); |
| 1151 } | 1151 } |
| 1152 | 1152 |
| 1153 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc
ilAttachment, | 1153 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc
ilAttachment, |
| 1154 GrStencilSettings* settings) { | 1154 GrStencilSettings* settings) { |
| 1155 if (stencilAttachment) { | 1155 if (stencilAttachment) { |
| 1156 int stencilBits = stencilAttachment->bits(); | 1156 int stencilBits = stencilAttachment->bits(); |
| 1157 this->adjustStencilParams(settings, fClipMode, stencilBits); | 1157 this->adjustStencilParams(settings, fClipMode, stencilBits); |
| 1158 } | 1158 } |
| 1159 } | 1159 } |
| OLD | NEW |