OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "OverView.h" | 8 #include "OverView.h" |
9 #include "SampleCode.h" | 9 #include "SampleCode.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 if (loc->fY > this->height() - fNameMetrics.fBottom) { | 112 if (loc->fY > this->height() - fNameMetrics.fBottom) { |
113 loc->fY = -fNameMetrics.fTop; | 113 loc->fY = -fNameMetrics.fTop; |
114 loc->fX += fNameW; | 114 loc->fX += fNameW; |
115 } | 115 } |
116 } | 116 } |
117 | 117 |
118 typedef SkView INHERITED; | 118 typedef SkView INHERITED; |
119 }; | 119 }; |
120 | 120 |
121 SkView* create_overview(int count, const SkViewFactory* factories[]) { | 121 SkView* create_overview(int count, const SkViewFactory* factories[]) { |
122 return SkNEW_ARGS(OverView, (count, factories)); | 122 return new OverView(count, factories); |
123 } | 123 } |
124 | 124 |
125 bool is_overview(SkView* view) { | 125 bool is_overview(SkView* view) { |
126 SkEvent isOverview(gIsOverview); | 126 SkEvent isOverview(gIsOverview); |
127 return view->doQuery(&isOverview); | 127 return view->doQuery(&isOverview); |
128 } | 128 } |
129 | 129 |
130 OverView::OverView(int count, const SkViewFactory* factories[]) { | 130 OverView::OverView(int count, const SkViewFactory* factories[]) { |
131 fCount = count; | 131 fCount = count; |
132 fFactories = factories; | 132 fFactories = factories; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 SkPoint loc = this->start(); | 164 SkPoint loc = this->start(); |
165 for (int i = 0; i < fCount; ++i) { | 165 for (int i = 0; i < fCount; ++i) { |
166 if (draw_this_name(fNames[i], fMatchStr)) { | 166 if (draw_this_name(fNames[i], fMatchStr)) { |
167 canvas->drawRect(this->bounds(loc), paint); | 167 canvas->drawRect(this->bounds(loc), paint); |
168 canvas->drawText(fNames[i].c_str(), fNames[i].size(), loc.x(), loc.y
(), fNamePaint); | 168 canvas->drawText(fNames[i].c_str(), fNames[i].size(), loc.x(), loc.y
(), fNamePaint); |
169 this->next(&loc); | 169 this->next(&loc); |
170 } | 170 } |
171 } | 171 } |
172 } | 172 } |
173 | 173 |
OLD | NEW |