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

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

Issue 544233002: "NULL !=" = NULL (Closed) Base URL: https://skia.googlesource.com/skia.git@are
Patch Set: rebase Created 6 years, 3 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/gpu/GrRedBlackTree.h ('k') | src/gpu/GrRenderTarget.cpp » ('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 2012 Google Inc. 3 * Copyright 2012 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 #include "GrReducedClip.h" 9 #include "GrReducedClip.h"
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 const SkIRect* bounds = &queryBounds; 59 const SkIRect* bounds = &queryBounds;
60 60
61 SkRect scalarQueryBounds = SkRect::Make(queryBounds); 61 SkRect scalarQueryBounds = SkRect::Make(queryBounds);
62 62
63 if (iior) { 63 if (iior) {
64 SkASSERT(SkClipStack::kNormal_BoundsType == stackBoundsType); 64 SkASSERT(SkClipStack::kNormal_BoundsType == stackBoundsType);
65 SkRect isectRect; 65 SkRect isectRect;
66 if (stackBounds.contains(scalarQueryBounds)) { 66 if (stackBounds.contains(scalarQueryBounds)) {
67 *initialState = kAllIn_InitialState; 67 *initialState = kAllIn_InitialState;
68 if (NULL != tighterBounds) { 68 if (tighterBounds) {
69 *tighterBounds = queryBounds; 69 *tighterBounds = queryBounds;
70 } 70 }
71 if (NULL != requiresAA) { 71 if (requiresAA) {
72 *requiresAA = false; 72 *requiresAA = false;
73 } 73 }
74 } else if (isectRect.intersect(stackBounds, scalarQueryBounds)) { 74 } else if (isectRect.intersect(stackBounds, scalarQueryBounds)) {
75 // If the caller asked for tighter integer bounds we may be able to 75 // If the caller asked for tighter integer bounds we may be able to
76 // return kAllIn and give the bounds with no elements 76 // return kAllIn and give the bounds with no elements
77 if (NULL != tighterBounds) { 77 if (tighterBounds) {
78 isectRect.roundOut(tighterBounds); 78 isectRect.roundOut(tighterBounds);
79 SkRect scalarTighterBounds = SkRect::Make(*tighterBounds); 79 SkRect scalarTighterBounds = SkRect::Make(*tighterBounds);
80 if (scalarTighterBounds == isectRect) { 80 if (scalarTighterBounds == isectRect) {
81 // the round-out didn't add any area outside the clip rect. 81 // the round-out didn't add any area outside the clip rect.
82 if (NULL != requiresAA) { 82 if (requiresAA) {
83 *requiresAA = false; 83 *requiresAA = false;
84 } 84 }
85 *initialState = kAllIn_InitialState; 85 *initialState = kAllIn_InitialState;
86 return; 86 return;
87 } 87 }
88 } 88 }
89 *initialState = kAllOut_InitialState; 89 *initialState = kAllOut_InitialState;
90 // iior should only be true if aa/non-aa status matches among all el ements. 90 // iior should only be true if aa/non-aa status matches among all el ements.
91 SkClipStack::Iter iter(stack, SkClipStack::Iter::kTop_IterStart); 91 SkClipStack::Iter iter(stack, SkClipStack::Iter::kTop_IterStart);
92 bool doAA = iter.prev()->isAA(); 92 bool doAA = iter.prev()->isAA();
93 SkNEW_INSERT_AT_LLIST_HEAD(result, Element, (isectRect, SkRegion::kR eplace_Op, doAA)); 93 SkNEW_INSERT_AT_LLIST_HEAD(result, Element, (isectRect, SkRegion::kR eplace_Op, doAA));
94 if (NULL != requiresAA) { 94 if (requiresAA) {
95 *requiresAA = doAA; 95 *requiresAA = doAA;
96 } 96 }
97 } else { 97 } else {
98 *initialState = kAllOut_InitialState; 98 *initialState = kAllOut_InitialState;
99 if (NULL != requiresAA) { 99 if (requiresAA) {
100 *requiresAA = false; 100 *requiresAA = false;
101 } 101 }
102 } 102 }
103 return; 103 return;
104 } else { 104 } else {
105 if (SkClipStack::kNormal_BoundsType == stackBoundsType) { 105 if (SkClipStack::kNormal_BoundsType == stackBoundsType) {
106 if (!SkRect::Intersects(stackBounds, scalarQueryBounds)) { 106 if (!SkRect::Intersects(stackBounds, scalarQueryBounds)) {
107 *initialState = kAllOut_InitialState; 107 *initialState = kAllOut_InitialState;
108 if (NULL != requiresAA) { 108 if (requiresAA) {
109 *requiresAA = false; 109 *requiresAA = false;
110 } 110 }
111 return; 111 return;
112 } 112 }
113 if (NULL != tighterBounds) { 113 if (tighterBounds) {
114 SkIRect stackIBounds; 114 SkIRect stackIBounds;
115 stackBounds.roundOut(&stackIBounds); 115 stackBounds.roundOut(&stackIBounds);
116 tighterBounds->intersect(queryBounds, stackIBounds); 116 tighterBounds->intersect(queryBounds, stackIBounds);
117 bounds = tighterBounds; 117 bounds = tighterBounds;
118 } 118 }
119 } else { 119 } else {
120 if (stackBounds.contains(scalarQueryBounds)) { 120 if (stackBounds.contains(scalarQueryBounds)) {
121 *initialState = kAllOut_InitialState; 121 *initialState = kAllOut_InitialState;
122 if (NULL != requiresAA) { 122 if (requiresAA) {
123 *requiresAA = false; 123 *requiresAA = false;
124 } 124 }
125 return; 125 return;
126 } 126 }
127 if (NULL != tighterBounds) { 127 if (tighterBounds) {
128 *tighterBounds = queryBounds; 128 *tighterBounds = queryBounds;
129 } 129 }
130 } 130 }
131 } 131 }
132 132
133 SkRect scalarBounds = SkRect::Make(*bounds); 133 SkRect scalarBounds = SkRect::Make(*bounds);
134 134
135 // Now that we have determined the bounds to use and filtered out the trivia l cases, call the 135 // Now that we have determined the bounds to use and filtered out the trivia l cases, call the
136 // helper that actually walks the stack. 136 // helper that actually walks the stack.
137 reduced_stack_walker(stack, scalarBounds, result, resultGenID, initialState, requiresAA); 137 reduced_stack_walker(stack, scalarBounds, result, resultGenID, initialState, requiresAA);
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 } 360 }
361 } 361 }
362 } 362 }
363 } 363 }
364 364
365 if ((kAllOut_InitialState == *initialState && !embiggens) || 365 if ((kAllOut_InitialState == *initialState && !embiggens) ||
366 (kAllIn_InitialState == *initialState && !emsmallens)) { 366 (kAllIn_InitialState == *initialState && !emsmallens)) {
367 result->reset(); 367 result->reset();
368 } else { 368 } else {
369 Element* element = result->headIter().get(); 369 Element* element = result->headIter().get();
370 while (NULL != element) { 370 while (element) {
371 bool skippable = false; 371 bool skippable = false;
372 switch (element->getOp()) { 372 switch (element->getOp()) {
373 case SkRegion::kDifference_Op: 373 case SkRegion::kDifference_Op:
374 // subtracting from the empty set yields the empty set. 374 // subtracting from the empty set yields the empty set.
375 skippable = kAllOut_InitialState == *initialState; 375 skippable = kAllOut_InitialState == *initialState;
376 break; 376 break;
377 case SkRegion::kIntersect_Op: 377 case SkRegion::kIntersect_Op:
378 // intersecting with the empty set yields the empty set 378 // intersecting with the empty set yields the empty set
379 if (kAllOut_InitialState == *initialState) { 379 if (kAllOut_InitialState == *initialState) {
380 skippable = true; 380 skippable = true;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 break; 428 break;
429 } else { 429 } else {
430 if (element->isAA()) { 430 if (element->isAA()) {
431 --numAAElements; 431 --numAAElements;
432 } 432 }
433 result->popHead(); 433 result->popHead();
434 element = result->headIter().get(); 434 element = result->headIter().get();
435 } 435 }
436 } 436 }
437 } 437 }
438 if (NULL != requiresAA) { 438 if (requiresAA) {
439 *requiresAA = numAAElements > 0; 439 *requiresAA = numAAElements > 0;
440 } 440 }
441 441
442 if (0 == result->count()) { 442 if (0 == result->count()) {
443 if (*initialState == kAllIn_InitialState) { 443 if (*initialState == kAllIn_InitialState) {
444 *resultGenID = SkClipStack::kWideOpenGenID; 444 *resultGenID = SkClipStack::kWideOpenGenID;
445 } else { 445 } else {
446 *resultGenID = SkClipStack::kEmptyGenID; 446 *resultGenID = SkClipStack::kEmptyGenID;
447 } 447 }
448 } 448 }
449 } 449 }
450 } // namespace GrReducedClip 450 } // namespace GrReducedClip
OLDNEW
« no previous file with comments | « src/gpu/GrRedBlackTree.h ('k') | src/gpu/GrRenderTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698