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

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

Issue 23483042: Replace uses of GrNoncopyable by SkNoncopyable. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rm GrNoncopyable.h Created 7 years, 3 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.h ('k') | src/gpu/GrInOrderDrawBuffer.h » ('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 * Copyright 2010 Google Inc. 2 * Copyright 2010 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrDrawTarget_DEFINED 8 #ifndef GrDrawTarget_DEFINED
9 #define GrDrawTarget_DEFINED 9 #define GrDrawTarget_DEFINED
10 10
11 #include "GrClipData.h" 11 #include "GrClipData.h"
12 #include "GrDrawState.h" 12 #include "GrDrawState.h"
13 #include "GrIndexBuffer.h" 13 #include "GrIndexBuffer.h"
14 14
15 #include "SkClipStack.h" 15 #include "SkClipStack.h"
16 #include "SkMatrix.h" 16 #include "SkMatrix.h"
17 #include "SkPath.h" 17 #include "SkPath.h"
18 #include "SkTArray.h" 18 #include "SkTArray.h"
19 #include "SkTLazy.h" 19 #include "SkTLazy.h"
20 #include "SkTypes.h"
20 #include "SkXfermode.h" 21 #include "SkXfermode.h"
21 22
22 class GrClipData; 23 class GrClipData;
23 class GrDrawTargetCaps; 24 class GrDrawTargetCaps;
24 class GrPath; 25 class GrPath;
25 class GrVertexBuffer; 26 class GrVertexBuffer;
26 class SkStrokeRec; 27 class SkStrokeRec;
27 28
28 class GrDrawTarget : public SkRefCnt { 29 class GrDrawTarget : public SkRefCnt {
29 protected: 30 protected:
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 * 466 *
466 * GrDrawState* state = target->drawState(); 467 * GrDrawState* state = target->drawState();
467 * AutoStateRestore asr(target, GrDrawTarget::kReset_ASRInit). 468 * AutoStateRestore asr(target, GrDrawTarget::kReset_ASRInit).
468 * state->setRenderTarget(rt); // state refers to the GrDrawState set on 469 * state->setRenderTarget(rt); // state refers to the GrDrawState set on
469 * // target before asr was initialized. 470 * // target before asr was initialized.
470 * // Therefore, rt is set on the GrDrawState 471 * // Therefore, rt is set on the GrDrawState
471 * // that will be restored after asr's 472 * // that will be restored after asr's
472 * // destructor rather than target's current 473 * // destructor rather than target's current
473 * // GrDrawState. 474 * // GrDrawState.
474 */ 475 */
475 class AutoStateRestore : ::GrNoncopyable { 476 class AutoStateRestore : public ::SkNoncopyable {
476 public: 477 public:
477 /** 478 /**
478 * Default ASR will have no effect unless set() is subsequently called. 479 * Default ASR will have no effect unless set() is subsequently called.
479 */ 480 */
480 AutoStateRestore(); 481 AutoStateRestore();
481 482
482 /** 483 /**
483 * Saves the state on target. The state will be restored when the ASR 484 * Saves the state on target. The state will be restored when the ASR
484 * is destroyed. If this constructor is used do not call set(). 485 * is destroyed. If this constructor is used do not call set().
485 * 486 *
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 bool setIdentity(GrDrawTarget* target, ASRInit init); 519 bool setIdentity(GrDrawTarget* target, ASRInit init);
519 520
520 private: 521 private:
521 GrDrawTarget* fDrawTarget; 522 GrDrawTarget* fDrawTarget;
522 SkTLazy<GrDrawState> fTempState; 523 SkTLazy<GrDrawState> fTempState;
523 GrDrawState* fSavedState; 524 GrDrawState* fSavedState;
524 }; 525 };
525 526
526 //////////////////////////////////////////////////////////////////////////// 527 ////////////////////////////////////////////////////////////////////////////
527 528
528 class AutoReleaseGeometry : ::GrNoncopyable { 529 class AutoReleaseGeometry : public ::SkNoncopyable {
529 public: 530 public:
530 AutoReleaseGeometry(GrDrawTarget* target, 531 AutoReleaseGeometry(GrDrawTarget* target,
531 int vertexCount, 532 int vertexCount,
532 int indexCount); 533 int indexCount);
533 AutoReleaseGeometry(); 534 AutoReleaseGeometry();
534 ~AutoReleaseGeometry(); 535 ~AutoReleaseGeometry();
535 bool set(GrDrawTarget* target, 536 bool set(GrDrawTarget* target,
536 int vertexCount, 537 int vertexCount,
537 int indexCount); 538 int indexCount);
538 bool succeeded() const { return NULL != fTarget; } 539 bool succeeded() const { return NULL != fTarget; }
539 void* vertices() const { SkASSERT(this->succeeded()); return fVertices; } 540 void* vertices() const { SkASSERT(this->succeeded()); return fVertices; }
540 void* indices() const { SkASSERT(this->succeeded()); return fIndices; } 541 void* indices() const { SkASSERT(this->succeeded()); return fIndices; }
541 GrPoint* positions() const { 542 GrPoint* positions() const {
542 return static_cast<GrPoint*>(this->vertices()); 543 return static_cast<GrPoint*>(this->vertices());
543 } 544 }
544 545
545 private: 546 private:
546 void reset(); 547 void reset();
547 548
548 GrDrawTarget* fTarget; 549 GrDrawTarget* fTarget;
549 void* fVertices; 550 void* fVertices;
550 void* fIndices; 551 void* fIndices;
551 }; 552 };
552 553
553 //////////////////////////////////////////////////////////////////////////// 554 ////////////////////////////////////////////////////////////////////////////
554 555
555 class AutoClipRestore : ::GrNoncopyable { 556 class AutoClipRestore : public ::SkNoncopyable {
556 public: 557 public:
557 AutoClipRestore(GrDrawTarget* target) { 558 AutoClipRestore(GrDrawTarget* target) {
558 fTarget = target; 559 fTarget = target;
559 fClip = fTarget->getClip(); 560 fClip = fTarget->getClip();
560 } 561 }
561 562
562 AutoClipRestore(GrDrawTarget* target, const SkIRect& newClip); 563 AutoClipRestore(GrDrawTarget* target, const SkIRect& newClip);
563 564
564 ~AutoClipRestore() { 565 ~AutoClipRestore() {
565 fTarget->setClip(fClip); 566 fTarget->setClip(fClip);
566 } 567 }
567 private: 568 private:
568 GrDrawTarget* fTarget; 569 GrDrawTarget* fTarget;
569 const GrClipData* fClip; 570 const GrClipData* fClip;
570 SkTLazy<SkClipStack> fStack; 571 SkTLazy<SkClipStack> fStack;
571 GrClipData fReplacementClip; 572 GrClipData fReplacementClip;
572 }; 573 };
573 574
574 //////////////////////////////////////////////////////////////////////////// 575 ////////////////////////////////////////////////////////////////////////////
575 576
576 /** 577 /**
577 * Saves the geometry src state at construction and restores in the destruct or. It also saves 578 * Saves the geometry src state at construction and restores in the destruct or. It also saves
578 * and then restores the vertex attrib state. 579 * and then restores the vertex attrib state.
579 */ 580 */
580 class AutoGeometryPush : ::GrNoncopyable { 581 class AutoGeometryPush : public ::SkNoncopyable {
581 public: 582 public:
582 AutoGeometryPush(GrDrawTarget* target) 583 AutoGeometryPush(GrDrawTarget* target)
583 : fAttribRestore(target->drawState()) { 584 : fAttribRestore(target->drawState()) {
584 SkASSERT(NULL != target); 585 SkASSERT(NULL != target);
585 fTarget = target; 586 fTarget = target;
586 target->pushGeometrySource(); 587 target->pushGeometrySource();
587 } 588 }
588 589
589 ~AutoGeometryPush() { fTarget->popGeometrySource(); } 590 ~AutoGeometryPush() { fTarget->popGeometrySource(); }
590 591
591 private: 592 private:
592 GrDrawTarget* fTarget; 593 GrDrawTarget* fTarget;
593 GrDrawState::AutoVertexAttribRestore fAttribRestore; 594 GrDrawState::AutoVertexAttribRestore fAttribRestore;
594 }; 595 };
595 596
596 /** 597 /**
597 * Combination of AutoGeometryPush and AutoStateRestore. The vertex attribs will be in default 598 * Combination of AutoGeometryPush and AutoStateRestore. The vertex attribs will be in default
598 * state regardless of ASRInit value. 599 * state regardless of ASRInit value.
599 */ 600 */
600 class AutoGeometryAndStatePush : ::GrNoncopyable { 601 class AutoGeometryAndStatePush : public ::SkNoncopyable {
601 public: 602 public:
602 AutoGeometryAndStatePush(GrDrawTarget* target, 603 AutoGeometryAndStatePush(GrDrawTarget* target,
603 ASRInit init, 604 ASRInit init,
604 const SkMatrix* viewMatrix = NULL) 605 const SkMatrix* viewMatrix = NULL)
605 : fState(target, init, viewMatrix) { 606 : fState(target, init, viewMatrix) {
606 SkASSERT(NULL != target); 607 SkASSERT(NULL != target);
607 fTarget = target; 608 fTarget = target;
608 target->pushGeometrySource(); 609 target->pushGeometrySource();
609 if (kPreserve_ASRInit == init) { 610 if (kPreserve_ASRInit == init) {
610 target->drawState()->setDefaultVertexAttribs(); 611 target->drawState()->setDefaultVertexAttribs();
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 const GrClipData* fClip; 864 const GrClipData* fClip;
864 GrDrawState* fDrawState; 865 GrDrawState* fDrawState;
865 GrDrawState fDefaultDraw State; 866 GrDrawState fDefaultDraw State;
866 // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar get. 867 // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar get.
867 GrContext* fContext; 868 GrContext* fContext;
868 869
869 typedef SkRefCnt INHERITED; 870 typedef SkRefCnt INHERITED;
870 }; 871 };
871 872
872 #endif 873 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrDrawState.h ('k') | src/gpu/GrInOrderDrawBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698