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 #ifndef GrGpu_DEFINED | 8 #ifndef GrGpu_DEFINED |
9 #define GrGpu_DEFINED | 9 #define GrGpu_DEFINED |
10 | 10 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 GrContext* getContext() { return fContext; } | 54 GrContext* getContext() { return fContext; } |
55 const GrContext* getContext() const { return fContext; } | 55 const GrContext* getContext() const { return fContext; } |
56 | 56 |
57 /** | 57 /** |
58 * Gets the capabilities of the draw target. | 58 * Gets the capabilities of the draw target. |
59 */ | 59 */ |
60 const GrCaps* caps() const { return fCaps.get(); } | 60 const GrCaps* caps() const { return fCaps.get(); } |
61 | 61 |
62 GrPathRendering* pathRendering() { return fPathRendering.get(); } | 62 GrPathRendering* pathRendering() { return fPathRendering.get(); } |
63 | 63 |
64 // Called by GrContext when the underlying backend context has been destroye
d. | 64 enum class DisconnectType { |
65 // GrGpu should use this to ensure that no backend API calls will be made fr
om | 65 // No cleanup should be attempted, immediately cease making backend API
calls |
66 // here onward, including in its destructor. Subclasses should call | 66 kAbandon, |
67 // INHERITED::contextAbandoned() if they override this. | 67 // Free allocated resources (not known by GrResourceCache) before return
ing and |
68 virtual void contextAbandoned(); | 68 // ensure no backend backend 3D API calls will be made after disconnect(
) returns. |
| 69 kCleanup, |
| 70 }; |
| 71 |
| 72 // Called by GrContext when the underlying backend context is already or wil
l be destroyed |
| 73 // before GrContext. |
| 74 virtual void disconnect(DisconnectType); |
69 | 75 |
70 /** | 76 /** |
71 * The GrGpu object normally assumes that no outsider is setting state | 77 * The GrGpu object normally assumes that no outsider is setting state |
72 * within the underlying 3D API's context/device/whatever. This call informs | 78 * within the underlying 3D API's context/device/whatever. This call informs |
73 * the GrGpu that the state was modified and it shouldn't make assumptions | 79 * the GrGpu that the state was modified and it shouldn't make assumptions |
74 * about the state. | 80 * about the state. |
75 */ | 81 */ |
76 void markContextDirty(uint32_t state = kAll_GrBackendState) { fResetBits |=
state; } | 82 void markContextDirty(uint32_t state = kAll_GrBackendState) { fResetBits |=
state; } |
77 | 83 |
78 /** | 84 /** |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 SkTArray<const MultisampleSpecs*, true> fMultisa
mpleSpecsMap; | 604 SkTArray<const MultisampleSpecs*, true> fMultisa
mpleSpecsMap; |
599 GrTAllocator<MultisampleSpecs> fMultisa
mpleSpecsAllocator; | 605 GrTAllocator<MultisampleSpecs> fMultisa
mpleSpecsAllocator; |
600 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. | 606 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. |
601 GrContext* fContext
; | 607 GrContext* fContext
; |
602 | 608 |
603 friend class GrPathRendering; | 609 friend class GrPathRendering; |
604 typedef SkRefCnt INHERITED; | 610 typedef SkRefCnt INHERITED; |
605 }; | 611 }; |
606 | 612 |
607 #endif | 613 #endif |
OLD | NEW |