Code

enable safe support for motion hints
[inkscape.git] / src / display / sodipodi-ctrlrect.cpp
index cce921b3cecb5b2ca7fbe45dd396b87dc404e8c4..28c76e7045e1f869dc529b74c233b02f47b10a65 100644 (file)
@@ -38,22 +38,26 @@ static SPCanvasItemClass *parent_class;
 
 static const guint DASH_LENGTH = 4;
 
-GtkType sp_ctrlrect_get_type()
+GType sp_ctrlrect_get_type()
 {
-    static GtkType ctrlrect_type = 0;
+    static GType type = 0;
 
-    if (!ctrlrect_type) {
-        GtkTypeInfo ctrlrect_info = {
-            "SPCtrlRect",
-            sizeof(CtrlRect),
+    if (!type) {
+        GTypeInfo info = {
             sizeof(SPCtrlRectClass),
-            (GtkClassInitFunc) sp_ctrlrect_class_init,
-            (GtkObjectInitFunc) sp_ctrlrect_init,
-            NULL, NULL, NULL
+            0, // base_init
+            0, // base_finalize
+            (GClassInitFunc)sp_ctrlrect_class_init,
+            0, // class_finalize
+            0, // class_data
+            sizeof(CtrlRect),
+            0, // n_preallocs
+            (GInstanceInitFunc)sp_ctrlrect_init,
+            0 // value_table
         };
-        ctrlrect_type = gtk_type_unique(SP_TYPE_CANVAS_ITEM, &ctrlrect_info);
+        type = g_type_register_static(SP_TYPE_CANVAS_ITEM, "SPCtrlRect", &info, static_cast<GTypeFlags>(0));
     }
-    return ctrlrect_type;
+    return type;
 }
 
 static void sp_ctrlrect_class_init(SPCtrlRectClass *c)
@@ -96,14 +100,14 @@ static void sp_ctrlrect_hline(SPCanvasBuf *buf, gint y, gint xs, gint xe, guint3
         guint const a = RGBA_A(rgba);
         gint const x0 = MAX(buf->rect.x0, xs);
         gint const x1 = MIN(buf->rect.x1, xe + 1);
-        guchar *p = buf->buf + (y - buf->rect.y0) * buf->buf_rowstride + (x0 - buf->rect.x0) * 3;
+        guchar *p = buf->buf + (y - buf->rect.y0) * buf->buf_rowstride + (x0 - buf->rect.x0) * 4;
         for (gint x = x0; x < x1; x++) {
             if (!dashed || ((x / DASH_LENGTH) % 2)) {
                 p[0] = INK_COMPOSE(r, a, p[0]);
                 p[1] = INK_COMPOSE(g, a, p[1]);
                 p[2] = INK_COMPOSE(b, a, p[2]);
             }
-            p += 3;
+            p += 4;
         }
     }
 }
@@ -117,7 +121,7 @@ static void sp_ctrlrect_vline(SPCanvasBuf *buf, gint x, gint ys, gint ye, guint3
         guint const a = RGBA_A(rgba);
         gint const y0 = MAX(buf->rect.y0, ys);
         gint const y1 = MIN(buf->rect.y1, ye + 1);
-        guchar *p = buf->buf + (y0 - buf->rect.y0) * buf->buf_rowstride + (x - buf->rect.x0) * 3;
+        guchar *p = buf->buf + (y0 - buf->rect.y0) * buf->buf_rowstride + (x - buf->rect.x0) * 4;
         for (gint y = y0; y < y1; y++) {
             if (!dashed || ((y / DASH_LENGTH) % 2)) {
                 p[0] = INK_COMPOSE(r, a, p[0]);
@@ -141,12 +145,12 @@ static void sp_ctrlrect_area(SPCanvasBuf *buf, gint xs, gint ys, gint xe, gint y
     gint const y0 = MAX(buf->rect.y0, ys);
     gint const y1 = MIN(buf->rect.y1, ye + 1);
     for (gint y = y0; y < y1; y++) {
-        guchar *p = buf->buf + (y - buf->rect.y0) * buf->buf_rowstride + (x0 - buf->rect.x0) * 3;
+        guchar *p = buf->buf + (y - buf->rect.y0) * buf->buf_rowstride + (x0 - buf->rect.x0) * 4;
         for (gint x = x0; x < x1; x++) {
             p[0] = INK_COMPOSE(r, a, p[0]);
             p[1] = INK_COMPOSE(g, a, p[1]);
             p[2] = INK_COMPOSE(b, a, p[2]);
-            p += 3;
+            p += 4;
         }
     }
 }