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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 if (GrGpu::kNoDraw_DrawPreference != drawPreference) { | 416 if (GrGpu::kNoDraw_DrawPreference != drawPreference) { |
417 if (tempDrawInfo.fUseExactScratch) { | 417 if (tempDrawInfo.fUseExactScratch) { |
418 // We only respect this when the entire src is being read. Otherwise
we can trigger too | 418 // We only respect this when the entire src is being read. Otherwise
we can trigger too |
419 // many odd ball texture sizes and trash the cache. | 419 // many odd ball texture sizes and trash the cache. |
420 if (width != src->width() || height != src->height()) { | 420 if (width != src->width() || height != src->height()) { |
421 tempDrawInfo.fUseExactScratch = false; | 421 tempDrawInfo.fUseExactScratch = false; |
422 } | 422 } |
423 } | 423 } |
424 SkAutoTUnref<GrTexture> temp; | 424 SkAutoTUnref<GrTexture> temp; |
425 if (tempDrawInfo.fUseExactScratch) { | 425 if (tempDrawInfo.fUseExactScratch) { |
426 temp.reset(this->textureProvider()->createTexture(tempDrawInfo.fTemp
SurfaceDesc, | 426 temp.reset(this->textureProvider()->createTexture(tempDrawInfo.fTemp
SurfaceDesc, true)); |
427 SkBudgeted::kYes))
; | |
428 } else { | 427 } else { |
429 temp.reset(this->textureProvider()->createApproxTexture(tempDrawInfo
.fTempSurfaceDesc)); | 428 temp.reset(this->textureProvider()->createApproxTexture(tempDrawInfo
.fTempSurfaceDesc)); |
430 } | 429 } |
431 if (temp) { | 430 if (temp) { |
432 SkMatrix textureMatrix; | 431 SkMatrix textureMatrix; |
433 textureMatrix.setTranslate(SkIntToScalar(left), SkIntToScalar(top)); | 432 textureMatrix.setTranslate(SkIntToScalar(left), SkIntToScalar(top)); |
434 textureMatrix.postIDiv(src->width(), src->height()); | 433 textureMatrix.postIDiv(src->width(), src->height()); |
435 SkAutoTUnref<const GrFragmentProcessor> fp; | 434 SkAutoTUnref<const GrFragmentProcessor> fp; |
436 if (unpremul) { | 435 if (unpremul) { |
437 fp.reset(this->createPMToUPMEffect(src->asTexture(), tempDrawInf
o.fSwizzle, | 436 fp.reset(this->createPMToUPMEffect(src->asTexture(), tempDrawInf
o.fSwizzle, |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 ASSERT_SINGLE_OWNER | 661 ASSERT_SINGLE_OWNER |
663 fResourceCache->setLimits(maxTextures, maxTextureBytes); | 662 fResourceCache->setLimits(maxTextures, maxTextureBytes); |
664 } | 663 } |
665 | 664 |
666 ////////////////////////////////////////////////////////////////////////////// | 665 ////////////////////////////////////////////////////////////////////////////// |
667 | 666 |
668 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { | 667 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { |
669 ASSERT_SINGLE_OWNER | 668 ASSERT_SINGLE_OWNER |
670 fResourceCache->dumpMemoryStatistics(traceMemoryDump); | 669 fResourceCache->dumpMemoryStatistics(traceMemoryDump); |
671 } | 670 } |
OLD | NEW |