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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 return false; | 443 return false; |
444 } | 444 } |
445 } else { | 445 } else { |
446 #ifdef SK_DEBUG | 446 #ifdef SK_DEBUG |
447 //GrPrintf("No dev bounds when dst copy is made.\n"); | 447 //GrPrintf("No dev bounds when dst copy is made.\n"); |
448 #endif | 448 #endif |
449 } | 449 } |
450 | 450 |
451 // MSAA consideration: When there is support for reading MSAA samples in the
shader we could | 451 // MSAA consideration: When there is support for reading MSAA samples in the
shader we could |
452 // have per-sample dst values by making the copy multisampled. | 452 // have per-sample dst values by making the copy multisampled. |
453 GrTextureDesc desc; | 453 GrSurfaceDesc desc; |
454 this->initCopySurfaceDstDesc(rt, &desc); | 454 this->initCopySurfaceDstDesc(rt, &desc); |
455 desc.fWidth = copyRect.width(); | 455 desc.fWidth = copyRect.width(); |
456 desc.fHeight = copyRect.height(); | 456 desc.fHeight = copyRect.height(); |
457 | 457 |
458 SkAutoTUnref<GrTexture> copy( | 458 SkAutoTUnref<GrTexture> copy( |
459 fContext->refScratchTexture(desc, GrContext::kApprox_ScratchTexMatch)); | 459 fContext->refScratchTexture(desc, GrContext::kApprox_ScratchTexMatch)); |
460 | 460 |
461 if (!copy) { | 461 if (!copy) { |
462 GrPrintf("Failed to create temporary copy of destination texture.\n"); | 462 GrPrintf("Failed to create temporary copy of destination texture.\n"); |
463 return false; | 463 return false; |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 matrix.postIDiv(tex->width(), tex->height()); | 988 matrix.postIDiv(tex->width(), tex->height()); |
989 this->drawState()->addColorTextureProcessor(tex, matrix); | 989 this->drawState()->addColorTextureProcessor(tex, matrix); |
990 SkIRect dstRect = SkIRect::MakeXYWH(dstPoint.fX, | 990 SkIRect dstRect = SkIRect::MakeXYWH(dstPoint.fX, |
991 dstPoint.fY, | 991 dstPoint.fY, |
992 srcRect.width(), | 992 srcRect.width(), |
993 srcRect.height()); | 993 srcRect.height()); |
994 this->drawSimpleRect(dstRect); | 994 this->drawSimpleRect(dstRect); |
995 return true; | 995 return true; |
996 } | 996 } |
997 | 997 |
998 void GrDrawTarget::initCopySurfaceDstDesc(const GrSurface* src, GrTextureDesc* d
esc) { | 998 void GrDrawTarget::initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* d
esc) { |
999 // Make the dst of the copy be a render target because the default copySurfa
ce draws to the dst. | 999 // Make the dst of the copy be a render target because the default copySurfa
ce draws to the dst. |
1000 desc->fOrigin = kDefault_GrSurfaceOrigin; | 1000 desc->fOrigin = kDefault_GrSurfaceOrigin; |
1001 desc->fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit; | 1001 desc->fFlags = kRenderTarget_GrSurfaceFlag | kNoStencil_GrSurfaceFlag; |
1002 desc->fConfig = src->config(); | 1002 desc->fConfig = src->config(); |
1003 } | 1003 } |
1004 | 1004 |
1005 /////////////////////////////////////////////////////////////////////////////// | 1005 /////////////////////////////////////////////////////////////////////////////// |
1006 | 1006 |
1007 void GrDrawTargetCaps::reset() { | 1007 void GrDrawTargetCaps::reset() { |
1008 fMipMapSupport = false; | 1008 fMipMapSupport = false; |
1009 fNPOTTextureTileSupport = false; | 1009 fNPOTTextureTileSupport = false; |
1010 fTwoSidedStencilSupport = false; | 1010 fTwoSidedStencilSupport = false; |
1011 fStencilWrapOpsSupport = false; | 1011 fStencilWrapOpsSupport = false; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 | 1152 |
1153 uint32_t GrDrawTargetCaps::CreateUniqueID() { | 1153 uint32_t GrDrawTargetCaps::CreateUniqueID() { |
1154 static int32_t gUniqueID = SK_InvalidUniqueID; | 1154 static int32_t gUniqueID = SK_InvalidUniqueID; |
1155 uint32_t id; | 1155 uint32_t id; |
1156 do { | 1156 do { |
1157 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); | 1157 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); |
1158 } while (id == SK_InvalidUniqueID); | 1158 } while (id == SK_InvalidUniqueID); |
1159 return id; | 1159 return id; |
1160 } | 1160 } |
1161 | 1161 |
OLD | NEW |