[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/pgtk 25cf592 067/100: Change coding style
From: |
Yuuki Harano |
Subject: |
feature/pgtk 25cf592 067/100: Change coding style |
Date: |
Tue, 24 Nov 2020 08:02:39 -0500 (EST) |
branch: feature/pgtk
commit 25cf59203e3e2787f8085462989ecaabb6292f75
Author: Yuuki Harano <masm+github@masm11.me>
Commit: Jeff Walsh <jeff.walsh@drtusers-MacBook-Pro.local>
Change coding style
* src/image.c (image_create_pattern_from_pixbuf): Change coding style
(image_create_bitmap_from_data): Change coding style
(image_create_bitmap_from_file): Change coding style
---
src/image.c | 87 ++++++++++++++++++++++++++++++++++---------------------------
1 file changed, 49 insertions(+), 38 deletions(-)
diff --git a/src/image.c b/src/image.c
index c7ae3b9..e2d142e 100644
--- a/src/image.c
+++ b/src/image.c
@@ -402,14 +402,15 @@ image_reference_bitmap (struct frame *f, ptrdiff_t id)
#ifdef HAVE_PGTK
static cairo_pattern_t *
-image_create_pattern_from_pixbuf (struct frame *f, GdkPixbuf *pixbuf)
+image_create_pattern_from_pixbuf (struct frame *f, GdkPixbuf * pixbuf)
{
GdkPixbuf *pb = gdk_pixbuf_add_alpha (pixbuf, TRUE, 255, 255, 255);
- cairo_surface_t *surface = cairo_surface_create_similar_image
(cairo_get_target(
-
f->output_data.pgtk->cr_context),
-
CAIRO_FORMAT_A1,
-
gdk_pixbuf_get_width (pb),
-
gdk_pixbuf_get_height (pb));
+ cairo_surface_t *surface =
+ cairo_surface_create_similar_image (cairo_get_target
+ (f->output_data.pgtk->cr_context),
+ CAIRO_FORMAT_A1,
+ gdk_pixbuf_get_width (pb),
+ gdk_pixbuf_get_height (pb));
cairo_t *cr = cairo_create (surface);
gdk_cairo_set_source_pixbuf (cr, pb, 0, 0);
@@ -462,38 +463,45 @@ image_create_bitmap_from_data (struct frame *f, char
*bits,
#endif
#ifdef HAVE_PGTK
- GdkPixbuf *pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB,
- FALSE,
- 8,
- width,
- height);
+ GdkPixbuf *pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
+ FALSE,
+ 8,
+ width,
+ height);
{
char *sp = bits;
int mask = 0x01;
unsigned char *buf = gdk_pixbuf_get_pixels (pixbuf);
int rowstride = gdk_pixbuf_get_rowstride (pixbuf);
- for (int y = 0; y < height; y++) {
- unsigned char *dp = buf + rowstride * y;
- for (int x = 0; x < width; x++) {
- if (*sp & mask) {
- *dp++ = 0xff;
- *dp++ = 0xff;
- *dp++ = 0xff;
- } else {
- *dp++ = 0x00;
- *dp++ = 0x00;
- *dp++ = 0x00;
- }
- if ((mask <<= 1) >= 0x100) {
- mask = 0x01;
- sp++;
- }
- }
- if (mask != 0x01) {
- mask = 0x01;
- sp++;
+ for (int y = 0; y < height; y++)
+ {
+ unsigned char *dp = buf + rowstride * y;
+ for (int x = 0; x < width; x++)
+ {
+ if (*sp & mask)
+ {
+ *dp++ = 0xff;
+ *dp++ = 0xff;
+ *dp++ = 0xff;
+ }
+ else
+ {
+ *dp++ = 0x00;
+ *dp++ = 0x00;
+ *dp++ = 0x00;
+ }
+ if ((mask <<= 1) >= 0x100)
+ {
+ mask = 0x01;
+ sp++;
+ }
+ }
+ if (mask != 0x01)
+ {
+ mask = 0x01;
+ sp++;
+ }
}
- }
}
#endif
@@ -507,7 +515,8 @@ image_create_bitmap_from_data (struct frame *f, char *bits,
#ifdef HAVE_PGTK
dpyinfo->bitmaps[id - 1].img = pixbuf;
dpyinfo->bitmaps[id - 1].depth = 1;
- dpyinfo->bitmaps[id - 1].pattern = image_create_pattern_from_pixbuf (f,
pixbuf);
+ dpyinfo->bitmaps[id - 1].pattern =
+ image_create_pattern_from_pixbuf (f, pixbuf);
#endif
dpyinfo->bitmaps[id - 1].file = NULL;
@@ -567,10 +576,11 @@ image_create_bitmap_from_file (struct frame *f,
Lisp_Object file)
ptrdiff_t id;
void * bitmap = gdk_pixbuf_new_from_file(SSDATA(file), &err);
- if (!bitmap) {
- g_error_free(err);
- return -1;
- }
+ if (!bitmap)
+ {
+ g_error_free(err);
+ return -1;
+ }
id = image_allocate_bitmap_record(f);
@@ -580,7 +590,8 @@ image_create_bitmap_from_file (struct frame *f, Lisp_Object
file)
//dpyinfo->bitmaps[id - 1].depth = 1;
dpyinfo->bitmaps[id - 1].height = gdk_pixbuf_get_width (bitmap);
dpyinfo->bitmaps[id - 1].width = gdk_pixbuf_get_height (bitmap);
- dpyinfo->bitmaps[id - 1].pattern = image_create_pattern_from_pixbuf (f,
bitmap);
+ dpyinfo->bitmaps[id - 1].pattern
+ = image_create_pattern_from_pixbuf (f, bitmap);
return id;
#endif
- feature/pgtk de7b0da 049/100: use pgtk_menu_set_in_use., (continued)
- feature/pgtk de7b0da 049/100: use pgtk_menu_set_in_use., Yuuki Harano, 2020/11/24
- feature/pgtk af1e279 073/100: Restore support for terminal only emacs in PGTK (add --with-pgtk), Yuuki Harano, 2020/11/24
- feature/pgtk 8669feb 054/100: Make icons and titles work like on X, Yuuki Harano, 2020/11/24
- feature/pgtk 20dbd4e 069/100: Change coding style, Yuuki Harano, 2020/11/24
- feature/pgtk 9e56fa9 034/100: Support focus on click event, Yuuki Harano, 2020/11/24
- feature/pgtk 385e85c 038/100: End Resize flickering by copying surface rather than just clearing, Yuuki Harano, 2020/11/24
- feature/pgtk cbd28cd 046/100: improve code readability., Yuuki Harano, 2020/11/24
- feature/pgtk ef67659 045/100: Set screen/display dpi res to make broadway work as expected, Yuuki Harano, 2020/11/24
- feature/pgtk d109dab 059/100: * src/pgtkfns.c: change coding style, Yuuki Harano, 2020/11/24
- feature/pgtk 9eb35f9 033/100: experimental support of tab-bar., Yuuki Harano, 2020/11/24
- feature/pgtk 25cf592 067/100: Change coding style,
Yuuki Harano <=
- feature/pgtk e7190d8 075/100: Fix non-English layout does not work, Yuuki Harano, 2020/11/24
- feature/pgtk 28073ba 083/100: Re-implement childframe with emacsgtkfixed, Yuuki Harano, 2020/11/24
- feature/pgtk 6c43496 074/100: Fix font lock is not applied on continued lines, Yuuki Harano, 2020/11/24
- feature/pgtk 9704e23 081/100: Enable GtkIMContext by default, Yuuki Harano, 2020/11/24
- feature/pgtk b60d4c9 086/100: Fix crash on creating child frames., Yuuki Harano, 2020/11/24
- feature/pgtk b1b7440 098/100: Work around gtk_im_context_filter_keypress() issue with super key, Yuuki Harano, 2020/11/24
- feature/pgtk 992ef48 041/100: update redisplay_interface., Yuuki Harano, 2020/11/24
- feature/pgtk 232c129 035/100: implement pre-edit input method, Yuuki Harano, 2020/11/24
- feature/pgtk 984f9cc 050/100: restore frame_rehighlight_hook., Yuuki Harano, 2020/11/24
- feature/pgtk 51462ce 078/100: Add PGTK to system-configuration-features, Yuuki Harano, 2020/11/24