[Bf-blender-cvs] [9cc8d50a046] master: cleanup: editor_image : Remove unused draw functions

jim man noreply at git.blender.org
Thu Jul 29 12:52:40 CEST 2021


Commit: 9cc8d50a046f4029df60a279dd86074b77c0da4a
Author: jim man
Date:   Thu Jul 29 12:46:24 2021 +0200
Branches: master
https://developer.blender.org/rB9cc8d50a046f4029df60a279dd86074b77c0da4a

cleanup: editor_image : Remove  unused draw functions

These functions are unused currently..

Reviewed By: deadpin, jbakker

Differential Revision: https://developer.blender.org/D11968

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

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

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

diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index dc693b25107..92ceb00d5c0 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -460,258 +460,6 @@ void ED_image_draw_info(Scene *scene,
     BLF_draw_ascii(blf_mono_font, str, sizeof(str));
   }
 }
-
-/* image drawing */
-static void sima_draw_zbuf_pixels(
-    float x1, float y1, int rectx, int recty, const int *rect, float zoomx, float zoomy)
-{
-  const float red[4] = {1.0f, 0.0f, 0.0f, 0.0f};
-
-  /* Very slow! */
-  float *rectf = MEM_mallocN(rectx * recty * sizeof(float), "temp");
-  for (int a = rectx * recty - 1; a >= 0; a--) {
-    /* zbuffer values are signed, so we need to shift color range */
-    rectf[a] = rect[a] * 0.5f + 0.5f;
-  }
-
-  IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR);
-  GPU_shader_uniform_vector(
-      state.shader, GPU_shader_get_uniform(state.shader, "shuffle"), 4, 1, red);
-
-  immDrawPixelsTex(&state, x1, y1, rectx, recty, GPU_R16F, false, rectf, zoomx, zoomy, NULL);
-
-  MEM_freeN(rectf);
-}
-
-static void sima_draw_zbuffloat_pixels(Scene *scene,
-                                       float x1,
-                                       float y1,
-                                       int rectx,
-                                       int recty,
-                                       const float *rect_float,
-                                       float zoomx,
-                                       float zoomy)
-{
-  float bias, scale, *rectf, clip_end;
-  int a;
-  const float red[4] = {1.0f, 0.0f, 0.0f, 0.0f};
-
-  if (scene->camera && scene->camera->type == OB_CAMERA) {
-    bias = ((Camera *)scene->camera->data)->clip_start;
-    clip_end = ((Camera *)scene->camera->data)->clip_end;
-    scale = 1.0f / (clip_end - bias);
-  }
-  else {
-    bias = 0.1f;
-    scale = 0.01f;
-    clip_end = 100.0f;
-  }
-
-  rectf = MEM_mallocN(rectx * recty * sizeof(float), "temp");
-  for (a = rectx * recty - 1; a >= 0; a--) {
-    if (rect_float[a] > clip_end) {
-      rectf[a] = 0.0f;
-    }
-    else if (rect_float[a] < bias) {
-      rectf[a] = 1.0f;
-    }
-    else {
-      rectf[a] = 1.0f - (rect_float[a] - bias) * scale;
-      rectf[a] *= rectf[a];
-    }
-  }
-
-  IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR);
-  GPU_shader_uniform_vector(
-      state.shader, GPU_shader_get_uniform(state.shader, "shuffle"), 4, 1, red);
-
-  immDrawPixelsTex(&state, x1, y1, rectx, recty, GPU_R16F, false, rectf, zoomx, zoomy, NULL);
-
-  MEM_freeN(rectf);
-}
-
-static void draw_udim_label(ARegion *region, float fx, float fy, const char *label)
-{
-  if (label == NULL || !label[0]) {
-    return;
-  }
-
-  /* find window pixel coordinates of origin */
-  int x, y;
-  UI_view2d_view_to_region(&region->v2d, fx, fy, &x, &y);
-
-  GPU_blend(GPU_BLEND_ALPHA);
-
-  int textwidth = BLF_width(blf_mono_font, label, strlen(label)) + 10;
-  float stepx = BLI_rcti_size_x(&region->v2d.mask) / BLI_rctf_size_x(&region->v2d.cur);
-  float opacity;
-  if (textwidth < 0.5f * (stepx - 10)) {
-    opacity = 1.0f;
-  }
-  else if (textwidth < (stepx - 10)) {
-    opacity = 2.0f - 2.0f * (textwidth / (stepx - 10));
-  }
-  else {
-    opacity = 0.0f;
-  }
-  BLF_color4ub(blf_mono_font, 220, 220, 220, 150 * opacity);
-  BLF_position(blf_mono_font, (int)(x + 10), (int)(y + 10), 0);
-  BLF_draw_ascii(blf_mono_font, label, strlen(label));
-
-  GPU_blend(GPU_BLEND_NONE);
-}
-
-static void draw_image_buffer(const bContext *C,
-                              SpaceImage *sima,
-                              ARegion *region,
-                              Scene *scene,
-                              ImBuf *ibuf,
-                              float fx,
-                              float fy,
-                              float zoomx,
-                              float zoomy)
-{
-  /* Image are still drawn in display space. */
-  GPUFrameBuffer *fb = GPU_framebuffer_active_get();
-  GPU_framebuffer_bind_no_srgb(fb);
-
-  int x, y;
-  int sima_flag = sima->flag & ED_space_image_get_display_channel_mask(ibuf);
-
-  /* find window pixel coordinates of origin */
-  UI_view2d_view_to_region(&region->v2d, fx, fy, &x, &y);
-
-  /* this part is generic image display */
-  if (sima_flag & SI_SHOW_ZBUF && (ibuf->zbuf || ibuf->zbuf_float || (ibuf->channels == 1))) {
-    if (ibuf->zbuf) {
-      sima_draw_zbuf_pixels(x, y, ibuf->x, ibuf->y, ibuf->zbuf, zoomx, zoomy);
-    }
-    else if (ibuf->zbuf_float) {
-      sima_draw_zbuffloat_pixels(scene, x, y, ibuf->x, ibuf->y, ibuf->zbuf_float, zoomx, zoomy);
-    }
-    else if (ibuf->channels == 1) {
-      sima_draw_zbuffloat_pixels(scene, x, y, ibuf->x, ibuf->y, ibuf->rect_float, zoomx, zoomy);
-    }
-  }
-  else {
-    int clip_max_x, clip_max_y;
-    UI_view2d_view_to_region(
-        &region->v2d, region->v2d.cur.xmax, region->v2d.cur.ymax, &clip_max_x, &clip_max_y);
-
-    if (sima_flag & SI_USE_ALPHA) {
-      imm_draw_box_checker_2d(x, y, x + ibuf->x * zoomx, y + ibuf->y * zoomy);
-
-      GPU_blend(GPU_BLEND_ALPHA);
-    }
-
-    /* If RGBA display with color management */
-    if ((sima_flag & (SI_SHOW_R | SI_SHOW_G | SI_SHOW_B | SI_SHOW_ALPHA)) == 0) {
-
-      ED_draw_imbuf_ctx_clipping(C, ibuf, x, y, false, 0, 0, clip_max_x, clip_max_y, zoomx, zoomy);
-    }
-    else {
-      float shuffle[4] = {0.0f, 0.0f, 0.0f, 0.0f};
-      uchar *display_buffer;
-      void *cache_handle;
-      ColorManagedViewSettings *view_settings;
-      ColorManagedDisplaySettings *display_settings;
-
-      if (sima_flag & SI_SHOW_R) {
-        shuffle[0] = 1.0f;
-      }
-      else if (sima_flag & SI_SHOW_G) {
-        shuffle[1] = 1.0f;
-      }
-      else if (sima_flag & SI_SHOW_B) {
-        shuffle[2] = 1.0f;
-      }
-      else if (sima_flag & SI_SHOW_ALPHA) {
-        shuffle[3] = 1.0f;
-      }
-
-      IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR);
-      GPU_shader_uniform_vector(
-          state.shader, GPU_shader_get_uniform(state.shader, "shuffle"), 4, 1, shuffle);
-
-      IMB_colormanagement_display_settings_from_ctx(C, &view_settings, &display_settings);
-      display_buffer = IMB_display_buffer_acquire(
-          ibuf, view_settings, display_settings, &cache_handle);
-
-      if (display_buffer) {
-        immDrawPixelsTex_clipping(&state,
-                                  x,
-                                  y,
-                                  ibuf->x,
-                                  ibuf->y,
-                                  GPU_RGBA8,
-                                  false,
-                                  display_buffer,
-                                  0,
-                                  0,
-                                  clip_max_x,
-                                  clip_max_y,
-                                  zoomx,
-                                  zoomy,
-                                  NULL);
-      }
-
-      IMB_display_buffer_release(cache_handle);
-    }
-
-    if (sima_flag & SI_USE_ALPHA) {
-      GPU_blend(GPU_BLEND_NONE);
-    }
-  }
-
-  GPU_framebuffer_bind(fb);
-}
-
-static void draw_image_buffer_repeated(const bContext *C,
-                                       SpaceImage *sima,
-                                       ARegion *region,
-                                       Scene *scene,
-                                       ImBuf *ibuf,
-                                       float zoomx,
-                                       float zoomy)
-{
-  const double time_current = PIL_check_seconds_timer();
-
-  const int xmax = ceil(region->v2d.cur.xmax);
-  const int ymax = ceil(region->v2d.cur.ymax);
-  const int xmin = floor(region->v2d.cur.xmin);
-  const int ymin = floor(region->v2d.cur.ymin);
-
-  for (int x = xmin; x < xmax; x++) {
-    for (int y = ymin; y < ymax; y++) {
-      draw_image_buffer(C, sima, region, scene, ibuf, x, y, zoomx, zoomy);
-
-      /* only draw until running out of time */
-      if ((PIL_check_seconds_timer() - time_current) > 0.25) {
-        return;
-      }
-    }
-  }
-}
-
-/* draw uv edit */
-
-/* draw grease pencil */
-void draw_image_grease_pencil(bContext *C, bool onlyv2d)
-{
-  /* draw in View2D space? */
-  if (onlyv2d) {
-    /* draw grease-pencil ('image' strokes) */
-    ED_annotation_draw_2dimage(C);
-  }
-  else {
-    /* assume that UI_view2d_restore(C) has been called... */
-    // SpaceImage *sima = (SpaceImage *)CTX_wm_space_data(C);
-
-    /* draw grease-pencil ('screen' strokes) */
-    ED_annotation_draw_view2d(C, 0);
-  }
-}
-
 void draw_image_sample_line(SpaceImage *sima)
 {
   if (sima->sample_line_hist.flag & HISTO_FLAG_SAMPLELINE) {
@@ -742,229 +490,6 @@ void draw_image_sample_line(SpaceImage *sima)
   }
 }
 
