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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 GrSurfaceDesc desc; | 507 GrSurfaceDesc desc; |
508 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 508 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
509 desc.fWidth = width; | 509 desc.fWidth = width; |
510 desc.fHeight = height; | 510 desc.fHeight = height; |
511 if (this->getContext()->caps()->isConfigRenderable(kAlpha_8_GrPixelConfig, f
alse)) { | 511 if (this->getContext()->caps()->isConfigRenderable(kAlpha_8_GrPixelConfig, f
alse)) { |
512 desc.fConfig = kAlpha_8_GrPixelConfig; | 512 desc.fConfig = kAlpha_8_GrPixelConfig; |
513 } else { | 513 } else { |
514 desc.fConfig = kRGBA_8888_GrPixelConfig; | 514 desc.fConfig = kRGBA_8888_GrPixelConfig; |
515 } | 515 } |
516 | 516 |
517 return this->getContext()->textureProvider()->refScratchTexture( | 517 return this->getContext()->textureProvider()->createApproxTexture(desc); |
518 desc, GrTextureProvider::kApprox_ScratchTexMatch); | |
519 } | 518 } |
520 | 519 |
521 //////////////////////////////////////////////////////////////////////////////// | 520 //////////////////////////////////////////////////////////////////////////////// |
522 // Return the texture currently in the cache if it exists. Otherwise, return NUL
L | 521 // Return the texture currently in the cache if it exists. Otherwise, return NUL
L |
523 GrTexture* GrClipMaskManager::getCachedMaskTexture(int32_t elementsGenID, | 522 GrTexture* GrClipMaskManager::getCachedMaskTexture(int32_t elementsGenID, |
524 const SkIRect& clipSpaceIBoun
ds) { | 523 const SkIRect& clipSpaceIBoun
ds) { |
525 bool cached = fAACache.canReuse(elementsGenID, clipSpaceIBounds); | 524 bool cached = fAACache.canReuse(elementsGenID, clipSpaceIBounds); |
526 if (!cached) { | 525 if (!cached) { |
527 return NULL; | 526 return NULL; |
528 } | 527 } |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 fAACache.purgeResources(); | 1150 fAACache.purgeResources(); |
1152 } | 1151 } |
1153 | 1152 |
1154 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc
ilAttachment, | 1153 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc
ilAttachment, |
1155 GrStencilSettings* settings) { | 1154 GrStencilSettings* settings) { |
1156 if (stencilAttachment) { | 1155 if (stencilAttachment) { |
1157 int stencilBits = stencilAttachment->bits(); | 1156 int stencilBits = stencilAttachment->bits(); |
1158 this->adjustStencilParams(settings, fClipMode, stencilBits); | 1157 this->adjustStencilParams(settings, fClipMode, stencilBits); |
1159 } | 1158 } |
1160 } | 1159 } |
OLD | NEW |