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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
608 return chosenSampleCount <= fGpu->caps()->maxSampleCount() ? chosenSampleCou nt : 0; | 608 return chosenSampleCount <= fGpu->caps()->maxSampleCount() ? chosenSampleCou nt : 0; |
609 } | 609 } |
610 | 610 |
611 | 611 |
612 sk_sp<GrDrawContext> GrContext::drawContext(sk_sp<GrRenderTarget> rt, | 612 sk_sp<GrDrawContext> GrContext::drawContext(sk_sp<GrRenderTarget> rt, |
613 const SkSurfaceProps* surfaceProps) { | 613 const SkSurfaceProps* surfaceProps) { |
614 ASSERT_SINGLE_OWNER | 614 ASSERT_SINGLE_OWNER |
615 return fDrawingManager->drawContext(std::move(rt), surfaceProps); | 615 return fDrawingManager->drawContext(std::move(rt), surfaceProps); |
616 } | 616 } |
617 | 617 |
618 sk_sp<GrDrawContext> GrContext::newDrawContext(BackingFit fit, | |
619 int width, int height, | |
620 GrPixelConfig config, | |
621 int sampleCnt, | |
622 GrSurfaceOrigin origin) { | |
623 GrSurfaceDesc desc; | |
624 desc.fFlags = kRenderTarget_GrSurfaceFlag; | |
625 desc.fOrigin = origin; | |
626 desc.fWidth = width; | |
627 desc.fHeight = height; | |
628 desc.fConfig = config; | |
629 desc.fSampleCnt = sampleCnt; | |
630 | |
631 sk_sp<GrTexture> maskTexture; | |
bsalomon
2016/04/27 19:42:10
Why is this called maskTexture?
robertphillips
2016/04/27 19:59:10
Done - it was left over from copy & paste.
| |
632 if (kTight_BackingFit == fit) { | |
633 maskTexture.reset(this->textureProvider()->createTexture(desc, SkBudgete d::kYes)); | |
634 } else { | |
635 maskTexture.reset(this->textureProvider()->createApproxTexture(desc)); | |
636 } | |
637 if (!maskTexture) { | |
638 return nullptr; | |
639 } | |
640 | |
641 sk_sp<GrDrawContext> drawContext(this->drawContext(sk_ref_sp(maskTexture->as RenderTarget()))); | |
642 if (!drawContext) { | |
643 return nullptr; | |
644 } | |
645 | |
646 return drawContext; | |
647 } | |
648 | |
618 bool GrContext::abandoned() const { | 649 bool GrContext::abandoned() const { |
619 ASSERT_SINGLE_OWNER | 650 ASSERT_SINGLE_OWNER |
620 return fDrawingManager->abandoned(); | 651 return fDrawingManager->abandoned(); |
621 } | 652 } |
622 | 653 |
623 namespace { | 654 namespace { |
624 void test_pm_conversions(GrContext* ctx, int* pmToUPMValue, int* upmToPMValue) { | 655 void test_pm_conversions(GrContext* ctx, int* pmToUPMValue, int* upmToPMValue) { |
625 GrConfigConversionEffect::PMConversion pmToUPM; | 656 GrConfigConversionEffect::PMConversion pmToUPM; |
626 GrConfigConversionEffect::PMConversion upmToPM; | 657 GrConfigConversionEffect::PMConversion upmToPM; |
627 GrConfigConversionEffect::TestForPreservingPMConversions(ctx, &pmToUPM, &upm ToPM); | 658 GrConfigConversionEffect::TestForPreservingPMConversions(ctx, &pmToUPM, &upm ToPM); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
695 ASSERT_SINGLE_OWNER | 726 ASSERT_SINGLE_OWNER |
696 fResourceCache->setLimits(maxTextures, maxTextureBytes); | 727 fResourceCache->setLimits(maxTextures, maxTextureBytes); |
697 } | 728 } |
698 | 729 |
699 ////////////////////////////////////////////////////////////////////////////// | 730 ////////////////////////////////////////////////////////////////////////////// |
700 | 731 |
701 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { | 732 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { |
702 ASSERT_SINGLE_OWNER | 733 ASSERT_SINGLE_OWNER |
703 fResourceCache->dumpMemoryStatistics(traceMemoryDump); | 734 fResourceCache->dumpMemoryStatistics(traceMemoryDump); |
704 } | 735 } |
OLD | NEW |