Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / mojo / examples / sample_app / gles2_client_impl.cc
index fde074a..6cdd87a 100644 (file)
@@ -9,6 +9,7 @@
 #include <math.h>
 #include <stdlib.h>
 
+#include "gpu/command_buffer/client/gles2_interface.h"
 #include "mojo/public/c/gles2/gles2.h"
 #include "mojo/public/cpp/environment/environment.h"
 #include "mojo/public/cpp/utility/run_loop.h"
@@ -45,6 +46,10 @@ void GLES2ClientImpl::SetSize(const mojo::Size& size) {
   size_ = size;
   if (size_.width == 0 || size_.height == 0)
     return;
+  static_cast<gpu::gles2::GLES2Interface*>(
+      MojoGLES2GetGLES2Interface(context_))->ResizeCHROMIUM(size_.width,
+                                                            size_.height,
+                                                            1);
   cube_.Init(size_.width, size_.height);
   WantToDraw();
 }
@@ -55,7 +60,7 @@ void GLES2ClientImpl::HandleInputEvent(const mojo::Event& event) {
   case mojo::EVENT_TYPE_TOUCH_PRESSED:
     if (event.flags & mojo::EVENT_FLAGS_RIGHT_MOUSE_BUTTON)
       break;
-    capture_point_ = *event.location;
+    capture_point_ = *event.location_data->in_view_location;
     last_drag_point_ = capture_point_;
     drag_start_time_ = mojo::GetTimeTicksNow();
     break;
@@ -63,16 +68,16 @@ void GLES2ClientImpl::HandleInputEvent(const mojo::Event& event) {
   case mojo::EVENT_TYPE_TOUCH_MOVED: {
     if (event.flags & mojo::EVENT_FLAGS_RIGHT_MOUSE_BUTTON)
       break;
-    int direction = event.location->y < last_drag_point_.y ||
-                            event.location->x > last_drag_point_.x
-                        ? 1
-                        : -1;
+    int direction =
+        (event.location_data->in_view_location->y < last_drag_point_.y ||
+         event.location_data->in_view_location->x > last_drag_point_.x)
+        ? 1 : -1;
     cube_.set_direction(direction);
-    cube_.UpdateForDragDistance(
-        CalculateDragDistance(last_drag_point_, *event.location));
+    cube_.UpdateForDragDistance(CalculateDragDistance(
+        last_drag_point_, *event.location_data->in_view_location));
     WantToDraw();
 
-    last_drag_point_ = *event.location;
+    last_drag_point_ = *event.location_data->in_view_location;
     break;
   }
   case mojo::EVENT_TYPE_MOUSE_RELEASED:
@@ -83,9 +88,8 @@ void GLES2ClientImpl::HandleInputEvent(const mojo::Event& event) {
     }
     MojoTimeTicks offset = mojo::GetTimeTicksNow() - drag_start_time_;
     float delta = static_cast<float>(offset) / 1000000.;
-    cube_.SetFlingMultiplier(
-        CalculateDragDistance(capture_point_, *event.location),
-        delta);
+    cube_.SetFlingMultiplier(CalculateDragDistance(
+        capture_point_, *event.location_data->in_view_location), delta);
 
     capture_point_ = last_drag_point_ = mojo::Point();
     WantToDraw();