| 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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 GrTextureParams::kNone_FilterMode))->unref
(); | 443 GrTextureParams::kNone_FilterMode))->unref
(); |
| 444 // The color passed in here does not matter since the coverageSetOpXP won't
read it. | 444 // The color passed in here does not matter since the coverageSetOpXP won't
read it. |
| 445 fClipTarget->drawSimpleRect(drawState, GrColor_WHITE, SkRect::Make(dstBound)
); | 445 fClipTarget->drawSimpleRect(drawState, GrColor_WHITE, SkRect::Make(dstBound)
); |
| 446 } | 446 } |
| 447 | 447 |
| 448 GrTexture* GrClipMaskManager::createTempMask(int width, int height) { | 448 GrTexture* GrClipMaskManager::createTempMask(int width, int height) { |
| 449 GrSurfaceDesc desc; | 449 GrSurfaceDesc desc; |
| 450 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 450 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
| 451 desc.fWidth = width; | 451 desc.fWidth = width; |
| 452 desc.fHeight = height; | 452 desc.fHeight = height; |
| 453 desc.fConfig = kAlpha_8_GrPixelConfig; | 453 if (this->getContext()->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) { |
| 454 desc.fConfig = kAlpha_8_GrPixelConfig; |
| 455 } else { |
| 456 desc.fConfig = kRGBA_8888_GrPixelConfig; |
| 457 } |
| 454 | 458 |
| 455 return this->getContext()->refScratchTexture(desc, GrContext::kApprox_Scratc
hTexMatch); | 459 return this->getContext()->refScratchTexture(desc, GrContext::kApprox_Scratc
hTexMatch); |
| 456 } | 460 } |
| 457 | 461 |
| 458 //////////////////////////////////////////////////////////////////////////////// | 462 //////////////////////////////////////////////////////////////////////////////// |
| 459 // Return the texture currently in the cache if it exists. Otherwise, return NUL
L | 463 // Return the texture currently in the cache if it exists. Otherwise, return NUL
L |
| 460 GrTexture* GrClipMaskManager::getCachedMaskTexture(int32_t elementsGenID, | 464 GrTexture* GrClipMaskManager::getCachedMaskTexture(int32_t elementsGenID, |
| 461 const SkIRect& clipSpaceIBoun
ds) { | 465 const SkIRect& clipSpaceIBoun
ds) { |
| 462 bool cached = fAACache.canReuse(elementsGenID, clipSpaceIBounds); | 466 bool cached = fAACache.canReuse(elementsGenID, clipSpaceIBounds); |
| 463 if (!cached) { | 467 if (!cached) { |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1058 } | 1062 } |
| 1059 | 1063 |
| 1060 void GrClipMaskManager::adjustPathStencilParams(const GrStencilBuffer* stencilBu
ffer, | 1064 void GrClipMaskManager::adjustPathStencilParams(const GrStencilBuffer* stencilBu
ffer, |
| 1061 GrStencilSettings* settings) { | 1065 GrStencilSettings* settings) { |
| 1062 // TODO: dynamically attach a stencil buffer | 1066 // TODO: dynamically attach a stencil buffer |
| 1063 if (stencilBuffer) { | 1067 if (stencilBuffer) { |
| 1064 int stencilBits = stencilBuffer->bits(); | 1068 int stencilBits = stencilBuffer->bits(); |
| 1065 this->adjustStencilParams(settings, fClipMode, stencilBits); | 1069 this->adjustStencilParams(settings, fClipMode, stencilBits); |
| 1066 } | 1070 } |
| 1067 } | 1071 } |
| OLD | NEW |