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

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

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/GrDrawTarget.h ('k') | src/gpu/GrGpu.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 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 10
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 //////////////////////////////////////////////////////////////////////////////// 86 ////////////////////////////////////////////////////////////////////////////////
87 87
88 #define DEBUG_INVAL_BUFFER 0xdeadcafe 88 #define DEBUG_INVAL_BUFFER 0xdeadcafe
89 #define DEBUG_INVAL_START_IDX -1 89 #define DEBUG_INVAL_START_IDX -1
90 90
91 GrDrawTarget::GrDrawTarget(GrContext* context) 91 GrDrawTarget::GrDrawTarget(GrContext* context)
92 : fClip(NULL) 92 : fClip(NULL)
93 , fContext(context) 93 , fContext(context)
94 , fGpuTraceMarkerCount(0) { 94 , fGpuTraceMarkerCount(0) {
95 SkASSERT(context); 95 SkASSERT(context);
96
97 fDrawState = &fDefaultDrawState; 96 fDrawState = &fDefaultDrawState;
98 // We assume that fDrawState always owns a ref to the object it points at. 97 // We assume that fDrawState always owns a ref to the object it points at.
99 fDefaultDrawState.ref(); 98 fDefaultDrawState.ref();
100 GeometrySrcState& geoSrc = fGeoSrcStateStack.push_back(); 99 GeometrySrcState& geoSrc = fGeoSrcStateStack.push_back();
101 #ifdef SK_DEBUG 100 #ifdef SK_DEBUG
102 geoSrc.fVertexCount = DEBUG_INVAL_START_IDX; 101 geoSrc.fVertexCount = DEBUG_INVAL_START_IDX;
103 geoSrc.fVertexBuffer = (GrVertexBuffer*)DEBUG_INVAL_BUFFER; 102 geoSrc.fVertexBuffer = (GrVertexBuffer*)DEBUG_INVAL_BUFFER;
104 geoSrc.fIndexCount = DEBUG_INVAL_START_IDX; 103 geoSrc.fIndexCount = DEBUG_INVAL_START_IDX;
105 geoSrc.fIndexBuffer = (GrIndexBuffer*)DEBUG_INVAL_BUFFER; 104 geoSrc.fIndexBuffer = (GrIndexBuffer*)DEBUG_INVAL_BUFFER;
106 #endif 105 #endif
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 } 717 }
719 SkRect bounds; 718 SkRect bounds;
720 this->getDrawState().getViewMatrix().mapRect(&bounds, rect); 719 this->getDrawState().getViewMatrix().mapRect(&bounds, rect);
721 720
722 this->drawNonIndexed(kTriangleFan_GrPrimitiveType, 0, 4, &bounds); 721 this->drawNonIndexed(kTriangleFan_GrPrimitiveType, 0, 4, &bounds);
723 } 722 }
724 723
725 void GrDrawTarget::clipWillBeSet(const GrClipData* clipData) { 724 void GrDrawTarget::clipWillBeSet(const GrClipData* clipData) {
726 } 725 }
727 726
727 static const GrStencilSettings& winding_path_stencil_settings() {
728 GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings,
729 kIncClamp_StencilOp,
730 kIncClamp_StencilOp,
731 kAlwaysIfInClip_StencilFunc,
732 0xFFFF, 0xFFFF, 0xFFFF);
733 return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings);
734 }
735
736 static const GrStencilSettings& even_odd_path_stencil_settings() {
737 GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings,
738 kInvert_StencilOp,
739 kInvert_StencilOp,
740 kAlwaysIfInClip_StencilFunc,
741 0xFFFF, 0xFFFF, 0xFFFF);
742 return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings);
743 }
744
745 void GrDrawTarget::getPathStencilSettingsForFillType(SkPath::FillType fill,
746 GrStencilSettings* outStenc ilSettings) {
747
748 switch (fill) {
749 default:
750 SkFAIL("Unexpected path fill.");
751 /* fallthrough */;
752 case SkPath::kWinding_FillType:
753 case SkPath::kInverseWinding_FillType:
754 *outStencilSettings = winding_path_stencil_settings();
755 break;
756 case SkPath::kEvenOdd_FillType:
757 case SkPath::kInverseEvenOdd_FillType:
758 *outStencilSettings = even_odd_path_stencil_settings();
759 break;
760 }
761 this->getClipMaskManager()->adjustPathStencilParams(outStencilSettings);
762 }
763
728 //////////////////////////////////////////////////////////////////////////////// 764 ////////////////////////////////////////////////////////////////////////////////
729 765
730 GrDrawTarget::AutoStateRestore::AutoStateRestore() { 766 GrDrawTarget::AutoStateRestore::AutoStateRestore() {
731 fDrawTarget = NULL; 767 fDrawTarget = NULL;
732 } 768 }
733 769
734 GrDrawTarget::AutoStateRestore::AutoStateRestore(GrDrawTarget* target, 770 GrDrawTarget::AutoStateRestore::AutoStateRestore(GrDrawTarget* target,
735 ASRInit init, 771 ASRInit init,
736 const SkMatrix* vm) { 772 const SkMatrix* vm) {
737 fDrawTarget = NULL; 773 fDrawTarget = NULL;
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 1188
1153 uint32_t GrDrawTargetCaps::CreateUniqueID() { 1189 uint32_t GrDrawTargetCaps::CreateUniqueID() {
1154 static int32_t gUniqueID = SK_InvalidUniqueID; 1190 static int32_t gUniqueID = SK_InvalidUniqueID;
1155 uint32_t id; 1191 uint32_t id;
1156 do { 1192 do {
1157 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); 1193 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1);
1158 } while (id == SK_InvalidUniqueID); 1194 } while (id == SK_InvalidUniqueID);
1159 return id; 1195 return id;
1160 } 1196 }
1161 1197
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrGpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698