Skip to content

Commit 086c5e1

Browse files
committed
(RPNG) Style nits
1 parent 95b518b commit 086c5e1

File tree

1 file changed

+26
-24
lines changed
  • libretro-common/formats/png

1 file changed

+26
-24
lines changed

libretro-common/formats/png/rpng.c

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,10 @@ static void rpng_copy_line_rgb_sse2(uint32_t *data,
246246
| ((unsigned)src[i*3+11] );
247247
}
248248
for (; i < width; i++)
249-
{
250249
data[i] = 0xFF000000u
251250
| ((unsigned)src[i*3+0] << 16)
252251
| ((unsigned)src[i*3+1] << 8)
253252
| ((unsigned)src[i*3+2] );
254-
}
255253
}
256254
#endif /* RPNG_SIMD_SSE2 */
257255

@@ -279,10 +277,8 @@ static void rpng_copy_line_rgba_sse2(uint32_t *data,
279277
| ((unsigned)src[i*4+13] << 8) | ((unsigned)src[i*4+14]);
280278
}
281279
for (; i < width; i++)
282-
{
283280
data[i] = ((unsigned)src[i*4+3] << 24) | ((unsigned)src[i*4+0] << 16)
284281
| ((unsigned)src[i*4+1] << 8) | ((unsigned)src[i*4+2]);
285-
}
286282
}
287283
#endif /* RPNG_SIMD_SSE2 */
288284

@@ -318,10 +314,8 @@ static void rpng_copy_line_rgba_neon(uint32_t *data,
318314
(void)ag; /* used implicitly above */
319315
}
320316
for (; i < width; i++)
321-
{
322317
data[i] = ((unsigned)src[i*4+3] << 24) | ((unsigned)src[i*4+0] << 16)
323318
| ((unsigned)src[i*4+1] << 8) | ((unsigned)src[i*4+2]);
324-
}
325319
}
326320

327321
/* NEON RGB → ARGB32 conversion using vld3 de-interleave */
@@ -349,16 +343,13 @@ static void rpng_copy_line_rgb_neon(uint32_t *data,
349343
vst1q_u32(data + i + 4, hi);
350344
}
351345
for (; i < width; i++)
352-
{
353346
data[i] = 0xFF000000u
354347
| ((unsigned)src[i*3+0] << 16)
355348
| ((unsigned)src[i*3+1] << 8)
356349
| ((unsigned)src[i*3+2] );
357-
}
358350
}
359351
#endif /* RPNG_SIMD_NEON */
360352

