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

Unified Diff: mojo/examples/sample_app/gles2_client_impl.cc

Issue 294833002: Mojo: more idiomatic C++ bindings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/examples/pepper_container_app/type_converters.h ('k') | mojo/examples/sample_app/sample_app.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/examples/sample_app/gles2_client_impl.cc
diff --git a/mojo/examples/sample_app/gles2_client_impl.cc b/mojo/examples/sample_app/gles2_client_impl.cc
index 1913b486e6690a8602ea34bf817adb31aa4b6f0e..981caaa18d670082551267b81005f0009acf9d9d 100644
--- a/mojo/examples/sample_app/gles2_client_impl.cc
+++ b/mojo/examples/sample_app/gles2_client_impl.cc
@@ -17,7 +17,7 @@ namespace examples {
namespace {
float CalculateDragDistance(const gfx::PointF& start, const Point& end) {
- return hypot(start.x() - end.x(), start.y() - end.y());
+ return hypot(start.x() - end.x, start.y() - end.y);
}
float GetRandomColor() {
@@ -41,7 +41,7 @@ GLES2ClientImpl::~GLES2ClientImpl() {
}
void GLES2ClientImpl::SetSize(const Size& size) {
- size_ = gfx::Size(size.width(), size.height());
+ size_ = gfx::Size(size.width, size.height);
if (size_.IsEmpty())
return;
cube_.Init(size_.width(), size_.height());
@@ -49,26 +49,26 @@ void GLES2ClientImpl::SetSize(const Size& size) {
}
void GLES2ClientImpl::HandleInputEvent(const Event& event) {
- switch (event.action()) {
+ switch (event.action) {
case ui::ET_MOUSE_PRESSED:
case ui::ET_TOUCH_PRESSED:
CancelAnimationFrames();
- capture_point_.SetPoint(event.location().x(), event.location().y());
+ capture_point_.SetPoint(event.location->x, event.location->y);
last_drag_point_ = capture_point_;
drag_start_time_ = GetTimeTicksNow();
break;
case ui::ET_MOUSE_DRAGGED:
case ui::ET_TOUCH_MOVED:
if (!getting_animation_frames_) {
- int direction = event.location().y() < last_drag_point_.y() ||
- event.location().x() > last_drag_point_.x() ? 1 : -1;
+ int direction = event.location->y < last_drag_point_.y() ||
+ event.location->x > last_drag_point_.x() ? 1 : -1;
cube_.set_direction(direction);
cube_.UpdateForDragDistance(
- CalculateDragDistance(last_drag_point_, event.location()));
+ CalculateDragDistance(last_drag_point_, *event.location));
cube_.Draw();
MojoGLES2SwapBuffers();
- last_drag_point_.SetPoint(event.location().x(), event.location().y());
+ last_drag_point_.SetPoint(event.location->x, event.location->y);
}
break;
case ui::ET_MOUSE_RELEASED:
@@ -76,7 +76,7 @@ void GLES2ClientImpl::HandleInputEvent(const Event& event) {
MojoTimeTicks offset = GetTimeTicksNow() - drag_start_time_;
float delta = static_cast<float>(offset) / 1000000.;
cube_.SetFlingMultiplier(
- CalculateDragDistance(capture_point_, event.location()),
+ CalculateDragDistance(capture_point_, *event.location),
delta);
cube_.set_color(GetRandomColor(), GetRandomColor(), GetRandomColor());
« no previous file with comments | « mojo/examples/pepper_container_app/type_converters.h ('k') | mojo/examples/sample_app/sample_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698