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