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>2014-01-15 03:41:13 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-01-15 03:41:13 +0400
commitfab5438943a2326d6af391b8fe0e3a3078cc7b85 (patch)
treef67b16ebe57ce370285bffc26f8b79638427f8f8 /source/blender/windowmanager/intern/wm_draw.c
parentcc978dc0c128f455145daf6d693ef0e571d22988 (diff)
Code Cleanup: avoid duplicate calls to WM_window_pixels_x/y
Diffstat (limited to 'source/blender/windowmanager/intern/wm_draw.c')
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index 5edc57be40b..b4d29f05e15 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -502,6 +502,9 @@ static int wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple)
static void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple, float alpha)
{
+ const int winsize_x = WM_window_pixels_x(win);
+ const int winsize_y = WM_window_pixels_y(win);
+
float halfx, halfy, ratiox, ratioy;
int x, y, sizex, sizey, offx, offy;
@@ -509,8 +512,8 @@ static void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple, float a
for (y = 0, offy = 0; y < triple->ny; offy += triple->y[y], y++) {
for (x = 0, offx = 0; x < triple->nx; offx += triple->x[x], x++) {
- sizex = (x == triple->nx - 1) ? WM_window_pixels_x(win) - offx : triple->x[x];
- sizey = (y == triple->ny - 1) ? WM_window_pixels_y(win) - offy : triple->y[y];
+ sizex = (x == triple->nx - 1) ? winsize_x - offx : triple->x[x];
+ sizey = (y == triple->ny - 1) ? winsize_y - offy : triple->y[y];
/* wmOrtho for the screen has this same offset */
ratiox = sizex;
@@ -551,12 +554,15 @@ static void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple, float a
static void wm_triple_copy_textures(wmWindow *win, wmDrawTriple *triple)
{
+ const int winsize_x = WM_window_pixels_x(win);
+ const int winsize_y = WM_window_pixels_y(win);
+
int x, y, sizex, sizey, offx, offy;
for (y = 0, offy = 0; y < triple->ny; offy += triple->y[y], y++) {
for (x = 0, offx = 0; x < triple->nx; offx += triple->x[x], x++) {
- sizex = (x == triple->nx - 1) ? WM_window_pixels_x(win) - offx : triple->x[x];
- sizey = (y == triple->ny - 1) ? WM_window_pixels_y(win) - offy : triple->y[y];
+ sizex = (x == triple->nx - 1) ? winsize_x - offx : triple->x[x];
+ sizey = (y == triple->ny - 1) ? winsize_y - offy : triple->y[y];
glBindTexture(triple->target, triple->bind[x + y * triple->nx]);
glCopyTexSubImage2D(triple->target, 0, 0, 0, offx, offy, sizex, sizey);