| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "GrReducedClip.h" | 8 #include "GrReducedClip.h" |
| 9 | 9 |
| 10 typedef SkClipStack::Element Element; | 10 typedef SkClipStack::Element Element; |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 if (!SkRect::Intersects(stackBounds, scalarQueryBounds)) { | 402 if (!SkRect::Intersects(stackBounds, scalarQueryBounds)) { |
| 403 *initialState = kAllOut_InitialState; | 403 *initialState = kAllOut_InitialState; |
| 404 if (requiresAA) { | 404 if (requiresAA) { |
| 405 *requiresAA = false; | 405 *requiresAA = false; |
| 406 } | 406 } |
| 407 return; | 407 return; |
| 408 } | 408 } |
| 409 if (tighterBounds) { | 409 if (tighterBounds) { |
| 410 SkIRect stackIBounds; | 410 SkIRect stackIBounds; |
| 411 stackBounds.roundOut(&stackIBounds); | 411 stackBounds.roundOut(&stackIBounds); |
| 412 tighterBounds->intersect(queryBounds, stackIBounds); | 412 if (!tighterBounds->intersect(queryBounds, stackIBounds)) { |
| 413 SkASSERT(0); |
| 414 tighterBounds->setEmpty(); |
| 415 } |
| 413 bounds = tighterBounds; | 416 bounds = tighterBounds; |
| 414 } | 417 } |
| 415 } else { | 418 } else { |
| 416 if (stackBounds.contains(scalarQueryBounds)) { | 419 if (stackBounds.contains(scalarQueryBounds)) { |
| 417 *initialState = kAllOut_InitialState; | 420 *initialState = kAllOut_InitialState; |
| 418 if (requiresAA) { | 421 if (requiresAA) { |
| 419 *requiresAA = false; | 422 *requiresAA = false; |
| 420 } | 423 } |
| 421 return; | 424 return; |
| 422 } | 425 } |
| 423 if (tighterBounds) { | 426 if (tighterBounds) { |
| 424 *tighterBounds = queryBounds; | 427 *tighterBounds = queryBounds; |
| 425 } | 428 } |
| 426 } | 429 } |
| 427 } | 430 } |
| 428 | 431 |
| 429 SkRect scalarBounds = SkRect::Make(*bounds); | 432 SkRect scalarBounds = SkRect::Make(*bounds); |
| 430 | 433 |
| 431 // Now that we have determined the bounds to use and filtered out the trivia
l cases, call the | 434 // Now that we have determined the bounds to use and filtered out the trivia
l cases, call the |
| 432 // helper that actually walks the stack. | 435 // helper that actually walks the stack. |
| 433 reduced_stack_walker(stack, scalarBounds, result, resultGenID, initialState,
requiresAA); | 436 reduced_stack_walker(stack, scalarBounds, result, resultGenID, initialState,
requiresAA); |
| 434 | 437 |
| 435 // The list that was computed in this function may be cached based on the ge
n id of the last | 438 // The list that was computed in this function may be cached based on the ge
n id of the last |
| 436 // element. | 439 // element. |
| 437 SkASSERT(SkClipStack::kInvalidGenID != *resultGenID); | 440 SkASSERT(SkClipStack::kInvalidGenID != *resultGenID); |
| 438 } | 441 } |
| OLD | NEW |