OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrAtlas.h" | 9 #include "GrAtlas.h" |
10 #include "GrContext.h" | 10 #include "GrContext.h" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 // If the above fails, then either we have no starting plot, or the current | 170 // If the above fails, then either we have no starting plot, or the current |
171 // plot list is full. Either way we need to allocate a new plot | 171 // plot list is full. Either way we need to allocate a new plot |
172 GrPlot* newPlot = this->allocPlot(); | 172 GrPlot* newPlot = this->allocPlot(); |
173 if (NULL == newPlot) { | 173 if (NULL == newPlot) { |
174 return NULL; | 174 return NULL; |
175 } | 175 } |
176 | 176 |
177 if (NULL == fTexture) { | 177 if (NULL == fTexture) { |
178 // TODO: Update this to use the cache rather than directly creating a te
xture. | 178 // TODO: Update this to use the cache rather than directly creating a te
xture. |
179 GrTextureDesc desc; | 179 GrTextureDesc desc; |
180 #ifdef SK_DEVELOPER | |
181 // RenderTarget so we can read the pixels to dump them | |
182 // TODO: Fix to support RT | |
183 desc.fFlags = kDynamicUpdate_GrTextureFlagBit;//|kRenderTarget_GrTexture
FlagBit; | |
184 //|kNoStencil_GrTextureFla
gBit; | |
185 #else | |
186 desc.fFlags = kDynamicUpdate_GrTextureFlagBit; | 180 desc.fFlags = kDynamicUpdate_GrTextureFlagBit; |
187 #endif | |
188 desc.fWidth = GR_ATLAS_TEXTURE_WIDTH; | 181 desc.fWidth = GR_ATLAS_TEXTURE_WIDTH; |
189 desc.fHeight = GR_ATLAS_TEXTURE_HEIGHT; | 182 desc.fHeight = GR_ATLAS_TEXTURE_HEIGHT; |
190 desc.fConfig = fPixelConfig; | 183 desc.fConfig = fPixelConfig; |
191 | 184 |
192 fTexture = fGpu->createTexture(desc, NULL, 0); | 185 fTexture = fGpu->createTexture(desc, NULL, 0); |
193 if (NULL == fTexture) { | 186 if (NULL == fTexture) { |
194 return NULL; | 187 return NULL; |
195 } | 188 } |
196 } | 189 } |
197 // be sure to set texture for fast lookup | 190 // be sure to set texture for fast lookup |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 252 |
260 plot->fRects->reset(); | 253 plot->fRects->reset(); |
261 plot->fNext = fFreePlots; | 254 plot->fNext = fFreePlots; |
262 fFreePlots = plot; | 255 fFreePlots = plot; |
263 | 256 |
264 #ifdef SK_DEBUG | 257 #ifdef SK_DEBUG |
265 --gCounter; | 258 --gCounter; |
266 // GrPrintf("~GrPlot %p [%d %d] %d\n", this, plot->fOffset.fX, plot->fOffset.
fY, gCounter); | 259 // GrPrintf("~GrPlot %p [%d %d] %d\n", this, plot->fOffset.fX, plot->fOffset.
fY, gCounter); |
267 #endif | 260 #endif |
268 } | 261 } |
OLD | NEW |