diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-04-17 16:53:36 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-04-17 18:51:28 +0300 |
commit | fb24813d64dd8fa2ddb8c0e55004d3792281c8d7 (patch) | |
tree | b81ccdad39051eceb9c99c172f876c813d9a464e /source/blender/editors | |
parent | 159806140fd33e6ddab951c0f6f180cfbf927d38 (diff) |
Remove game properties in image editor
The following properties were used by the Blender Game Engine and no longer
need to be around:
* Animated
* Tiles
* Clamp
* Mapping
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image_proj.c | 23 | ||||
-rw-r--r-- | source/blender/editors/space_image/image_draw.c | 120 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 2 |
3 files changed, 5 insertions, 140 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 4eea4fed9b6..084b3dfbf09 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -2492,8 +2492,7 @@ static bool IsectPoly2Df_twoside(const float pt[2], float uv[][2], const int tot static void project_paint_face_init( const ProjPaintState *ps, const int thread_index, const int bucket_index, const int tri_index, const int image_index, - const rctf *clip_rect, const rctf *bucket_bounds, ImBuf *ibuf, ImBuf **tmpibuf, - const bool clamp_u, const bool clamp_v) + const rctf *clip_rect, const rctf *bucket_bounds, ImBuf *ibuf, ImBuf **tmpibuf) { /* Projection vars, to get the 3D locations into screen space */ MemArena *arena = ps->arena_mt[thread_index]; @@ -2600,17 +2599,6 @@ static void project_paint_face_init( #endif if (pixel_bounds_array(uv_clip, &bounds_px, ibuf->x, ibuf->y, uv_clip_tot)) { - - if (clamp_u) { - CLAMP(bounds_px.xmin, 0, ibuf->x); - CLAMP(bounds_px.xmax, 0, ibuf->x); - } - - if (clamp_v) { - CLAMP(bounds_px.ymin, 0, ibuf->y); - CLAMP(bounds_px.ymax, 0, ibuf->y); - } - #if 0 project_paint_undo_tiles_init(&bounds_px, ps->projImages + image_index, tmpibuf, tile_width, threaded, ps->do_masking); @@ -2927,19 +2915,16 @@ static void project_bucket_init( int tri_index, image_index = 0; ImBuf *ibuf = NULL; Image *tpage_last = NULL, *tpage; - Image *ima = NULL; ImBuf *tmpibuf = NULL; if (ps->image_tot == 1) { /* Simple loop, no context switching */ ibuf = ps->projImages[0].ibuf; - ima = ps->projImages[0].ima; for (node = ps->bucketFaces[bucket_index]; node; node = node->next) { project_paint_face_init( ps, thread_index, bucket_index, GET_INT_FROM_POINTER(node->link), 0, - clip_rect, bucket_bounds, ibuf, &tmpibuf, - (ima->tpageflag & IMA_CLAMP_U) != 0, (ima->tpageflag & IMA_CLAMP_V) != 0); + clip_rect, bucket_bounds, ibuf, &tmpibuf); } } else { @@ -2956,7 +2941,6 @@ static void project_bucket_init( for (image_index = 0; image_index < ps->image_tot; image_index++) { if (ps->projImages[image_index].ima == tpage_last) { ibuf = ps->projImages[image_index].ibuf; - ima = ps->projImages[image_index].ima; break; } } @@ -2965,8 +2949,7 @@ static void project_bucket_init( project_paint_face_init( ps, thread_index, bucket_index, tri_index, image_index, - clip_rect, bucket_bounds, ibuf, &tmpibuf, - (ima->tpageflag & IMA_CLAMP_U) != 0, (ima->tpageflag & IMA_CLAMP_V) != 0); + clip_rect, bucket_bounds, ibuf, &tmpibuf); } } diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 43d5348da3e..e1ba83a0d78 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -548,118 +548,6 @@ static void draw_image_buffer(const bContext *C, SpaceImage *sima, ARegion *ar, } } -static unsigned int *get_part_from_buffer(unsigned int *buffer, int width, short startx, short starty, short endx, short endy) -{ - unsigned int *rt, *rp, *rectmain; - short y, heigth, len; - - /* the right offset in rectot */ - - rt = buffer + (starty * width + startx); - - len = (endx - startx); - heigth = (endy - starty); - - rp = rectmain = MEM_mallocN(heigth * len * sizeof(int), "rect"); - - for (y = 0; y < heigth; y++) { - memcpy(rp, rt, len * 4); - rt += width; - rp += len; - } - return rectmain; -} - -static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Scene *scene, Image *ima, ImBuf *ibuf, float fx, float fy, float zoomx, float zoomy) -{ - unsigned char *display_buffer; - unsigned int *rect; - int dx, dy, sx, sy, x, y; - void *cache_handle; - float shuffle[4] = {0.0f, 0.0f, 0.0f, 0.0f}; - - /* verify valid values, just leave this a while */ - if (ima->xrep < 1) return; - if (ima->yrep < 1) return; - - if (ima->flag & IMA_VIEW_AS_RENDER) - display_buffer = IMB_display_buffer_acquire(ibuf, &scene->view_settings, &scene->display_settings, &cache_handle); - else - display_buffer = IMB_display_buffer_acquire(ibuf, NULL, &scene->display_settings, &cache_handle); - - if (!display_buffer) - return; - - if (sima->curtile >= ima->xrep * ima->yrep) - sima->curtile = ima->xrep * ima->yrep - 1; - - /* retrieve part of image buffer */ - dx = max_ii(ibuf->x / ima->xrep, 1); - dy = max_ii(ibuf->y / ima->yrep, 1); - sx = (sima->curtile % ima->xrep) * dx; - sy = (sima->curtile / ima->xrep) * dy; - rect = get_part_from_buffer((unsigned int *)display_buffer, ibuf->x, sx, sy, sx + dx, sy + dy); - - /* draw repeated */ - if ((sima->flag & (SI_SHOW_R | SI_SHOW_G | SI_SHOW_B | SI_SHOW_ALPHA)) != 0) { - 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; - } - - for (sy = 0; sy + dy <= ibuf->y; sy += dy) { - for (sx = 0; sx + dx <= ibuf->x; sx += dx) { - UI_view2d_view_to_region(&ar->v2d, fx + (float)sx / (float)ibuf->x, fy + (float)sy / (float)ibuf->y, &x, &y); - - if ((sima->flag & (SI_SHOW_R | SI_SHOW_G | SI_SHOW_B | SI_SHOW_ALPHA)) == 0) { - IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR); - immDrawPixelsTex(&state, x, y, dx, dy, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST, rect, zoomx, zoomy, NULL); - } - else { - 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); - - immDrawPixelsTex(&state, x, y, dx, dy, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST, rect, zoomx, zoomy, NULL); - } - } - } - - IMB_display_buffer_release(cache_handle); - - MEM_freeN(rect); -} - -static void draw_image_buffer_repeated(const bContext *C, SpaceImage *sima, ARegion *ar, Scene *scene, Image *ima, ImBuf *ibuf, float zoomx, float zoomy) -{ - const double time_current = PIL_check_seconds_timer(); - - const int xmax = ceil(ar->v2d.cur.xmax); - const int ymax = ceil(ar->v2d.cur.ymax); - const int xmin = floor(ar->v2d.cur.xmin); - const int ymin = floor(ar->v2d.cur.ymin); - - int x; - - for (x = xmin; x < xmax; x++) { - int y; - for (y = ymin; y < ymax; y++) { - if (ima && (ima->tpageflag & IMA_TILES)) - draw_image_buffer_tiled(sima, ar, scene, ima, ibuf, x, y, zoomx, zoomy); - else - draw_image_buffer(C, sima, ar, 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 */ @@ -810,14 +698,8 @@ void draw_image_main(const bContext *C, ARegion *ar) ED_region_grid_draw(ar, zoomx, zoomy); } else { + draw_image_buffer(C, sima, ar, scene, ibuf, 0.0f, 0.0f, zoomx, zoomy); - if (sima->flag & SI_DRAW_TILE) - draw_image_buffer_repeated(C, sima, ar, scene, ima, ibuf, zoomx, zoomy); - else if (ima && (ima->tpageflag & IMA_TILES)) - draw_image_buffer_tiled(sima, ar, scene, ima, ibuf, 0.0f, 0.0, zoomx, zoomy); - else - draw_image_buffer(C, sima, ar, scene, ibuf, 0.0f, 0.0f, zoomx, zoomy); - if (sima->flag & SI_DRAW_METADATA) { int x, y; rctf frame; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 1d54a1937eb..37279c77ba0 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -671,7 +671,7 @@ static void draw_empty_image(Object *ob, const short dflag, const unsigned char } if (ob_alpha > 0.0f) { - bindcode = GPU_verify_image(ima, &iuser, GL_TEXTURE_2D, 0, false, false, false); + bindcode = GPU_verify_image(ima, &iuser, GL_TEXTURE_2D, false, false, false); /* don't bother drawing the image if alpha = 0 */ } |