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

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: more 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
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 ca26b2d4f3dc4da0daec730e874bb297ef05f0db..ba54cc916f0552bc8b753fa19c2a08c08a50e402 100644
--- a/mojo/examples/sample_app/gles2_client_impl.cc
+++ b/mojo/examples/sample_app/gles2_client_impl.cc
@@ -16,7 +16,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);
}
}
@@ -36,7 +36,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());
@@ -44,26 +44,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:
@@ -71,7 +71,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);
capture_point_ = last_drag_point_ = gfx::PointF();

Powered by Google App Engine
This is Rietveld 408576698