OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 GrDrawState_DEFINED | 8 #ifndef GrDrawState_DEFINED |
9 #define GrDrawState_DEFINED | 9 #define GrDrawState_DEFINED |
10 | 10 |
11 #include "GrBlend.h" | 11 #include "GrBlend.h" |
| 12 #include "GrDrawTargetCaps.h" |
12 #include "GrGpuResourceRef.h" | 13 #include "GrGpuResourceRef.h" |
13 #include "GrRODrawState.h" | 14 #include "GrRODrawState.h" |
14 #include "effects/GrSimpleTextureEffect.h" | 15 #include "effects/GrSimpleTextureEffect.h" |
15 | 16 |
16 class GrOptDrawState; | 17 class GrOptDrawState; |
17 | 18 |
18 /** | 19 /** |
19 * Modifiable subclass derived from GrRODrawState. The majority of the data that
represents a draw | 20 * Modifiable subclass derived from GrRODrawState. The majority of the data that
represents a draw |
20 * state is stored in the parent class. GrDrawState contains methods for setting
, adding to, etc. | 21 * state is stored in the parent class. GrDrawState contains methods for setting
, adding to, etc. |
21 * various data members of the draw state. This class is used to configure the s
tate used when | 22 * various data members of the draw state. This class is used to configure the s
tate used when |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 const GrDrawTargetCaps& caps); | 541 const GrDrawTargetCaps& caps); |
541 | 542 |
542 GrDrawState& operator= (const GrDrawState& that); | 543 GrDrawState& operator= (const GrDrawState& that); |
543 | 544 |
544 /** | 545 /** |
545 * Returns a snapshot of the current optimized state. If the current drawSta
te has a valid | 546 * Returns a snapshot of the current optimized state. If the current drawSta
te has a valid |
546 * cached optimiezed state it will simply return a pointer to it otherwise i
t will create a new | 547 * cached optimiezed state it will simply return a pointer to it otherwise i
t will create a new |
547 * GrOptDrawState. In all cases the GrOptDrawState is reffed and ownership i
s given to the | 548 * GrOptDrawState. In all cases the GrOptDrawState is reffed and ownership i
s given to the |
548 * caller. | 549 * caller. |
549 */ | 550 */ |
550 GrOptDrawState* createOptState() const; | 551 GrOptDrawState* createOptState(const GrDrawTargetCaps&) const; |
551 | 552 |
552 private: | 553 private: |
553 void invalidateOptState() const; | 554 void invalidateOptState() const; |
554 | 555 |
555 void onReset(const SkMatrix* initialViewMatrix); | 556 void onReset(const SkMatrix* initialViewMatrix); |
556 | 557 |
557 // Some of the auto restore objects assume that no effects are removed durin
g their lifetime. | 558 // Some of the auto restore objects assume that no effects are removed durin
g their lifetime. |
558 // This is used to assert that this condition holds. | 559 // This is used to assert that this condition holds. |
559 SkDEBUGCODE(int fBlockEffectRemovalCnt;) | 560 SkDEBUGCODE(int fBlockEffectRemovalCnt;) |
560 | 561 |
561 void internalSetVertexAttribs(const GrVertexAttrib attribs[], int count, siz
e_t stride); | 562 void internalSetVertexAttribs(const GrVertexAttrib attribs[], int count, siz
e_t stride); |
562 | 563 |
563 mutable GrOptDrawState* fCachedOptState; | 564 mutable GrOptDrawState* fCachedOptState; |
| 565 mutable uint32_t fCachedCapsID; |
564 | 566 |
565 typedef GrRODrawState INHERITED; | 567 typedef GrRODrawState INHERITED; |
566 }; | 568 }; |
567 | 569 |
568 #endif | 570 #endif |
OLD | NEW |