OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrClipMaskManager.h" | 9 #include "GrClipMaskManager.h" |
10 #include "effects/GrTextureDomainEffect.h" | 10 #include "effects/GrTextureDomainEffect.h" |
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 } | 817 } |
818 | 818 |
819 // TODO: dynamically attach a stencil buffer | 819 // TODO: dynamically attach a stencil buffer |
820 int stencilBits = 0; | 820 int stencilBits = 0; |
821 GrStencilBuffer* stencilBuffer = | 821 GrStencilBuffer* stencilBuffer = |
822 drawState.getRenderTarget()->getStencilBuffer(); | 822 drawState.getRenderTarget()->getStencilBuffer(); |
823 if (NULL != stencilBuffer) { | 823 if (NULL != stencilBuffer) { |
824 stencilBits = stencilBuffer->bits(); | 824 stencilBits = stencilBuffer->bits(); |
825 } | 825 } |
826 | 826 |
827 GrAssert(fGpu->getCaps().stencilWrapOpsSupport() || !settings.usesWrapOp()); | 827 GrAssert(fGpu->caps()->stencilWrapOpsSupport() || !settings.usesWrapOp()); |
828 GrAssert(fGpu->getCaps().twoSidedStencilSupport() || !settings.isTwoSided())
; | 828 GrAssert(fGpu->caps()->twoSidedStencilSupport() || !settings.isTwoSided()); |
829 this->adjustStencilParams(&settings, clipMode, stencilBits); | 829 this->adjustStencilParams(&settings, clipMode, stencilBits); |
830 fGpu->setStencilSettings(settings); | 830 fGpu->setStencilSettings(settings); |
831 } | 831 } |
832 | 832 |
833 void GrClipMaskManager::adjustStencilParams(GrStencilSettings* settings, | 833 void GrClipMaskManager::adjustStencilParams(GrStencilSettings* settings, |
834 StencilClipMode mode, | 834 StencilClipMode mode, |
835 int stencilBitCnt) { | 835 int stencilBitCnt) { |
836 GrAssert(stencilBitCnt > 0); | 836 GrAssert(stencilBitCnt > 0); |
837 | 837 |
838 if (kModifyClip_StencilClipMode == mode) { | 838 if (kModifyClip_StencilClipMode == mode) { |
839 // We assume that this clip manager itself is drawing to the GrGpu and | 839 // We assume that this clip manager itself is drawing to the GrGpu and |
840 // has already setup the correct values. | 840 // has already setup the correct values. |
841 return; | 841 return; |
842 } | 842 } |
843 | 843 |
844 unsigned int clipBit = (1 << (stencilBitCnt - 1)); | 844 unsigned int clipBit = (1 << (stencilBitCnt - 1)); |
845 unsigned int userBits = clipBit - 1; | 845 unsigned int userBits = clipBit - 1; |
846 | 846 |
847 GrStencilSettings::Face face = GrStencilSettings::kFront_Face; | 847 GrStencilSettings::Face face = GrStencilSettings::kFront_Face; |
848 bool twoSided = fGpu->getCaps().twoSidedStencilSupport(); | 848 bool twoSided = fGpu->caps()->twoSidedStencilSupport(); |
849 | 849 |
850 bool finished = false; | 850 bool finished = false; |
851 while (!finished) { | 851 while (!finished) { |
852 GrStencilFunc func = settings->func(face); | 852 GrStencilFunc func = settings->func(face); |
853 uint16_t writeMask = settings->writeMask(face); | 853 uint16_t writeMask = settings->writeMask(face); |
854 uint16_t funcMask = settings->funcMask(face); | 854 uint16_t funcMask = settings->funcMask(face); |
855 uint16_t funcRef = settings->funcRef(face); | 855 uint16_t funcRef = settings->funcRef(face); |
856 | 856 |
857 GrAssert((unsigned) func < kStencilFuncCount); | 857 GrAssert((unsigned) func < kStencilFuncCount); |
858 | 858 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
999 | 999 |
1000 //////////////////////////////////////////////////////////////////////////////// | 1000 //////////////////////////////////////////////////////////////////////////////// |
1001 void GrClipMaskManager::releaseResources() { | 1001 void GrClipMaskManager::releaseResources() { |
1002 fAACache.releaseResources(); | 1002 fAACache.releaseResources(); |
1003 } | 1003 } |
1004 | 1004 |
1005 void GrClipMaskManager::setGpu(GrGpu* gpu) { | 1005 void GrClipMaskManager::setGpu(GrGpu* gpu) { |
1006 fGpu = gpu; | 1006 fGpu = gpu; |
1007 fAACache.setContext(gpu->getContext()); | 1007 fAACache.setContext(gpu->getContext()); |
1008 } | 1008 } |
OLD | NEW |