From: Munkyu Im Date: Mon, 29 Jun 2015 08:45:46 +0000 (+0900) Subject: VIGS: bind multitouch points to window coordinates X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.2~334 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fbe6b70dbbd8244b7a77dadc79df25fcee83bd7b;p=sdk%2Femulator%2Fqemu.git VIGS: bind multitouch points to window coordinates It seems a better solution than using guest coordinates since we no more need to take any special care about preserving mt points size (i.e. scaling/rotation stuff). Change-Id: I35243954dc9ac1e189c7eed9beec29e80d67dd0c Signed-off-by: Munkyu Im Signed-off-by: Vasiliy Ulyanov --- diff --git a/hw/vigs/vigs_gl_backend.c b/hw/vigs/vigs_gl_backend.c index c2e67b7cf1..efe89c2a15 100644 --- a/hw/vigs/vigs_gl_backend.c +++ b/hw/vigs/vigs_gl_backend.c @@ -2450,12 +2450,10 @@ static bool vigs_gl_backend_display(struct vigs_backend *backend, vigs_vector_resize(&gl_backend->dpy_v2, 0); for (i = 0; i < mt_count; i++) { - GLfloat w = (GLfloat)gl_backend->mt_tex_width * - ((GLfloat)gl_backend->dpy_tex_width / (GLfloat)qt5_window_width); - GLfloat h = (GLfloat)gl_backend->mt_tex_height * - ((GLfloat)gl_backend->dpy_tex_height / (GLfloat)qt5_window_height); + GLfloat w = (GLfloat)gl_backend->mt_tex_width; + GLfloat h = (GLfloat)gl_backend->mt_tex_height; GLfloat x = qt5_mt_points[2 * i + 0] - w / 2; - GLfloat y = gl_backend->dpy_tex_height - qt5_mt_points[2 * i + 1] - h / 2; + GLfloat y = qt5_window_height - qt5_mt_points[2 * i + 1] - h / 2; vert_coords = vigs_vector_append(&gl_backend->dpy_v1, (12 * sizeof(GLfloat))); @@ -2482,14 +2480,20 @@ static bool vigs_gl_backend_display(struct vigs_backend *backend, } if (mt_count) { + vigs_gl_create_ortho(0.0f, qt5_window_width, + 0.0f, qt5_window_height, + -1.0f, 1.0f, + gl_backend->mt_tex_ortho); + gl_backend->Enable(GL_BLEND); gl_backend->BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - if (scale) { - vigs_gl_draw_dpy_scale_prog(gl_backend, mt_count * 6); - } else { - vigs_gl_draw_dpy_tex_prog(gl_backend, mt_count * 6); - } + gl_backend->UseProgram(gl_backend->dpy_tex_prog_id); + gl_backend->UniformMatrix4fv(gl_backend->dpy_tex_prog_proj_loc, 1, GL_FALSE, + gl_backend->mt_tex_ortho); + gl_backend->Uniform1f(gl_backend->dpy_tex_prog_brightness_loc, 1.0f); + + vigs_gl_draw_dpy_tex_prog(gl_backend, mt_count * 6); gl_backend->Disable(GL_BLEND); } diff --git a/hw/vigs/vigs_gl_backend.h b/hw/vigs/vigs_gl_backend.h index 638cf5ec08..dca456b06c 100644 --- a/hw/vigs/vigs_gl_backend.h +++ b/hw/vigs/vigs_gl_backend.h @@ -253,6 +253,7 @@ struct vigs_gl_backend uint32_t dpy_tex_height; GLuint mt_tex; + GLfloat mt_tex_ortho[16]; uint32_t mt_tex_width; uint32_t mt_tex_height; diff --git a/tizen/src/ui/input/multitouchtracker.cpp b/tizen/src/ui/input/multitouchtracker.cpp index 7b4dd182f7..9d8774ed22 100644 --- a/tizen/src/ui/input/multitouchtracker.cpp +++ b/tizen/src/ui/input/multitouchtracker.cpp @@ -79,8 +79,8 @@ void TouchPoint::updatePos(QPoint hostPos, QPoint guestPos) this->hostPos = hostPos; this->guestPos = guestPos; - qt5_mt_points[2 * (this->id - 1) + 0] = guestPos.x(); - qt5_mt_points[2 * (this->id - 1) + 1] = guestPos.y(); + qt5_mt_points[2 * (this->id - 1) + 0] = hostPos.x(); + qt5_mt_points[2 * (this->id - 1) + 1] = hostPos.y(); qt5_graphic_hw_invalidate(); } @@ -105,7 +105,7 @@ MultiTouchTracker::MultiTouchTracker( painter.setPen(QColor(255, 255, 255, 255)); painter.setBrush(QBrush(QColor(128, 128, 128, 128))); painter.setRenderHint(QPainter::Antialiasing, true); - painter.drawEllipse(0, 0, 31, 31); + painter.drawEllipse(1, 1, 30, 30); qt5_mt_points = new float[2 * maxTouchPoint](); qt5_mt_count = 0; @@ -146,8 +146,8 @@ int MultiTouchTracker::addTouchPoint(QPoint hostPos, QPoint guestPos) touchPointList.append(point); qDebug() << "ID" << point->getID() << "point touching" << hostPos << guestPos; - qt5_mt_points[2 * qt5_mt_count + 0] = guestPos.x(); - qt5_mt_points[2 * qt5_mt_count + 1] = guestPos.y(); + qt5_mt_points[2 * qt5_mt_count + 0] = hostPos.x(); + qt5_mt_points[2 * qt5_mt_count + 1] = hostPos.y(); qt5_mt_count++; qt5_graphic_hw_invalidate();