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 | 10 |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 GrRenderTarget* rt = this->drawState()->getRenderTarget(); | 430 GrRenderTarget* rt = this->drawState()->getRenderTarget(); |
431 SkIRect copyRect; | 431 SkIRect copyRect; |
432 const GrClipData* clip = this->getClip(); | 432 const GrClipData* clip = this->getClip(); |
433 clip->getConservativeBounds(rt, ©Rect); | 433 clip->getConservativeBounds(rt, ©Rect); |
434 | 434 |
435 if (drawBounds) { | 435 if (drawBounds) { |
436 SkIRect drawIBounds; | 436 SkIRect drawIBounds; |
437 drawBounds->roundOut(&drawIBounds); | 437 drawBounds->roundOut(&drawIBounds); |
438 if (!copyRect.intersect(drawIBounds)) { | 438 if (!copyRect.intersect(drawIBounds)) { |
439 #ifdef SK_DEBUG | 439 #ifdef SK_DEBUG |
440 GrPrintf("Missed an early reject. Bailing on draw from setupDstReadI
fNecessary.\n"); | 440 SkDebugf("Missed an early reject. Bailing on draw from setupDstReadI
fNecessary.\n"); |
441 #endif | 441 #endif |
442 return false; | 442 return false; |
443 } | 443 } |
444 } else { | 444 } else { |
445 #ifdef SK_DEBUG | 445 #ifdef SK_DEBUG |
446 //GrPrintf("No dev bounds when dst copy is made.\n"); | 446 //SkDebugf("No dev bounds when dst copy is made.\n"); |
447 #endif | 447 #endif |
448 } | 448 } |
449 | 449 |
450 // MSAA consideration: When there is support for reading MSAA samples in the
shader we could | 450 // MSAA consideration: When there is support for reading MSAA samples in the
shader we could |
451 // have per-sample dst values by making the copy multisampled. | 451 // have per-sample dst values by making the copy multisampled. |
452 GrSurfaceDesc desc; | 452 GrSurfaceDesc desc; |
453 this->initCopySurfaceDstDesc(rt, &desc); | 453 this->initCopySurfaceDstDesc(rt, &desc); |
454 desc.fWidth = copyRect.width(); | 454 desc.fWidth = copyRect.width(); |
455 desc.fHeight = copyRect.height(); | 455 desc.fHeight = copyRect.height(); |
456 | 456 |
457 SkAutoTUnref<GrTexture> copy( | 457 SkAutoTUnref<GrTexture> copy( |
458 fContext->refScratchTexture(desc, GrContext::kApprox_ScratchTexMatch)); | 458 fContext->refScratchTexture(desc, GrContext::kApprox_ScratchTexMatch)); |
459 | 459 |
460 if (!copy) { | 460 if (!copy) { |
461 GrPrintf("Failed to create temporary copy of destination texture.\n"); | 461 SkDebugf("Failed to create temporary copy of destination texture.\n"); |
462 return false; | 462 return false; |
463 } | 463 } |
464 SkIPoint dstPoint = {0, 0}; | 464 SkIPoint dstPoint = {0, 0}; |
465 if (this->copySurface(copy, rt, copyRect, dstPoint)) { | 465 if (this->copySurface(copy, rt, copyRect, dstPoint)) { |
466 dstCopy->setTexture(copy); | 466 dstCopy->setTexture(copy); |
467 dstCopy->setOffset(copyRect.fLeft, copyRect.fTop); | 467 dstCopy->setOffset(copyRect.fLeft, copyRect.fTop); |
468 return true; | 468 return true; |
469 } else { | 469 } else { |
470 return false; | 470 return false; |
471 } | 471 } |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 }; | 692 }; |
693 | 693 |
694 void GrDrawTarget::onDrawRect(const SkRect& rect, | 694 void GrDrawTarget::onDrawRect(const SkRect& rect, |
695 const SkRect* localRect, | 695 const SkRect* localRect, |
696 const SkMatrix* localMatrix) { | 696 const SkMatrix* localMatrix) { |
697 | 697 |
698 set_vertex_attributes(this->drawState(), SkToBool(localRect)); | 698 set_vertex_attributes(this->drawState(), SkToBool(localRect)); |
699 | 699 |
700 AutoReleaseGeometry geo(this, 4, 0); | 700 AutoReleaseGeometry geo(this, 4, 0); |
701 if (!geo.succeeded()) { | 701 if (!geo.succeeded()) { |
702 GrPrintf("Failed to get space for vertices!\n"); | 702 SkDebugf("Failed to get space for vertices!\n"); |
703 return; | 703 return; |
704 } | 704 } |
705 | 705 |
706 size_t vstride = this->drawState()->getVertexStride(); | 706 size_t vstride = this->drawState()->getVertexStride(); |
707 geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom
, vstride); | 707 geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom
, vstride); |
708 if (localRect) { | 708 if (localRect) { |
709 SkPoint* coords = GrTCast<SkPoint*>(GrTCast<intptr_t>(geo.vertices()) + | 709 SkPoint* coords = GrTCast<SkPoint*>(GrTCast<intptr_t>(geo.vertices()) + |
710 sizeof(SkPoint)); | 710 sizeof(SkPoint)); |
711 coords->setRectFan(localRect->fLeft, localRect->fTop, | 711 coords->setRectFan(localRect->fLeft, localRect->fTop, |
712 localRect->fRight, localRect->fBottom, | 712 localRect->fRight, localRect->fBottom, |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1188 | 1188 |
1189 uint32_t GrDrawTargetCaps::CreateUniqueID() { | 1189 uint32_t GrDrawTargetCaps::CreateUniqueID() { |
1190 static int32_t gUniqueID = SK_InvalidUniqueID; | 1190 static int32_t gUniqueID = SK_InvalidUniqueID; |
1191 uint32_t id; | 1191 uint32_t id; |
1192 do { | 1192 do { |
1193 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); | 1193 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); |
1194 } while (id == SK_InvalidUniqueID); | 1194 } while (id == SK_InvalidUniqueID); |
1195 return id; | 1195 return id; |
1196 } | 1196 } |
1197 | 1197 |
OLD | NEW |