#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"
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();
}
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;
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:
}
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();