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 | 8 |
9 #include "GrGpu.h" | 9 #include "GrGpu.h" |
10 | 10 |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 !this->caps()->isConfigRenderable(tempDrawInfo->fTempSurfaceDesc.fConfig
, false)) { | 261 !this->caps()->isConfigRenderable(tempDrawInfo->fTempSurfaceDesc.fConfig
, false)) { |
262 // If we don't have a fallback to a straight read then fail. | 262 // If we don't have a fallback to a straight read then fail. |
263 if (kRequireDraw_DrawPreference == *drawPreference) { | 263 if (kRequireDraw_DrawPreference == *drawPreference) { |
264 return false; | 264 return false; |
265 } | 265 } |
266 *drawPreference = kNoDraw_DrawPreference; | 266 *drawPreference = kNoDraw_DrawPreference; |
267 } | 267 } |
268 | 268 |
269 return true; | 269 return true; |
270 } | 270 } |
271 bool GrGpu::getWritePixelsInfo(GrSurface* dstSurface, int width, int height, siz
e_t rowBytes, | 271 bool GrGpu::getWritePixelsInfo(GrSurface* dstSurface, int width, int height, |
272 GrPixelConfig srcConfig, DrawPreference* drawPref
erence, | 272 GrPixelConfig srcConfig, DrawPreference* drawPref
erence, |
273 WritePixelTempDrawInfo* tempDrawInfo) { | 273 WritePixelTempDrawInfo* tempDrawInfo) { |
274 SkASSERT(drawPreference); | 274 SkASSERT(drawPreference); |
275 SkASSERT(tempDrawInfo); | 275 SkASSERT(tempDrawInfo); |
276 SkASSERT(kGpuPrefersDraw_DrawPreference != *drawPreference); | 276 SkASSERT(kGpuPrefersDraw_DrawPreference != *drawPreference); |
277 | 277 |
278 if (GrPixelConfigIsCompressed(dstSurface->desc().fConfig) && | 278 if (GrPixelConfigIsCompressed(dstSurface->desc().fConfig) && |
279 dstSurface->desc().fConfig != srcConfig) { | 279 dstSurface->desc().fConfig != srcConfig) { |
280 return false; | 280 return false; |
281 } | 281 } |
282 | 282 |
283 if (this->caps()->useDrawInsteadOfPartialRenderTargetWrite() && | 283 if (this->caps()->useDrawInsteadOfPartialRenderTargetWrite() && |
284 SkToBool(dstSurface->asRenderTarget()) && | 284 SkToBool(dstSurface->asRenderTarget()) && |
285 (width < dstSurface->width() || height < dstSurface->height())) { | 285 (width < dstSurface->width() || height < dstSurface->height())) { |
286 ElevateDrawPreference(drawPreference, kRequireDraw_DrawPreference); | 286 ElevateDrawPreference(drawPreference, kRequireDraw_DrawPreference); |
287 } | 287 } |
288 | 288 |
289 if (!this->onGetWritePixelsInfo(dstSurface, width, height, rowBytes, srcConf
ig, drawPreference, | 289 if (!this->onGetWritePixelsInfo(dstSurface, width, height, srcConfig, drawPr
eference, |
290 tempDrawInfo)) { | 290 tempDrawInfo)) { |
291 return false; | 291 return false; |
292 } | 292 } |
293 | 293 |
294 // Check to see if we're going to request that the caller draw when drawing
is not possible. | 294 // Check to see if we're going to request that the caller draw when drawing
is not possible. |
295 if (!dstSurface->asRenderTarget() || | 295 if (!dstSurface->asRenderTarget() || |
296 !this->caps()->isConfigTexturable(tempDrawInfo->fTempSurfaceDesc.fConfig
)) { | 296 !this->caps()->isConfigTexturable(tempDrawInfo->fTempSurfaceDesc.fConfig
)) { |
297 // If we don't have a fallback to a straight upload then fail. | 297 // If we don't have a fallback to a straight upload then fail. |
298 if (kRequireDraw_DrawPreference == *drawPreference || | 298 if (kRequireDraw_DrawPreference == *drawPreference || |
299 !this->caps()->isConfigTexturable(srcConfig)) { | 299 !this->caps()->isConfigTexturable(srcConfig)) { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 } | 378 } |
379 | 379 |
380 GrVertices::Iterator iter; | 380 GrVertices::Iterator iter; |
381 const GrNonInstancedVertices* verts = iter.init(vertices); | 381 const GrNonInstancedVertices* verts = iter.init(vertices); |
382 do { | 382 do { |
383 this->onDraw(args, *verts); | 383 this->onDraw(args, *verts); |
384 fStats.incNumDraws(); | 384 fStats.incNumDraws(); |
385 } while ((verts = iter.next())); | 385 } while ((verts = iter.next())); |
386 } | 386 } |
387 | 387 |
OLD | NEW |