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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 if (!skippable) { | 199 if (!skippable) { |
200 if (0 == result->count()) { | 200 if (0 == result->count()) { |
201 // This will be the last element. Record the stricter genID. | 201 // This will be the last element. Record the stricter genID. |
202 *resultGenID = element->getGenID(); | 202 *resultGenID = element->getGenID(); |
203 } | 203 } |
204 | 204 |
205 // if it is a flip, change it to a bounds-filling rect | 205 // if it is a flip, change it to a bounds-filling rect |
206 if (isFlip) { | 206 if (isFlip) { |
207 SkASSERT(SkRegion::kXOR_Op == element->getOp() || | 207 SkASSERT(SkRegion::kXOR_Op == element->getOp() || |
208 SkRegion::kReverseDifference_Op == element->getOp()); | 208 SkRegion::kReverseDifference_Op == element->getOp()); |
209 SkNEW_INSERT_AT_LLIST_HEAD(result, | 209 result->addToHead(queryBounds, SkRegion::kReverseDifference_Op,
false); |
210 Element, | |
211 (queryBounds, SkRegion::kReverseDiffe
rence_Op, false)); | |
212 } else { | 210 } else { |
213 Element* newElement = result->addToHead(*element); | 211 Element* newElement = result->addToHead(*element); |
214 if (newElement->isAA()) { | 212 if (newElement->isAA()) { |
215 ++numAAElements; | 213 ++numAAElements; |
216 } | 214 } |
217 // Intersecting an inverse shape is the same as differencing the
non-inverse shape. | 215 // Intersecting an inverse shape is the same as differencing the
non-inverse shape. |
218 // Replacing with an inverse shape is the same as setting initia
lState=kAllIn and | 216 // Replacing with an inverse shape is the same as setting initia
lState=kAllIn and |
219 // differencing the non-inverse shape. | 217 // differencing the non-inverse shape. |
220 bool isReplace = SkRegion::kReplace_Op == newElement->getOp(); | 218 bool isReplace = SkRegion::kReplace_Op == newElement->getOp(); |
221 if (newElement->isInverseFilled() && | 219 if (newElement->isInverseFilled() && |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 *requiresAA = false; | 377 *requiresAA = false; |
380 } | 378 } |
381 *initialState = GrReducedClip::kAllIn_InitialState; | 379 *initialState = GrReducedClip::kAllIn_InitialState; |
382 return; | 380 return; |
383 } | 381 } |
384 } | 382 } |
385 *initialState = kAllOut_InitialState; | 383 *initialState = kAllOut_InitialState; |
386 // iior should only be true if aa/non-aa status matches among all el
ements. | 384 // iior should only be true if aa/non-aa status matches among all el
ements. |
387 SkClipStack::Iter iter(stack, SkClipStack::Iter::kTop_IterStart); | 385 SkClipStack::Iter iter(stack, SkClipStack::Iter::kTop_IterStart); |
388 bool doAA = iter.prev()->isAA(); | 386 bool doAA = iter.prev()->isAA(); |
389 SkNEW_INSERT_AT_LLIST_HEAD(result, Element, (isectRect, SkRegion::kR
eplace_Op, doAA)); | 387 result->addToHead(isectRect, SkRegion::kReplace_Op, doAA); |
390 if (requiresAA) { | 388 if (requiresAA) { |
391 *requiresAA = doAA; | 389 *requiresAA = doAA; |
392 } | 390 } |
393 } else { | 391 } else { |
394 *initialState = kAllOut_InitialState; | 392 *initialState = kAllOut_InitialState; |
395 if (requiresAA) { | 393 if (requiresAA) { |
396 *requiresAA = false; | 394 *requiresAA = false; |
397 } | 395 } |
398 } | 396 } |
399 return; | 397 return; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 SkRect scalarBounds = SkRect::Make(*bounds); | 430 SkRect scalarBounds = SkRect::Make(*bounds); |
433 | 431 |
434 // Now that we have determined the bounds to use and filtered out the trivia
l cases, call the | 432 // Now that we have determined the bounds to use and filtered out the trivia
l cases, call the |
435 // helper that actually walks the stack. | 433 // helper that actually walks the stack. |
436 reduced_stack_walker(stack, scalarBounds, result, resultGenID, initialState,
requiresAA); | 434 reduced_stack_walker(stack, scalarBounds, result, resultGenID, initialState,
requiresAA); |
437 | 435 |
438 // The list that was computed in this function may be cached based on the ge
n id of the last | 436 // The list that was computed in this function may be cached based on the ge
n id of the last |
439 // element. | 437 // element. |
440 SkASSERT(SkClipStack::kInvalidGenID != *resultGenID); | 438 SkASSERT(SkClipStack::kInvalidGenID != *resultGenID); |
441 } | 439 } |
OLD | NEW |