summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2010-03-09 11:10:00 +0100
committerAlexander Larsson <alexl@redhat.com>2010-03-09 11:10:00 +0100
commit90c5766caf16e35cb871116a4655a106a3c272dc (patch)
treeddc2ea976240a3f8f9c3294b41492256e6eb3f82 /client
parent5cb99e12c6817592f49ca153a3081dd6b5995cf2 (diff)
downloadspice-90c5766caf16e35cb871116a4655a106a3c272dc.tar.gz
spice-90c5766caf16e35cb871116a4655a106a3c272dc.tar.xz
spice-90c5766caf16e35cb871116a4655a106a3c272dc.zip
Use macros from <spice/macros.h> rather than duplicate them
Diffstat (limited to 'client')
-rw-r--r--client/cursor.cpp18
-rw-r--r--client/cursor_channel.cpp6
-rw-r--r--client/glz_decoder_config.h4
-rw-r--r--client/utils.h5
-rw-r--r--client/windows/red_pixmap.cpp2
-rw-r--r--client/x11/red_pixmap.cpp2
6 files changed, 16 insertions, 21 deletions
diff --git a/client/cursor.cpp b/client/cursor.cpp
index 7babdb90..60dc1dd7 100644
--- a/client/cursor.cpp
+++ b/client/cursor.cpp
@@ -34,29 +34,29 @@ CursorData::CursorData(SpiceCursor& cursor, int data_size)
expected_size = (_header.width << 2) * _header.height;
break;
case SPICE_CURSOR_TYPE_MONO:
- expected_size = (ALIGN(_header.width, 8) >> 2) * _header.height;
+ expected_size = (SPICE_ALIGN(_header.width, 8) >> 2) * _header.height;
break;
case SPICE_CURSOR_TYPE_COLOR4:
- expected_size = (ALIGN(_header.width, 2) >> 1) * _header.height;
- expected_size += (ALIGN(_header.width, 8) >> 3) * _header.height;
+ expected_size = (SPICE_ALIGN(_header.width, 2) >> 1) * _header.height;
+ expected_size += (SPICE_ALIGN(_header.width, 8) >> 3) * _header.height;
expected_size += 16 * sizeof(uint32_t);
break;
case SPICE_CURSOR_TYPE_COLOR8:
expected_size = _header.width * _header.height;
- expected_size += (ALIGN(_header.width, 8) >> 3) * _header.height;
+ expected_size += (SPICE_ALIGN(_header.width, 8) >> 3) * _header.height;
expected_size += 256 * sizeof(uint32_t);
break;
case SPICE_CURSOR_TYPE_COLOR16:
expected_size = (_header.width << 1) * _header.height;
- expected_size += (ALIGN(_header.width, 8) >> 3) * _header.height;
+ expected_size += (SPICE_ALIGN(_header.width, 8) >> 3) * _header.height;
break;
case SPICE_CURSOR_TYPE_COLOR24:
expected_size = (_header.width * 3) * _header.height;
- expected_size += (ALIGN(_header.width, 8) >> 3) * _header.height;
+ expected_size += (SPICE_ALIGN(_header.width, 8) >> 3) * _header.height;
break;
case SPICE_CURSOR_TYPE_COLOR32:
expected_size = (_header.width << 2) * _header.height;
- expected_size += (ALIGN(_header.width, 8) >> 3) * _header.height;
+ expected_size += (SPICE_ALIGN(_header.width, 8) >> 3) * _header.height;
break;
}
@@ -92,10 +92,10 @@ int LocalCursor::get_size_bits(const SpiceCursorHeader& header, int& size)
size = (header.width << 2) * header.height;
return 32;
case SPICE_CURSOR_TYPE_MONO:
- size = (ALIGN(header.width, 8) >> 3) * header.height;
+ size = (SPICE_ALIGN(header.width, 8) >> 3) * header.height;
return 1;
case SPICE_CURSOR_TYPE_COLOR4:
- size = (ALIGN(header.width, 2) >> 1) * header.height;
+ size = (SPICE_ALIGN(header.width, 2) >> 1) * header.height;
return 4;
case SPICE_CURSOR_TYPE_COLOR8:
size = header.width * header.height;
diff --git a/client/cursor_channel.cpp b/client/cursor_channel.cpp
index 0909f5c6..63b76980 100644
--- a/client/cursor_channel.cpp
+++ b/client/cursor_channel.cpp
@@ -137,7 +137,7 @@ MonoCursor::MonoCursor(const SpiceCursorHeader& header, const uint8_t* data)
int dest_stride = _pixmap->get_stride();
uint8_t *dest_line = _pixmap->get_data();
- int src_stride = ALIGN(header.width, 8) >> 3;
+ int src_stride = SPICE_ALIGN(header.width, 8) >> 3;
const uint8_t* src_line = data;
const uint8_t* end_line = src_line + _pixmap->get_height() * src_stride;
@@ -188,7 +188,7 @@ ColorCursor::ColorCursor(const SpiceCursorHeader& header)
void ColorCursor::init_pixels(const SpiceCursorHeader& header, const uint8_t* pixels,
const uint8_t *and_mask)
{
- int mask_stride = ALIGN(header.width, 8) / 8;
+ int mask_stride = SPICE_ALIGN(header.width, 8) / 8;
int invers_stride = _invers->get_stride();
int pixmap_stride = _pixmap->get_stride();
uint8_t *_pixmap_line = _pixmap->get_data();
@@ -266,7 +266,7 @@ class ColorCursor4: public ColorCursor {
public:
ColorCursor4(const SpiceCursorHeader& header, const uint8_t* data)
: ColorCursor(header)
- , _src_stride (ALIGN(header.width, 2) >> 1)
+ , _src_stride (SPICE_ALIGN(header.width, 2) >> 1)
, _palette ((uint32_t*)(data + _src_stride * header.height))
{
init_pixels(header, data, (uint8_t*)(_palette + 16));
diff --git a/client/glz_decoder_config.h b/client/glz_decoder_config.h
index 3e820a5f..57358b23 100644
--- a/client/glz_decoder_config.h
+++ b/client/glz_decoder_config.h
@@ -26,9 +26,7 @@
#include <stdio.h>
#include <spice/types.h>
-
-#define MIN(x, y) (((x) <= (y)) ? (x) : (y))
-#define MAX(x, y) (((x) >= (y)) ? (x) : (y))
+#include <spice/macros.h>
class GlzException: public std::exception {
public:
diff --git a/client/utils.h b/client/utils.h
index 6ed3eea2..6145fb5d 100644
--- a/client/utils.h
+++ b/client/utils.h
@@ -20,10 +20,7 @@
#include "common.h"
#include <spice/error_codes.h>
-
-#define MIN(x, y) (((x) <= (y)) ? (x) : (y))
-#define MAX(x, y) (((x) >= (y)) ? (x) : (y))
-#define ALIGN(a, b) (((a) + ((b) - 1)) & ~((b) - 1))
+#include <spice/macros.h>
class Exception: public std::exception {
public:
diff --git a/client/windows/red_pixmap.cpp b/client/windows/red_pixmap.cpp
index bd9d7e41..6d65b46b 100644
--- a/client/windows/red_pixmap.cpp
+++ b/client/windows/red_pixmap.cpp
@@ -25,7 +25,7 @@ RedPixmap::RedPixmap(int width, int height, RedPixmap::Format format,
: _format (format)
, _width (width)
, _height (height)
- , _stride (ALIGN(width * (_format == RedPixmap::A1 ? 1: 32), 32) / 8)
+ , _stride (SPICE_ALIGN(width * (_format == RedPixmap::A1 ? 1: 32), 32) / 8)
, _top_bottom (top_bottom)
, _data (NULL)
{
diff --git a/client/x11/red_pixmap.cpp b/client/x11/red_pixmap.cpp
index 85a45515..8452596d 100644
--- a/client/x11/red_pixmap.cpp
+++ b/client/x11/red_pixmap.cpp
@@ -25,7 +25,7 @@ RedPixmap::RedPixmap(int width, int height, RedPixmap::Format format,
: _format (format)
, _width (width)
, _height (height)
- , _stride (ALIGN(width * (_format == RedPixmap::A1 ? 1 : 32), 32) / 8)
+ , _stride (SPICE_ALIGN(width * (_format == RedPixmap::A1 ? 1 : 32), 32) / 8)
, _top_bottom (top_bottom)
, _data (NULL)
{