emacs-diffs
[Top][All Lists]
Advanced

[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
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]