Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/gpu/GrDrawTarget.cpp

Issue 12843026: Make GrDrawTarget::Caps ref counted and GrGLCaps derive from it. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 if (NULL != devBounds) { 445 if (NULL != devBounds) {
446 info.setDevBounds(*devBounds); 446 info.setDevBounds(*devBounds);
447 } 447 }
448 this->onDraw(info); 448 this->onDraw(info);
449 } 449 }
450 } 450 }
451 451
452 void GrDrawTarget::stencilPath(const GrPath* path, const SkStrokeRec& stroke, Sk Path::FillType fill) { 452 void GrDrawTarget::stencilPath(const GrPath* path, const SkStrokeRec& stroke, Sk Path::FillType fill) {
453 // TODO: extract portions of checkDraw that are relevant to path stenciling. 453 // TODO: extract portions of checkDraw that are relevant to path stenciling.
454 GrAssert(NULL != path); 454 GrAssert(NULL != path);
455 GrAssert(fCaps.pathStencilingSupport()); 455 GrAssert(this->caps()->pathStencilingSupport());
456 GrAssert(!stroke.isHairlineStyle()); 456 GrAssert(!stroke.isHairlineStyle());
457 GrAssert(!SkPath::IsInverseFillType(fill)); 457 GrAssert(!SkPath::IsInverseFillType(fill));
458 this->onStencilPath(path, stroke, fill); 458 this->onStencilPath(path, stroke, fill);
459 } 459 }
460 460
461 //////////////////////////////////////////////////////////////////////////////// 461 ////////////////////////////////////////////////////////////////////////////////
462 462
463 bool GrDrawTarget::willUseHWAALines() const { 463 bool GrDrawTarget::willUseHWAALines() const {
464 // There is a conflict between using smooth lines and our use of premultipli ed alpha. Smooth 464 // There is a conflict between using smooth lines and our use of premultipli ed alpha. Smooth
465 // lines tweak the incoming alpha value but not in a premul-alpha way. So we only use them when 465 // lines tweak the incoming alpha value but not in a premul-alpha way. So we only use them when
466 // our alpha is 0xff and tweaking the color for partial coverage is OK 466 // our alpha is 0xff and tweaking the color for partial coverage is OK
467 if (!fCaps.hwAALineSupport() || 467 if (!this->caps()->hwAALineSupport() ||
468 !this->getDrawState().isHWAntialiasState()) { 468 !this->getDrawState().isHWAntialiasState()) {
469 return false; 469 return false;
470 } 470 }
471 GrDrawState::BlendOptFlags opts = this->getDrawState().getBlendOpts(); 471 GrDrawState::BlendOptFlags opts = this->getDrawState().getBlendOpts();
472 return (GrDrawState::kDisableBlend_BlendOptFlag & opts) && 472 return (GrDrawState::kDisableBlend_BlendOptFlag & opts) &&
473 (GrDrawState::kCoverageAsAlpha_BlendOptFlag & opts); 473 (GrDrawState::kCoverageAsAlpha_BlendOptFlag & opts);
474 } 474 }
475 475
476 bool GrDrawTarget::canApplyCoverage() const { 476 bool GrDrawTarget::canApplyCoverage() const {
477 // we can correctly apply coverage if a) we have dual source blending 477 // we can correctly apply coverage if a) we have dual source blending
478 // or b) one of our blend optimizations applies. 478 // or b) one of our blend optimizations applies.
479 return this->getCaps().dualSourceBlendingSupport() || 479 return this->caps()->dualSourceBlendingSupport() ||
480 GrDrawState::kNone_BlendOpt != this->getDrawState().getBlendOpts(true ); 480 GrDrawState::kNone_BlendOpt != this->getDrawState().getBlendOpts(true );
481 } 481 }
482 482
483 //////////////////////////////////////////////////////////////////////////////// 483 ////////////////////////////////////////////////////////////////////////////////
484 484
485 void GrDrawTarget::drawIndexedInstances(GrPrimitiveType type, 485 void GrDrawTarget::drawIndexedInstances(GrPrimitiveType type,
486 int instanceCount, 486 int instanceCount,
487 int verticesPerInstance, 487 int verticesPerInstance,
488 int indicesPerInstance, 488 int indicesPerInstance,
489 const SkRect* devBounds) { 489 const SkRect* devBounds) {
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 670
671 GrDrawTarget::AutoClipRestore::AutoClipRestore(GrDrawTarget* target, const SkIRe ct& newClip) { 671 GrDrawTarget::AutoClipRestore::AutoClipRestore(GrDrawTarget* target, const SkIRe ct& newClip) {
672 fTarget = target; 672 fTarget = target;
673 fClip = fTarget->getClip(); 673 fClip = fTarget->getClip();
674 fStack.init(); 674 fStack.init();
675 fStack.get()->clipDevRect(newClip, SkRegion::kReplace_Op); 675 fStack.get()->clipDevRect(newClip, SkRegion::kReplace_Op);
676 fReplacementClip.fClipStack = fStack.get(); 676 fReplacementClip.fClipStack = fStack.get();
677 target->setClip(&fReplacementClip); 677 target->setClip(&fReplacementClip);
678 } 678 }
679 679
680 ///////////////////////////////////////////////////////////////////////////////
681
682 void GrDrawTarget::Caps::reset() {
683 f8BitPaletteSupport = false;
684 fNPOTTextureTileSupport = false;
685 fTwoSidedStencilSupport = false;
686 fStencilWrapOpsSupport = false;
687 fHWAALineSupport = false;
688 fShaderDerivativeSupport = false;
689 fGeometryShaderSupport = false;
690 fDualSourceBlendingSupport = false;
691 fBufferLockSupport = false;
692 fPathStencilingSupport = false;
693
694 fMaxRenderTargetSize = 0;
695 fMaxTextureSize = 0;
696 fMaxSampleCount = 0;
697 }
698
699 GrDrawTarget::Caps& GrDrawTarget::Caps::operator=(const GrDrawTarget::Caps& othe r) {
700 f8BitPaletteSupport = other.f8BitPaletteSupport;
701 fNPOTTextureTileSupport = other.fNPOTTextureTileSupport;
702 fTwoSidedStencilSupport = other.fTwoSidedStencilSupport;
703 fStencilWrapOpsSupport = other.fStencilWrapOpsSupport;
704 fHWAALineSupport = other.fHWAALineSupport;
705 fShaderDerivativeSupport = other.fShaderDerivativeSupport;
706 fGeometryShaderSupport = other.fGeometryShaderSupport;
707 fDualSourceBlendingSupport = other.fDualSourceBlendingSupport;
708 fBufferLockSupport = other.fBufferLockSupport;
709 fPathStencilingSupport = other.fPathStencilingSupport;
710
711 fMaxRenderTargetSize = other.fMaxRenderTargetSize;
712 fMaxTextureSize = other.fMaxTextureSize;
713 fMaxSampleCount = other.fMaxSampleCount;
714
715 return *this;
716 }
717
680 void GrDrawTarget::Caps::print() const { 718 void GrDrawTarget::Caps::print() const {
681 static const char* gNY[] = {"NO", "YES"}; 719 static const char* gNY[] = {"NO", "YES"};
682 GrPrintf("8 Bit Palette Support : %s\n", gNY[fInternals.f8BitPaletteSu pport]); 720 GrPrintf("8 Bit Palette Support : %s\n", gNY[f8BitPaletteSupport]);
683 GrPrintf("NPOT Texture Tile Support : %s\n", gNY[fInternals.fNPOTTextureTi leSupport]); 721 GrPrintf("NPOT Texture Tile Support : %s\n", gNY[fNPOTTextureTileSupport]) ;
684 GrPrintf("Two Sided Stencil Support : %s\n", gNY[fInternals.fTwoSidedStenc ilSupport]); 722 GrPrintf("Two Sided Stencil Support : %s\n", gNY[fTwoSidedStencilSupport]) ;
685 GrPrintf("Stencil Wrap Ops Support : %s\n", gNY[fInternals.fStencilWrapOp sSupport]); 723 GrPrintf("Stencil Wrap Ops Support : %s\n", gNY[fStencilWrapOpsSupport]);
686 GrPrintf("HW AA Lines Support : %s\n", gNY[fInternals.fHWAALineSuppo rt]); 724 GrPrintf("HW AA Lines Support : %s\n", gNY[fHWAALineSupport]);
687 GrPrintf("Shader Derivative Support : %s\n", gNY[fInternals.fShaderDerivat iveSupport]); 725 GrPrintf("Shader Derivative Support : %s\n", gNY[fShaderDerivativeSupport] );
688 GrPrintf("Geometry Shader Support : %s\n", gNY[fInternals.fGeometryShade rSupport]); 726 GrPrintf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport]);
689 GrPrintf("FSAA Support : %s\n", gNY[fInternals.fFSAASupport]) ; 727 GrPrintf("Dual Source Blending Support: %s\n", gNY[fDualSourceBlendingSuppor t]);
690 GrPrintf("Dual Source Blending Support: %s\n", gNY[fInternals.fDualSourceBle ndingSupport]); 728 GrPrintf("Buffer Lock Support : %s\n", gNY[fBufferLockSupport]);
691 GrPrintf("Buffer Lock Support : %s\n", gNY[fInternals.fBufferLockSup port]); 729 GrPrintf("Path Stenciling Support : %s\n", gNY[fPathStencilingSupport]);
692 GrPrintf("Path Stenciling Support : %s\n", gNY[fInternals.fPathStencilin gSupport]); 730 GrPrintf("Max Texture Size : %d\n", fMaxTextureSize);
693 GrPrintf("Max Texture Size : %d\n", fInternals.fMaxTextureSize); 731 GrPrintf("Max Render Target Size : %d\n", fMaxRenderTargetSize);
694 GrPrintf("Max Render Target Size : %d\n", fInternals.fMaxRenderTargetSi ze); 732 GrPrintf("Max Sample Count : %d\n", fMaxSampleCount);
695 } 733 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrGpu.cpp » ('j') | src/gpu/gl/GrGLContext.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698