| 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 | 9 |
| 10 #include "GrGpu.h" | 10 #include "GrGpu.h" |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 | 272 |
| 273 return true; | 273 return true; |
| 274 } | 274 } |
| 275 bool GrGpu::getWritePixelsInfo(GrSurface* dstSurface, int width, int height, siz
e_t rowBytes, | 275 bool GrGpu::getWritePixelsInfo(GrSurface* dstSurface, int width, int height, siz
e_t rowBytes, |
| 276 GrPixelConfig srcConfig, DrawPreference* drawPref
erence, | 276 GrPixelConfig srcConfig, DrawPreference* drawPref
erence, |
| 277 WritePixelTempDrawInfo* tempDrawInfo) { | 277 WritePixelTempDrawInfo* tempDrawInfo) { |
| 278 SkASSERT(drawPreference); | 278 SkASSERT(drawPreference); |
| 279 SkASSERT(tempDrawInfo); | 279 SkASSERT(tempDrawInfo); |
| 280 SkASSERT(kGpuPrefersDraw_DrawPreference != *drawPreference); | 280 SkASSERT(kGpuPrefersDraw_DrawPreference != *drawPreference); |
| 281 | 281 |
| 282 if (GrPixelConfigIsCompressed(dstSurface->desc().fConfig) && |
| 283 dstSurface->desc().fConfig != srcConfig) { |
| 284 return false; |
| 285 } |
| 286 |
| 282 if (this->caps()->useDrawInsteadOfPartialRenderTargetWrite() && | 287 if (this->caps()->useDrawInsteadOfPartialRenderTargetWrite() && |
| 283 SkToBool(dstSurface->asRenderTarget()) && | 288 SkToBool(dstSurface->asRenderTarget()) && |
| 284 (width < dstSurface->width() || height < dstSurface->height())) { | 289 (width < dstSurface->width() || height < dstSurface->height())) { |
| 285 ElevateDrawPreference(drawPreference, kRequireDraw_DrawPreference); | 290 ElevateDrawPreference(drawPreference, kRequireDraw_DrawPreference); |
| 286 } | 291 } |
| 287 | 292 |
| 288 if (!this->onGetWritePixelsInfo(dstSurface, width, height, rowBytes, srcConf
ig, drawPreference, | 293 if (!this->onGetWritePixelsInfo(dstSurface, width, height, rowBytes, srcConf
ig, drawPreference, |
| 289 tempDrawInfo)) { | 294 tempDrawInfo)) { |
| 290 return false; | 295 return false; |
| 291 } | 296 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 return this->onReadPixels(surface, | 330 return this->onReadPixels(surface, |
| 326 left, top, width, height, | 331 left, top, width, height, |
| 327 config, buffer, | 332 config, buffer, |
| 328 rowBytes); | 333 rowBytes); |
| 329 } | 334 } |
| 330 | 335 |
| 331 bool GrGpu::writePixels(GrSurface* surface, | 336 bool GrGpu::writePixels(GrSurface* surface, |
| 332 int left, int top, int width, int height, | 337 int left, int top, int width, int height, |
| 333 GrPixelConfig config, const void* buffer, | 338 GrPixelConfig config, const void* buffer, |
| 334 size_t rowBytes) { | 339 size_t rowBytes) { |
| 340 if (!buffer) { |
| 341 return false; |
| 342 } |
| 343 |
| 335 this->handleDirtyContext(); | 344 this->handleDirtyContext(); |
| 336 if (this->onWritePixels(surface, left, top, width, height, config, buffer, r
owBytes)) { | 345 if (this->onWritePixels(surface, left, top, width, height, config, buffer, r
owBytes)) { |
| 337 fStats.incTextureUploads(); | 346 fStats.incTextureUploads(); |
| 338 return true; | 347 return true; |
| 339 } | 348 } |
| 340 return false; | 349 return false; |
| 341 } | 350 } |
| 342 | 351 |
| 343 void GrGpu::resolveRenderTarget(GrRenderTarget* target) { | 352 void GrGpu::resolveRenderTarget(GrRenderTarget* target) { |
| 344 SkASSERT(target); | 353 SkASSERT(target); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 if (GrXferBarrierType barrierType = args.fPipeline->xferBarrierType(*this->c
aps())) { | 403 if (GrXferBarrierType barrierType = args.fPipeline->xferBarrierType(*this->c
aps())) { |
| 395 this->xferBarrier(args.fPipeline->getRenderTarget(), barrierType); | 404 this->xferBarrier(args.fPipeline->getRenderTarget(), barrierType); |
| 396 } | 405 } |
| 397 | 406 |
| 398 GrVertices::Iterator iter; | 407 GrVertices::Iterator iter; |
| 399 const GrNonInstancedVertices* verts = iter.init(vertices); | 408 const GrNonInstancedVertices* verts = iter.init(vertices); |
| 400 do { | 409 do { |
| 401 this->onDraw(args, *verts); | 410 this->onDraw(args, *verts); |
| 402 } while ((verts = iter.next())); | 411 } while ((verts = iter.next())); |
| 403 } | 412 } |
| OLD | NEW |