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 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 const SkSurfaceProps* surfaceProps)
{ | 649 const SkSurfaceProps* surfaceProps)
{ |
650 ASSERT_SINGLE_OWNER | 650 ASSERT_SINGLE_OWNER |
651 return fDrawingManager->drawContext(std::move(rt), surfaceProps); | 651 return fDrawingManager->drawContext(std::move(rt), surfaceProps); |
652 } | 652 } |
653 | 653 |
654 sk_sp<GrDrawContext> GrContext::newDrawContext(SkBackingFit fit, | 654 sk_sp<GrDrawContext> GrContext::newDrawContext(SkBackingFit fit, |
655 int width, int height, | 655 int width, int height, |
656 GrPixelConfig config, | 656 GrPixelConfig config, |
657 int sampleCnt, | 657 int sampleCnt, |
658 GrSurfaceOrigin origin, | 658 GrSurfaceOrigin origin, |
659 const SkSurfaceProps* surfaceProp
s) { | 659 const SkSurfaceProps* surfaceProp
s, |
| 660 SkBudgeted budgeted) { |
660 GrSurfaceDesc desc; | 661 GrSurfaceDesc desc; |
661 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 662 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
662 desc.fOrigin = origin; | 663 desc.fOrigin = origin; |
663 desc.fWidth = width; | 664 desc.fWidth = width; |
664 desc.fHeight = height; | 665 desc.fHeight = height; |
665 desc.fConfig = config; | 666 desc.fConfig = config; |
666 desc.fSampleCnt = sampleCnt; | 667 desc.fSampleCnt = sampleCnt; |
667 | 668 |
668 sk_sp<GrTexture> tex; | 669 sk_sp<GrTexture> tex; |
669 if (SkBackingFit::kExact == fit) { | 670 if (SkBackingFit::kExact == fit) { |
670 tex.reset(this->textureProvider()->createTexture(desc, SkBudgeted::kYes)
); | 671 tex.reset(this->textureProvider()->createTexture(desc, budgeted)); |
671 } else { | 672 } else { |
672 tex.reset(this->textureProvider()->createApproxTexture(desc)); | 673 tex.reset(this->textureProvider()->createApproxTexture(desc)); |
673 } | 674 } |
674 if (!tex) { | 675 if (!tex) { |
675 return nullptr; | 676 return nullptr; |
676 } | 677 } |
677 | 678 |
678 sk_sp<GrDrawContext> drawContext(this->drawContext(sk_ref_sp(tex->asRenderTa
rget()), | 679 sk_sp<GrDrawContext> drawContext(this->drawContext(sk_ref_sp(tex->asRenderTa
rget()), |
679 surfaceProps)); | 680 surfaceProps)); |
680 if (!drawContext) { | 681 if (!drawContext) { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 ASSERT_SINGLE_OWNER | 765 ASSERT_SINGLE_OWNER |
765 fResourceCache->setLimits(maxTextures, maxTextureBytes); | 766 fResourceCache->setLimits(maxTextures, maxTextureBytes); |
766 } | 767 } |
767 | 768 |
768 ////////////////////////////////////////////////////////////////////////////// | 769 ////////////////////////////////////////////////////////////////////////////// |
769 | 770 |
770 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { | 771 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { |
771 ASSERT_SINGLE_OWNER | 772 ASSERT_SINGLE_OWNER |
772 fResourceCache->dumpMemoryStatistics(traceMemoryDump); | 773 fResourceCache->dumpMemoryStatistics(traceMemoryDump); |
773 } | 774 } |
OLD | NEW |