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