OLD | NEW |
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 "GrClipMaskManager.h" |
12 #include "GrContext.h" | 13 #include "GrContext.h" |
13 #include "GrDrawState.h" | 14 #include "GrDrawState.h" |
14 #include "GrIndexBuffer.h" | 15 #include "GrIndexBuffer.h" |
15 #include "GrPathRendering.h" | 16 #include "GrPathRendering.h" |
16 #include "GrTraceMarker.h" | 17 #include "GrTraceMarker.h" |
17 | 18 |
18 #include "SkClipStack.h" | 19 #include "SkClipStack.h" |
19 #include "SkMatrix.h" | 20 #include "SkMatrix.h" |
20 #include "SkPath.h" | 21 #include "SkPath.h" |
21 #include "SkStrokeRec.h" | 22 #include "SkStrokeRec.h" |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 bool isIssued() { return fDrawTarget && fDrawTarget->isIssued(fDrawID);
} | 686 bool isIssued() { return fDrawTarget && fDrawTarget->isIssued(fDrawID);
} |
686 | 687 |
687 private: | 688 private: |
688 GrDrawTarget* fDrawTarget; | 689 GrDrawTarget* fDrawTarget; |
689 uint32_t fDrawID; // this may wrap, but we're doing direct compa
rison | 690 uint32_t fDrawID; // this may wrap, but we're doing direct compa
rison |
690 // so that should be okay | 691 // so that should be okay |
691 }; | 692 }; |
692 | 693 |
693 virtual DrawToken getCurrentDrawToken() { return DrawToken(this, 0); } | 694 virtual DrawToken getCurrentDrawToken() { return DrawToken(this, 0); } |
694 | 695 |
695 // The state of the scissor is controlled by the clip manager, no one else s
hould set | |
696 // Scissor state | |
697 struct ScissorState { | |
698 ScissorState() : fEnabled(false) {} | |
699 void set(const SkIRect& rect) { fRect = rect; fEnabled = true; } | |
700 bool fEnabled; | |
701 SkIRect fRect; | |
702 }; | |
703 | |
704 protected: | 696 protected: |
705 // Extend access to GrDrawState::convertToPEndeingExec to subclasses. | 697 // Extend access to GrDrawState::convertToPEndeingExec to subclasses. |
706 void convertDrawStateToPendingExec(GrDrawState* ds) { | 698 void convertDrawStateToPendingExec(GrDrawState* ds) { |
707 ds->convertToPendingExec(); | 699 ds->convertToPendingExec(); |
708 } | 700 } |
709 | 701 |
710 enum GeometrySrcType { | 702 enum GeometrySrcType { |
711 kNone_GeometrySrcType, //<! src has not been specified | 703 kNone_GeometrySrcType, //<! src has not been specified |
712 kReserved_GeometrySrcType, //<! src was set using reserve*Space | 704 kReserved_GeometrySrcType, //<! src was set using reserve*Space |
713 kArray_GeometrySrcType, //<! src was set using set*SourceToArray | 705 kArray_GeometrySrcType, //<! src was set using set*SourceToArray |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar
get. | 934 // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar
get. |
943 GrContext* fContext; | 935 GrContext* fContext; |
944 // To keep track that we always have at least as many debug marker adds as r
emoves | 936 // To keep track that we always have at least as many debug marker adds as r
emoves |
945 int fGpuTraceMar
kerCount; | 937 int fGpuTraceMar
kerCount; |
946 GrTraceMarkerSet fActiveTrace
Markers; | 938 GrTraceMarkerSet fActiveTrace
Markers; |
947 GrTraceMarkerSet fStoredTrace
Markers; | 939 GrTraceMarkerSet fStoredTrace
Markers; |
948 | 940 |
949 typedef SkRefCnt INHERITED; | 941 typedef SkRefCnt INHERITED; |
950 }; | 942 }; |
951 | 943 |
| 944 class GrClipTarget : public GrDrawTarget { |
| 945 public: |
| 946 GrClipTarget(GrContext* context) : INHERITED(context) {} |
| 947 /** |
| 948 * Clip Mask Manager(and no one else) needs to clear private stencil bits. |
| 949 * ClipTarget subclass sets clip bit in the stencil buffer. The subclass |
| 950 * is free to clear the remaining bits to zero if masked clears are more |
| 951 * expensive than clearing all bits. |
| 952 */ |
| 953 virtual void clearStencilClip(const SkIRect& rect, bool insideClip, GrRender
Target* = NULL) = 0; |
| 954 |
| 955 private: |
| 956 typedef GrDrawTarget INHERITED; |
| 957 }; |
| 958 |
952 #endif | 959 #endif |
OLD | NEW |