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

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

Issue 22850006: Replace uses of GrAssert by SkASSERT. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years, 4 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/GrDrawState.cpp ('k') | src/gpu/GrDrawTarget.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 #ifndef GrDrawTarget_DEFINED 10 #ifndef GrDrawTarget_DEFINED
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 public: 532 public:
533 AutoReleaseGeometry(GrDrawTarget* target, 533 AutoReleaseGeometry(GrDrawTarget* target,
534 int vertexCount, 534 int vertexCount,
535 int indexCount); 535 int indexCount);
536 AutoReleaseGeometry(); 536 AutoReleaseGeometry();
537 ~AutoReleaseGeometry(); 537 ~AutoReleaseGeometry();
538 bool set(GrDrawTarget* target, 538 bool set(GrDrawTarget* target,
539 int vertexCount, 539 int vertexCount,
540 int indexCount); 540 int indexCount);
541 bool succeeded() const { return NULL != fTarget; } 541 bool succeeded() const { return NULL != fTarget; }
542 void* vertices() const { GrAssert(this->succeeded()); return fVertices; } 542 void* vertices() const { SkASSERT(this->succeeded()); return fVertices; }
543 void* indices() const { GrAssert(this->succeeded()); return fIndices; } 543 void* indices() const { SkASSERT(this->succeeded()); return fIndices; }
544 GrPoint* positions() const { 544 GrPoint* positions() const {
545 return static_cast<GrPoint*>(this->vertices()); 545 return static_cast<GrPoint*>(this->vertices());
546 } 546 }
547 547
548 private: 548 private:
549 void reset(); 549 void reset();
550 550
551 GrDrawTarget* fTarget; 551 GrDrawTarget* fTarget;
552 void* fVertices; 552 void* fVertices;
553 void* fIndices; 553 void* fIndices;
(...skipping 23 matching lines...) Expand all
577 //////////////////////////////////////////////////////////////////////////// 577 ////////////////////////////////////////////////////////////////////////////
578 578
579 /** 579 /**
580 * Saves the geometry src state at construction and restores in the destruct or. It also saves 580 * Saves the geometry src state at construction and restores in the destruct or. It also saves
581 * and then restores the vertex attrib state. 581 * and then restores the vertex attrib state.
582 */ 582 */
583 class AutoGeometryPush : ::GrNoncopyable { 583 class AutoGeometryPush : ::GrNoncopyable {
584 public: 584 public:
585 AutoGeometryPush(GrDrawTarget* target) 585 AutoGeometryPush(GrDrawTarget* target)
586 : fAttribRestore(target->drawState()) { 586 : fAttribRestore(target->drawState()) {
587 GrAssert(NULL != target); 587 SkASSERT(NULL != target);
588 fTarget = target; 588 fTarget = target;
589 target->pushGeometrySource(); 589 target->pushGeometrySource();
590 } 590 }
591 591
592 ~AutoGeometryPush() { fTarget->popGeometrySource(); } 592 ~AutoGeometryPush() { fTarget->popGeometrySource(); }
593 593
594 private: 594 private:
595 GrDrawTarget* fTarget; 595 GrDrawTarget* fTarget;
596 GrDrawState::AutoVertexAttribRestore fAttribRestore; 596 GrDrawState::AutoVertexAttribRestore fAttribRestore;
597 }; 597 };
598 598
599 /** 599 /**
600 * Combination of AutoGeometryPush and AutoStateRestore. The vertex attribs will be in default 600 * Combination of AutoGeometryPush and AutoStateRestore. The vertex attribs will be in default
601 * state regardless of ASRInit value. 601 * state regardless of ASRInit value.
602 */ 602 */
603 class AutoGeometryAndStatePush : ::GrNoncopyable { 603 class AutoGeometryAndStatePush : ::GrNoncopyable {
604 public: 604 public:
605 AutoGeometryAndStatePush(GrDrawTarget* target, 605 AutoGeometryAndStatePush(GrDrawTarget* target,
606 ASRInit init, 606 ASRInit init,
607 const SkMatrix* viewMatrix = NULL) 607 const SkMatrix* viewMatrix = NULL)
608 : fState(target, init, viewMatrix) { 608 : fState(target, init, viewMatrix) {
609 GrAssert(NULL != target); 609 SkASSERT(NULL != target);
610 fTarget = target; 610 fTarget = target;
611 target->pushGeometrySource(); 611 target->pushGeometrySource();
612 if (kPreserve_ASRInit == init) { 612 if (kPreserve_ASRInit == init) {
613 target->drawState()->setDefaultVertexAttribs(); 613 target->drawState()->setDefaultVertexAttribs();
614 } 614 }
615 } 615 }
616 616
617 ~AutoGeometryAndStatePush() { fTarget->popGeometrySource(); } 617 ~AutoGeometryAndStatePush() { fTarget->popGeometrySource(); }
618 618
619 private: 619 private:
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 // subclasses must call this in their destructors to ensure all vertex 712 // subclasses must call this in their destructors to ensure all vertex
713 // and index sources have been released (including those held by 713 // and index sources have been released (including those held by
714 // pushGeometrySource()) 714 // pushGeometrySource())
715 void releaseGeometry(); 715 void releaseGeometry();
716 716
717 // accessors for derived classes 717 // accessors for derived classes
718 const GeometrySrcState& getGeomSrc() const { return fGeoSrcStateStack.back() ; } 718 const GeometrySrcState& getGeomSrc() const { return fGeoSrcStateStack.back() ; }
719 // it is preferable to call this rather than getGeomSrc()->fVertexSize becau se of the assert. 719 // it is preferable to call this rather than getGeomSrc()->fVertexSize becau se of the assert.
720 size_t getVertexSize() const { 720 size_t getVertexSize() const {
721 // the vertex layout is only valid if a vertex source has been specified . 721 // the vertex layout is only valid if a vertex source has been specified .
722 GrAssert(this->getGeomSrc().fVertexSrc != kNone_GeometrySrcType); 722 SkASSERT(this->getGeomSrc().fVertexSrc != kNone_GeometrySrcType);
723 return this->getGeomSrc().fVertexSize; 723 return this->getGeomSrc().fVertexSize;
724 } 724 }
725 725
726 // Subclass must initialize this in its constructor. 726 // Subclass must initialize this in its constructor.
727 SkAutoTUnref<const GrDrawTargetCaps> fCaps; 727 SkAutoTUnref<const GrDrawTargetCaps> fCaps;
728 728
729 /** 729 /**
730 * Used to communicate draws to subclass's onDraw function. 730 * Used to communicate draws to subclass's onDraw function.
731 */ 731 */
732 class DrawInfo { 732 class DrawInfo {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 const GrClipData* fClip; 866 const GrClipData* fClip;
867 GrDrawState* fDrawState; 867 GrDrawState* fDrawState;
868 GrDrawState fDefaultDraw State; 868 GrDrawState fDefaultDraw State;
869 // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar get. 869 // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar get.
870 GrContext* fContext; 870 GrContext* fContext;
871 871
872 typedef GrRefCnt INHERITED; 872 typedef GrRefCnt INHERITED;
873 }; 873 };
874 874
875 #endif 875 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrDrawState.cpp ('k') | src/gpu/GrDrawTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698