| 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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 if (!this->setupDstReadIfNecessary(&info)) { | 511 if (!this->setupDstReadIfNecessary(&info)) { |
| 512 return; | 512 return; |
| 513 } | 513 } |
| 514 this->onDraw(info); | 514 this->onDraw(info); |
| 515 } | 515 } |
| 516 } | 516 } |
| 517 | 517 |
| 518 void GrDrawTarget::stencilPath(const GrPath* path, const SkStrokeRec& stroke, Sk
Path::FillType fill) { | 518 void GrDrawTarget::stencilPath(const GrPath* path, const SkStrokeRec& stroke, Sk
Path::FillType fill) { |
| 519 // TODO: extract portions of checkDraw that are relevant to path stenciling. | 519 // TODO: extract portions of checkDraw that are relevant to path stenciling. |
| 520 SkASSERT(NULL != path); | 520 SkASSERT(NULL != path); |
| 521 SkASSERT(this->caps()->pathStencilingSupport()); | 521 SkASSERT(this->caps()->pathRenderingSupport()); |
| 522 SkASSERT(!stroke.isHairlineStyle()); | 522 SkASSERT(!stroke.isHairlineStyle()); |
| 523 SkASSERT(!SkPath::IsInverseFillType(fill)); | 523 SkASSERT(!SkPath::IsInverseFillType(fill)); |
| 524 this->onStencilPath(path, stroke, fill); | 524 this->onStencilPath(path, stroke, fill); |
| 525 } | 525 } |
| 526 | 526 |
| 527 void GrDrawTarget::fillPath(const GrPath* path, const SkStrokeRec& stroke, SkPat
h::FillType fill) { |
| 528 // TODO: extract portions of checkDraw that are relevant to path rendering. |
| 529 SkASSERT(NULL != path); |
| 530 SkASSERT(this->caps()->pathRenderingSupport()); |
| 531 SkASSERT(!stroke.isHairlineStyle()); |
| 532 this->onFillPath(path, stroke, fill); |
| 533 } |
| 534 |
| 527 //////////////////////////////////////////////////////////////////////////////// | 535 //////////////////////////////////////////////////////////////////////////////// |
| 528 | 536 |
| 529 bool GrDrawTarget::willUseHWAALines() const { | 537 bool GrDrawTarget::willUseHWAALines() const { |
| 530 // There is a conflict between using smooth lines and our use of premultipli
ed alpha. Smooth | 538 // There is a conflict between using smooth lines and our use of premultipli
ed alpha. Smooth |
| 531 // lines tweak the incoming alpha value but not in a premul-alpha way. So we
only use them when | 539 // lines tweak the incoming alpha value but not in a premul-alpha way. So we
only use them when |
| 532 // our alpha is 0xff and tweaking the color for partial coverage is OK | 540 // our alpha is 0xff and tweaking the color for partial coverage is OK |
| 533 if (!this->caps()->hwAALineSupport() || | 541 if (!this->caps()->hwAALineSupport() || |
| 534 !this->getDrawState().isHWAntialiasState()) { | 542 !this->getDrawState().isHWAntialiasState()) { |
| 535 return false; | 543 return false; |
| 536 } | 544 } |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 void GrDrawTargetCaps::reset() { | 950 void GrDrawTargetCaps::reset() { |
| 943 f8BitPaletteSupport = false; | 951 f8BitPaletteSupport = false; |
| 944 fNPOTTextureTileSupport = false; | 952 fNPOTTextureTileSupport = false; |
| 945 fTwoSidedStencilSupport = false; | 953 fTwoSidedStencilSupport = false; |
| 946 fStencilWrapOpsSupport = false; | 954 fStencilWrapOpsSupport = false; |
| 947 fHWAALineSupport = false; | 955 fHWAALineSupport = false; |
| 948 fShaderDerivativeSupport = false; | 956 fShaderDerivativeSupport = false; |
| 949 fGeometryShaderSupport = false; | 957 fGeometryShaderSupport = false; |
| 950 fDualSourceBlendingSupport = false; | 958 fDualSourceBlendingSupport = false; |
| 951 fBufferLockSupport = false; | 959 fBufferLockSupport = false; |
| 952 fPathStencilingSupport = false; | 960 fPathRenderingSupport = false; |
| 953 fDstReadInShaderSupport = false; | 961 fDstReadInShaderSupport = false; |
| 954 fReuseScratchTextures = true; | 962 fReuseScratchTextures = true; |
| 955 | 963 |
| 956 fMaxRenderTargetSize = 0; | 964 fMaxRenderTargetSize = 0; |
| 957 fMaxTextureSize = 0; | 965 fMaxTextureSize = 0; |
| 958 fMaxSampleCount = 0; | 966 fMaxSampleCount = 0; |
| 959 } | 967 } |
| 960 | 968 |
| 961 GrDrawTargetCaps& GrDrawTargetCaps::operator=(const GrDrawTargetCaps& other) { | 969 GrDrawTargetCaps& GrDrawTargetCaps::operator=(const GrDrawTargetCaps& other) { |
| 962 f8BitPaletteSupport = other.f8BitPaletteSupport; | 970 f8BitPaletteSupport = other.f8BitPaletteSupport; |
| 963 fNPOTTextureTileSupport = other.fNPOTTextureTileSupport; | 971 fNPOTTextureTileSupport = other.fNPOTTextureTileSupport; |
| 964 fTwoSidedStencilSupport = other.fTwoSidedStencilSupport; | 972 fTwoSidedStencilSupport = other.fTwoSidedStencilSupport; |
| 965 fStencilWrapOpsSupport = other.fStencilWrapOpsSupport; | 973 fStencilWrapOpsSupport = other.fStencilWrapOpsSupport; |
| 966 fHWAALineSupport = other.fHWAALineSupport; | 974 fHWAALineSupport = other.fHWAALineSupport; |
| 967 fShaderDerivativeSupport = other.fShaderDerivativeSupport; | 975 fShaderDerivativeSupport = other.fShaderDerivativeSupport; |
| 968 fGeometryShaderSupport = other.fGeometryShaderSupport; | 976 fGeometryShaderSupport = other.fGeometryShaderSupport; |
| 969 fDualSourceBlendingSupport = other.fDualSourceBlendingSupport; | 977 fDualSourceBlendingSupport = other.fDualSourceBlendingSupport; |
| 970 fBufferLockSupport = other.fBufferLockSupport; | 978 fBufferLockSupport = other.fBufferLockSupport; |
| 971 fPathStencilingSupport = other.fPathStencilingSupport; | 979 fPathRenderingSupport = other.fPathRenderingSupport; |
| 972 fDstReadInShaderSupport = other.fDstReadInShaderSupport; | 980 fDstReadInShaderSupport = other.fDstReadInShaderSupport; |
| 973 fReuseScratchTextures = other.fReuseScratchTextures; | 981 fReuseScratchTextures = other.fReuseScratchTextures; |
| 974 | 982 |
| 975 fMaxRenderTargetSize = other.fMaxRenderTargetSize; | 983 fMaxRenderTargetSize = other.fMaxRenderTargetSize; |
| 976 fMaxTextureSize = other.fMaxTextureSize; | 984 fMaxTextureSize = other.fMaxTextureSize; |
| 977 fMaxSampleCount = other.fMaxSampleCount; | 985 fMaxSampleCount = other.fMaxSampleCount; |
| 978 | 986 |
| 979 return *this; | 987 return *this; |
| 980 } | 988 } |
| 981 | 989 |
| 982 void GrDrawTargetCaps::print() const { | 990 void GrDrawTargetCaps::print() const { |
| 983 static const char* gNY[] = {"NO", "YES"}; | 991 static const char* gNY[] = {"NO", "YES"}; |
| 984 GrPrintf("8 Bit Palette Support : %s\n", gNY[f8BitPaletteSupport]); | 992 GrPrintf("8 Bit Palette Support : %s\n", gNY[f8BitPaletteSupport]); |
| 985 GrPrintf("NPOT Texture Tile Support : %s\n", gNY[fNPOTTextureTileSupport])
; | 993 GrPrintf("NPOT Texture Tile Support : %s\n", gNY[fNPOTTextureTileSupport])
; |
| 986 GrPrintf("Two Sided Stencil Support : %s\n", gNY[fTwoSidedStencilSupport])
; | 994 GrPrintf("Two Sided Stencil Support : %s\n", gNY[fTwoSidedStencilSupport])
; |
| 987 GrPrintf("Stencil Wrap Ops Support : %s\n", gNY[fStencilWrapOpsSupport]); | 995 GrPrintf("Stencil Wrap Ops Support : %s\n", gNY[fStencilWrapOpsSupport]); |
| 988 GrPrintf("HW AA Lines Support : %s\n", gNY[fHWAALineSupport]); | 996 GrPrintf("HW AA Lines Support : %s\n", gNY[fHWAALineSupport]); |
| 989 GrPrintf("Shader Derivative Support : %s\n", gNY[fShaderDerivativeSupport]
); | 997 GrPrintf("Shader Derivative Support : %s\n", gNY[fShaderDerivativeSupport]
); |
| 990 GrPrintf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport]); | 998 GrPrintf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport]); |
| 991 GrPrintf("Dual Source Blending Support: %s\n", gNY[fDualSourceBlendingSuppor
t]); | 999 GrPrintf("Dual Source Blending Support: %s\n", gNY[fDualSourceBlendingSuppor
t]); |
| 992 GrPrintf("Buffer Lock Support : %s\n", gNY[fBufferLockSupport]); | 1000 GrPrintf("Buffer Lock Support : %s\n", gNY[fBufferLockSupport]); |
| 993 GrPrintf("Path Stenciling Support : %s\n", gNY[fPathStencilingSupport]); | 1001 GrPrintf("Path Rendering Support : %s\n", gNY[fPathRenderingSupport]); |
| 994 GrPrintf("Dst Read In Shader Support : %s\n", gNY[fDstReadInShaderSupport])
; | 1002 GrPrintf("Dst Read In Shader Support : %s\n", gNY[fDstReadInShaderSupport])
; |
| 995 GrPrintf("Reuse Scratch Textures : %s\n", gNY[fReuseScratchTextures]); | 1003 GrPrintf("Reuse Scratch Textures : %s\n", gNY[fReuseScratchTextures]); |
| 996 GrPrintf("Max Texture Size : %d\n", fMaxTextureSize); | 1004 GrPrintf("Max Texture Size : %d\n", fMaxTextureSize); |
| 997 GrPrintf("Max Render Target Size : %d\n", fMaxRenderTargetSize); | 1005 GrPrintf("Max Render Target Size : %d\n", fMaxRenderTargetSize); |
| 998 GrPrintf("Max Sample Count : %d\n", fMaxSampleCount); | 1006 GrPrintf("Max Sample Count : %d\n", fMaxSampleCount); |
| 999 } | 1007 } |
| OLD | NEW |