From 00e7a4b5a70c64c6f1961b860c50d93daee4cbf7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 22 May 2012 08:24:52 +0000 Subject: fix [#31530] Project paint with Clipping border gives opaque background draw clipping box alpha 0 so reprojection and rendering show the background as alpha 0. --- source/blender/editors/include/UI_resources.h | 5 +++-- source/blender/editors/interface/resources.c | 23 +++++++++++++++++++++-- source/blender/editors/space_view3d/view3d_draw.c | 6 +++++- 3 files changed, 29 insertions(+), 5 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index d157db9e993..35376412628 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -232,9 +232,10 @@ float UI_GetThemeValuef(int colorid); int UI_GetThemeValue(int colorid); // get three color values, scaled to 0.0-1.0 range -void UI_GetThemeColor3fv(int colorid, float *col); +void UI_GetThemeColor3fv(int colorid, float col[3]); // get the color, range 0.0-1.0, complete with shading offset -void UI_GetThemeColorShade3fv(int colorid, int offset, float *col); +void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3]); +void UI_GetThemeColorShade3ubv(int colorid, int offset, unsigned char col[3]); // get the 3 or 4 byte values void UI_GetThemeColor3ubv(int colorid, unsigned char col[3]); diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index bf57dda44bf..9d66c9ea2e1 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -1028,7 +1028,7 @@ int UI_GetThemeValue(int colorid) // get the color, range 0.0-1.0 -void UI_GetThemeColor3fv(int colorid, float *col) +void UI_GetThemeColor3fv(int colorid, float col[3]) { const unsigned char *cp; @@ -1039,7 +1039,7 @@ void UI_GetThemeColor3fv(int colorid, float *col) } // get the color, range 0.0-1.0, complete with shading offset -void UI_GetThemeColorShade3fv(int colorid, int offset, float *col) +void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3]) { int r, g, b; const unsigned char *cp; @@ -1058,6 +1058,25 @@ void UI_GetThemeColorShade3fv(int colorid, int offset, float *col) col[2] = ((float)b) / 255.0f; } +void UI_GetThemeColorShade3ubv(int colorid, int offset, unsigned char col[3]) +{ + int r, g, b; + const unsigned char *cp; + + cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); + + r = offset + (int) cp[0]; + CLAMP(r, 0, 255); + g = offset + (int) cp[1]; + CLAMP(g, 0, 255); + b = offset + (int) cp[2]; + CLAMP(b, 0, 255); + + col[0] = r; + col[1] = g; + col[2] = b; +} + // get the color, in char pointer void UI_GetThemeColor3ubv(int colorid, unsigned char col[3]) { diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 33141bb6abb..0c6e13051bb 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -160,7 +160,11 @@ static void view3d_draw_clipping(RegionView3D *rv3d) {1, 5, 6, 2}, {7, 4, 0, 3}}; - UI_ThemeColorShade(TH_BACK, -8); + /* fill in zero alpha for rendering & re-projection [#31530] */ + unsigned char col[4]; + UI_GetThemeColorShade3ubv(TH_BACK, -8, col); + col[3] = 0; + glColor4ubv(col); glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(3, GL_FLOAT, 0, bb->vec); -- cgit v1.2.3