From 8cabdbe55c0457db5faceb3e250bd9aa7aeab3c4 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Wed, 10 May 2006 20:23:28 +0000 Subject: [PATCH] app/widgets/gimpviewrendererbrush.c use gimp_viewable_get_size() and get 2006-05-10 Michael Natterer * app/widgets/gimpviewrendererbrush.c * app/widgets/gimpviewrendererbuffer.c: use gimp_viewable_get_size() and get rid of useless local "brush" and "buffer" variables. --- ChangeLog | 7 +++++++ app/widgets/gimpviewrendererbrush.c | 19 ++++++++----------- app/widgets/gimpviewrendererbuffer.c | 20 ++++++++++---------- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0a447af39d..8bf283ae80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-05-10 Michael Natterer + + * app/widgets/gimpviewrendererbrush.c + * app/widgets/gimpviewrendererbuffer.c: use + gimp_viewable_get_size() and get rid of useless + local "brush" and "buffer" variables. + 2006-05-10 Michael Natterer * app/widgets/gimptoolbox.c: code cleanup, no logic changed. diff --git a/app/widgets/gimpviewrendererbrush.c b/app/widgets/gimpviewrendererbrush.c index fa27d036ef..d8f05ed4d8 100644 --- a/app/widgets/gimpviewrendererbrush.c +++ b/app/widgets/gimpviewrendererbrush.c @@ -84,7 +84,6 @@ gimp_view_renderer_brush_render (GimpViewRenderer *renderer, GtkWidget *widget) { GimpViewRendererBrush *renderbrush = GIMP_VIEW_RENDERER_BRUSH (renderer); - GimpBrush *brush; TempBuf *temp_buf; gint brush_width; gint brush_height; @@ -95,9 +94,7 @@ gimp_view_renderer_brush_render (GimpViewRenderer *renderer, renderbrush->pipe_timeout_id = 0; } - brush = GIMP_BRUSH (renderer->viewable); - brush_width = brush->mask->width; - brush_height = brush->mask->height; + gimp_viewable_get_size (renderer->viewable, &brush_width, &brush_height); temp_buf = gimp_viewable_get_new_preview (renderer->viewable, renderer->width, @@ -117,7 +114,7 @@ gimp_view_renderer_brush_render (GimpViewRenderer *renderer, temp_buf_free (temp_buf); - if (GIMP_IS_BRUSH_PIPE (brush)) + if (GIMP_IS_BRUSH_PIPE (renderer->viewable)) { renderbrush->pipe_animation_index = 0; renderbrush->pipe_timeout_id = @@ -139,10 +136,10 @@ gimp_view_renderer_brush_render (GimpViewRenderer *renderer, if (renderer->width >= INDICATOR_WIDTH * 2 && renderer->height >= INDICATOR_HEIGHT * 2 && - (renderer->width < brush_width || - renderer->height < brush_height || - GIMP_IS_BRUSH_PIPE (brush) || - GIMP_IS_BRUSH_GENERATED (brush))) + (renderer->width < brush_width || + renderer->height < brush_height || + GIMP_IS_BRUSH_PIPE (renderer->viewable) || + GIMP_IS_BRUSH_GENERATED (renderer->viewable))) { #define WHT { 255, 255, 255 } #define BLK { 0, 0, 0 } @@ -225,8 +222,8 @@ gimp_view_renderer_brush_render (GimpViewRenderer *renderer, buf = renderer->buffer + (offset_y * renderer->rowstride + offset_x * renderer->bytes); - pipe = GIMP_IS_BRUSH_PIPE (brush); - genbrush = GIMP_IS_BRUSH_GENERATED (brush); + pipe = GIMP_IS_BRUSH_PIPE (renderer->viewable); + genbrush = GIMP_IS_BRUSH_GENERATED (renderer->viewable); scale = (renderer->width < brush_width || renderer->height < brush_height); alpha = (renderer->bytes == 4); diff --git a/app/widgets/gimpviewrendererbuffer.c b/app/widgets/gimpviewrendererbuffer.c index 9851d576a6..b477dcff27 100644 --- a/app/widgets/gimpviewrendererbuffer.c +++ b/app/widgets/gimpviewrendererbuffer.c @@ -61,16 +61,17 @@ static void gimp_view_renderer_buffer_render (GimpViewRenderer *renderer, GtkWidget *widget) { - GimpBuffer *buffer; - gint view_width; - gint view_height; - gboolean scaling_up; - TempBuf *render_buf = NULL; + gint buffer_width; + gint buffer_height; + gint view_width; + gint view_height; + gboolean scaling_up; + TempBuf *render_buf = NULL; - buffer = GIMP_BUFFER (renderer->viewable); + gimp_viewable_get_size (renderer->viewable, &buffer_width, &buffer_height); - gimp_viewable_calc_preview_size (gimp_buffer_get_width (buffer), - gimp_buffer_get_height (buffer), + gimp_viewable_calc_preview_size (buffer_width, + buffer_height, renderer->width, renderer->height, TRUE, 1.0, 1.0, @@ -83,8 +84,7 @@ gimp_view_renderer_buffer_render (GimpViewRenderer *renderer, TempBuf *temp_buf; temp_buf = gimp_viewable_get_new_preview (renderer->viewable, - gimp_buffer_get_width (buffer), - gimp_buffer_get_height (buffer)); + buffer_width, buffer_height); if (temp_buf) {