Chromium Code Reviews| 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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 412 * clip and all other draw state (blend mode, stages, etc). Clears the | 413 * clip and all other draw state (blend mode, stages, etc). Clears the |
| 413 * whole thing if rect is NULL, otherwise just the rect. If canIgnoreRect | 414 * whole thing if rect is NULL, otherwise just the rect. If canIgnoreRect |
| 414 * is set then the entire render target can be optionally cleared. | 415 * is set then the entire render target can be optionally cleared. |
| 415 */ | 416 */ |
| 416 virtual void clear(const SkIRect* rect, | 417 virtual void clear(const SkIRect* rect, |
| 417 GrColor color, | 418 GrColor color, |
| 418 bool canIgnoreRect, | 419 bool canIgnoreRect, |
| 419 GrRenderTarget* renderTarget = NULL) = 0; | 420 GrRenderTarget* renderTarget = NULL) = 0; |
| 420 | 421 |
| 421 /** | 422 /** |
| 423 * Similar to the above. DrawTarget subclass sets clip bit in the stencil b uffer. The subclass | |
| 424 * is free to clear the remaining bits to zero if masked clears are more | |
| 425 * expensive than clearing all bits. | |
| 426 */ | |
| 427 | |
| 428 virtual void clearStencilClip(const SkIRect& rect, bool insideClip, GrRender Target* = NULL) = 0; | |
|
bsalomon
2014/10/28 15:08:01
Does this need to be on GrDT or can it just be on
| |
| 429 | |
| 430 /** | |
| 422 * Discards the contents render target. NULL indicates that the current rend er target should | 431 * Discards the contents render target. NULL indicates that the current rend er target should |
| 423 * be discarded. | 432 * be discarded. |
| 424 **/ | 433 **/ |
| 425 virtual void discard(GrRenderTarget* = NULL) = 0; | 434 virtual void discard(GrRenderTarget* = NULL) = 0; |
| 426 | 435 |
| 427 /** | 436 /** |
| 428 * Called at start and end of gpu trace marking | 437 * Called at start and end of gpu trace marking |
| 429 * GR_CREATE_GPU_TRACE_MARKER(marker_str, target) will automatically call th ese at the start | 438 * GR_CREATE_GPU_TRACE_MARKER(marker_str, target) will automatically call th ese at the start |
| 430 * and end of a code block respectively | 439 * and end of a code block respectively |
| 431 */ | 440 */ |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 685 bool isIssued() { return fDrawTarget && fDrawTarget->isIssued(fDrawID); } | 694 bool isIssued() { return fDrawTarget && fDrawTarget->isIssued(fDrawID); } |
| 686 | 695 |
| 687 private: | 696 private: |
| 688 GrDrawTarget* fDrawTarget; | 697 GrDrawTarget* fDrawTarget; |
| 689 uint32_t fDrawID; // this may wrap, but we're doing direct compa rison | 698 uint32_t fDrawID; // this may wrap, but we're doing direct compa rison |
| 690 // so that should be okay | 699 // so that should be okay |
| 691 }; | 700 }; |
| 692 | 701 |
| 693 virtual DrawToken getCurrentDrawToken() { return DrawToken(this, 0); } | 702 virtual DrawToken getCurrentDrawToken() { return DrawToken(this, 0); } |
| 694 | 703 |
| 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: | 704 protected: |
| 705 // Extend access to GrDrawState::convertToPEndeingExec to subclasses. | 705 // Extend access to GrDrawState::convertToPEndeingExec to subclasses. |
| 706 void convertDrawStateToPendingExec(GrDrawState* ds) { | 706 void convertDrawStateToPendingExec(GrDrawState* ds) { |
| 707 ds->convertToPendingExec(); | 707 ds->convertToPendingExec(); |
| 708 } | 708 } |
| 709 | 709 |
| 710 enum GeometrySrcType { | 710 enum GeometrySrcType { |
| 711 kNone_GeometrySrcType, //<! src has not been specified | 711 kNone_GeometrySrcType, //<! src has not been specified |
| 712 kReserved_GeometrySrcType, //<! src was set using reserve*Space | 712 kReserved_GeometrySrcType, //<! src was set using reserve*Space |
| 713 kArray_GeometrySrcType, //<! src was set using set*SourceToArray | 713 kArray_GeometrySrcType, //<! src was set using set*SourceToArray |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 943 GrContext* fContext; | 943 GrContext* fContext; |
| 944 // To keep track that we always have at least as many debug marker adds as r emoves | 944 // To keep track that we always have at least as many debug marker adds as r emoves |
| 945 int fGpuTraceMar kerCount; | 945 int fGpuTraceMar kerCount; |
| 946 GrTraceMarkerSet fActiveTrace Markers; | 946 GrTraceMarkerSet fActiveTrace Markers; |
| 947 GrTraceMarkerSet fStoredTrace Markers; | 947 GrTraceMarkerSet fStoredTrace Markers; |
| 948 | 948 |
| 949 typedef SkRefCnt INHERITED; | 949 typedef SkRefCnt INHERITED; |
| 950 }; | 950 }; |
| 951 | 951 |
| 952 #endif | 952 #endif |
| OLD | NEW |