From cee437c5042c8d9d80db77865c6b6dfbe74a3fa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Wed, 30 Jan 2008 19:07:44 +0000 Subject: [PATCH] to take into account 16 bits colorspaces, we only use the 5 highest bits of the red channel this fixes bug #1310 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23793 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/glteapot/ObjectView.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/apps/glteapot/ObjectView.cpp b/src/apps/glteapot/ObjectView.cpp index ff9d5ca76c..8c9a9f0501 100644 --- a/src/apps/glteapot/ObjectView.cpp +++ b/src/apps/glteapot/ObjectView.cpp @@ -98,8 +98,8 @@ simonThread(void* cookie) { ObjectView* ov = (ObjectView*)cookie; - int noPause = 0; - while (acquire_sem_etc(ov->quittingSem,1,B_TIMEOUT,0) == B_NO_ERROR) { + int noPause = 0; + while (acquire_sem_etc(ov->quittingSem, 1, B_TIMEOUT, 0) == B_NO_ERROR) { if (ov->SpinIt()) { ov->DrawFrame(noPause); release_sem(ov->quittingSem); @@ -373,7 +373,8 @@ ObjectView::ObjectAtPoint(BPoint p) float f[3]; f[1] = f[2] = 0; for (int i = 0; i < fObjects.CountItems(); i++) { - f[0] = (255 - i) / 255.0; + // to take into account 16 bits colorspaces, only use the 5 highest bits of the red channel + f[0] = (255 - (i << 3)) / 255.0; ((GLObject*)fObjects.ItemAt(i))->Draw(true, f); } glReadBuffer(GL_BACK); @@ -381,7 +382,7 @@ ObjectView::ObjectAtPoint(BPoint p) glReadPixels((GLint)p.x, (GLint)(Bounds().bottom - p.y), 1, 1, GL_RGB, GL_UNSIGNED_BYTE, pixel); int objNum = pixel[0]; - objNum = 255 - objNum; + objNum = (255 - objNum) >> 3; EnforceState(); UnlockGL();