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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-10-16 09:12:31 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-10-16 09:12:31 +0400
commit03e6bb7ede4ac5e45ba8db7233ba775a07b27ced (patch)
tree1bfb868e1bd6e7f045d5eb4ab83cb9342c97b3f1 /source
parentad65cd59870df1e59a5960c7c355c2c888a8141a (diff)
patch for bug [#24253] r32218 breaks outliner icon drawing
provided by Shane Ambler (sambler) with some changes.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/interface/interface_icons.c41
1 files changed, 29 insertions, 12 deletions
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index cbd4939b1b1..2da54b492e6 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -843,7 +843,7 @@ static void icon_set_image(bContext *C, ID *id, PreviewImage* prv_img, int miple
prv_img->w[miplevel], prv_img->h[miplevel]);
}
-static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), int rw, int rh, unsigned int *rect, float alpha, float *rgb)
+static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), int rw, int rh, unsigned int *rect, float alpha, float *rgb, short is_preview)
{
/* modulate color */
if(alpha != 1.0f)
@@ -855,6 +855,11 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect),
glPixelTransferf(GL_BLUE_SCALE, rgb[2]);
}
+ if(is_preview == 0) {
+ /* position */
+ glRasterPos2f(x,y);
+ }
+
/* draw */
if((w<1 || h<1)) {
// XXX - TODO 2.5 verify whether this case can happen
@@ -876,13 +881,25 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect),
/* scale it */
IMB_scaleImBuf(ima, w, h);
- glaDrawPixelsSafe(x, y, w, h, w, GL_RGBA, GL_UNSIGNED_BYTE, ima->rect);
-
+
+ if(is_preview) {
+ glaDrawPixelsSafe(x, y, w, h, w, GL_RGBA, GL_UNSIGNED_BYTE, ima->rect);
+ }
+ else {
+ glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, ima->rect);
+ }
+
IMB_freeImBuf(ima);
}
}
- else
- glaDrawPixelsSafe(x, y, w, h, w, GL_RGBA, GL_UNSIGNED_BYTE, rect);
+ else {
+ if(is_preview) {
+ glaDrawPixelsSafe(x, y, w, h, w, GL_RGBA, GL_UNSIGNED_BYTE, rect);
+ }
+ else {
+ glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, rect);
+ }
+ }
/* restore color */
if(alpha != 0.0f)
@@ -938,7 +955,7 @@ static int preview_size(int miplevel)
return 0;
}
-static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, int miplevel, int draw_size, int UNUSED(nocreate))
+static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, int miplevel, int draw_size, int UNUSED(nocreate), int is_preview)
{
Icon *icon = NULL;
DrawInfo *di = NULL;
@@ -981,7 +998,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al
if(!iimg->rect) return; /* something has gone wrong! */
- icon_draw_rect(x, y, w, h, aspect, iimg->w, iimg->h, iimg->rect, alpha, rgb);
+ icon_draw_rect(x, y, w, h, aspect, iimg->w, iimg->h, iimg->rect, alpha, rgb, is_preview);
}
else if(di->type == ICON_TYPE_PREVIEW) {
PreviewImage* pi = BKE_previewimg_get((ID*)icon->obj);
@@ -992,7 +1009,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al
/* preview images use premul alpha ... */
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- icon_draw_rect(x, y, w, h, aspect, pi->w[miplevel], pi->h[miplevel], pi->rect[miplevel], 1.0f, NULL);
+ icon_draw_rect(x, y, w, h, aspect, pi->w[miplevel], pi->h[miplevel], pi->rect[miplevel], 1.0f, NULL, is_preview);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
}
@@ -1082,7 +1099,7 @@ int ui_id_icon_get(bContext *C, ID *id, int preview)
static void icon_draw_mipmap(float x, float y, int icon_id, float aspect, float alpha, int miplevel, int nocreate)
{
int draw_size = preview_size(miplevel);
- icon_draw_size(x, y, icon_id, aspect, alpha, NULL, miplevel, draw_size, nocreate);
+ icon_draw_size(x, y, icon_id, aspect, alpha, NULL, miplevel, draw_size, nocreate, FALSE);
}
void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect, float alpha)
@@ -1093,7 +1110,7 @@ void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect, float alph
void UI_icon_draw_aspect_color(float x, float y, int icon_id, float aspect, float *rgb)
{
int draw_size = preview_size(PREVIEW_MIPMAP_ZERO);
- icon_draw_size(x, y, icon_id, aspect, 1.0f, rgb, PREVIEW_MIPMAP_ZERO, draw_size, 0);
+ icon_draw_size(x, y, icon_id, aspect, 1.0f, rgb, PREVIEW_MIPMAP_ZERO, draw_size, FALSE, FALSE);
}
void UI_icon_draw(float x, float y, int icon_id)
@@ -1103,7 +1120,7 @@ void UI_icon_draw(float x, float y, int icon_id)
void UI_icon_draw_size(float x, float y, int size, int icon_id, float alpha)
{
- icon_draw_size(x, y, icon_id, 1.0f, alpha, NULL, 0, size, 1);
+ icon_draw_size(x, y, icon_id, 1.0f, alpha, NULL, PREVIEW_MIPMAP_ZERO, size, TRUE, FALSE);
}
void UI_icon_draw_preview(float x, float y, int icon_id)
@@ -1118,6 +1135,6 @@ void UI_icon_draw_preview_aspect(float x, float y, int icon_id, float aspect)
void UI_icon_draw_preview_aspect_size(float x, float y, int icon_id, float aspect, int size)
{
- icon_draw_size(x, y, icon_id, aspect, 1.0f, NULL, PREVIEW_MIPMAP_LARGE, size, 0);
+ icon_draw_size(x, y, icon_id, aspect, 1.0f, NULL, PREVIEW_MIPMAP_LARGE, size, FALSE, TRUE);
}