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:
authorClément Foucault <foucault.clem@gmail.com>2018-03-28 01:05:14 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-03-28 01:05:57 +0300
commit873c23456b4423c96382f94190645f0ef6a5d9d5 (patch)
tree9ce6a9995a6feca5bf72e80cc0709f130b027ff9 /source/blender/editors/screen/area.c
parent0acf655f9de7fd6e75bb1d3bec90d4b561975ea7 (diff)
UI: Perf: Don't use implicit Attrib.
Implicit attrib is doing memcpy which seems to be slower compared to individual immAttrib*. Only fixed the ones who appeared in my profilling logs.
Diffstat (limited to 'source/blender/editors/screen/area.c')
-rw-r--r--source/blender/editors/screen/area.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index ac577375a31..3b899a3d302 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -102,9 +102,11 @@ static void region_draw_emboss(const ARegion *ar, const rcti *scirct)
/* right */
immAttrib4ub(color, 0, 0, 0, 30);
immVertex2f(pos, rect.xmax, rect.ymax);
+ immAttrib4ub(color, 0, 0, 0, 30);
immVertex2f(pos, rect.xmax, rect.ymin);
/* bottom */
+ immAttrib4ub(color, 0, 0, 0, 30);
immVertex2f(pos, rect.xmin, rect.ymin);
/* left */
@@ -112,6 +114,7 @@ static void region_draw_emboss(const ARegion *ar, const rcti *scirct)
immVertex2f(pos, rect.xmin, rect.ymax);
/* top */
+ immAttrib4ub(color, 255, 255, 255, 30);
immVertex2f(pos, rect.xmax, rect.ymax);
immEnd();
@@ -264,26 +267,32 @@ static void area_draw_azone(short x1, short y1, short x2, short y2)
immAttrib4ub(col, 255, 255, 255, 180);
immVertex2f(pos, x1, y2);
+ immAttrib4ub(col, 255, 255, 255, 180);
immVertex2f(pos, x2, y1);
immAttrib4ub(col, 255, 255, 255, 130);
immVertex2f(pos, x1, y2 - dy);
+ immAttrib4ub(col, 255, 255, 255, 130);
immVertex2f(pos, x2 - dx, y1);
immAttrib4ub(col, 255, 255, 255, 80);
immVertex2f(pos, x1, y2 - 2 * dy);
+ immAttrib4ub(col, 255, 255, 255, 80);
immVertex2f(pos, x2 - 2 * dx, y1);
immAttrib4ub(col, 0, 0, 0, 210);
immVertex2f(pos, x1, y2 + 1);
+ immAttrib4ub(col, 0, 0, 0, 210);
immVertex2f(pos, x2 + 1, y1);
immAttrib4ub(col, 0, 0, 0, 180);
immVertex2f(pos, x1, y2 - dy + 1);
+ immAttrib4ub(col, 0, 0, 0, 180);
immVertex2f(pos, x2 - dx + 1, y1);
immAttrib4ub(col, 0, 0, 0, 150);
immVertex2f(pos, x1, y2 - 2 * dy + 1);
+ immAttrib4ub(col, 0, 0, 0, 150);
immVertex2f(pos, x2 - 2 * dx + 1, y1);
immEnd();
@@ -2503,28 +2512,34 @@ void ED_region_grid_draw(ARegion *ar, float zoomx, float zoomy)
float theme_color[3];
UI_GetThemeColorShade3fv(TH_BACK, (int)(20.0f * (1.0f - blendfac)), theme_color);
- immAttrib3fv(color, theme_color);
fac = 0.0f;
/* the fine resolution level */
for (int i = 0; i < count_fine; i++) {
+ immAttrib3fv(color, theme_color);
immVertex2f(pos, x1, y1 * (1.0f - fac) + y2 * fac);
+ immAttrib3fv(color, theme_color);
immVertex2f(pos, x2, y1 * (1.0f - fac) + y2 * fac);
+ immAttrib3fv(color, theme_color);
immVertex2f(pos, x1 * (1.0f - fac) + x2 * fac, y1);
+ immAttrib3fv(color, theme_color);
immVertex2f(pos, x1 * (1.0f - fac) + x2 * fac, y2);
fac += gridstep;
}
if (count_large > 0) {
UI_GetThemeColor3fv(TH_BACK, theme_color);
- immAttrib3fv(color, theme_color);
fac = 0.0f;
/* the large resolution level */
for (int i = 0; i < count_large; i++) {
+ immAttrib3fv(color, theme_color);
immVertex2f(pos, x1, y1 * (1.0f - fac) + y2 * fac);
+ immAttrib3fv(color, theme_color);
immVertex2f(pos, x2, y1 * (1.0f - fac) + y2 * fac);
+ immAttrib3fv(color, theme_color);
immVertex2f(pos, x1 * (1.0f - fac) + x2 * fac, y1);
+ immAttrib3fv(color, theme_color);
immVertex2f(pos, x1 * (1.0f - fac) + x2 * fac, y2);
fac += 4.0f * gridstep;
}