-static void draw_udim_tile_grid(uint pos_attr,
-                                uint color_attr,
-                                ARegion *region,
-                                int x,
-                                int y,
-                                float stepx,
-                                float stepy,
-                                const float color[3])
-{
-  float x1, y1;
-  UI_view2d_view_to_region_fl(&region->v2d, x, y, &x1, &y1);
-  const int gridpos[5][2] = {{0, 0}, {0, 1}, {1, 1}, {1, 0}, {0, 0}};
-  for (int i = 0; i < 4; i++) {
-    immAttr3fv(color_attr, color);
-    immVertex2f(pos_attr, x1 + gridpos[i][0] * stepx, y1 + gridpos[i][1] * stepy);
-    immAttr3fv(color_attr, color);
-    immVertex2f(pos_attr, x1 + gridpos[i + 1][0] * stepx, y1 + gridpos[i + 1][1] * stepy);
-  }
-}
-
-static void draw_udim_tile_grids(ARegion *region, SpaceImage *sima, Image *ima)
-{
-  int num_tiles;
-  if (ima != NULL) {
-    num_tiles = BLI_listbase_count(&ima->tiles);
-
-    if (ima->source != IMA_SRC_TILED) {
-      return;
-    }
-  }
-  else {
-    num_tiles = sima->tile_grid_shape[0] * sima->tile_grid_shape[1];
-  }
-
-  float stepx = BLI_rcti_size_x(&region->v2d.mask) / BLI_rctf_size_x(&region->v2d.cur);
-  float stepy = BLI_rcti_size_y(&region->v2d.mask) / BLI_rctf_size_y(&region->v2d.

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list