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

Side by Side Diff: include/core/SkRegion.h

Issue 2116513002: inline very common intersect+rect_rgn (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 5 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 | « no previous file | 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 /* 2 /*
3 * Copyright 2005 The Android Open Source Project 3 * Copyright 2005 The Android Open Source Project
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 #ifndef SkRegion_DEFINED 10 #ifndef SkRegion_DEFINED
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 kLastOp = kReplace_Op 248 kLastOp = kReplace_Op
249 }; 249 };
250 250
251 static const int kOpCnt = kLastOp + 1; 251 static const int kOpCnt = kLastOp + 1;
252 252
253 /** 253 /**
254 * Set this region to the result of applying the Op to this region and the 254 * Set this region to the result of applying the Op to this region and the
255 * specified rectangle: this = (this op rect). 255 * specified rectangle: this = (this op rect).
256 * Return true if the resulting region is non-empty. 256 * Return true if the resulting region is non-empty.
257 */ 257 */
258 bool op(const SkIRect& rect, Op op) { return this->op(*this, rect, op); } 258 bool op(const SkIRect& rect, Op op) {
259 if (this->isRect() && kIntersect_Op == op) {
260 if (!fBounds.intersect(rect)) {
261 return this->setEmpty();
262 }
263 return true;
264 }
265 return this->op(*this, rect, op);
266 }
259 267
260 /** 268 /**
261 * Set this region to the result of applying the Op to this region and the 269 * Set this region to the result of applying the Op to this region and the
262 * specified rectangle: this = (this op rect). 270 * specified rectangle: this = (this op rect).
263 * Return true if the resulting region is non-empty. 271 * Return true if the resulting region is non-empty.
264 */ 272 */
265 bool op(int left, int top, int right, int bottom, Op op) { 273 bool op(int left, int top, int right, int bottom, Op op) {
266 SkIRect rect; 274 SkIRect rect;
267 rect.set(left, top, right, bottom); 275 rect.set(left, top, right, bottom);
268 return this->op(*this, rect, op); 276 return this->op(*this, rect, op);
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 static bool Oper(const SkRegion&, const SkRegion&, SkRegion::Op, SkRegion*); 451 static bool Oper(const SkRegion&, const SkRegion&, SkRegion::Op, SkRegion*);
444 452
445 friend struct RunHead; 453 friend struct RunHead;
446 friend class Iterator; 454 friend class Iterator;
447 friend class Spanerator; 455 friend class Spanerator;
448 friend class SkRgnBuilder; 456 friend class SkRgnBuilder;
449 friend class SkFlatRegion; 457 friend class SkFlatRegion;
450 }; 458 };
451 459
452 #endif 460 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698