OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "GrContext.h" | 8 #include "GrContext.h" |
9 #include "GrContextOptions.h" | 9 #include "GrContextOptions.h" |
10 #include "GrDrawingManager.h" | 10 #include "GrDrawingManager.h" |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 SkAutoTUnref<GrTexture> tempTexture; | 279 SkAutoTUnref<GrTexture> tempTexture; |
280 if (GrGpu::kNoDraw_DrawPreference != drawPreference) { | 280 if (GrGpu::kNoDraw_DrawPreference != drawPreference) { |
281 tempTexture.reset( | 281 tempTexture.reset( |
282 this->textureProvider()->createApproxTexture(tempDrawInfo.fTempSurfa
ceDesc)); | 282 this->textureProvider()->createApproxTexture(tempDrawInfo.fTempSurfa
ceDesc)); |
283 if (!tempTexture && GrGpu::kRequireDraw_DrawPreference == drawPreference
) { | 283 if (!tempTexture && GrGpu::kRequireDraw_DrawPreference == drawPreference
) { |
284 return false; | 284 return false; |
285 } | 285 } |
286 } | 286 } |
287 | 287 |
288 // temp buffer for doing sw premul conversion, if needed. | 288 // temp buffer for doing sw premul conversion, if needed. |
289 #if defined(GOOGLE3) | |
290 // Stack frame size is limited in GOOGLE3. | |
291 SkAutoSTMalloc<48 * 48, uint32_t> tmpPixels(0); | |
292 #else | |
293 SkAutoSTMalloc<128 * 128, uint32_t> tmpPixels(0); | 289 SkAutoSTMalloc<128 * 128, uint32_t> tmpPixels(0); |
294 #endif | |
295 if (tempTexture) { | 290 if (tempTexture) { |
296 SkAutoTUnref<const GrFragmentProcessor> fp; | 291 SkAutoTUnref<const GrFragmentProcessor> fp; |
297 SkMatrix textureMatrix; | 292 SkMatrix textureMatrix; |
298 textureMatrix.setIDiv(tempTexture->width(), tempTexture->height()); | 293 textureMatrix.setIDiv(tempTexture->width(), tempTexture->height()); |
299 if (applyPremulToSrc) { | 294 if (applyPremulToSrc) { |
300 fp.reset(this->createUPMToPMEffect(tempTexture, tempDrawInfo.fSwizzl
e, | 295 fp.reset(this->createUPMToPMEffect(tempTexture, tempDrawInfo.fSwizzl
e, |
301 textureMatrix)); | 296 textureMatrix)); |
302 // If premultiplying was the only reason for the draw, fall back to
a straight write. | 297 // If premultiplying was the only reason for the draw, fall back to
a straight write. |
303 if (!fp) { | 298 if (!fp) { |
304 if (GrGpu::kCallerPrefersDraw_DrawPreference == drawPreference)
{ | 299 if (GrGpu::kCallerPrefersDraw_DrawPreference == drawPreference)
{ |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 ASSERT_SINGLE_OWNER | 652 ASSERT_SINGLE_OWNER |
658 fResourceCache->setLimits(maxTextures, maxTextureBytes); | 653 fResourceCache->setLimits(maxTextures, maxTextureBytes); |
659 } | 654 } |
660 | 655 |
661 ////////////////////////////////////////////////////////////////////////////// | 656 ////////////////////////////////////////////////////////////////////////////// |
662 | 657 |
663 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { | 658 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { |
664 ASSERT_SINGLE_OWNER | 659 ASSERT_SINGLE_OWNER |
665 fResourceCache->dumpMemoryStatistics(traceMemoryDump); | 660 fResourceCache->dumpMemoryStatistics(traceMemoryDump); |
666 } | 661 } |
OLD | NEW |