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

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

Issue 615993003: optimize setRectFan and join -- from profiling drawText (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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/core/SkPoint.cpp ('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 "SkRect.h" 10 #include "SkRect.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 a.fTop < b.fBottom && b.fTop < a.fBottom) { 139 a.fTop < b.fBottom && b.fTop < a.fBottom) {
140 fLeft = SkMaxScalar(a.fLeft, b.fLeft); 140 fLeft = SkMaxScalar(a.fLeft, b.fLeft);
141 fTop = SkMaxScalar(a.fTop, b.fTop); 141 fTop = SkMaxScalar(a.fTop, b.fTop);
142 fRight = SkMinScalar(a.fRight, b.fRight); 142 fRight = SkMinScalar(a.fRight, b.fRight);
143 fBottom = SkMinScalar(a.fBottom, b.fBottom); 143 fBottom = SkMinScalar(a.fBottom, b.fBottom);
144 return true; 144 return true;
145 } 145 }
146 return false; 146 return false;
147 } 147 }
148 148
149 void SkRect::join(SkScalar left, SkScalar top, SkScalar right, 149 void SkRect::join(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom) {
150 SkScalar bottom) {
151 // do nothing if the params are empty 150 // do nothing if the params are empty
152 if (left >= right || top >= bottom) { 151 if (left >= right || top >= bottom) {
153 return; 152 return;
154 } 153 }
155 154
156 // if we are empty, just assign 155 // if we are empty, just assign
157 if (fLeft >= fRight || fTop >= fBottom) { 156 if (fLeft >= fRight || fTop >= fBottom) {
158 this->set(left, top, right, bottom); 157 this->set(left, top, right, bottom);
159 } else { 158 } else {
160 if (left < fLeft) fLeft = left; 159 fLeft = SkMinScalar(fLeft, left);
161 if (top < fTop) fTop = top; 160 fTop = SkMinScalar(fTop, top);
162 if (right > fRight) fRight = right; 161 fRight = SkMaxScalar(fRight, right);
163 if (bottom > fBottom) fBottom = bottom; 162 fBottom = SkMaxScalar(fBottom, bottom);
164 } 163 }
165 } 164 }
OLDNEW
« no previous file with comments | « src/core/SkPoint.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698