diff --git a/src/sp-cursor.cpp b/src/sp-cursor.cpp
index f59c63487083ac986e74e49b61ed4acb39d6e691..4bbba5f10875748550293add149c905de30b6e12 100644 (file)
--- a/src/sp-cursor.cpp
+++ b/src/sp-cursor.cpp
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#include <string.h>
+#include <cstdio>
+#include <cstring>
+#include <string>
#include <ctype.h>
#include "sp-cursor.h"
-void sp_cursor_bitmap_and_mask_from_xpm (GdkBitmap **bitmap, GdkBitmap **mask, gchar **xpm)
+void
+sp_cursor_bitmap_and_mask_from_xpm(GdkBitmap **bitmap, GdkBitmap **mask, gchar const *const *xpm)
{
int height;
int width;
int transparent_color = ' ';
int black_color = '.';
-
+
char pixmap_buffer[(32 * 32)/8];
char mask_buffer[(32 * 32)/8];
if (strcmp(p, "None") == 0) {
transparent_color = ccode;
}
-
+
if (strcmp(p, "#000000") == 0) {
black_color = ccode;
}
@@ -59,20 +62,20 @@ void sp_cursor_bitmap_and_mask_from_xpm (GdkBitmap **bitmap, GdkBitmap **mask, g
for (int y = 0; y < 32; y++) {
for (int x = 0; x < 32; ) {
-
+
char value = 0;
char maskv = 0;
for (int pix = 0; pix < 8; pix++, x++){
- if (xpm [4+y][x] != transparent_color) {
+ if (xpm[4+y][x] != transparent_color) {
maskv |= 1 << pix;
- if (xpm [4+y][x] == black_color) {
+ if (xpm[4+y][x] == black_color) {
value |= 1 << pix;
}
}
}
-
+
pixmap_buffer[(y * 4 + x/8)-1] = value;
mask_buffer[(y * 4 + x/8)-1] = maskv;
}
@@ -82,11 +85,12 @@ void sp_cursor_bitmap_and_mask_from_xpm (GdkBitmap **bitmap, GdkBitmap **mask, g
*mask = gdk_bitmap_create_from_data(NULL, mask_buffer, 32, 32);
}
-GdkCursor *sp_cursor_new_from_xpm (gchar **xpm, gint hot_x, gint hot_y)
+GdkCursor *
+sp_cursor_new_from_xpm(gchar const *const *xpm, gint hot_x, gint hot_y)
{
GdkColor const fg = { 0, 0, 0, 0 };
GdkColor const bg = { 0, 65535, 65535, 65535 };
-
+
GdkBitmap *bitmap = NULL;
GdkBitmap *mask = NULL;