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:
authorCampbell Barton <ideasman42@gmail.com>2011-06-06 13:12:03 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-06-06 13:12:03 +0400
commit6a1e74418ce0cb19bea51354a46ec77f73f4eb8b (patch)
tree75ea4b8d146ecfcdd934e30061559d23b58d4ac8
parent2f5c7623b08027a7bb0d433333ad62c787c05cbf (diff)
use the same stippled drawing for colorband background as alpha color swatches, with low DPI would look squashed, also use the same colors for both.
-rw-r--r--source/blender/editors/interface/interface_draw.c23
-rw-r--r--source/blender/editors/interface/interface_intern.h5
-rw-r--r--source/blender/editors/interface/interface_widgets.c28
3 files changed, 30 insertions, 26 deletions
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 710d4d58825..c7f11116834 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -1120,7 +1120,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect)
ColorBand *coba;
CBData *cbd;
float x1, y1, sizex, sizey;
- float dx, v3[2], v1[2], v2[2], v1a[2], v2a[2];
+ float v3[2], v1[2], v2[2], v1a[2], v2a[2];
int a;
float pos, colf[4]= {0,0,0,0}; /* initialize incase the colorband isnt valid */
@@ -1131,18 +1131,17 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect)
y1= rect->ymin;
sizex= rect->xmax-x1;
sizey= rect->ymax-y1;
-
+
/* first background, to show tranparency */
- dx= sizex/12.0f;
- v1[0]= x1;
- for(a=0; a<12; a++) {
- if(a & 1) glColor3f(0.3, 0.3, 0.3); else glColor3f(0.8, 0.8, 0.8);
- glRectf(v1[0], y1, v1[0]+dx, y1+0.5f*sizey);
- if(a & 1) glColor3f(0.8, 0.8, 0.8); else glColor3f(0.3, 0.3, 0.3);
- glRectf(v1[0], y1+0.5f*sizey, v1[0]+dx, y1+sizey);
- v1[0]+= dx;
- }
-
+
+ glColor4ub(UI_TRANSP_DARK, UI_TRANSP_DARK, UI_TRANSP_DARK, 255);
+ glRectf(x1, y1, x1+sizex, y1+sizey);
+ glEnable(GL_POLYGON_STIPPLE);
+ glColor4ub(UI_TRANSP_LIGHT, UI_TRANSP_LIGHT, UI_TRANSP_LIGHT, 255);
+ glPolygonStipple(checker_stipple_sml);
+ glRectf(x1, y1, x1+sizex, y1+sizey);
+ glDisable(GL_POLYGON_STIPPLE);
+
glShadeModel(GL_FLAT);
glEnable(GL_BLEND);
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 3f3665aae38..8475090b468 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -486,6 +486,11 @@ void ui_widget_color_init(struct ThemeUI *tui);
void ui_draw_menu_item(struct uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state);
void ui_draw_preview_item(struct uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state);
+extern unsigned char checker_stipple_sml[];
+/* used for transp checkers */
+#define UI_TRANSP_DARK 100
+#define UI_TRANSP_LIGHT 160
+
/* interface_style.c */
void uiStyleInit(void);
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index f767a432cd0..41bb12e4433 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -159,6 +159,18 @@ static float check_tria_vert[6][2]= {
static int check_tria_face[4][3]= {
{3, 2, 4}, {3, 4, 5}, {1, 0, 3}, {0, 2, 3}};
+GLubyte checker_stipple_sml[32*32/8] =
+{
+ 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, \
+ 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, \
+ 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, \
+ 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, \
+ 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, \
+ 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, \
+ 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, \
+ 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, \
+};
+
/* ************************************************* */
void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3)
@@ -614,22 +626,10 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
if(wtb->inner) {
if(wcol->shaded==0) {
if (wcol->alpha_check) {
- GLubyte checker_stipple_sml[32*32/8] =
- {
- 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, \
- 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, \
- 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, \
- 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, \
- 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, \
- 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, \
- 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, \
- 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, \
- };
-
float x_mid= 0.0f; /* used for dumb clamping of values */
/* dark checkers */
- glColor4ub(100, 100, 100, 255);
+ glColor4ub(UI_TRANSP_DARK, UI_TRANSP_DARK, UI_TRANSP_DARK, 255);
glBegin(GL_POLYGON);
for(a=0; a<wtb->totvert; a++) {
glVertex2fv(wtb->inner_v[a]);
@@ -638,7 +638,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
/* light checkers */
glEnable(GL_POLYGON_STIPPLE);
- glColor4ub(160, 160, 160, 255);
+ glColor4ub(UI_TRANSP_LIGHT, UI_TRANSP_LIGHT, UI_TRANSP_LIGHT, 255);
glPolygonStipple(checker_stipple_sml);
glBegin(GL_POLYGON);
for(a=0; a<wtb->totvert; a++) {