void
GLVideoView::size_changed (wxSizeEvent const& ev)
{
- _canvas_size = ev.GetSize ();
+ auto const scale = _canvas->GetDPIScaleFactor();
+ int const width = std::round(ev.GetSize().GetWidth() * scale);
+ int const height = std::round(ev.GetSize().GetHeight() * scale);
+ _canvas_size = { width, height };
+ LOG_GENERAL("GLVideoView canvas size changed to %1x%2", width, height);
Sized ();
}
-
GLVideoView::~GLVideoView ()
{
boost::this_thread::disable_interruption dis;
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &log_length);
string log;
if (log_length > 0) {
- char* log_char = new char[log_length];
- glGetShaderInfoLog(shader, log_length, nullptr, log_char);
- log = string(log_char);
- delete[] log_char;
+ std::vector<char> log_char(log_length);
+ glGetShaderInfoLog(shader, log_length, nullptr, log_char.data());
+ log = string(log_char.data());
}
glDeleteShader(shader);
throw GLError(String::compose("Could not compile shader (%1)", log).c_str(), -1);
glGetProgramiv(program, GL_INFO_LOG_LENGTH, &log_length);
string log;
if (log_length > 0) {
- char* log_char = new char[log_length];
- glGetProgramInfoLog(program, log_length, nullptr, log_char);
- log = string(log_char);
- delete[] log_char;
+ std::vector<char> log_char(log_length);
+ glGetProgramInfoLog(program, log_length, nullptr, log_char.data());
+ log = string(log_char.data());
}
glDeleteProgram (program);
throw GLError(String::compose("Could not link shader (%1)", log).c_str(), -1);
void
-GLVideoView::draw (Position<int>, dcp::Size)
+GLVideoView::draw ()
{
auto pad = pad_colour();
glClearColor(pad.Red() / 255.0, pad.Green() / 255.0, pad.Blue() / 255.0, 1.0);
glBufferSubData (GL_ARRAY_BUFFER, 0, video.size(), video.vertices());
check_gl_error ("glBufferSubData (video)");
- const auto border = Rectangle(canvas_size, inter_position.x, inter_position.y, inter_size);
+ const auto border = Rectangle(canvas_size, inter_position.x + x_offset, inter_position.y + y_offset, inter_size);
glBufferSubData (GL_ARRAY_BUFFER, 8 * 5 * sizeof(float), border.size(), border.vertices());
check_gl_error ("glBufferSubData (border)");
}
auto pv = player_video().first;
if (pv) {
set_image (pv);
- draw (pv->inter_position(), pv->inter_size());
+ }
+
+ draw ();
+
+ if (pv) {
_viewer->image_changed (pv);
}
}