| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 #include "SampleCode.h" | 8 #include "SampleCode.h" |
| 9 #include "SkView.h" | 9 #include "SkView.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 canvas->translate(0, SkIntToScalar(200)); | 389 canvas->translate(0, SkIntToScalar(200)); |
| 390 this->drawPathOped(canvas, gOps[op].fOp, gOps[op].fColor); | 390 this->drawPathOped(canvas, gOps[op].fOp, gOps[op].fColor); |
| 391 canvas->restore(); | 391 canvas->restore(); |
| 392 | 392 |
| 393 canvas->translate(SkIntToScalar(200), 0); | 393 canvas->translate(SkIntToScalar(200), 0); |
| 394 } | 394 } |
| 395 } | 395 } |
| 396 | 396 |
| 397 virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, | 397 virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, |
| 398 unsigned modi) SK_OVERRIDE { | 398 unsigned modi) SK_OVERRIDE { |
| 399 return fRect.contains(SkScalarRound(x), SkScalarRound(y)) ? new Click(th
is) : NULL; | 399 return fRect.contains(SkScalarRoundToInt(x), |
| 400 SkScalarRoundToInt(y)) ? new Click(this) : NULL; |
| 400 } | 401 } |
| 401 | 402 |
| 402 virtual bool onClick(Click* click) { | 403 virtual bool onClick(Click* click) { |
| 403 fRect.offset(click->fICurr.fX - click->fIPrev.fX, | 404 fRect.offset(click->fICurr.fX - click->fIPrev.fX, |
| 404 click->fICurr.fY - click->fIPrev.fY); | 405 click->fICurr.fY - click->fIPrev.fY); |
| 405 this->inval(NULL); | 406 this->inval(NULL); |
| 406 return true; | 407 return true; |
| 407 } | 408 } |
| 408 | 409 |
| 409 private: | 410 private: |
| 410 SkIRect fBase, fRect; | 411 SkIRect fBase, fRect; |
| 411 | 412 |
| 412 typedef SampleView INHERITED; | 413 typedef SampleView INHERITED; |
| 413 }; | 414 }; |
| 414 | 415 |
| 415 ////////////////////////////////////////////////////////////////////////////// | 416 ////////////////////////////////////////////////////////////////////////////// |
| 416 | 417 |
| 417 static SkView* MyFactory() { return new RegionView; } | 418 static SkView* MyFactory() { return new RegionView; } |
| 418 static SkViewRegister reg(MyFactory); | 419 static SkViewRegister reg(MyFactory); |
| OLD | NEW |