summaryrefslogtreecommitdiff
path: root/eel/eel-graphic-effects.c
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2019-04-12 22:17:28 +0200
committerraveit65 <[email protected]>2019-04-18 10:47:40 +0200
commitc93d8453ecc0421fe45e6f88ed3d15163149e39c (patch)
tree595dbe405c56dfc882081b0eb23a4db97a7e3adc /eel/eel-graphic-effects.c
parent2f3f26ee105181dbc2996f5fb492cfa24468cf6c (diff)
downloadcaja-c93d8453ecc0421fe45e6f88ed3d15163149e39c.tar.bz2
caja-c93d8453ecc0421fe45e6f88ed3d15163149e39c.tar.xz
eel: reduce the scope of some variables
Fixes 'cppcheck' warnings: [eel/eel-background.c:163]: (style) The scope of the variable 'intensity' can be reduced. [eel/eel-background.c:163]: (style) The scope of the variable 'saturation' can be reduced. [eel/eel-background.c:196]: (style) The scope of the variable 'end_color' can be reduced. [eel/eel-canvas-rect-ellipse.c:600]: (style) The scope of the variable 'tmp' can be reduced. [eel/eel-canvas-rect-ellipse.c:705]: (style) The scope of the variable 'width_pixels' can be reduced. [eel/eel-canvas-rect-ellipse.c:706]: (style) The scope of the variable 'width_lt' can be reduced. [eel/eel-canvas-rect-ellipse.c:706]: (style) The scope of the variable 'width_rb' can be reduced. [eel/eel-canvas.c:1420]: (style) The scope of the variable 'child' can be reduced. [eel/eel-canvas.c:1493]: (style) The scope of the variable 'i' can be reduced. [eel/eel-canvas.c:1518]: (style) The scope of the variable 'i' can be reduced. [eel/eel-canvas.c:1545]: (style) The scope of the variable 'i' can be reduced. [eel/eel-canvas.c:1599]: (style) The scope of the variable 'child' can be reduced. [eel/eel-canvas.c:2598]: (style) The scope of the variable 'cx' can be reduced. [eel/eel-canvas.c:2598]: (style) The scope of the variable 'cy' can be reduced. [eel/eel-debug.c:80]: (style) The scope of the variable 'f' can be reduced. [eel/eel-editable-label.c:1493]: (style) The scope of the variable 'clip' can be reduced. [eel/eel-editable-label.c:1571]: (style) The scope of the variable 'text' can be reduced. [eel/eel-editable-label.c:2270]: (style) The scope of the variable 'anchor' can be reduced. [eel/eel-editable-label.c:2270]: (style) The scope of the variable 'end' can be reduced. [eel/eel-editable-label.c:3054]: (style) The scope of the variable 'menuitem' can be reduced. [eel/eel-editable-label.c:3400]: (style) The scope of the variable 'index' can be reduced. [eel/eel-gdk-pixbuf-extensions.c:85]: (style) The scope of the variable 'scale' can be reduced. [eel/eel-gdk-pixbuf-extensions.c:283]: (style) The scope of the variable 's_x1' can be reduced. [eel/eel-gdk-pixbuf-extensions.c:283]: (style) The scope of the variable 's_y2' can be reduced. [eel/eel-gdk-pixbuf-extensions.c:284]: (style) The scope of the variable 's_xfrac' can be reduced. [eel/eel-glib-extensions.c:439]: (style) The scope of the variable 'compare_result' can be reduced. [eel/eel-glib-extensions.c:561]: (style) The scope of the variable 'hash_table_to_free' can be reduced. [eel/eel-graphic-effects.c:74]: (style) The scope of the variable 'pixsrc' can be reduced. [eel/eel-graphic-effects.c:74]: (style) The scope of the variable 'pixdest' can be reduced. [eel/eel-graphic-effects.c:137]: (style) The scope of the variable 'pixsrc' can be reduced. [eel/eel-graphic-effects.c:137]: (style) The scope of the variable 'pixdest' can be reduced. [eel/eel-graphic-effects.c:195]: (style) The scope of the variable 'pixsrc' can be reduced. [eel/eel-graphic-effects.c:196]: (style) The scope of the variable 'pixdest' can be reduced. [eel/eel-graphic-effects.c:245]: (style) The scope of the variable 'slab_width' can be reduced. [eel/eel-graphic-effects.c:262]: (style) The scope of the variable 'slab_height' can be reduced. [eel/eel-graphic-effects.c:282]: (style) The scope of the variable 'y' can be reduced. [eel/eel-gtk-extensions.c:165]: (style) The scope of the variable 'screen' can be reduced. [eel/eel-gtk-extensions.c:167]: (style) The scope of the variable 'screen_width' can be reduced. [eel/eel-gtk-extensions.c:167]: (style) The scope of the variable 'screen_height' can be reduced. [eel/eel-gtk-extensions.c:168]: (style) The scope of the variable 'scale' can be reduced. [eel/eel-labeled-image.c:1051]: (style) The scope of the variable 'x_alignment' can be reduced. [eel/eel-labeled-image.c:1052]: (style) The scope of the variable 'y_alignment' can be reduced. [eel/eel-labeled-image.c:1100]: (style) The scope of the variable 'x_alignment' can be reduced. [eel/eel-labeled-image.c:1101]: (style) The scope of the variable 'y_alignment' can be reduced. [eel/eel-mate-extensions.c:73]: (style) The scope of the variable 'quoted' can be reduced. [eel/eel-stock-dialogs.c:409]: (style) The scope of the variable 'button_title' can be reduced. [eel/eel-string.c:415]: (style) The scope of the variable 'i' can be reduced. [eel/eel-string.c:542]: (style) The scope of the variable 'type' can be reduced. [eel/eel-vfs-extensions.c:65]: (style) The scope of the variable 'valid_bytes' can be reduced. [eel/eel-wrap-table.c:766]: (style) The scope of the variable 'hadj' can be reduced. [eel/eel-wrap-table.c:766]: (style) The scope of the variable 'vadj' can be reduced.
Diffstat (limited to 'eel/eel-graphic-effects.c')
-rw-r--r--eel/eel-graphic-effects.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/eel/eel-graphic-effects.c b/eel/eel-graphic-effects.c
index 2405a296..1a7bc659 100644
--- a/eel/eel-graphic-effects.c
+++ b/eel/eel-graphic-effects.c
@@ -71,7 +71,6 @@ eel_create_spotlight_pixbuf (GdkPixbuf* src)
int i, j;
int width, height, has_alpha, src_row_stride, dst_row_stride;
guchar *target_pixels, *original_pixels;
- guchar *pixsrc, *pixdest;
g_return_val_if_fail (gdk_pixbuf_get_colorspace (src) == GDK_COLORSPACE_RGB, NULL);
g_return_val_if_fail ((!gdk_pixbuf_get_has_alpha (src)
@@ -92,6 +91,8 @@ eel_create_spotlight_pixbuf (GdkPixbuf* src)
for (i = 0; i < height; i++)
{
+ guchar *pixsrc, *pixdest;
+
pixdest = target_pixels + i * dst_row_stride;
pixsrc = original_pixels + i * src_row_stride;
for (j = 0; j < width; j++)
@@ -134,7 +135,6 @@ eel_create_darkened_pixbuf (GdkPixbuf *src, int saturation, int darken)
gint width, height, src_row_stride, dest_row_stride;
gboolean has_alpha;
guchar *target_pixels, *original_pixels;
- guchar *pixsrc, *pixdest;
guchar intensity;
guchar alpha;
guchar negalpha;
@@ -160,6 +160,8 @@ eel_create_darkened_pixbuf (GdkPixbuf *src, int saturation, int darken)
for (i = 0; i < height; i++)
{
+ guchar *pixsrc, *pixdest;
+
pixdest = target_pixels + i * dest_row_stride;
pixsrc = original_pixels + i * src_row_stride;
for (j = 0; j < width; j++)
@@ -192,8 +194,6 @@ eel_create_colorized_pixbuf (GdkPixbuf *src,
int width, height, has_alpha, src_row_stride, dst_row_stride;
guchar *target_pixels;
guchar *original_pixels;
- guchar *pixsrc;
- guchar *pixdest;
GdkPixbuf *dest;
gint red_value, green_value, blue_value;
@@ -221,6 +221,9 @@ eel_create_colorized_pixbuf (GdkPixbuf *src,
for (i = 0; i < height; i++)
{
+ guchar *pixdest;
+ guchar *pixsrc;
+
pixdest = target_pixels + i*dst_row_stride;
pixsrc = original_pixels + i*src_row_stride;
for (j = 0; j < width; j++)
@@ -242,12 +245,14 @@ eel_create_colorized_pixbuf (GdkPixbuf *src,
static void
draw_frame_row (GdkPixbuf *frame_image, int target_width, int source_width, int source_v_position, int dest_v_position, GdkPixbuf *result_pixbuf, int left_offset, int height)
{
- int remaining_width, h_offset, slab_width;
+ int remaining_width, h_offset;
remaining_width = target_width;
h_offset = 0;
while (remaining_width > 0)
{
+ int slab_width;
+
slab_width = remaining_width > source_width ? source_width : remaining_width;
gdk_pixbuf_copy_area (frame_image, left_offset, source_v_position, slab_width, height, result_pixbuf, left_offset + h_offset, dest_v_position);
remaining_width -= slab_width;
@@ -259,12 +264,15 @@ draw_frame_row (GdkPixbuf *frame_image, int target_width, int source_width, int
static void
draw_frame_column (GdkPixbuf *frame_image, int target_height, int source_height, int source_h_position, int dest_h_position, GdkPixbuf *result_pixbuf, int top_offset, int width)
{
- int remaining_height, v_offset, slab_height;
+ int remaining_height, v_offset;
remaining_height = target_height;
v_offset = 0;
+
while (remaining_height > 0)
{
+ int slab_height;
+
slab_height = remaining_height > source_height ? source_height : remaining_height;
gdk_pixbuf_copy_area (frame_image, source_h_position, top_offset, width, slab_height, result_pixbuf, dest_h_position, top_offset + v_offset);
remaining_height -= slab_height;
@@ -279,7 +287,7 @@ eel_stretch_frame_image (GdkPixbuf *frame_image, int left_offset, int top_offset
GdkPixbuf *result_pixbuf;
guchar *pixels_ptr;
int frame_width, frame_height;
- int y, row_stride;
+ int row_stride;
int target_width, target_frame_width;
int target_height, target_frame_height;
@@ -300,6 +308,8 @@ eel_stretch_frame_image (GdkPixbuf *frame_image, int left_offset, int top_offset
/* clear the new pixbuf */
if (!fill_flag)
{
+ int y;
+
for (y = 0; y < dest_height; y++)
{
memset (pixels_ptr, 255, row_stride);