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 "GrContextPriv.h" | 9 #include "GrContextPriv.h" |
10 #include "GrContextOptions.h" | 10 #include "GrContextOptions.h" |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 chosenSampleCount = 16; | 618 chosenSampleCount = 16; |
619 } | 619 } |
620 } | 620 } |
621 return chosenSampleCount <= fGpu->caps()->maxSampleCount() ? chosenSampleCou
nt : 0; | 621 return chosenSampleCount <= fGpu->caps()->maxSampleCount() ? chosenSampleCou
nt : 0; |
622 } | 622 } |
623 | 623 |
624 sk_sp<GrDrawContext> GrContextPriv::makeWrappedDrawContext(sk_sp<GrRenderTarget>
rt, | 624 sk_sp<GrDrawContext> GrContextPriv::makeWrappedDrawContext(sk_sp<GrRenderTarget>
rt, |
625 sk_sp<SkColorSpace> c
olorSpace, | 625 sk_sp<SkColorSpace> c
olorSpace, |
626 const SkSurfaceProps*
surfaceProps) { | 626 const SkSurfaceProps*
surfaceProps) { |
627 ASSERT_SINGLE_OWNER_PRIV | 627 ASSERT_SINGLE_OWNER_PRIV |
628 return fContext->drawingManager()->makeDrawContext(std::move(rt), | 628 return this->drawingManager()->makeDrawContext(std::move(rt), |
629 std::move(colorSpace), | 629 std::move(colorSpace), |
630 surfaceProps); | 630 surfaceProps); |
631 } | 631 } |
632 | 632 |
633 sk_sp<GrDrawContext> GrContextPriv::makeBackendTextureDrawContext(const GrBacken
dTextureDesc& desc, | 633 sk_sp<GrDrawContext> GrContextPriv::makeBackendTextureDrawContext(const GrBacken
dTextureDesc& desc, |
634 sk_sp<SkColorS
pace> colorSpace, | 634 sk_sp<SkColorS
pace> colorSpace, |
635 const SkSurfac
eProps* props, | 635 const SkSurfac
eProps* props, |
636 GrWrapOwnershi
p ownership) { | 636 GrWrapOwnershi
p ownership) { |
637 ASSERT_SINGLE_OWNER_PRIV | 637 ASSERT_SINGLE_OWNER_PRIV |
638 SkASSERT(desc.fFlags & kRenderTarget_GrBackendTextureFlag); | 638 SkASSERT(desc.fFlags & kRenderTarget_GrBackendTextureFlag); |
639 | 639 |
640 sk_sp<GrSurface> surface(fContext->textureProvider()->wrapBackendTexture(des
c, ownership)); | 640 sk_sp<GrSurface> surface(fContext->textureProvider()->wrapBackendTexture(des
c, ownership)); |
641 if (!surface) { | 641 if (!surface) { |
642 return nullptr; | 642 return nullptr; |
643 } | 643 } |
644 | 644 |
645 return fContext->drawingManager()->makeDrawContext(sk_ref_sp(surface->asRend
erTarget()), | 645 return this->drawingManager()->makeDrawContext(sk_ref_sp(surface->asRenderTa
rget()), |
646 std::move(colorSpace), pr
ops); | 646 std::move(colorSpace), props)
; |
647 } | 647 } |
648 | 648 |
649 sk_sp<GrDrawContext> GrContextPriv::makeBackendRenderTargetDrawContext( | 649 sk_sp<GrDrawContext> GrContextPriv::makeBackendRenderTargetDrawContext( |
650 const GrBackendRenderTargetDesc&
desc, | 650 const GrBackendRenderTargetDesc&
desc, |
651 sk_sp<SkColorSpace> colorSpace, | 651 sk_sp<SkColorSpace> colorSpace, |
652 const SkSurfaceProps* surfacePro
ps) { | 652 const SkSurfaceProps* surfacePro
ps) { |
653 ASSERT_SINGLE_OWNER_PRIV | 653 ASSERT_SINGLE_OWNER_PRIV |
654 | 654 |
655 sk_sp<GrRenderTarget> rt(fContext->textureProvider()->wrapBackendRenderTarge
t(desc)); | 655 sk_sp<GrRenderTarget> rt(fContext->textureProvider()->wrapBackendRenderTarge
t(desc)); |
656 if (!rt) { | 656 if (!rt) { |
657 return nullptr; | 657 return nullptr; |
658 } | 658 } |
659 | 659 |
660 return fContext->drawingManager()->makeDrawContext(std::move(rt), | 660 return this->drawingManager()->makeDrawContext(std::move(rt), |
661 std::move(colorSpace), | 661 std::move(colorSpace), |
662 surfaceProps); | 662 surfaceProps); |
663 } | 663 } |
664 | 664 |
665 sk_sp<GrDrawContext> GrContextPriv::makeBackendTextureAsRenderTargetDrawContext( | 665 sk_sp<GrDrawContext> GrContextPriv::makeBackendTextureAsRenderTargetDrawContext( |
666 const GrBackendTextureDesc&
desc, | 666 const GrBackendTextureDesc&
desc, |
667 sk_sp<SkColorSpace> colorSp
ace, | 667 sk_sp<SkColorSpace> colorSp
ace, |
668 const SkSurfaceProps* surfa
ceProps) { | 668 const SkSurfaceProps* surfa
ceProps) { |
669 ASSERT_SINGLE_OWNER_PRIV | 669 ASSERT_SINGLE_OWNER_PRIV |
670 SkASSERT(desc.fFlags & kRenderTarget_GrBackendTextureFlag); | 670 SkASSERT(desc.fFlags & kRenderTarget_GrBackendTextureFlag); |
671 | 671 |
672 sk_sp<GrSurface> surface(fContext->resourceProvider()->wrapBackendTextureAsR
enderTarget(desc)); | 672 sk_sp<GrSurface> surface(fContext->resourceProvider()->wrapBackendTextureAsR
enderTarget(desc)); |
673 if (!surface) { | 673 if (!surface) { |
674 return nullptr; | 674 return nullptr; |
675 } | 675 } |
676 | 676 |
677 return fContext->drawingManager()->makeDrawContext(sk_ref_sp(surface->asRend
erTarget()), | 677 return this->drawingManager()->makeDrawContext(sk_ref_sp(surface->asRenderTa
rget()), |
678 std::move(colorSpace), | 678 std::move(colorSpace), |
679 surfaceProps); | 679 surfaceProps); |
680 } | 680 } |
681 | 681 |
682 sk_sp<GrDrawContext> GrContext::makeDrawContext(SkBackingFit fit, | 682 sk_sp<GrDrawContext> GrContext::makeDrawContext(SkBackingFit fit, |
683 int width, int height, | 683 int width, int height, |
684 GrPixelConfig config, | 684 GrPixelConfig config, |
685 sk_sp<SkColorSpace> colorSpace, | 685 sk_sp<SkColorSpace> colorSpace, |
686 int sampleCnt, | 686 int sampleCnt, |
687 GrSurfaceOrigin origin, | 687 GrSurfaceOrigin origin, |
688 const SkSurfaceProps* surfacePro
ps, | 688 const SkSurfaceProps* surfacePro
ps, |
689 SkBudgeted budgeted) { | 689 SkBudgeted budgeted) { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 ASSERT_SINGLE_OWNER | 795 ASSERT_SINGLE_OWNER |
796 fResourceCache->setLimits(maxTextures, maxTextureBytes); | 796 fResourceCache->setLimits(maxTextures, maxTextureBytes); |
797 } | 797 } |
798 | 798 |
799 ////////////////////////////////////////////////////////////////////////////// | 799 ////////////////////////////////////////////////////////////////////////////// |
800 | 800 |
801 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { | 801 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { |
802 ASSERT_SINGLE_OWNER | 802 ASSERT_SINGLE_OWNER |
803 fResourceCache->dumpMemoryStatistics(traceMemoryDump); | 803 fResourceCache->dumpMemoryStatistics(traceMemoryDump); |
804 } | 804 } |
OLD | NEW |