[gnome-notes/136-implement-the-list-row-pattern-in-main-view: 11/18] icon-frame: Remove dependancy



commit ad27b80f58c6dc63ee957e713752e9a9a9c3c86b
Author: Isaque Galdino <igaldino@gmail>
Date:   Fri Dec 27 03:16:21 2019 -0300

    icon-frame: Remove dependancy
    
    Remove one more dependency on libgd to draw icon frame using
    gd_embed_surface_in_frame. As a temporary solution, it's been drawn only
    a line around the note icon.

 data/bjb.gresource.xml             |   1 -
 data/meson.build                   |   3 +--
 data/resources/thumbnail-frame.png | Bin 832 -> 0 bytes
 src/libbiji/biji-note-obj.c        |  23 ++++++++++++-----------
 4 files changed, 13 insertions(+), 14 deletions(-)
---
diff --git a/data/bjb.gresource.xml b/data/bjb.gresource.xml
index 49c41de..d02f824 100644
--- a/data/bjb.gresource.xml
+++ b/data/bjb.gresource.xml
@@ -3,7 +3,6 @@
   <gresource prefix="/org/gnome/Notes">
     <file alias="Adwaita.css">resources/Adwaita.css</file>
     <file alias="editor-toolbar.ui" compressed="true" 
preprocess="xml-stripblanks">resources/editor-toolbar.ui</file>
-    <file alias="thumbnail-frame.png">resources/thumbnail-frame.png</file>
   </gresource>
 
   <gresource prefix="/org/gnome/Notes/icons">
diff --git a/data/meson.build b/data/meson.build
index 3fa99a5..ac090e6 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -48,8 +48,7 @@ resource_data = files(
   'resources/editor-toolbar.ui',
   'resources/empty-results-box.ui',
   'resources/note-symbolic.svg',
-  'resources/settings-dialog.ui',
-  'resources/thumbnail-frame.png'
+  'resources/settings-dialog.ui'
 )
 
 gresource = files('bjb.gresource.xml')
diff --git a/src/libbiji/biji-note-obj.c b/src/libbiji/biji-note-obj.c
index 79baaa7..3abbdd6 100644
--- a/src/libbiji/biji-note-obj.c
+++ b/src/libbiji/biji-note-obj.c
@@ -29,9 +29,6 @@
 
 #include "editor/biji-webkit-editor.h"
 
-
-#include <libgd/gd.h>
-
 typedef struct
 {
   /* Metadata */
@@ -641,15 +638,14 @@ static cairo_surface_t *
 biji_note_obj_get_icon (BijiItem *item,
                         gint scale)
 {
-  GdkRGBA               note_color;
+  GdkRGBA                note_color;
   const gchar           *text;
   cairo_t               *cr;
   PangoLayout           *layout;
   PangoFontDescription  *desc;
   cairo_surface_t       *surface = NULL;
-  GtkBorder              frame_slice = { 4, 3, 3, 6 };
-  BijiNoteObj *note = BIJI_NOTE_OBJ (item);
-  BijiNoteObjPrivate *priv = biji_note_obj_get_instance_private (note);
+  BijiNoteObj           *note = BIJI_NOTE_OBJ (item);
+  BijiNoteObjPrivate    *priv = biji_note_obj_get_instance_private (note);
 
   if (priv->icon)
     return priv->icon;
@@ -693,14 +689,19 @@ biji_note_obj_get_icon (BijiItem *item,
     pango_cairo_show_layout (cr, layout);
 
     g_object_unref (layout);
+
+    cairo_translate (cr, -10, -10);
   }
 
-  cairo_destroy (cr);
+  /* Border */
+  cairo_set_source_rgba (cr, 0.3, 0.3, 0.3, 1);
+  cairo_set_line_width (cr, 1 * scale);
+  cairo_rectangle (cr, 0, 0, BIJI_ICON_WIDTH, BIJI_ICON_HEIGHT);
+  cairo_stroke (cr);
 
-  priv->icon = gd_embed_surface_in_frame (surface, "resource:///org/gnome/Notes/thumbnail-frame.png",
-                                                &frame_slice, &frame_slice);
-  cairo_surface_destroy (surface);
+  cairo_destroy (cr);
 
+  priv->icon = surface;
   return priv->icon;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]