| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "GrContext.h" | 9 #include "GrContext.h" |
| 10 | 10 |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 SkAutoTUnref<GrTexture> tempTexture; | 397 SkAutoTUnref<GrTexture> tempTexture; |
| 398 if (GrGpu::kNoDraw_DrawPreference != drawPreference) { | 398 if (GrGpu::kNoDraw_DrawPreference != drawPreference) { |
| 399 tempTexture.reset( | 399 tempTexture.reset( |
| 400 this->textureProvider()->createApproxTexture(tempDrawInfo.fTempSurfa
ceDesc)); | 400 this->textureProvider()->createApproxTexture(tempDrawInfo.fTempSurfa
ceDesc)); |
| 401 if (!tempTexture && GrGpu::kRequireDraw_DrawPreference == drawPreference
) { | 401 if (!tempTexture && GrGpu::kRequireDraw_DrawPreference == drawPreference
) { |
| 402 return false; | 402 return false; |
| 403 } | 403 } |
| 404 } | 404 } |
| 405 | 405 |
| 406 // temp buffer for doing sw premul conversion, if needed. | 406 // temp buffer for doing sw premul conversion, if needed. |
| 407 #if defined(GOOGLE3) |
| 408 // Stack frame size is limited in GOOGLE3. |
| 409 SkAutoSTMalloc<48 * 48, uint32_t> tmpPixels(0); |
| 410 #else |
| 407 SkAutoSTMalloc<128 * 128, uint32_t> tmpPixels(0); | 411 SkAutoSTMalloc<128 * 128, uint32_t> tmpPixels(0); |
| 412 #endif |
| 408 if (tempTexture) { | 413 if (tempTexture) { |
| 409 SkAutoTUnref<const GrFragmentProcessor> fp; | 414 SkAutoTUnref<const GrFragmentProcessor> fp; |
| 410 SkMatrix textureMatrix; | 415 SkMatrix textureMatrix; |
| 411 textureMatrix.setIDiv(tempTexture->width(), tempTexture->height()); | 416 textureMatrix.setIDiv(tempTexture->width(), tempTexture->height()); |
| 412 GrPaint paint; | 417 GrPaint paint; |
| 413 if (applyPremulToSrc) { | 418 if (applyPremulToSrc) { |
| 414 fp.reset(this->createUPMToPMEffect(tempTexture, tempDrawInfo.fSwapRA
ndB, | 419 fp.reset(this->createUPMToPMEffect(tempTexture, tempDrawInfo.fSwapRA
ndB, |
| 415 textureMatrix)); | 420 textureMatrix)); |
| 416 // If premultiplying was the only reason for the draw, fall back to
a straight write. | 421 // If premultiplying was the only reason for the draw, fall back to
a straight write. |
| 417 if (!fp) { | 422 if (!fp) { |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 | 796 |
| 792 void GrContext::setResourceCacheLimits(int maxTextures, size_t maxTextureBytes)
{ | 797 void GrContext::setResourceCacheLimits(int maxTextures, size_t maxTextureBytes)
{ |
| 793 fResourceCache->setLimits(maxTextures, maxTextureBytes); | 798 fResourceCache->setLimits(maxTextures, maxTextureBytes); |
| 794 } | 799 } |
| 795 | 800 |
| 796 ////////////////////////////////////////////////////////////////////////////// | 801 ////////////////////////////////////////////////////////////////////////////// |
| 797 | 802 |
| 798 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { | 803 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { |
| 799 fResourceCache->dumpMemoryStatistics(traceMemoryDump); | 804 fResourceCache->dumpMemoryStatistics(traceMemoryDump); |
| 800 } | 805 } |
| OLD | NEW |