| 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 "GrDrawContext.h" | 8 #include "GrDrawContext.h" |
| 9 #include "GrDrawingManager.h" | 9 #include "GrDrawingManager.h" |
| 10 #include "GrDrawTarget.h" | 10 #include "GrDrawTarget.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 } | 57 } |
| 58 | 58 |
| 59 void GrDrawingManager::reset() { | 59 void GrDrawingManager::reset() { |
| 60 for (int i = 0; i < fDrawTargets.count(); ++i) { | 60 for (int i = 0; i < fDrawTargets.count(); ++i) { |
| 61 fDrawTargets[i]->reset(); | 61 fDrawTargets[i]->reset(); |
| 62 } | 62 } |
| 63 fFlushState.reset(); | 63 fFlushState.reset(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void GrDrawingManager::flush() { | 66 void GrDrawingManager::flush() { |
| 67 if (fFlushing) { |
| 68 return; |
| 69 } |
| 70 fFlushing = true; |
| 71 |
| 67 SkDEBUGCODE(bool result =) | 72 SkDEBUGCODE(bool result =) |
| 68 SkTTopoSort<GrDrawTarget, GrDrawTarget::TopoSortTraits>(
&fDrawTargets); | 73 SkTTopoSort<GrDrawTarget, GrDrawTarget::TopoSortTraits>(
&fDrawTargets); |
| 69 SkASSERT(result); | 74 SkASSERT(result); |
| 70 | 75 |
| 71 #if 0 | 76 #if 0 |
| 72 for (int i = 0; i < fDrawTargets.count(); ++i) { | 77 for (int i = 0; i < fDrawTargets.count(); ++i) { |
| 73 SkDEBUGCODE(fDrawTargets[i]->dump();) | 78 SkDEBUGCODE(fDrawTargets[i]->dump();) |
| 74 } | 79 } |
| 75 #endif | 80 #endif |
| 76 | 81 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 100 SkASSERT(fDrawTargets.count() == 1); | 105 SkASSERT(fDrawTargets.count() == 1); |
| 101 // Clear out this flag so the topological sort's SkTTopoSort_CheckAllUnm
arked check | 106 // Clear out this flag so the topological sort's SkTTopoSort_CheckAllUnm
arked check |
| 102 // won't bark | 107 // won't bark |
| 103 fDrawTargets[0]->resetFlag(GrDrawTarget::kWasOutput_Flag); | 108 fDrawTargets[0]->resetFlag(GrDrawTarget::kWasOutput_Flag); |
| 104 } | 109 } |
| 105 #else | 110 #else |
| 106 fDrawTargets.reset(); | 111 fDrawTargets.reset(); |
| 107 #endif | 112 #endif |
| 108 | 113 |
| 109 fFlushState.reset(); | 114 fFlushState.reset(); |
| 115 fFlushing = false; |
| 110 } | 116 } |
| 111 | 117 |
| 112 GrTextContext* GrDrawingManager::textContext(const SkSurfaceProps& props, | 118 GrTextContext* GrDrawingManager::textContext(const SkSurfaceProps& props, |
| 113 GrRenderTarget* rt) { | 119 GrRenderTarget* rt) { |
| 114 if (this->abandoned()) { | 120 if (this->abandoned()) { |
| 115 return nullptr; | 121 return nullptr; |
| 116 } | 122 } |
| 117 | 123 |
| 118 SkASSERT(props.pixelGeometry() < kNumPixelGeometries); | 124 SkASSERT(props.pixelGeometry() < kNumPixelGeometries); |
| 119 bool useDIF = props.isUseDeviceIndependentFonts(); | 125 bool useDIF = props.isUseDeviceIndependentFonts(); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 } | 194 } |
| 189 | 195 |
| 190 GrDrawContext* GrDrawingManager::drawContext(GrRenderTarget* rt, | 196 GrDrawContext* GrDrawingManager::drawContext(GrRenderTarget* rt, |
| 191 const SkSurfaceProps* surfaceProps)
{ | 197 const SkSurfaceProps* surfaceProps)
{ |
| 192 if (this->abandoned()) { | 198 if (this->abandoned()) { |
| 193 return nullptr; | 199 return nullptr; |
| 194 } | 200 } |
| 195 | 201 |
| 196 return new GrDrawContext(this, rt, surfaceProps); | 202 return new GrDrawContext(this, rt, surfaceProps); |
| 197 } | 203 } |
| OLD | NEW |