| OLD | NEW |
| 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 Loading... |
| 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 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1152 | 1151 |
| 1153 uint32_t GrDrawTargetCaps::CreateUniqueID() { | 1152 uint32_t GrDrawTargetCaps::CreateUniqueID() { |
| 1154 static int32_t gUniqueID = SK_InvalidUniqueID; | 1153 static int32_t gUniqueID = SK_InvalidUniqueID; |
| 1155 uint32_t id; | 1154 uint32_t id; |
| 1156 do { | 1155 do { |
| 1157 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); | 1156 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); |
| 1158 } while (id == SK_InvalidUniqueID); | 1157 } while (id == SK_InvalidUniqueID); |
| 1159 return id; | 1158 return id; |
| 1160 } | 1159 } |
| 1161 | 1160 |
| 1161 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 1162 |
| 1163 static const GrStencilSettings& winding_path_stencil_settings() { |
| 1164 GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings, |
| 1165 kIncClamp_StencilOp, |
| 1166 kIncClamp_StencilOp, |
| 1167 kAlwaysIfInClip_StencilFunc, |
| 1168 0xFFFF, 0xFFFF, 0xFFFF); |
| 1169 return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings); |
| 1170 } |
| 1171 |
| 1172 static const GrStencilSettings& even_odd_path_stencil_settings() { |
| 1173 GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings, |
| 1174 kInvert_StencilOp, |
| 1175 kInvert_StencilOp, |
| 1176 kAlwaysIfInClip_StencilFunc, |
| 1177 0xFFFF, 0xFFFF, 0xFFFF); |
| 1178 return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings); |
| 1179 } |
| 1180 |
| 1181 void GrClipTarget::getPathStencilSettingsForFillType(SkPath::FillType fill, |
| 1182 GrStencilSettings* outStenc
ilSettings) { |
| 1183 |
| 1184 switch (fill) { |
| 1185 default: |
| 1186 SkFAIL("Unexpected path fill."); |
| 1187 /* fallthrough */; |
| 1188 case SkPath::kWinding_FillType: |
| 1189 case SkPath::kInverseWinding_FillType: |
| 1190 *outStencilSettings = winding_path_stencil_settings(); |
| 1191 break; |
| 1192 case SkPath::kEvenOdd_FillType: |
| 1193 case SkPath::kInverseEvenOdd_FillType: |
| 1194 *outStencilSettings = even_odd_path_stencil_settings(); |
| 1195 break; |
| 1196 } |
| 1197 fClipMaskManager.adjustPathStencilParams(outStencilSettings); |
| 1198 } |
| OLD | NEW |