OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 #ifndef GrContext_DEFINED | 8 #ifndef GrContext_DEFINED |
9 #define GrContext_DEFINED | 9 #define GrContext_DEFINED |
10 | 10 |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 // This enum exists to require a caller of the constructor to acknowledg
e that the clip will | 693 // This enum exists to require a caller of the constructor to acknowledg
e that the clip will |
694 // initially be wide open. It also could be extended if there are other
desirable initial | 694 // initially be wide open. It also could be extended if there are other
desirable initial |
695 // clip states. | 695 // clip states. |
696 enum InitialClip { | 696 enum InitialClip { |
697 kWideOpen_InitialClip, | 697 kWideOpen_InitialClip, |
698 }; | 698 }; |
699 | 699 |
700 AutoClip(GrContext* context, InitialClip SkDEBUGCODE(initialState)) | 700 AutoClip(GrContext* context, InitialClip SkDEBUGCODE(initialState)) |
701 : fContext(context) { | 701 : fContext(context) { |
702 SkASSERT(kWideOpen_InitialClip == initialState); | 702 SkASSERT(kWideOpen_InitialClip == initialState); |
703 fNewClipData.fClipStack = &fNewClipStack; | 703 fNewClipData.fClipStack.reset(SkRef(&fNewClipStack)); |
704 | 704 |
705 fOldClip = context->getClip(); | 705 fOldClip = context->getClip(); |
706 context->setClip(&fNewClipData); | 706 context->setClip(&fNewClipData); |
707 } | 707 } |
708 | 708 |
709 AutoClip(GrContext* context, const SkRect& newClipRect) | 709 AutoClip(GrContext* context, const SkRect& newClipRect) |
710 : fContext(context) | 710 : fContext(context) |
711 , fNewClipStack(newClipRect) { | 711 , fNewClipStack(newClipRect) { |
712 fNewClipData.fClipStack = &fNewClipStack; | 712 fNewClipData.fClipStack.reset(SkRef(&fNewClipStack)); |
713 | 713 |
714 fOldClip = fContext->getClip(); | 714 fOldClip = fContext->getClip(); |
715 fContext->setClip(&fNewClipData); | 715 fContext->setClip(&fNewClipData); |
716 } | 716 } |
717 | 717 |
718 ~AutoClip() { | 718 ~AutoClip() { |
719 if (fContext) { | 719 if (fContext) { |
720 fContext->setClip(fOldClip); | 720 fContext->setClip(fOldClip); |
721 } | 721 } |
722 } | 722 } |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 /** | 855 /** |
856 * This callback allows the resource cache to callback into the GrContext | 856 * This callback allows the resource cache to callback into the GrContext |
857 * when the cache is still over budget after a purge. | 857 * when the cache is still over budget after a purge. |
858 */ | 858 */ |
859 static void OverBudgetCB(void* data); | 859 static void OverBudgetCB(void* data); |
860 | 860 |
861 typedef SkRefCnt INHERITED; | 861 typedef SkRefCnt INHERITED; |
862 }; | 862 }; |
863 | 863 |
864 #endif | 864 #endif |
OLD | NEW |