Chromium Code Reviews| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 SkPoint pts[2] = { fPts[1], fPts[2] }; | 134 SkPoint pts[2] = { fPts[1], fPts[2] }; |
| 135 fMatrix.mapPoints(pts, 2); | 135 fMatrix.mapPoints(pts, 2); |
| 136 for (int i = 0; i < 2; i++) { | 136 for (int i = 0; i < 2; i++) { |
| 137 if (SkPoint::Distance(pts[i], target) < SkIntToScalar(4)) { | 137 if (SkPoint::Distance(pts[i], target) < SkIntToScalar(4)) { |
| 138 return i + 1; | 138 return i + 1; |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 return -1; | 141 return -1; |
| 142 } | 142 } |
| 143 | 143 |
| 144 virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y) { | 144 virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned) { |
|
sugoi
2013/03/06 16:14:59
virtual function's signature did not fit base clas
| |
| 145 fDragIndex = hittest(x, y); | 145 fDragIndex = hittest(x, y); |
| 146 return fDragIndex >= 0 ? new Click(this) : NULL; | 146 return fDragIndex >= 0 ? new Click(this) : NULL; |
| 147 } | 147 } |
| 148 | 148 |
| 149 virtual bool onClick(Click* click) { | 149 virtual bool onClick(Click* click) { |
| 150 if (fDragIndex >= 0) { | 150 if (fDragIndex >= 0) { |
| 151 if (!invertPt(click->fCurr.fX, click->fCurr.fY, | 151 if (!invertPt(click->fCurr.fX, click->fCurr.fY, |
| 152 &fPts[fDragIndex])) { | 152 &fPts[fDragIndex])) { |
| 153 return false; | 153 return false; |
| 154 } | 154 } |
| 155 | 155 |
| 156 this->setViews(); | 156 this->setViews(); |
| 157 this->inval(NULL); | 157 this->inval(NULL); |
| 158 return true; | 158 return true; |
| 159 } | 159 } |
| 160 return false; | 160 return false; |
| 161 } | 161 } |
| 162 | 162 |
| 163 private: | 163 private: |
| 164 int fDragIndex; | 164 int fDragIndex; |
| 165 | 165 |
| 166 typedef SampleView INHERITED; | 166 typedef SampleView INHERITED; |
| 167 }; | 167 }; |
| 168 | 168 |
| 169 ////////////////////////////////////////////////////////////////////////////// | 169 ////////////////////////////////////////////////////////////////////////////// |
| 170 | 170 |
| 171 static SkView* MyFactory() { return new UnitMapperView; } | 171 static SkView* MyFactory() { return new UnitMapperView; } |
| 172 static SkViewRegister reg(MyFactory); | 172 static SkViewRegister reg(MyFactory); |
| OLD | NEW |