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

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

Issue 15780002: Replace GrDrawState::AutoDeviceCoordDraw with GrDrawState::AutoViewMatrixRestore::setIdentity(). s (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: update based on comments Created 7 years, 6 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
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrInOrderDrawBuffer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 void GrDrawTarget::clipWillBeSet(const GrClipData* clipData) { 650 void GrDrawTarget::clipWillBeSet(const GrClipData* clipData) {
651 } 651 }
652 652
653 //////////////////////////////////////////////////////////////////////////////// 653 ////////////////////////////////////////////////////////////////////////////////
654 654
655 GrDrawTarget::AutoStateRestore::AutoStateRestore() { 655 GrDrawTarget::AutoStateRestore::AutoStateRestore() {
656 fDrawTarget = NULL; 656 fDrawTarget = NULL;
657 } 657 }
658 658
659 GrDrawTarget::AutoStateRestore::AutoStateRestore(GrDrawTarget* target, 659 GrDrawTarget::AutoStateRestore::AutoStateRestore(GrDrawTarget* target,
660 ASRInit init) { 660 ASRInit init,
661 const SkMatrix* vm) {
661 fDrawTarget = NULL; 662 fDrawTarget = NULL;
662 this->set(target, init); 663 this->set(target, init, vm);
663 } 664 }
664 665
665 GrDrawTarget::AutoStateRestore::~AutoStateRestore() { 666 GrDrawTarget::AutoStateRestore::~AutoStateRestore() {
666 if (NULL != fDrawTarget) { 667 if (NULL != fDrawTarget) {
667 fDrawTarget->setDrawState(fSavedState); 668 fDrawTarget->setDrawState(fSavedState);
668 fSavedState->unref(); 669 fSavedState->unref();
669 } 670 }
670 } 671 }
671 672
672 void GrDrawTarget::AutoStateRestore::set(GrDrawTarget* target, ASRInit init) { 673 void GrDrawTarget::AutoStateRestore::set(GrDrawTarget* target, ASRInit init, con st SkMatrix* vm) {
673 GrAssert(NULL == fDrawTarget); 674 GrAssert(NULL == fDrawTarget);
674 fDrawTarget = target; 675 fDrawTarget = target;
675 fSavedState = target->drawState(); 676 fSavedState = target->drawState();
677 GrAssert(fSavedState);
678 fSavedState->ref();
679 if (kReset_ASRInit == init) {
680 if (NULL == vm) {
681 // calls the default cons
682 fTempState.init();
683 } else {
684 SkNEW_IN_TLAZY(&fTempState, GrDrawState, (*vm));
685 }
686 } else {
687 GrAssert(kPreserve_ASRInit == init);
688 if (NULL == vm) {
689 fTempState.set(*fSavedState);
690 } else {
691 SkNEW_IN_TLAZY(&fTempState, GrDrawState, (*fSavedState, *vm));
692 }
693 }
694 target->setDrawState(fTempState.get());
695 }
696
697 bool GrDrawTarget::AutoStateRestore::setIdentity(GrDrawTarget* target, ASRInit i nit) {
698 GrAssert(NULL == fDrawTarget);
699 fDrawTarget = target;
700 fSavedState = target->drawState();
676 GrAssert(fSavedState); 701 GrAssert(fSavedState);
677 fSavedState->ref(); 702 fSavedState->ref();
678 if (kReset_ASRInit == init) { 703 if (kReset_ASRInit == init) {
679 // calls the default cons 704 // calls the default cons
680 fTempState.init(); 705 fTempState.init();
681 } else { 706 } else {
682 GrAssert(kPreserve_ASRInit == init); 707 GrAssert(kPreserve_ASRInit == init);
683 // calls the copy cons 708 // calls the copy cons
684 fTempState.set(*fSavedState); 709 fTempState.set(*fSavedState);
710 if (!fTempState.get()->setIdentityViewMatrix()) {
711 // let go of any resources held by the temp
712 fTempState.get()->reset();
713 fDrawTarget = NULL;
714 fSavedState->unref();
715 fSavedState = NULL;
716 return false;
717 }
685 } 718 }
686 target->setDrawState(fTempState.get()); 719 target->setDrawState(fTempState.get());
720 return true;
687 } 721 }
688 722
689 //////////////////////////////////////////////////////////////////////////////// 723 ////////////////////////////////////////////////////////////////////////////////
690 724
691 GrDrawTarget::AutoReleaseGeometry::AutoReleaseGeometry( 725 GrDrawTarget::AutoReleaseGeometry::AutoReleaseGeometry(
692 GrDrawTarget* target, 726 GrDrawTarget* target,
693 int vertexCount, 727 int vertexCount,
694 int indexCount) { 728 int indexCount) {
695 fTarget = NULL; 729 fTarget = NULL;
696 this->set(target, vertexCount, indexCount); 730 this->set(target, vertexCount, indexCount);
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 GrPrintf("Shader Derivative Support : %s\n", gNY[fShaderDerivativeSupport] ); 978 GrPrintf("Shader Derivative Support : %s\n", gNY[fShaderDerivativeSupport] );
945 GrPrintf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport]); 979 GrPrintf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport]);
946 GrPrintf("Dual Source Blending Support: %s\n", gNY[fDualSourceBlendingSuppor t]); 980 GrPrintf("Dual Source Blending Support: %s\n", gNY[fDualSourceBlendingSuppor t]);
947 GrPrintf("Buffer Lock Support : %s\n", gNY[fBufferLockSupport]); 981 GrPrintf("Buffer Lock Support : %s\n", gNY[fBufferLockSupport]);
948 GrPrintf("Path Stenciling Support : %s\n", gNY[fPathStencilingSupport]); 982 GrPrintf("Path Stenciling Support : %s\n", gNY[fPathStencilingSupport]);
949 GrPrintf("Dst Read In Shader Support : %s\n", gNY[fDstReadInShaderSupport]) ; 983 GrPrintf("Dst Read In Shader Support : %s\n", gNY[fDstReadInShaderSupport]) ;
950 GrPrintf("Max Texture Size : %d\n", fMaxTextureSize); 984 GrPrintf("Max Texture Size : %d\n", fMaxTextureSize);
951 GrPrintf("Max Render Target Size : %d\n", fMaxRenderTargetSize); 985 GrPrintf("Max Render Target Size : %d\n", fMaxRenderTargetSize);
952 GrPrintf("Max Sample Count : %d\n", fMaxSampleCount); 986 GrPrintf("Max Sample Count : %d\n", fMaxSampleCount);
953 } 987 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrInOrderDrawBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698