| 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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 } | 425 } |
| 426 } else { | 426 } else { |
| 427 #if GR_DEBUG | 427 #if GR_DEBUG |
| 428 //GrPrintf("No dev bounds when dst copy is made.\n"); | 428 //GrPrintf("No dev bounds when dst copy is made.\n"); |
| 429 #endif | 429 #endif |
| 430 } | 430 } |
| 431 | 431 |
| 432 // MSAA consideration: When there is support for reading MSAA samples in the
shader we could | 432 // MSAA consideration: When there is support for reading MSAA samples in the
shader we could |
| 433 // have per-sample dst values by making the copy multisampled. | 433 // have per-sample dst values by making the copy multisampled. |
| 434 GrTextureDesc desc; | 434 GrTextureDesc desc; |
| 435 desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit; | 435 this->initCopySurfaceDstDesc(rt, &desc); |
| 436 desc.fWidth = copyRect.width(); | 436 desc.fWidth = copyRect.width(); |
| 437 desc.fHeight = copyRect.height(); | 437 desc.fHeight = copyRect.height(); |
| 438 desc.fSampleCnt = 0; | |
| 439 desc.fConfig = rt->config(); | |
| 440 | 438 |
| 441 GrAutoScratchTexture ast(fContext, desc, GrContext::kApprox_ScratchTexMatch)
; | 439 GrAutoScratchTexture ast(fContext, desc, GrContext::kApprox_ScratchTexMatch)
; |
| 442 | 440 |
| 443 if (NULL == ast.texture()) { | 441 if (NULL == ast.texture()) { |
| 444 GrPrintf("Failed to create temporary copy of destination texture.\n"); | 442 GrPrintf("Failed to create temporary copy of destination texture.\n"); |
| 445 return false; | 443 return false; |
| 446 } | 444 } |
| 447 SkIPoint dstPoint = {0, 0}; | 445 SkIPoint dstPoint = {0, 0}; |
| 448 if (this->copySurface(ast.texture(), rt, copyRect, dstPoint)) { | 446 if (this->copySurface(ast.texture(), rt, copyRect, dstPoint)) { |
| 449 info->fDstCopy.setTexture(ast.texture()); | 447 info->fDstCopy.setTexture(ast.texture()); |
| 450 info->fDstCopy.setOffset(copyRect.fLeft, copyRect.fTop); | 448 info->fDstCopy.setOffset(copyRect.fLeft, copyRect.fTop); |
| 451 return true; | 449 return true; |
| 452 } else { | 450 } else { |
| 453 return false; | 451 return false; |
| 454 } | 452 } |
| 455 } | 453 } |
| 456 | 454 |
| 457 void GrDrawTarget::drawIndexed(GrPrimitiveType type, | 455 void GrDrawTarget::drawIndexed(GrPrimitiveType type, |
| 458 int startVertex, | 456 int startVertex, |
| 459 int startIndex, | 457 int startIndex, |
| 460 int vertexCount, | 458 int vertexCount, |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 matrix.postIDiv(tex->width(), tex->height()); | 872 matrix.postIDiv(tex->width(), tex->height()); |
| 875 this->drawState()->createTextureEffect(0, tex, matrix); | 873 this->drawState()->createTextureEffect(0, tex, matrix); |
| 876 SkIRect dstRect = SkIRect::MakeXYWH(dstPoint.fX, | 874 SkIRect dstRect = SkIRect::MakeXYWH(dstPoint.fX, |
| 877 dstPoint.fY, | 875 dstPoint.fY, |
| 878 srcRect.width(), | 876 srcRect.width(), |
| 879 srcRect.height()); | 877 srcRect.height()); |
| 880 this->drawSimpleRect(dstRect); | 878 this->drawSimpleRect(dstRect); |
| 881 return true; | 879 return true; |
| 882 } | 880 } |
| 883 | 881 |
| 882 void GrDrawTarget::initCopySurfaceDstDesc(const GrSurface* src, GrTextureDesc* d
esc) { |
| 883 // Make the dst of the copy be a render target because the default copySurfa
ce draws to the dst. |
| 884 desc->fOrigin = kDefault_GrSurfaceOrigin; |
| 885 desc->fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit; |
| 886 desc->fConfig = src->config(); |
| 887 } |
| 888 |
| 884 /////////////////////////////////////////////////////////////////////////////// | 889 /////////////////////////////////////////////////////////////////////////////// |
| 885 | 890 |
| 886 SK_DEFINE_INST_COUNT(GrDrawTargetCaps) | 891 SK_DEFINE_INST_COUNT(GrDrawTargetCaps) |
| 887 | 892 |
| 888 void GrDrawTargetCaps::reset() { | 893 void GrDrawTargetCaps::reset() { |
| 889 f8BitPaletteSupport = false; | 894 f8BitPaletteSupport = false; |
| 890 fNPOTTextureTileSupport = false; | 895 fNPOTTextureTileSupport = false; |
| 891 fTwoSidedStencilSupport = false; | 896 fTwoSidedStencilSupport = false; |
| 892 fStencilWrapOpsSupport = false; | 897 fStencilWrapOpsSupport = false; |
| 893 fHWAALineSupport = false; | 898 fHWAALineSupport = false; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 GrPrintf("HW AA Lines Support : %s\n", gNY[fHWAALineSupport]); | 935 GrPrintf("HW AA Lines Support : %s\n", gNY[fHWAALineSupport]); |
| 931 GrPrintf("Shader Derivative Support : %s\n", gNY[fShaderDerivativeSupport]
); | 936 GrPrintf("Shader Derivative Support : %s\n", gNY[fShaderDerivativeSupport]
); |
| 932 GrPrintf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport]); | 937 GrPrintf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport]); |
| 933 GrPrintf("Dual Source Blending Support: %s\n", gNY[fDualSourceBlendingSuppor
t]); | 938 GrPrintf("Dual Source Blending Support: %s\n", gNY[fDualSourceBlendingSuppor
t]); |
| 934 GrPrintf("Buffer Lock Support : %s\n", gNY[fBufferLockSupport]); | 939 GrPrintf("Buffer Lock Support : %s\n", gNY[fBufferLockSupport]); |
| 935 GrPrintf("Path Stenciling Support : %s\n", gNY[fPathStencilingSupport]); | 940 GrPrintf("Path Stenciling Support : %s\n", gNY[fPathStencilingSupport]); |
| 936 GrPrintf("Max Texture Size : %d\n", fMaxTextureSize); | 941 GrPrintf("Max Texture Size : %d\n", fMaxTextureSize); |
| 937 GrPrintf("Max Render Target Size : %d\n", fMaxRenderTargetSize); | 942 GrPrintf("Max Render Target Size : %d\n", fMaxRenderTargetSize); |
| 938 GrPrintf("Max Sample Count : %d\n", fMaxSampleCount); | 943 GrPrintf("Max Sample Count : %d\n", fMaxSampleCount); |
| 939 } | 944 } |
| OLD | NEW |