Skip to content

Commit 75b300d

Browse files
authored
text: reformat and polish (#4122)
* text: reformat and polish Non-functional change.
1 parent 7375fcf commit 75b300d

File tree

1 file changed

+18
-21
lines changed

1 file changed

+18
-21
lines changed

libvips/create/text.c

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ vips_text_build(VipsObject *object)
394394
VipsImage **t = (VipsImage **) vips_object_local_array(object, 3);
395395

396396
VipsRect extents;
397-
VipsImage *image;
397+
VipsImage *in;
398398
cairo_surface_t *surface;
399399
cairo_t *cr;
400400
cairo_status_t status;
@@ -470,26 +470,26 @@ vips_text_build(VipsObject *object)
470470
return -1;
471471
}
472472

473-
image = t[0] = vips_image_new_memory();
474-
vips_image_init_fields(image,
473+
t[0] = vips_image_new_memory();
474+
vips_image_init_fields(t[0],
475475
extents.width, extents.height, 4,
476-
VIPS_FORMAT_UCHAR, VIPS_CODING_NONE,
477-
VIPS_INTERPRETATION_sRGB,
476+
VIPS_FORMAT_UCHAR, VIPS_CODING_NONE, VIPS_INTERPRETATION_sRGB,
478477
text->dpi / 25.4, text->dpi / 25.4);
479-
image->Xoffset = extents.left;
480-
image->Yoffset = extents.top;
478+
t[0]->Xoffset = extents.left;
479+
t[0]->Yoffset = extents.top;
481480

482-
if (vips_image_pipelinev(image, VIPS_DEMAND_STYLE_ANY, NULL) ||
483-
vips_image_write_prepare(image)) {
481+
if (vips_image_pipelinev(t[0], VIPS_DEMAND_STYLE_ANY, NULL) ||
482+
vips_image_write_prepare(t[0])) {
484483
g_mutex_unlock(vips_text_lock);
485484
return -1;
486485
}
486+
in = t[0];
487487

488488
surface = cairo_image_surface_create_for_data(
489-
VIPS_IMAGE_ADDR(image, 0, 0),
489+
VIPS_IMAGE_ADDR(in, 0, 0),
490490
CAIRO_FORMAT_ARGB32,
491-
image->Xsize, image->Ysize,
492-
VIPS_IMAGE_SIZEOF_LINE(image));
491+
in->Xsize, in->Ysize,
492+
VIPS_IMAGE_SIZEOF_LINE(in));
493493

494494
status = cairo_surface_status(surface);
495495
if (status) {
@@ -512,29 +512,26 @@ vips_text_build(VipsObject *object)
512512
g_mutex_unlock(vips_text_lock);
513513

514514
if (text->rgba) {
515-
int y;
516-
517515
/* Cairo makes pre-multipled BRGA -- we must byteswap and
518516
* unpremultiply.
519517
*/
520-
for (y = 0; y < image->Ysize; y++)
518+
for (int y = 0; y < in->Ysize; y++)
521519
vips__premultiplied_bgra2rgba(
522-
(guint32 *)
523-
VIPS_IMAGE_ADDR(image, 0, y),
524-
image->Xsize);
520+
(guint32 *) VIPS_IMAGE_ADDR(in, 0, y),
521+
in->Xsize);
525522
}
526523
else {
527524
/* We just want the alpha channel.
528525
*/
529-
if (vips_extract_band(image, &t[1], 3, NULL) ||
526+
if (vips_extract_band(in, &t[1], 3, NULL) ||
530527
vips_copy(t[1], &t[2],
531528
"interpretation", VIPS_INTERPRETATION_MULTIBAND,
532529
NULL))
533530
return -1;
534-
image = t[2];
531+
in = t[2];
535532
}
536533

537-
if (vips_image_write(image, create->out))
534+
if (vips_image_write(in, create->out))
538535
return -1;
539536

540537
return 0;

0 commit comments

Comments
 (0)