361-
362353
#if defined(DEBUG) || defined(RPNG_TEST)
363354
static bool rpng_process_ihdr(struct png_ihdr *ihdr)
364355
{
@@ -443,7 +434,8 @@ static void rpng_reverse_filter_copy_line_rgb(uint32_t *data,
443434
{
444435
int i;
445436

446-
/* Fast path for 8-bit depth (bpp == 24): each pixel is exactly 3 bytes. */
437+
/* Fast path for 8-bit depth (bpp == 24):
438+
* each pixel is exactly 3 bytes. */
447439
if (bpp == 24)
448440
{
449441
#if defined(RPNG_SIMD_NEON)
@@ -476,7 +468,8 @@ static void rpng_reverse_filter_copy_line_rgba(uint32_t *data,
476468
{
477469
int i;
478470

479-
/* Fast path for 8-bit depth (bpp == 32): each pixel is exactly 4 bytes. */
471+
/* Fast path for 8-bit depth (bpp == 32):
472+
* each pixel is exactly 4 bytes. */
480473
if (bpp == 32)
481474
{
482475
#if defined(RPNG_SIMD_NEON)
@@ -835,8 +828,10 @@ static int rpng_reverse_filter_copy_line(uint32_t *data,
835828
for (i = 0; i < pngp->bpp; i++)
836829
pngp->decoded_scanline[i] += pngp->prev_scanline[i];
837830
for (i = pngp->bpp; i < pngp->pitch; i++)
838-
pngp->decoded_scanline[i] += paeth(pngp->decoded_scanline[i - pngp->bpp],
839-
pngp->prev_scanline[i], pngp->prev_scanline[i - pngp->bpp]);
831+
pngp->decoded_scanline[i] += paeth(
832+
pngp->decoded_scanline[i - pngp->bpp],
833+
pngp->prev_scanline[i],
834+
pngp->prev_scanline[i - pngp->bpp]);
840835
break;
841836
default:
842837
return IMAGE_PROCESS_ERROR_END;
@@ -856,11 +851,13 @@ static int rpng_reverse_filter_copy_line(uint32_t *data,
856851
ihdr->depth, pngp->palette);
857852
break;
858853
case PNG_IHDR_COLOR_GRAY_ALPHA:
859-
rpng_reverse_filter_copy_line_gray_alpha(data, pngp->decoded_scanline, ihdr->width,
854+
rpng_reverse_filter_copy_line_gray_alpha(
855+
data, pngp->decoded_scanline, ihdr->width,
860856
ihdr->depth);
861857
break;
862858
case PNG_IHDR_COLOR_RGBA:
863-
rpng_reverse_filter_copy_line_rgba(data, pngp->decoded_scanline, ihdr->width, ihdr->depth);
859+
rpng_reverse_filter_copy_line_rgba(
860+
data, pngp->decoded_scanline, ihdr->width, ihdr->depth);
864861
break;
865862
}
866863

@@ -990,13 +987,14 @@ static int rpng_load_image_argb_process_inflate_init(
990987
enum trans_stream_error err;
991988
uint32_t rd, wn;
992989
struct rpng_process *process = (struct rpng_process*)rpng->process;
993-
bool to_continue = (process->avail_in > 0
994-
&& process->avail_out > 0);
990+
bool to_continue = (process->avail_in > 0
991+
&& process->avail_out > 0);
995992

996993
if (!to_continue)
997994
goto end;
998995

999-
zstatus = process->stream_backend->trans(process->stream, false, &rd, &wn, &err);
996+
zstatus = process->stream_backend->trans(
997+
process->stream, false, &rd, &wn, &err);
1000998

1001999
if (!zstatus && err != TRANS_STREAM_ERROR_BUFFER_FULL)
10021000
goto error;
@@ -1013,7 +1011,8 @@ static int rpng_load_image_argb_process_inflate_init(
10131011
process->stream = NULL;
10141012

10151013
#ifdef GEKKO
1016-
/* we often use these in textures, make sure they're 32-byte aligned */
1014+
/* We often use these in textures, make sure
1015+
* they're 32-byte aligned */
10171016
*data = (uint32_t*)memalign(32, rpng->ihdr.width *
10181017
rpng->ihdr.height * sizeof(uint32_t));
10191018
#else
@@ -1031,12 +1030,12 @@ static int rpng_load_image_argb_process_inflate_init(
10311030
if (rpng_reverse_filter_init(&rpng->ihdr, process) == -1)
10321031
goto false_end;
10331032

1034-
process->flags |= RPNG_PROCESS_FLAG_INFLATE_INITIALIZED;
1033+
process->flags |= RPNG_PROCESS_FLAG_INFLATE_INITIALIZED;
10351034
return 1;
10361035

10371036
error:
10381037
false_end:
1039-
process->flags &= ~RPNG_PROCESS_FLAG_INFLATE_INITIALIZED;
1038+
process->flags &= ~RPNG_PROCESS_FLAG_INFLATE_INITIALIZED;
10401039
return -1;
10411040
}
10421041

@@ -1252,7 +1251,8 @@ bool rpng_iterate_image(rpng_t *rpng)
12521251

12531252
if ( rpng->ihdr.width == 0
12541253
|| rpng->ihdr.height == 0
1255-
/* ensure multiplications don't overflow and wrap around, that'd give buffer overflow crashes */
1254+
/* Ensure multiplications don't overflow and wrap around,
1255+
* that'd give buffer overflow crashes */
12561256
|| (uint64_t)rpng->ihdr.width*rpng->ihdr.height*sizeof(uint32_t) >= 0x80000000)
12571257
return false;
12581258

@@ -1390,7 +1390,8 @@ int rpng_process_image(rpng_t *rpng,
13901390

13911391
if (rpng->ihdr.interlace && rpng->process)
13921392
return rpng_reverse_filter_adam7(data, &rpng->ihdr, rpng->process);
1393-
return rpng_reverse_filter_regular_iterate(data, &rpng->ihdr, rpng->process);
1393+
return rpng_reverse_filter_regular_iterate(data,
1394+
&rpng->ihdr, rpng->process);
13941395

13951396
error:
13961397
if (rpng->process)
@@ -1418,7 +1419,8 @@ void rpng_free(rpng_t *rpng)
14181419
free(rpng->process->inflate_buf);
14191420
if (rpng->process->stream)
14201421
{
1421-
if (rpng->process->stream_backend && rpng->process->stream_backend->stream_free)
1422+
if ( rpng->process->stream_backend
1423+
&& rpng->process->stream_backend->stream_free)
14221424
rpng->process->stream_backend->stream_free(rpng->process->stream);
14231425
else
14241426
free(rpng->process->stream);

0 commit comments

Comments
 (0)