app/widgets/gimpviewrendererbrush.c use gimp_viewable_get_size() and get

2006-05-10  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpviewrendererbrush.c
	* app/widgets/gimpviewrendererbuffer.c: use
	gimp_viewable_get_size() and get rid of useless
	local "brush" and "buffer" variables.
This commit is contained in:
Michael Natterer 2006-05-10 20:23:28 +00:00 committed by Michael Natterer
parent bca167a50e
commit 8cabdbe55c
3 changed files with 25 additions and 21 deletions

View File

@ -1,3 +1,10 @@
2006-05-10 Michael Natterer <mitch@gimp.org>
* 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 <mitch@gimp.org>
* app/widgets/gimptoolbox.c: code cleanup, no logic changed.

View File

@ -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);

View File

@ -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)
{