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

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

Issue 683933003: Clip mask manager moved to ClipTarget (Closed) Base URL: https://skia.googlesource.com/skia.git@clear_stencil_clip_on_drawinfo
Patch Set: rebase on master Created 6 years, 1 month 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
« no previous file with comments | « src/gpu/GrClipMaskManager.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 * 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
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 /** 498 /**
499 * For subclass internal use to invoke a call to onDrawPaths(). 499 * For subclass internal use to invoke a call to onDrawPaths().
500 */ 500 */
501 void executeDrawPaths(const GrPathRange* pathRange, 501 void executeDrawPaths(const GrPathRange* pathRange,
502 const uint32_t indices[], int count, 502 const uint32_t indices[], int count,
503 const float transforms[], PathTransformType transforms Type, 503 const float transforms[], PathTransformType transforms Type,
504 SkPath::FillType fill, 504 SkPath::FillType fill,
505 const GrDeviceCoordTexture* dstCopy) { 505 const GrDeviceCoordTexture* dstCopy) {
506 this->onDrawPaths(pathRange, indices, count, transforms, transformsType, fill, dstCopy); 506 this->onDrawPaths(pathRange, indices, count, transforms, transformsType, fill, dstCopy);
507 } 507 }
508
509 void getPathStencilSettingsForFillType(SkPath::FillType, GrStencilSettings*) ;
510
508 //////////////////////////////////////////////////////////////////////////// 511 ////////////////////////////////////////////////////////////////////////////
509 512
510 /** 513 /**
511 * See AutoStateRestore below. 514 * See AutoStateRestore below.
512 */ 515 */
513 enum ASRInit { 516 enum ASRInit {
514 kPreserve_ASRInit, 517 kPreserve_ASRInit,
515 kReset_ASRInit 518 kReset_ASRInit
516 }; 519 };
517 520
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 // indicate non-indexed drawing. 919 // indicate non-indexed drawing.
917 bool checkDraw(GrPrimitiveType type, int startVertex, 920 bool checkDraw(GrPrimitiveType type, int startVertex,
918 int startIndex, int vertexCount, 921 int startIndex, int vertexCount,
919 int indexCount) const; 922 int indexCount) const;
920 // called when setting a new vert/idx source to unref prev vb/ib 923 // called when setting a new vert/idx source to unref prev vb/ib
921 void releasePreviousVertexSource(); 924 void releasePreviousVertexSource();
922 void releasePreviousIndexSource(); 925 void releasePreviousIndexSource();
923 926
924 // Check to see if this set of draw commands has been sent out 927 // Check to see if this set of draw commands has been sent out
925 virtual bool isIssued(uint32_t drawID) { return true; } 928 virtual bool isIssued(uint32_t drawID) { return true; }
929 virtual GrClipMaskManager* getClipMaskManager() = 0;
926 930
927 enum { 931 enum {
928 kPreallocGeoSrcStateStackCnt = 4, 932 kPreallocGeoSrcStateStackCnt = 4,
929 }; 933 };
930 SkSTArray<kPreallocGeoSrcStateStackCnt, GeometrySrcState, true> fGeoSrcState Stack; 934 SkSTArray<kPreallocGeoSrcStateStackCnt, GeometrySrcState, true> fGeoSrcState Stack;
931 const GrClipData* fClip; 935 const GrClipData* fClip;
932 GrDrawState* fDrawState; 936 GrDrawState* fDrawState;
933 GrDrawState fDefaultDraw State; 937 GrDrawState fDefaultDraw State;
934 // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar get. 938 // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar get.
935 GrContext* fContext; 939 GrContext* fContext;
936 // To keep track that we always have at least as many debug marker adds as r emoves 940 // To keep track that we always have at least as many debug marker adds as r emoves
937 int fGpuTraceMar kerCount; 941 int fGpuTraceMar kerCount;
938 GrTraceMarkerSet fActiveTrace Markers; 942 GrTraceMarkerSet fActiveTrace Markers;
939 GrTraceMarkerSet fStoredTrace Markers; 943 GrTraceMarkerSet fStoredTrace Markers;
940 944
941 typedef SkRefCnt INHERITED; 945 typedef SkRefCnt INHERITED;
942 }; 946 };
943 947
948 /*
949 * This class is JUST for clip mask manager. Everyone else should just use draw target above.
950 */
944 class GrClipTarget : public GrDrawTarget { 951 class GrClipTarget : public GrDrawTarget {
945 public: 952 public:
946 GrClipTarget(GrContext* context) : INHERITED(context) {} 953 GrClipTarget(GrContext* context) : INHERITED(context) {
954 fClipMaskManager.setClipTarget(this);
955 }
956
957 /* Clip mask manager needs access to the context.
958 * TODO we only need a very small subset of context in the CMM.
959 */
960 GrContext* getContext() { return INHERITED::getContext(); }
961 const GrContext* getContext() const { return INHERITED::getContext(); }
962
947 /** 963 /**
948 * Clip Mask Manager(and no one else) needs to clear private stencil bits. 964 * 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 965 * 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 966 * is free to clear the remaining bits to zero if masked clears are more
951 * expensive than clearing all bits. 967 * expensive than clearing all bits.
952 */ 968 */
953 virtual void clearStencilClip(const SkIRect& rect, bool insideClip, GrRender Target* = NULL) = 0; 969 virtual void clearStencilClip(const SkIRect& rect, bool insideClip, GrRender Target* = NULL) = 0;
954 970
971 protected:
972 GrClipMaskManager fClipMaskManager;
973
955 private: 974 private:
975 GrClipMaskManager* getClipMaskManager() { return &fClipMaskManager; }
976
956 typedef GrDrawTarget INHERITED; 977 typedef GrDrawTarget INHERITED;
957 }; 978 };
958 979
959 #endif 980 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/GrDrawTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698