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