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
This commit is contained in:
@@ -373,7 +373,8 @@ ObjectView::ObjectAtPoint(BPoint p)
|
|||||||
float f[3];
|
float f[3];
|
||||||
f[1] = f[2] = 0;
|
f[1] = f[2] = 0;
|
||||||
for (int i = 0; i < fObjects.CountItems(); i++) {
|
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);
|
((GLObject*)fObjects.ItemAt(i))->Draw(true, f);
|
||||||
}
|
}
|
||||||
glReadBuffer(GL_BACK);
|
glReadBuffer(GL_BACK);
|
||||||
@@ -381,7 +382,7 @@ ObjectView::ObjectAtPoint(BPoint p)
|
|||||||
glReadPixels((GLint)p.x, (GLint)(Bounds().bottom - p.y), 1, 1,
|
glReadPixels((GLint)p.x, (GLint)(Bounds().bottom - p.y), 1, 1,
|
||||||
GL_RGB, GL_UNSIGNED_BYTE, pixel);
|
GL_RGB, GL_UNSIGNED_BYTE, pixel);
|
||||||
int objNum = pixel[0];
|
int objNum = pixel[0];
|
||||||
objNum = 255 - objNum;
|
objNum = (255 - objNum) >> 3;
|
||||||
|
|
||||||
EnforceState();
|
EnforceState();
|
||||||
UnlockGL();
|
UnlockGL();
|
||||||
|
|||||||
Reference in New Issue
Block a user