OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "GrDrawingManager.h" | 8 #include "GrDrawingManager.h" |
9 | 9 |
10 #include "GrContext.h" | 10 #include "GrContext.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 SkASSERT(fDrawTargets.count() == 1); | 122 SkASSERT(fDrawTargets.count() == 1); |
123 // Clear out this flag so the topological sort's SkTTopoSort_CheckAllUnm
arked check | 123 // Clear out this flag so the topological sort's SkTTopoSort_CheckAllUnm
arked check |
124 // won't bark | 124 // won't bark |
125 fDrawTargets[0]->resetFlag(GrDrawTarget::kWasOutput_Flag); | 125 fDrawTargets[0]->resetFlag(GrDrawTarget::kWasOutput_Flag); |
126 } | 126 } |
127 #else | 127 #else |
128 fDrawTargets.reset(); | 128 fDrawTargets.reset(); |
129 #endif | 129 #endif |
130 | 130 |
131 fFlushState.reset(); | 131 fFlushState.reset(); |
132 // Avoid notifying the cache about successive client flushes where no render
ing occurred between | 132 // We always have to notify the cache when it requested a flush so it can re
set its state. |
133 // them. | 133 if (flushed || type == GrResourceCache::FlushType::kCacheRequested) { |
134 bool skipNotify = false; | |
135 if (!flushed) { | |
136 skipNotify = GrResourceCache::kExternal == fLastFlushType && | |
137 GrResourceCache::kExternal == type; | |
138 } | |
139 if (!skipNotify) { | |
140 fContext->getResourceCache()->notifyFlushOccurred(type); | 134 fContext->getResourceCache()->notifyFlushOccurred(type); |
141 } | 135 } |
142 fLastFlushType = type; | |
143 fFlushing = false; | 136 fFlushing = false; |
144 } | 137 } |
145 | 138 |
146 void GrDrawingManager::prepareSurfaceForExternalIO(GrSurface* surface) { | 139 void GrDrawingManager::prepareSurfaceForExternalIO(GrSurface* surface) { |
147 if (this->wasAbandoned()) { | 140 if (this->wasAbandoned()) { |
148 return; | 141 return; |
149 } | 142 } |
150 SkASSERT(surface); | 143 SkASSERT(surface); |
151 SkASSERT(surface->getContext() == fContext); | 144 SkASSERT(surface->getContext() == fContext); |
152 | 145 |
153 if (surface->surfacePriv().hasPendingIO()) { | 146 if (surface->surfacePriv().hasPendingIO()) { |
154 this->flush(); | 147 this->flush(); |
155 } else if (GrResourceCache::kExternal != fLastFlushType) { | |
156 fContext->getResourceCache()->notifyFlushOccurred(GrResourceCache::kExte
rnal); | |
157 fLastFlushType = GrResourceCache::kExternal; | |
158 } | 148 } |
159 | 149 |
160 GrRenderTarget* rt = surface->asRenderTarget(); | 150 GrRenderTarget* rt = surface->asRenderTarget(); |
161 if (fContext->getGpu() && rt) { | 151 if (fContext->getGpu() && rt) { |
162 fContext->getGpu()->resolveRenderTarget(rt); | 152 fContext->getGpu()->resolveRenderTarget(rt); |
163 } | 153 } |
164 } | 154 } |
165 | 155 |
166 GrDrawTarget* GrDrawingManager::newDrawTarget(GrRenderTarget* rt) { | 156 GrDrawTarget* GrDrawingManager::newDrawTarget(GrRenderTarget* rt) { |
167 SkASSERT(fContext); | 157 SkASSERT(fContext); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 std::move(colorSpace), s
urfaceProps, | 242 std::move(colorSpace), s
urfaceProps, |
253 fContext->getAuditTrail(
), fSingleOwner)); | 243 fContext->getAuditTrail(
), fSingleOwner)); |
254 } | 244 } |
255 } | 245 } |
256 | 246 |
257 return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt), | 247 return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt), |
258 std::move(colorSpace), surface
Props, | 248 std::move(colorSpace), surface
Props, |
259 fContext->getAuditTrail(), | 249 fContext->getAuditTrail(), |
260 fSingleOwner)); | 250 fSingleOwner)); |
261 } | 251 } |
OLD | NEW |