Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2010-07-04 16:24:19 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2010-07-04 16:24:19 +0400
commit90162cb0cb4ad432a7453c7d5ec7de832a058f16 (patch)
treea83e17623392d53b40604e64fb779975aa3d5107 /source/blender/windowmanager/intern/wm_subwindow.c
parentace570cb1024f0b3affd48b2f2104af3048d1707 (diff)
Fix #21894: backface selection wasn't working correct with < 24 bits colors,
e.g. thousands of colors on OS X, due to use of uninitialized value. Problem tracked down and patch provided by Shane Ambler, thanks!
Diffstat (limited to 'source/blender/windowmanager/intern/wm_subwindow.c')
-rw-r--r--source/blender/windowmanager/intern/wm_subwindow.c30
1 files changed, 5 insertions, 25 deletions
diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c
index f512434a141..207b6cebfe6 100644
--- a/source/blender/windowmanager/intern/wm_subwindow.c
+++ b/source/blender/windowmanager/intern/wm_subwindow.c
@@ -45,6 +45,8 @@
#include "BIF_gl.h"
+#include "GPU_extensions.h"
+
#include "WM_api.h"
#include "wm_subwindow.h"
#include "wm_window.h"
@@ -301,28 +303,6 @@ void wmOrtho2(float x1, float x2, float y1, float y2)
/* *************************** Framebuffer color depth, for selection codes ********************** */
-static int wm_get_colordepth(void)
-{
- static int mainwin_color_depth= 0;
-
- if(mainwin_color_depth==0) {
- GLint r, g, b;
-
- glGetIntegerv(GL_RED_BITS, &r);
- glGetIntegerv(GL_GREEN_BITS, &g);
- glGetIntegerv(GL_BLUE_BITS, &b);
-
- mainwin_color_depth= r + g + b;
- if(G.f & G_DEBUG) {
- printf("Color depth r %d g %d b %d\n", (int)r, (int)g, (int)b);
- glGetIntegerv(GL_AUX_BUFFERS, &r);
- printf("Aux buffers: %d\n", (int)r);
- }
- }
- return mainwin_color_depth;
-}
-
-
#ifdef __APPLE__
/* apple seems to round colors to below and up on some configs */
@@ -331,7 +311,7 @@ unsigned int index_to_framebuffer(int index)
{
unsigned int i= index;
- switch(wm_get_colordepth()) {
+ switch(GPU_color_depth()) {
case 12:
i= ((i & 0xF00)<<12) + ((i & 0xF0)<<8) + ((i & 0xF)<<4);
/* sometimes dithering subtracts! */
@@ -361,7 +341,7 @@ unsigned int index_to_framebuffer(int index)
{
unsigned int i= index;
- switch(wm_get_colordepth()) {
+ switch(GPU_color_depth()) {
case 8:
i= ((i & 48)<<18) + ((i & 12)<<12) + ((i & 3)<<6);
i |= 0x3F3F3F;
@@ -398,7 +378,7 @@ int WM_framebuffer_to_index(unsigned int col)
{
if (col==0) return 0;
- switch(wm_get_colordepth()) {
+ switch(GPU_color_depth()) {
case 8:
return ((col & 0xC00000)>>18) + ((col & 0xC000)>>12) + ((col & 0xC0)>>6);
case 12: