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

Side by Side Diff: src/views/SkTouchGesture.cpp

Issue 695663003: Cleanup: Go with SkDebugf instead of GrPrintf. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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/gl/builders/GrGLShaderStringBuilder.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 2010 Google Inc. 3 * Copyright 2010 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 9
10 10
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 135
136 void SkTouchGesture::appendNewRec(void* owner, float x, float y) { 136 void SkTouchGesture::appendNewRec(void* owner, float x, float y) {
137 Rec* rec = fTouches.append(); 137 Rec* rec = fTouches.append();
138 rec->fOwner = owner; 138 rec->fOwner = owner;
139 rec->fStartX = rec->fPrevX = rec->fLastX = x; 139 rec->fStartX = rec->fPrevX = rec->fLastX = x;
140 rec->fStartY = rec->fPrevY = rec->fLastY = y; 140 rec->fStartY = rec->fPrevY = rec->fLastY = y;
141 rec->fLastT = rec->fPrevT = SkTime::GetMSecs(); 141 rec->fLastT = rec->fPrevT = SkTime::GetMSecs();
142 } 142 }
143 143
144 void SkTouchGesture::touchBegin(void* owner, float x, float y) { 144 void SkTouchGesture::touchBegin(void* owner, float x, float y) {
145 // GrPrintf("--- %d touchBegin %p %g %g\n", fTouches.count(), owner, x, y); 145 // SkDebugf("--- %d touchBegin %p %g %g\n", fTouches.count(), owner, x, y);
146 146
147 int index = this->findRec(owner); 147 int index = this->findRec(owner);
148 if (index >= 0) { 148 if (index >= 0) {
149 this->flushLocalM(); 149 this->flushLocalM();
150 fTouches.removeShuffle(index); 150 fTouches.removeShuffle(index);
151 SkDebugf("---- already exists, removing\n"); 151 SkDebugf("---- already exists, removing\n");
152 } 152 }
153 153
154 if (fTouches.count() == 2) { 154 if (fTouches.count() == 2) {
155 return; 155 return;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 194
195 if (scale > 1 && curr * scale > MAX_ZOOM_SCALE) { 195 if (scale > 1 && curr * scale > MAX_ZOOM_SCALE) {
196 scale = MAX_ZOOM_SCALE / curr; 196 scale = MAX_ZOOM_SCALE / curr;
197 } else if (scale < 1 && curr * scale < MIN_ZOOM_SCALE) { 197 } else if (scale < 1 && curr * scale < MIN_ZOOM_SCALE) {
198 scale = MIN_ZOOM_SCALE / curr; 198 scale = MIN_ZOOM_SCALE / curr;
199 } 199 }
200 return scale; 200 return scale;
201 } 201 }
202 202
203 void SkTouchGesture::touchMoved(void* owner, float x, float y) { 203 void SkTouchGesture::touchMoved(void* owner, float x, float y) {
204 // GrPrintf("--- %d touchMoved %p %g %g\n", fTouches.count(), owner, x, y); 204 // SkDebugf("--- %d touchMoved %p %g %g\n", fTouches.count(), owner, x, y);
205 205
206 if (kEmpty_State == fState) { 206 if (kEmpty_State == fState) {
207 return; 207 return;
208 } 208 }
209 209
210 int index = this->findRec(owner); 210 int index = this->findRec(owner);
211 if (index < 0) { 211 if (index < 0) {
212 // not found, so I guess we should add it... 212 // not found, so I guess we should add it...
213 SkDebugf("---- add missing begin\n"); 213 SkDebugf("---- add missing begin\n");
214 this->appendNewRec(owner, x, y); 214 this->appendNewRec(owner, x, y);
215 index = fTouches.count() - 1; 215 index = fTouches.count() - 1;
216 } 216 }
217 217
218 Rec& rec = fTouches[index]; 218 Rec& rec = fTouches[index];
219 219
220 // not sure how valuable this is 220 // not sure how valuable this is
221 if (fTouches.count() == 2) { 221 if (fTouches.count() == 2) {
222 if (close_enough_for_jitter(rec.fLastX, rec.fLastY, x, y)) { 222 if (close_enough_for_jitter(rec.fLastX, rec.fLastY, x, y)) {
223 // GrPrintf("--- drop touchMove, withing jitter tolerance %g %g\n", r ec.fLastX - x, rec.fLastY - y); 223 // SkDebugf("--- drop touchMove, withing jitter tolerance %g %g\n", r ec.fLastX - x, rec.fLastY - y);
224 return; 224 return;
225 } 225 }
226 } 226 }
227 227
228 rec.fPrevX = rec.fLastX; rec.fLastX = x; 228 rec.fPrevX = rec.fLastX; rec.fLastX = x;
229 rec.fPrevY = rec.fLastY; rec.fLastY = y; 229 rec.fPrevY = rec.fLastY; rec.fLastY = y;
230 rec.fPrevT = rec.fLastT; rec.fLastT = SkTime::GetMSecs(); 230 rec.fPrevT = rec.fLastT; rec.fLastT = SkTime::GetMSecs();
231 231
232 switch (fTouches.count()) { 232 switch (fTouches.count()) {
233 case 1: { 233 case 1: {
(...skipping 16 matching lines...) Expand all
250 fLocalM.postScale(scale, scale); 250 fLocalM.postScale(scale, scale);
251 fLocalM.postTranslate(center(rec0.fLastX, rec1.fLastX), 251 fLocalM.postTranslate(center(rec0.fLastX, rec1.fLastX),
252 center(rec0.fLastY, rec1.fLastY)); 252 center(rec0.fLastY, rec1.fLastY));
253 } break; 253 } break;
254 default: 254 default:
255 break; 255 break;
256 } 256 }
257 } 257 }
258 258
259 void SkTouchGesture::touchEnd(void* owner) { 259 void SkTouchGesture::touchEnd(void* owner) {
260 // GrPrintf("--- %d touchEnd %p\n", fTouches.count(), owner); 260 // SkDebugf("--- %d touchEnd %p\n", fTouches.count(), owner);
261 261
262 int index = this->findRec(owner); 262 int index = this->findRec(owner);
263 if (index < 0) { 263 if (index < 0) {
264 SkDebugf("--- not found\n"); 264 SkDebugf("--- not found\n");
265 return; 265 return;
266 } 266 }
267 267
268 const Rec& rec = fTouches[index]; 268 const Rec& rec = fTouches[index];
269 if (this->handleDblTap(rec.fLastX, rec.fLastY)) { 269 if (this->handleDblTap(rec.fLastX, rec.fLastY)) {
270 return; 270 return;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 fTouches.reset(); 320 fTouches.reset();
321 fState = kEmpty_State; 321 fState = kEmpty_State;
322 found = true; 322 found = true;
323 } 323 }
324 } 324 }
325 325
326 fLastUpT = now; 326 fLastUpT = now;
327 fLastUpP.set(x, y); 327 fLastUpP.set(x, y);
328 return found; 328 return found;
329 } 329 }
OLDNEW
« no previous file with comments | « src/gpu/gl/builders/GrGLShaderStringBuilder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698