summaryrefslogtreecommitdiffstats
path: root/client/windows
diff options
context:
space:
mode:
Diffstat (limited to 'client/windows')
-rw-r--r--client/windows/red_pixmap.cpp4
-rw-r--r--client/windows/red_pixmap_cairo.cpp24
-rw-r--r--client/windows/red_pixmap_gdi.cpp21
3 files changed, 20 insertions, 29 deletions
diff --git a/client/windows/red_pixmap.cpp b/client/windows/red_pixmap.cpp
index 1ec41faf..574d2851 100644
--- a/client/windows/red_pixmap.cpp
+++ b/client/windows/red_pixmap.cpp
@@ -21,11 +21,11 @@
#include "utils.h"
RedPixmap::RedPixmap(int width, int height, RedPixmap::Format format,
- bool top_bottom, rgb32_t* pallet)
+ bool top_bottom)
: _format (format)
, _width (width)
, _height (height)
- , _stride (SPICE_ALIGN(width * (_format == RedPixmap::A1 ? 1: 32), 32) / 8)
+ , _stride (SPICE_ALIGN(width * format_to_bpp(format), 32) / 8)
, _top_bottom (top_bottom)
, _data (NULL)
{
diff --git a/client/windows/red_pixmap_cairo.cpp b/client/windows/red_pixmap_cairo.cpp
index 6ed58068..793d21ed 100644
--- a/client/windows/red_pixmap_cairo.cpp
+++ b/client/windows/red_pixmap_cairo.cpp
@@ -29,14 +29,9 @@ struct RedPixmap_p {
HBITMAP prev_bitmap;
};
-static inline int format_to_bpp(RedPixmap::Format format)
-{
- return ((format == RedPixmap::A1) ? 1 : 32);
-}
-
-RedPixmapCairo::RedPixmapCairo(int width, int height, RedPixmap::Format format, bool top_bottom,
- rgb32_t* pallet, RedWindow *win)
- : RedPixmap(width, height, format, top_bottom, pallet)
+RedPixmapCairo::RedPixmapCairo(int width, int height, RedPixmap::Format format,
+ bool top_bottom, RedWindow *win)
+ : RedPixmap(width, height, format, top_bottom)
{
ASSERT(format == RedPixmap::ARGB32 || format == RedPixmap::RGB32 || format == RedPixmap::A1);
ASSERT(sizeof(RedPixmap_p) <= PIXELES_SOURCE_OPAQUE_SIZE);
@@ -65,15 +60,16 @@ RedPixmapCairo::RedPixmapCairo(int width, int height, RedPixmap::Format format,
#endif*/
bitmap_info.inf.bmiHeader.biPlanes = 1;
- bitmap_info.inf.bmiHeader.biBitCount = format_to_bpp(format);
+ bitmap_info.inf.bmiHeader.biBitCount = RedPixmap::format_to_bpp(format);
bitmap_info.inf.bmiHeader.biCompression = BI_RGB;
switch (format) {
case RedPixmap::A1:
- for (int i = 0; i < (1 << format_to_bpp(format)); i++) {
- bitmap_info.inf.bmiColors[i].rgbRed = rgb32_get_red(pallet[i]);
- bitmap_info.inf.bmiColors[i].rgbGreen = rgb32_get_green(pallet[i]);
- bitmap_info.inf.bmiColors[i].rgbBlue = rgb32_get_blue(pallet[i]);
- }
+ bitmap_info.inf.bmiColors[0].rgbRed = 0;
+ bitmap_info.inf.bmiColors[0].rgbGreen = 0;
+ bitmap_info.inf.bmiColors[0].rgbBlue = 0;
+ bitmap_info.inf.bmiColors[1].rgbRed = 0xff;
+ bitmap_info.inf.bmiColors[1].rgbGreen = 0xff;
+ bitmap_info.inf.bmiColors[1].rgbBlue = 0xff;
break;
}
AutoDC dc(create_compatible_dc());
diff --git a/client/windows/red_pixmap_gdi.cpp b/client/windows/red_pixmap_gdi.cpp
index d4913c49..1c90f3d5 100644
--- a/client/windows/red_pixmap_gdi.cpp
+++ b/client/windows/red_pixmap_gdi.cpp
@@ -29,13 +29,7 @@ struct RedPixmap_p {
HBITMAP prev_bitmap;
};
-static inline int format_to_bpp(RedPixmap::Format format)
-{
- return ((format == RedPixmap::A1) ? 1 : 32);
-}
-
-RedPixmapGdi::RedPixmapGdi(int width, int height, RedPixmap::Format format, bool top_bottom,
- rgb32_t* pallet)
+RedPixmapGdi::RedPixmapGdi(int width, int height, RedPixmap::Format format, bool top_bottom)
: RedPixmap(width, height, format, top_bottom, pallet)
{
ASSERT(format == RedPixmap::ARGB32 || format == RedPixmap::RGB32 || format == RedPixmap::A1);
@@ -52,15 +46,16 @@ RedPixmapGdi::RedPixmapGdi(int width, int height, RedPixmap::Format format, bool
bitmap_info.inf.bmiHeader.biHeight = top_bottom ? -_height : _height;
bitmap_info.inf.bmiHeader.biPlanes = 1;
- bitmap_info.inf.bmiHeader.biBitCount = format_to_bpp(format);
+ bitmap_info.inf.bmiHeader.biBitCount = RedPixmap::format_to_bpp(format);
bitmap_info.inf.bmiHeader.biCompression = BI_RGB;
switch (format) {
case RedPixmap::A1:
- for (int i = 0; i < (1 << format_to_bpp(format)); i++) {
- bitmap_info.inf.bmiColors[i].rgbRed = rgb32_get_red(pallet[i]);
- bitmap_info.inf.bmiColors[i].rgbGreen = rgb32_get_green(pallet[i]);
- bitmap_info.inf.bmiColors[i].rgbBlue = rgb32_get_blue(pallet[i]);
- }
+ bitmap_info.inf.bmiColors[0].rgbRed = 0;
+ bitmap_info.inf.bmiColors[0].rgbGreen = 0;
+ bitmap_info.inf.bmiColors[0].rgbBlue = 0;
+ bitmap_info.inf.bmiColors[1].rgbRed = 0xff;
+ bitmap_info.inf.bmiColors[1].rgbGreen = 0xff;
+ bitmap_info.inf.bmiColors[1].rgbBlue = 0xff;
break;
}
AutoDC dc(create_compatible_dc());