| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SampleCode.h" | 8 #include "SampleCode.h" |
| 9 #include "SkView.h" | 9 #include "SkView.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 class MyClick : public Click { | 326 class MyClick : public Click { |
| 327 public: | 327 public: |
| 328 int fIndex; | 328 int fIndex; |
| 329 MyClick(SkView* target, int index) : Click(target), fIndex(index) {} | 329 MyClick(SkView* target, int index) : Click(target), fIndex(index) {} |
| 330 }; | 330 }; |
| 331 | 331 |
| 332 virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, | 332 virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, |
| 333 unsigned modi) SK_OVERRIDE { | 333 unsigned modi) SK_OVERRIDE { |
| 334 for (size_t i = 0; i < SK_ARRAY_COUNT(fPts); ++i) { | 334 for (size_t i = 0; i < SK_ARRAY_COUNT(fPts); ++i) { |
| 335 if (hittest(fPts[i], x, y)) { | 335 if (hittest(fPts[i], x, y)) { |
| 336 return new MyClick(this, i); | 336 return new MyClick(this, (int)i); |
| 337 } | 337 } |
| 338 } | 338 } |
| 339 return this->INHERITED::onFindClickHandler(x, y, modi); | 339 return this->INHERITED::onFindClickHandler(x, y, modi); |
| 340 } | 340 } |
| 341 | 341 |
| 342 virtual bool onClick(Click* click) { | 342 virtual bool onClick(Click* click) { |
| 343 int index = ((MyClick*)click)->fIndex; | 343 int index = ((MyClick*)click)->fIndex; |
| 344 fPts[index].offset(SkIntToScalar(click->fICurr.fX - click->fIPrev.fX), | 344 fPts[index].offset(SkIntToScalar(click->fICurr.fX - click->fIPrev.fX), |
| 345 SkIntToScalar(click->fICurr.fY - click->fIPrev.fY)); | 345 SkIntToScalar(click->fICurr.fY - click->fIPrev.fY)); |
| 346 this->inval(NULL); | 346 this->inval(NULL); |
| 347 return true; | 347 return true; |
| 348 } | 348 } |
| 349 | 349 |
| 350 private: | 350 private: |
| 351 typedef SkView INHERITED; | 351 typedef SkView INHERITED; |
| 352 }; | 352 }; |
| 353 | 353 |
| 354 /////////////////////////////////////////////////////////////////////////////// | 354 /////////////////////////////////////////////////////////////////////////////// |
| 355 | 355 |
| 356 static SkView* F0() { return new RotateCirclesView; } | 356 static SkView* F0() { return new RotateCirclesView; } |
| 357 static SkViewRegister gR0(F0); | 357 static SkViewRegister gR0(F0); |
| 358 static SkView* F1() { return new TestCirclesView; } | 358 static SkView* F1() { return new TestCirclesView; } |
| 359 static SkViewRegister gR1(F1); | 359 static SkViewRegister gR1(F1); |
| 360 static SkView* F2() { return new TestStrokeView; } | 360 static SkView* F2() { return new TestStrokeView; } |
| 361 static SkViewRegister gR2(F2); | 361 static SkViewRegister gR2(F2); |
| OLD | NEW |