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

Side by Side Diff: src/pathops/SkPathOpsDebug.cpp

Issue 263553012: Rename SK_DEBUGBREAK to SK_ALWAYSBREAK (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix XPS Created 6 years, 7 months 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/device/xps/SkXPSDevice.cpp ('k') | no next file » | 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 2013 Google Inc. 2 * Copyright 2013 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 #include "SkPathOpsDebug.h" 8 #include "SkPathOpsDebug.h"
9 #include "SkPath.h" 9 #include "SkPath.h"
10 10
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 SkDebugf(" operand"); 164 SkDebugf(" operand");
165 } 165 }
166 if (fStop) { 166 if (fStop) {
167 SkDebugf(" stop"); 167 SkDebugf(" stop");
168 } 168 }
169 } 169 }
170 #endif 170 #endif
171 171
172 #if DEBUG_ANGLE 172 #if DEBUG_ANGLE
173 void SkOpAngle::debugSameAs(const SkOpAngle* compare) const { 173 void SkOpAngle::debugSameAs(const SkOpAngle* compare) const {
174 SK_DEBUGBREAK(fSegment == compare->fSegment); 174 SK_ALWAYSBREAK(fSegment == compare->fSegment);
175 const SkOpSpan& startSpan = fSegment->span(fStart); 175 const SkOpSpan& startSpan = fSegment->span(fStart);
176 const SkOpSpan& oStartSpan = fSegment->span(compare->fStart); 176 const SkOpSpan& oStartSpan = fSegment->span(compare->fStart);
177 SK_DEBUGBREAK(startSpan.fToAngleIndex == oStartSpan.fToAngleIndex); 177 SK_ALWAYSBREAK(startSpan.fToAngleIndex == oStartSpan.fToAngleIndex);
178 SK_DEBUGBREAK(startSpan.fFromAngleIndex == oStartSpan.fFromAngleIndex); 178 SK_ALWAYSBREAK(startSpan.fFromAngleIndex == oStartSpan.fFromAngleIndex);
179 const SkOpSpan& endSpan = fSegment->span(fEnd); 179 const SkOpSpan& endSpan = fSegment->span(fEnd);
180 const SkOpSpan& oEndSpan = fSegment->span(compare->fEnd); 180 const SkOpSpan& oEndSpan = fSegment->span(compare->fEnd);
181 SK_DEBUGBREAK(endSpan.fToAngleIndex == oEndSpan.fToAngleIndex); 181 SK_ALWAYSBREAK(endSpan.fToAngleIndex == oEndSpan.fToAngleIndex);
182 SK_DEBUGBREAK(endSpan.fFromAngleIndex == oEndSpan.fFromAngleIndex); 182 SK_ALWAYSBREAK(endSpan.fFromAngleIndex == oEndSpan.fFromAngleIndex);
183 } 183 }
184 #endif 184 #endif
185 185
186 #if DEBUG_VALIDATE 186 #if DEBUG_VALIDATE
187 void SkOpAngle::debugValidateNext() const { 187 void SkOpAngle::debugValidateNext() const {
188 const SkOpAngle* first = this; 188 const SkOpAngle* first = this;
189 const SkOpAngle* next = first; 189 const SkOpAngle* next = first;
190 SkTDArray<const SkOpAngle*>(angles); 190 SkTDArray<const SkOpAngle*>(angles);
191 do { 191 do {
192 SK_DEBUGBREAK(next->fSegment->debugContains(next)); 192 SK_ALWAYSBREAK(next->fSegment->debugContains(next));
193 angles.push(next); 193 angles.push(next);
194 next = next->next(); 194 next = next->next();
195 if (next == first) { 195 if (next == first) {
196 break; 196 break;
197 } 197 }
198 SK_DEBUGBREAK(!angles.contains(next)); 198 SK_ALWAYSBREAK(!angles.contains(next));
199 if (!next) { 199 if (!next) {
200 return; 200 return;
201 } 201 }
202 } while (true); 202 } while (true);
203 } 203 }
204 204
205 void SkOpAngle::debugValidateLoop() const { 205 void SkOpAngle::debugValidateLoop() const {
206 const SkOpAngle* first = this; 206 const SkOpAngle* first = this;
207 const SkOpAngle* next = first; 207 const SkOpAngle* next = first;
208 SK_DEBUGBREAK(first->next() != first); 208 SK_ALWAYSBREAK(first->next() != first);
209 int signSum = 0; 209 int signSum = 0;
210 int oppSum = 0; 210 int oppSum = 0;
211 bool firstOperand = fSegment->operand(); 211 bool firstOperand = fSegment->operand();
212 bool unorderable = false; 212 bool unorderable = false;
213 do { 213 do {
214 unorderable |= next->fUnorderable; 214 unorderable |= next->fUnorderable;
215 const SkOpSegment* segment = next->fSegment; 215 const SkOpSegment* segment = next->fSegment;
216 bool operandsMatch = firstOperand == segment->operand(); 216 bool operandsMatch = firstOperand == segment->operand();
217 signSum += operandsMatch ? segment->spanSign(next) : segment->oppSign(ne xt); 217 signSum += operandsMatch ? segment->spanSign(next) : segment->oppSign(ne xt);
218 oppSum += operandsMatch ? segment->oppSign(next) : segment->spanSign(nex t); 218 oppSum += operandsMatch ? segment->oppSign(next) : segment->spanSign(nex t);
219 const SkOpSpan& span = segment->span(SkMin32(next->fStart, next->fEnd)); 219 const SkOpSpan& span = segment->span(SkMin32(next->fStart, next->fEnd));
220 if (segment->_xor()) { 220 if (segment->_xor()) {
221 // SK_DEBUGBREAK(span.fWindValue == 1); 221 // SK_ALWAYSBREAK(span.fWindValue == 1);
222 // SK_DEBUGBREAK(span.fWindSum == SK_MinS32 || span.fWindSum == 1); 222 // SK_ALWAYSBREAK(span.fWindSum == SK_MinS32 || span.fWindSum == 1);
223 } 223 }
224 if (segment->oppXor()) { 224 if (segment->oppXor()) {
225 SK_DEBUGBREAK(span.fOppValue == 0 || abs(span.fOppValue) == 1); 225 SK_ALWAYSBREAK(span.fOppValue == 0 || abs(span.fOppValue) == 1);
226 // SK_DEBUGBREAK(span.fOppSum == SK_MinS32 || span.fOppSum == 0 || ab s(span.fOppSum) == 1); 226 // SK_ALWAYSBREAK(span.fOppSum == SK_MinS32 || span.fOppSum == 0 || a bs(span.fOppSum) == 1);
227 } 227 }
228 next = next->next(); 228 next = next->next();
229 if (!next) { 229 if (!next) {
230 return; 230 return;
231 } 231 }
232 } while (next != first); 232 } while (next != first);
233 if (unorderable) { 233 if (unorderable) {
234 return; 234 return;
235 } 235 }
236 SK_DEBUGBREAK(!signSum || fSegment->_xor()); 236 SK_ALWAYSBREAK(!signSum || fSegment->_xor());
237 SK_DEBUGBREAK(!oppSum || fSegment->oppXor()); 237 SK_ALWAYSBREAK(!oppSum || fSegment->oppXor());
238 int lastWinding; 238 int lastWinding;
239 int lastOppWinding; 239 int lastOppWinding;
240 int winding; 240 int winding;
241 int oppWinding; 241 int oppWinding;
242 do { 242 do {
243 const SkOpSegment* segment = next->fSegment; 243 const SkOpSegment* segment = next->fSegment;
244 const SkOpSpan& span = segment->span(SkMin32(next->fStart, next->fEnd)); 244 const SkOpSpan& span = segment->span(SkMin32(next->fStart, next->fEnd));
245 winding = span.fWindSum; 245 winding = span.fWindSum;
246 if (winding != SK_MinS32) { 246 if (winding != SK_MinS32) {
247 // SK_DEBUGBREAK(winding != 0); 247 // SK_ALWAYSBREAK(winding != 0);
248 SK_DEBUGBREAK(SkPathOpsDebug::ValidWind(winding)); 248 SK_ALWAYSBREAK(SkPathOpsDebug::ValidWind(winding));
249 lastWinding = winding; 249 lastWinding = winding;
250 int diffWinding = segment->spanSign(next); 250 int diffWinding = segment->spanSign(next);
251 if (!segment->_xor()) { 251 if (!segment->_xor()) {
252 SK_DEBUGBREAK(diffWinding != 0); 252 SK_ALWAYSBREAK(diffWinding != 0);
253 bool sameSign = (winding > 0) == (diffWinding > 0); 253 bool sameSign = (winding > 0) == (diffWinding > 0);
254 winding -= sameSign ? diffWinding : -diffWinding; 254 winding -= sameSign ? diffWinding : -diffWinding;
255 SK_DEBUGBREAK(SkPathOpsDebug::ValidWind(winding)); 255 SK_ALWAYSBREAK(SkPathOpsDebug::ValidWind(winding));
256 SK_DEBUGBREAK(abs(winding) <= abs(lastWinding)); 256 SK_ALWAYSBREAK(abs(winding) <= abs(lastWinding));
257 if (!sameSign) { 257 if (!sameSign) {
258 SkTSwap(winding, lastWinding); 258 SkTSwap(winding, lastWinding);
259 } 259 }
260 } 260 }
261 lastOppWinding = oppWinding = span.fOppSum; 261 lastOppWinding = oppWinding = span.fOppSum;
262 if (oppWinding != SK_MinS32 && !segment->oppXor()) { 262 if (oppWinding != SK_MinS32 && !segment->oppXor()) {
263 int oppDiffWinding = segment->oppSign(next); 263 int oppDiffWinding = segment->oppSign(next);
264 // SK_DEBUGBREAK(abs(oppDiffWinding) <= abs(diffWinding) || segme nt->_xor()); 264 // SK_ALWAYSBREAK(abs(oppDiffWinding) <= abs(diffWinding) || segm ent->_xor());
265 if (oppDiffWinding) { 265 if (oppDiffWinding) {
266 bool oppSameSign = (oppWinding > 0) == (oppDiffWinding > 0); 266 bool oppSameSign = (oppWinding > 0) == (oppDiffWinding > 0);
267 oppWinding -= oppSameSign ? oppDiffWinding : -oppDiffWinding ; 267 oppWinding -= oppSameSign ? oppDiffWinding : -oppDiffWinding ;
268 SK_DEBUGBREAK(SkPathOpsDebug::ValidWind(oppWinding)); 268 SK_ALWAYSBREAK(SkPathOpsDebug::ValidWind(oppWinding));
269 SK_DEBUGBREAK(abs(oppWinding) <= abs(lastOppWinding)); 269 SK_ALWAYSBREAK(abs(oppWinding) <= abs(lastOppWinding));
270 if (!oppSameSign) { 270 if (!oppSameSign) {
271 SkTSwap(oppWinding, lastOppWinding); 271 SkTSwap(oppWinding, lastOppWinding);
272 } 272 }
273 } 273 }
274 } 274 }
275 firstOperand = segment->operand(); 275 firstOperand = segment->operand();
276 break; 276 break;
277 } 277 }
278 SK_DEBUGBREAK(span.fOppSum == SK_MinS32); 278 SK_ALWAYSBREAK(span.fOppSum == SK_MinS32);
279 next = next->next(); 279 next = next->next();
280 } while (next != first); 280 } while (next != first);
281 if (winding == SK_MinS32) { 281 if (winding == SK_MinS32) {
282 return; 282 return;
283 } 283 }
284 SK_DEBUGBREAK(oppWinding == SK_MinS32 || SkPathOpsDebug::ValidWind(oppWindin g)); 284 SK_ALWAYSBREAK(oppWinding == SK_MinS32 || SkPathOpsDebug::ValidWind(oppWindi ng));
285 first = next; 285 first = next;
286 next = next->next(); 286 next = next->next();
287 do { 287 do {
288 const SkOpSegment* segment = next->fSegment; 288 const SkOpSegment* segment = next->fSegment;
289 lastWinding = winding; 289 lastWinding = winding;
290 lastOppWinding = oppWinding; 290 lastOppWinding = oppWinding;
291 bool operandsMatch = firstOperand == segment->operand(); 291 bool operandsMatch = firstOperand == segment->operand();
292 if (operandsMatch) { 292 if (operandsMatch) {
293 if (!segment->_xor()) { 293 if (!segment->_xor()) {
294 winding -= segment->spanSign(next); 294 winding -= segment->spanSign(next);
295 SK_DEBUGBREAK(winding != lastWinding); 295 SK_ALWAYSBREAK(winding != lastWinding);
296 SK_DEBUGBREAK(SkPathOpsDebug::ValidWind(winding)); 296 SK_ALWAYSBREAK(SkPathOpsDebug::ValidWind(winding));
297 } 297 }
298 if (!segment->oppXor()) { 298 if (!segment->oppXor()) {
299 int oppDiffWinding = segment->oppSign(next); 299 int oppDiffWinding = segment->oppSign(next);
300 if (oppWinding != SK_MinS32) { 300 if (oppWinding != SK_MinS32) {
301 oppWinding -= oppDiffWinding; 301 oppWinding -= oppDiffWinding;
302 SK_DEBUGBREAK(SkPathOpsDebug::ValidWind(oppWinding)); 302 SK_ALWAYSBREAK(SkPathOpsDebug::ValidWind(oppWinding));
303 } else { 303 } else {
304 SK_DEBUGBREAK(oppDiffWinding == 0); 304 SK_ALWAYSBREAK(oppDiffWinding == 0);
305 } 305 }
306 } 306 }
307 } else { 307 } else {
308 if (!segment->oppXor()) { 308 if (!segment->oppXor()) {
309 winding -= segment->oppSign(next); 309 winding -= segment->oppSign(next);
310 SK_DEBUGBREAK(SkPathOpsDebug::ValidWind(winding)); 310 SK_ALWAYSBREAK(SkPathOpsDebug::ValidWind(winding));
311 } 311 }
312 if (!segment->_xor()) { 312 if (!segment->_xor()) {
313 oppWinding -= segment->spanSign(next); 313 oppWinding -= segment->spanSign(next);
314 SK_DEBUGBREAK(oppWinding != lastOppWinding); 314 SK_ALWAYSBREAK(oppWinding != lastOppWinding);
315 SK_DEBUGBREAK(SkPathOpsDebug::ValidWind(oppWinding)); 315 SK_ALWAYSBREAK(SkPathOpsDebug::ValidWind(oppWinding));
316 } 316 }
317 } 317 }
318 bool useInner = SkOpSegment::UseInnerWinding(lastWinding, winding); 318 bool useInner = SkOpSegment::UseInnerWinding(lastWinding, winding);
319 int sumWinding = useInner ? winding : lastWinding; 319 int sumWinding = useInner ? winding : lastWinding;
320 bool oppUseInner = SkOpSegment::UseInnerWinding(lastOppWinding, oppWindi ng); 320 bool oppUseInner = SkOpSegment::UseInnerWinding(lastOppWinding, oppWindi ng);
321 int oppSumWinding = oppUseInner ? oppWinding : lastOppWinding; 321 int oppSumWinding = oppUseInner ? oppWinding : lastOppWinding;
322 if (!operandsMatch) { 322 if (!operandsMatch) {
323 SkTSwap(useInner, oppUseInner); 323 SkTSwap(useInner, oppUseInner);
324 SkTSwap(sumWinding, oppSumWinding); 324 SkTSwap(sumWinding, oppSumWinding);
325 } 325 }
326 const SkOpSpan& span = segment->span(SkMin32(next->fStart, next->fEnd)); 326 const SkOpSpan& span = segment->span(SkMin32(next->fStart, next->fEnd));
327 if (winding == -lastWinding) { 327 if (winding == -lastWinding) {
328 if (span.fWindSum != SK_MinS32) { 328 if (span.fWindSum != SK_MinS32) {
329 SkDebugf("%s useInner=%d spanSign=%d lastWinding=%d winding=%d w indSum=%d\n", 329 SkDebugf("%s useInner=%d spanSign=%d lastWinding=%d winding=%d w indSum=%d\n",
330 __FUNCTION__, 330 __FUNCTION__,
331 useInner, segment->spanSign(next), lastWinding, winding, span.fWindSum); 331 useInner, segment->spanSign(next), lastWinding, winding, span.fWindSum);
332 } 332 }
333 } 333 }
334 if (oppWinding != SK_MinS32) { 334 if (oppWinding != SK_MinS32) {
335 if (span.fOppSum != SK_MinS32) { 335 if (span.fOppSum != SK_MinS32) {
336 SK_DEBUGBREAK(span.fOppSum == oppSumWinding || segment->oppXor() || segment->_xor()); 336 SK_ALWAYSBREAK(span.fOppSum == oppSumWinding || segment->oppXor( ) || segment->_xor());
337 } 337 }
338 } else { 338 } else {
339 SK_DEBUGBREAK(!firstOperand); 339 SK_ALWAYSBREAK(!firstOperand);
340 SK_DEBUGBREAK(!segment->operand()); 340 SK_ALWAYSBREAK(!segment->operand());
341 SK_DEBUGBREAK(!span.fOppValue); 341 SK_ALWAYSBREAK(!span.fOppValue);
342 } 342 }
343 next = next->next(); 343 next = next->next();
344 } while (next != first); 344 } while (next != first);
345 } 345 }
346 #endif 346 #endif
347 347
348 #if DEBUG_SWAP_TOP 348 #if DEBUG_SWAP_TOP
349 bool SkOpSegment::controlsContainedByEnds(int tStart, int tEnd) const { 349 bool SkOpSegment::controlsContainedByEnds(int tStart, int tEnd) const {
350 if (fVerb != SkPath::kCubic_Verb) { 350 if (fVerb != SkPath::kCubic_Verb) {
351 return false; 351 return false;
352 } 352 }
353 SkDCubic dst = SkDCubic::SubDivide(fPts, fTs[tStart].fT, fTs[tEnd].fT); 353 SkDCubic dst = SkDCubic::SubDivide(fPts, fTs[tStart].fT, fTs[tEnd].fT);
354 return dst.controlsContainedByEnds(); 354 return dst.controlsContainedByEnds();
355 } 355 }
356 #endif 356 #endif
357 357
358 #if DEBUG_CONCIDENT 358 #if DEBUG_CONCIDENT
359 // SK_DEBUGBREAK if pair has not already been added 359 // SK_ALWAYSBREAK if pair has not already been added
360 void SkOpSegment::debugAddTPair(double t, const SkOpSegment& other, double other T) const { 360 void SkOpSegment::debugAddTPair(double t, const SkOpSegment& other, double other T) const {
361 for (int i = 0; i < fTs.count(); ++i) { 361 for (int i = 0; i < fTs.count(); ++i) {
362 if (fTs[i].fT == t && fTs[i].fOther == &other && fTs[i].fOtherT == other T) { 362 if (fTs[i].fT == t && fTs[i].fOther == &other && fTs[i].fOtherT == other T) {
363 return; 363 return;
364 } 364 }
365 } 365 }
366 SK_DEBUGBREAK(0); 366 SK_ALWAYSBREAK(0);
367 } 367 }
368 #endif 368 #endif
369 369
370 #if DEBUG_ANGLE 370 #if DEBUG_ANGLE
371 void SkOpSegment::debugCheckPointsEqualish(int tStart, int tEnd) const { 371 void SkOpSegment::debugCheckPointsEqualish(int tStart, int tEnd) const {
372 const SkPoint& basePt = fTs[tStart].fPt; 372 const SkPoint& basePt = fTs[tStart].fPt;
373 while (++tStart < tEnd) { 373 while (++tStart < tEnd) {
374 const SkPoint& cmpPt = fTs[tStart].fPt; 374 const SkPoint& cmpPt = fTs[tStart].fPt;
375 SK_DEBUGBREAK(SkDPoint::ApproximatelyEqual(basePt, cmpPt)); 375 SK_ALWAYSBREAK(SkDPoint::ApproximatelyEqual(basePt, cmpPt));
376 } 376 }
377 } 377 }
378 #endif 378 #endif
379 379
380 #if DEBUG_VALIDATE 380 #if DEBUG_VALIDATE
381 bool SkOpSegment::debugContains(const SkOpAngle* angle) const { 381 bool SkOpSegment::debugContains(const SkOpAngle* angle) const {
382 for (int index = 0; index < fAngles.count(); ++index) { 382 for (int index = 0; index < fAngles.count(); ++index) {
383 if (&fAngles[index] == angle) { 383 if (&fAngles[index] == angle) {
384 return true; 384 return true;
385 } 385 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 return; 454 return;
455 } 455 }
456 #if DEBUG_ACTIVE_SPANS_SHORT_FORM 456 #if DEBUG_ACTIVE_SPANS_SHORT_FORM
457 int lastId = -1; 457 int lastId = -1;
458 double lastT = -1; 458 double lastT = -1;
459 #endif 459 #endif
460 for (int i = 0; i < fTs.count(); ++i) { 460 for (int i = 0; i < fTs.count(); ++i) {
461 if (fTs[i].fDone) { 461 if (fTs[i].fDone) {
462 continue; 462 continue;
463 } 463 }
464 SK_DEBUGBREAK(i < fTs.count() - 1); 464 SK_ALWAYSBREAK(i < fTs.count() - 1);
465 #if DEBUG_ACTIVE_SPANS_SHORT_FORM 465 #if DEBUG_ACTIVE_SPANS_SHORT_FORM
466 if (lastId == fID && lastT == fTs[i].fT) { 466 if (lastId == fID && lastT == fTs[i].fT) {
467 continue; 467 continue;
468 } 468 }
469 lastId = fID; 469 lastId = fID;
470 lastT = fTs[i].fT; 470 lastT = fTs[i].fT;
471 #endif 471 #endif
472 SkDebugf("%s id=%d", __FUNCTION__, fID); 472 SkDebugf("%s id=%d", __FUNCTION__, fID);
473 SkDebugf(" (%1.9g,%1.9g", fPts[0].fX, fPts[0].fY); 473 SkDebugf(" (%1.9g,%1.9g", fPts[0].fX, fPts[0].fY);
474 for (int vIndex = 1; vIndex <= SkPathOpsVerbToPoints(fVerb); ++vIndex) { 474 for (int vIndex = 1; vIndex <= SkPathOpsVerbToPoints(fVerb); ++vIndex) {
(...skipping 20 matching lines...) Expand all
495 #endif 495 #endif
496 496
497 #if DEBUG_MARK_DONE || DEBUG_UNSORTABLE 497 #if DEBUG_MARK_DONE || DEBUG_UNSORTABLE
498 void SkOpSegment::debugShowNewWinding(const char* fun, const SkOpSpan& span, int winding) { 498 void SkOpSegment::debugShowNewWinding(const char* fun, const SkOpSpan& span, int winding) {
499 const SkPoint& pt = xyAtT(&span); 499 const SkPoint& pt = xyAtT(&span);
500 SkDebugf("%s id=%d", fun, fID); 500 SkDebugf("%s id=%d", fun, fID);
501 SkDebugf(" (%1.9g,%1.9g", fPts[0].fX, fPts[0].fY); 501 SkDebugf(" (%1.9g,%1.9g", fPts[0].fX, fPts[0].fY);
502 for (int vIndex = 1; vIndex <= SkPathOpsVerbToPoints(fVerb); ++vIndex) { 502 for (int vIndex = 1; vIndex <= SkPathOpsVerbToPoints(fVerb); ++vIndex) {
503 SkDebugf(" %1.9g,%1.9g", fPts[vIndex].fX, fPts[vIndex].fY); 503 SkDebugf(" %1.9g,%1.9g", fPts[vIndex].fX, fPts[vIndex].fY);
504 } 504 }
505 SK_DEBUGBREAK(&span == &span.fOther->fTs[span.fOtherIndex].fOther-> 505 SK_ALWAYSBREAK(&span == &span.fOther->fTs[span.fOtherIndex].fOther->
506 fTs[span.fOther->fTs[span.fOtherIndex].fOtherIndex]); 506 fTs[span.fOther->fTs[span.fOtherIndex].fOtherIndex]);
507 SkDebugf(") t=%1.9g [%d] (%1.9g,%1.9g) tEnd=%1.9g newWindSum=%d windSum=", 507 SkDebugf(") t=%1.9g [%d] (%1.9g,%1.9g) tEnd=%1.9g newWindSum=%d windSum=",
508 span.fT, span.fOther->fTs[span.fOtherIndex].fOtherIndex, pt.fX, pt.f Y, 508 span.fT, span.fOther->fTs[span.fOtherIndex].fOtherIndex, pt.fX, pt.f Y,
509 (&span)[1].fT, winding); 509 (&span)[1].fT, winding);
510 if (span.fWindSum == SK_MinS32) { 510 if (span.fWindSum == SK_MinS32) {
511 SkDebugf("?"); 511 SkDebugf("?");
512 } else { 512 } else {
513 SkDebugf("%d", span.fWindSum); 513 SkDebugf("%d", span.fWindSum);
514 } 514 }
515 SkDebugf(" windValue=%d\n", span.fWindValue); 515 SkDebugf(" windValue=%d\n", span.fWindValue);
516 } 516 }
517 517
518 void SkOpSegment::debugShowNewWinding(const char* fun, const SkOpSpan& span, int winding, 518 void SkOpSegment::debugShowNewWinding(const char* fun, const SkOpSpan& span, int winding,
519 int oppWinding) { 519 int oppWinding) {
520 const SkPoint& pt = xyAtT(&span); 520 const SkPoint& pt = xyAtT(&span);
521 SkDebugf("%s id=%d", fun, fID); 521 SkDebugf("%s id=%d", fun, fID);
522 SkDebugf(" (%1.9g,%1.9g", fPts[0].fX, fPts[0].fY); 522 SkDebugf(" (%1.9g,%1.9g", fPts[0].fX, fPts[0].fY);
523 for (int vIndex = 1; vIndex <= SkPathOpsVerbToPoints(fVerb); ++vIndex) { 523 for (int vIndex = 1; vIndex <= SkPathOpsVerbToPoints(fVerb); ++vIndex) {
524 SkDebugf(" %1.9g,%1.9g", fPts[vIndex].fX, fPts[vIndex].fY); 524 SkDebugf(" %1.9g,%1.9g", fPts[vIndex].fX, fPts[vIndex].fY);
525 } 525 }
526 SK_DEBUGBREAK(&span == &span.fOther->fTs[span.fOtherIndex].fOther-> 526 SK_ALWAYSBREAK(&span == &span.fOther->fTs[span.fOtherIndex].fOther->
527 fTs[span.fOther->fTs[span.fOtherIndex].fOtherIndex]); 527 fTs[span.fOther->fTs[span.fOtherIndex].fOtherIndex]);
528 SkDebugf(") t=%1.9g [%d] (%1.9g,%1.9g) tEnd=%1.9g newWindSum=%d newOppSum=%d oppSum=", 528 SkDebugf(") t=%1.9g [%d] (%1.9g,%1.9g) tEnd=%1.9g newWindSum=%d newOppSum=%d oppSum=",
529 span.fT, span.fOther->fTs[span.fOtherIndex].fOtherIndex, pt.fX, pt.f Y, 529 span.fT, span.fOther->fTs[span.fOtherIndex].fOtherIndex, pt.fX, pt.f Y,
530 (&span)[1].fT, winding, oppWinding); 530 (&span)[1].fT, winding, oppWinding);
531 if (span.fOppSum == SK_MinS32) { 531 if (span.fOppSum == SK_MinS32) {
532 SkDebugf("?"); 532 SkDebugf("?");
533 } else { 533 } else {
534 SkDebugf("%d", span.fOppSum); 534 SkDebugf("%d", span.fOppSum);
535 } 535 }
536 SkDebugf(" windSum="); 536 SkDebugf(" windSum=");
(...skipping 25 matching lines...) Expand all
562 } 562 }
563 SkDebugf("%s id=%2d %.*s | %.*s\n", __FUNCTION__, fID, slotCount, slots.begi n(), slotCount, 563 SkDebugf("%s id=%2d %.*s | %.*s\n", __FUNCTION__, fID, slotCount, slots.begi n(), slotCount,
564 slots.begin() + slotCount); 564 slots.begin() + slotCount);
565 return sum; 565 return sum;
566 } 566 }
567 #endif 567 #endif
568 568
569 void SkOpSegment::debugValidate() const { 569 void SkOpSegment::debugValidate() const {
570 #if DEBUG_VALIDATE 570 #if DEBUG_VALIDATE
571 int count = fTs.count(); 571 int count = fTs.count();
572 SK_DEBUGBREAK(count >= 2); 572 SK_ALWAYSBREAK(count >= 2);
573 SK_DEBUGBREAK(fTs[0].fT == 0); 573 SK_ALWAYSBREAK(fTs[0].fT == 0);
574 SK_DEBUGBREAK(fTs[count - 1].fT == 1); 574 SK_ALWAYSBREAK(fTs[count - 1].fT == 1);
575 int done = 0; 575 int done = 0;
576 double t = -1; 576 double t = -1;
577 const SkOpSpan* last = NULL; 577 const SkOpSpan* last = NULL;
578 bool tinyTFound = false; 578 bool tinyTFound = false;
579 bool hasLoop = false; 579 bool hasLoop = false;
580 for (int i = 0; i < count; ++i) { 580 for (int i = 0; i < count; ++i) {
581 const SkOpSpan& span = fTs[i]; 581 const SkOpSpan& span = fTs[i];
582 SK_DEBUGBREAK(t <= span.fT); 582 SK_ALWAYSBREAK(t <= span.fT);
583 t = span.fT; 583 t = span.fT;
584 int otherIndex = span.fOtherIndex; 584 int otherIndex = span.fOtherIndex;
585 const SkOpSegment* other = span.fOther; 585 const SkOpSegment* other = span.fOther;
586 SK_DEBUGBREAK(other != this || fVerb == SkPath::kCubic_Verb); 586 SK_ALWAYSBREAK(other != this || fVerb == SkPath::kCubic_Verb);
587 const SkOpSpan& otherSpan = other->fTs[otherIndex]; 587 const SkOpSpan& otherSpan = other->fTs[otherIndex];
588 SK_DEBUGBREAK(otherSpan.fPt == span.fPt); 588 SK_ALWAYSBREAK(otherSpan.fPt == span.fPt);
589 SK_DEBUGBREAK(otherSpan.fOtherT == t); 589 SK_ALWAYSBREAK(otherSpan.fOtherT == t);
590 SK_DEBUGBREAK(&fTs[i] == &otherSpan.fOther->fTs[otherSpan.fOtherIndex]); 590 SK_ALWAYSBREAK(&fTs[i] == &otherSpan.fOther->fTs[otherSpan.fOtherIndex]) ;
591 done += span.fDone; 591 done += span.fDone;
592 if (last) { 592 if (last) {
593 bool tsEqual = last->fT == span.fT; 593 bool tsEqual = last->fT == span.fT;
594 bool tsPreciselyEqual = precisely_equal(last->fT, span.fT); 594 bool tsPreciselyEqual = precisely_equal(last->fT, span.fT);
595 SK_DEBUGBREAK(!tsEqual || tsPreciselyEqual); 595 SK_ALWAYSBREAK(!tsEqual || tsPreciselyEqual);
596 bool pointsEqual = last->fPt == span.fPt; 596 bool pointsEqual = last->fPt == span.fPt;
597 bool pointsNearlyEqual = AlmostEqualUlps(last->fPt, span.fPt); 597 bool pointsNearlyEqual = AlmostEqualUlps(last->fPt, span.fPt);
598 #if 0 // bufferOverflow test triggers this 598 #if 0 // bufferOverflow test triggers this
599 SK_DEBUGBREAK(!tsPreciselyEqual || pointsNearlyEqual); 599 SK_ALWAYSBREAK(!tsPreciselyEqual || pointsNearlyEqual);
600 #endif 600 #endif
601 // SK_DEBUGBREAK(!last->fTiny || !tsPreciselyEqual || span.fTiny || t inyTFound); 601 // SK_ALWAYSBREAK(!last->fTiny || !tsPreciselyEqual || span.fTiny || tinyTFound);
602 SK_DEBUGBREAK(last->fTiny || tsPreciselyEqual || !pointsEqual || has Loop); 602 SK_ALWAYSBREAK(last->fTiny || tsPreciselyEqual || !pointsEqual || ha sLoop);
603 SK_DEBUGBREAK(!last->fTiny || pointsEqual); 603 SK_ALWAYSBREAK(!last->fTiny || pointsEqual);
604 SK_DEBUGBREAK(!last->fTiny || last->fDone); 604 SK_ALWAYSBREAK(!last->fTiny || last->fDone);
605 SK_DEBUGBREAK(!last->fSmall || pointsNearlyEqual); 605 SK_ALWAYSBREAK(!last->fSmall || pointsNearlyEqual);
606 SK_DEBUGBREAK(!last->fSmall || last->fDone); 606 SK_ALWAYSBREAK(!last->fSmall || last->fDone);
607 // SK_DEBUGBREAK(!last->fSmall || last->fTiny); 607 // SK_ALWAYSBREAK(!last->fSmall || last->fTiny);
608 // SK_DEBUGBREAK(last->fTiny || !pointsEqual || last->fDone == span.f Done); 608 // SK_ALWAYSBREAK(last->fTiny || !pointsEqual || last->fDone == span. fDone);
609 if (last->fTiny) { 609 if (last->fTiny) {
610 tinyTFound |= !tsPreciselyEqual; 610 tinyTFound |= !tsPreciselyEqual;
611 } else { 611 } else {
612 tinyTFound = false; 612 tinyTFound = false;
613 } 613 }
614 } 614 }
615 last = &span; 615 last = &span;
616 hasLoop |= last->fLoop; 616 hasLoop |= last->fLoop;
617 } 617 }
618 SK_DEBUGBREAK(done == fDoneSpans); 618 SK_ALWAYSBREAK(done == fDoneSpans);
619 if (fAngles.count() ) { 619 if (fAngles.count() ) {
620 fAngles.begin()->debugValidateLoop(); 620 fAngles.begin()->debugValidateLoop();
621 } 621 }
622 #endif 622 #endif
623 } 623 }
OLDNEW
« no previous file with comments | « src/device/xps/SkXPSDevice.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698