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

Side by Side Diff: src/core/SkRegion.cpp

Issue 19366008: Add getRectCount to SkRegtion (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « include/core/SkRegion.h ('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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 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 #include "SkRegionPriv.h" 10 #include "SkRegionPriv.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 SkRegion& SkRegion::operator=(const SkRegion& src) { 117 SkRegion& SkRegion::operator=(const SkRegion& src) {
118 (void)this->setRegion(src); 118 (void)this->setRegion(src);
119 return *this; 119 return *this;
120 } 120 }
121 121
122 void SkRegion::swap(SkRegion& other) { 122 void SkRegion::swap(SkRegion& other) {
123 SkTSwap<SkIRect>(fBounds, other.fBounds); 123 SkTSwap<SkIRect>(fBounds, other.fBounds);
124 SkTSwap<RunHead*>(fRunHead, other.fRunHead); 124 SkTSwap<RunHead*>(fRunHead, other.fRunHead);
125 } 125 }
126 126
127 int SkRegion::computeRegionComplexity() const {
128 if (this->isEmpty()) {
129 return 0;
130 } else if (this->isRect()) {
131 return 1;
132 }
133 return fRunHead->getIntervalCount();
134 }
135
127 bool SkRegion::setEmpty() { 136 bool SkRegion::setEmpty() {
128 this->freeRuns(); 137 this->freeRuns();
129 fBounds.set(0, 0, 0, 0); 138 fBounds.set(0, 0, 0, 0);
130 fRunHead = SkRegion_gEmptyRunHeadPtr; 139 fRunHead = SkRegion_gEmptyRunHeadPtr;
131 return false; 140 return false;
132 } 141 }
133 142
134 bool SkRegion::setRect(int32_t left, int32_t top, 143 bool SkRegion::setRect(int32_t left, int32_t top,
135 int32_t right, int32_t bottom) { 144 int32_t right, int32_t bottom) {
136 if (left >= right || top >= bottom) { 145 if (left >= right || top >= bottom) {
(...skipping 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 bool SkRegion::debugSetRuns(const RunType runs[], int count) { 1472 bool SkRegion::debugSetRuns(const RunType runs[], int count) {
1464 // we need to make a copy, since the real method may modify the array, and 1473 // we need to make a copy, since the real method may modify the array, and
1465 // so it cannot be const. 1474 // so it cannot be const.
1466 1475
1467 SkAutoTArray<RunType> storage(count); 1476 SkAutoTArray<RunType> storage(count);
1468 memcpy(storage.get(), runs, count * sizeof(RunType)); 1477 memcpy(storage.get(), runs, count * sizeof(RunType));
1469 return this->setRuns(storage.get(), count); 1478 return this->setRuns(storage.get(), count);
1470 } 1479 }
1471 1480
1472 #endif 1481 #endif
OLDNEW
« no previous file with comments | « include/core/SkRegion.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698