Commit: 0215b3e9574f46ae48b73c94a9cf80152f2f1e8f
Author: Mike Erwin
Date:   Fri Mar 3 17:53:53 2017 -0500
Branches: blender2.8
https://developer.blender.org/rB0215b3e9574f46ae48b73c94a9cf80152f2f1e8f

OpenGL: draw image render info with new imm mode (part 1)

Part of T49043

This was the last use of glaDrawBorderCorners.

Plenty more to do in this file, I'll keep working on it...

===================================================================

M       source/blender/editors/space_image/image_draw.c

===================================================================

diff --git a/source/blender/editors/space_image/image_draw.c 
b/source/blender/editors/space_image/image_draw.c
index 07cf748902..b41790b179 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -88,7 +88,6 @@ static void draw_render_info(const bContext *C,
                              float zoomx,
                              float zoomy)
 {
-       RenderResult *rr;
        Render *re = RE_GetRender(scene->id.name);
        RenderData *rd = RE_engine_get_render_data(re);
        Scene *stats_scene = ED_render_job_get_scene(C);
@@ -96,7 +95,7 @@ static void draw_render_info(const bContext *C,
                stats_scene = CTX_data_scene(C);
        }
 
-       rr = BKE_image_acquire_renderresult(stats_scene, ima);
+       RenderResult *rr = BKE_image_acquire_renderresult(stats_scene, ima);
 
        if (rr && rr->text) {
                float fill_color[4] = {0.0f, 0.0f, 0.0f, 0.25f};
@@ -108,15 +107,11 @@ static void draw_render_info(const bContext *C,
        if (re) {
                int total_tiles;
                bool need_free_tiles;
-               rcti *tiles;
-
-               tiles = RE_engine_get_current_tiles(re, &total_tiles, 
&need_free_tiles);
+               rcti *tiles = RE_engine_get_current_tiles(re, &total_tiles, 
&need_free_tiles);
 
                if (total_tiles) {
-                       int i, x, y;
-                       rcti *tile;
-
                        /* find window pixel coordinates of origin */
+                       int x, y;
                        UI_view2d_view_to_region(&ar->v2d, 0.0f, 0.0f, &x, &y);
 
                        glPushMatrix();
@@ -124,18 +119,25 @@ static void draw_render_info(const bContext *C,
                        glScalef(zoomx, zoomy, 1.0f);
 
                        if (rd->mode & R_BORDER) {
-                               glTranslatef((int)(-rd->border.xmin * rd->xsch 
* rd->size / 100.0f),
-                                            (int)(-rd->border.ymin * rd->ysch 
* rd->size / 100.0f),
+                               /* TODO: round or floor instead of casting to 
int */
+                               glTranslatef((int)(-rd->border.xmin * rd->xsch 
* rd->size * 0.01f),
+                                            (int)(-rd->border.ymin * rd->ysch 
* rd->size * 0.01f),
                                             0.0f);
                        }
 
-                       UI_ThemeColor(TH_FACE_SELECT);
+                       unsigned int pos = add_attrib(immVertexFormat(), "pos", 
COMP_F32, 2, KEEP_FLOAT);
+                       immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
+                       immUniformThemeColor(TH_FACE_SELECT);
 
                        glLineWidth(1.0f);
-                       for (i = 0, tile = tiles; i < total_tiles; i++, tile++) 
{
-                               glaDrawBorderCorners(tile, zoomx, zoomy);
+
+                       rcti *tile = tiles;
+                       for (int i = 0; i < total_tiles; i++, tile++) {
+                               immDrawBorderCorners(pos, tile, zoomx, zoomy);
                        }
 
+                       immUnbindProgram();
+
                        if (need_free_tiles) {
                                MEM_freeN(tiles);
                        }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to