// -=- ScaledPixelBuffer.cxx
+#include <rfb/Exception.h>
#include <rfb/ScaledPixelBuffer.h>
#include <math.h>
using namespace rfb;
ScaledPixelBuffer::ScaledPixelBuffer(U8 **src_data_, int src_width_,
- int src_height_, int scale)
- : bpp(32), scaled_data(0), scale_ratio(1), scale(100) {
+ int src_height_, int scale, PixelFormat pf_)
+ : scaled_data(0), scale_ratio(1), scale(100) {
setSourceBuffer(src_data_, src_width_, src_height_);
+ setPF(pf_);
}
ScaledPixelBuffer::ScaledPixelBuffer()
: src_data(0), src_width(0), src_height(0), scale_ratio(1), scale(100),
- bpp(32), scaled_data(0) {
+ pf(PixelFormat(32,24,0,1,255,255,255,0,8,16)), scaled_data(0) {
}
ScaledPixelBuffer::~ScaledPixelBuffer() {
src_width = w;
src_height = h;
calculateScaledBufferSize();
- recreateScaledBuffer();
+}
+
+void ScaledPixelBuffer::setPF(const PixelFormat &pf_) {
+ if (pf_.depth != 24) {
+ throw rfb::Exception("rfb::ScaledPixelBuffer support only the true colour pixel format.");
+ }
+ pf = pf_;
}
void ScaledPixelBuffer::setScale(int scale_) {
scale = scale_;
scale_ratio = double(scale) / 100;
calculateScaledBufferSize();
- recreateScaledBuffer();
}
}
scaled_width = (int)ceil(src_width * scale_ratio);
scaled_height = (int)ceil(src_height * scale_ratio);
}
-
-void ScaledPixelBuffer::recreateScaledBuffer() {
-}
#include <rdr/types.h>
#include <rfb/Rect.h>
+#include <rfb/PixelFormat.h>
using namespace rdr;
class ScaledPixelBuffer {
public:
- ScaledPixelBuffer(U8 **data, int width, int height, int scale);
+ ScaledPixelBuffer(U8 **data, int width, int height, int scale, PixelFormat pf);
ScaledPixelBuffer();
virtual ~ScaledPixelBuffer();
// Set the new source buffer and its parameters
void setSourceBuffer(U8 **src_data, int w, int h);
+ // Set the new pixel format
+ void setPF(const PixelFormat &pf);
+
// Set the new scale, in percent
virtual void setScale(int scale);
// parameters (width, height, pixel format)
void calculateScaledBufferSize();
- // Recreate the scaled pixel buffer
- virtual void recreateScaledBuffer();
int src_width;
int src_height;
int scaled_width;
int scaled_height;
- int bpp;
+ PixelFormat pf;
int scale;
double scale_ratio;
U8 **src_data;
$(VENDOR_STRING) $(VENDOR_RELEASE) $(STD_DEFINES) ServerOSDefines \
$(VNCDEFINES) -UXFree86LOADER
-#ifdef XFree86Version
+#if defined(XFree86Version) || defined(XorgVersion)
/*
* Make sure XINPUT, XF86VidTune, etc arent defined for the miinitext.o
* used by Xvnc
*/
-EXT_DEFINES = ExtensionDefines -UXF86VIDMODE -UXFreeXDGA -UXF86MISC
+EXT_DEFINES = ExtensionDefines -UXF86VIDMODE -UXFreeXDGA -UXF86MISC -UXF86DRI
#endif
#undef and
}
-#define XVNCVERSION "Free Edition 4.1.1"
+#define XVNCVERSION "TightVNC 1.5 series"
#define XVNCCOPYRIGHT ("Copyright (C) 2002-2005 RealVNC Ltd.\n" \
- "See http://www.realvnc.com for information on VNC.\n")
+ "Copyright (C) 2000-2006 Constantin Kaplinsky\n" \
+ "Copyright (C) 2004-2006 Peter Astrand, Cendio AB\n" \
+ "See http://www.tightvnc.com for information on TightVNC.\n")
extern char *display;
extern "C" {
- /* ddxInitGlobals - called by |InitGlobals| from os/util.c in XOrg */
- void ddxInitGlobals(void)
- {
- }
-
void ddxGiveUp()
{
int i;
void ScaledDIBSectionBuffer::setScale(int scale_) {
if (scale_ == getScale()) return;
- if (src_buffer) {
- delete src_buffer;
- src_buffer = 0;
- }
if (scale_ != 100) {
scaling = true;
- src_buffer = new ManagedPixelBuffer(format, src_width, src_height);
- src_data = &(src_buffer->data);
+ if (!src_buffer) {
+ src_buffer = new ManagedPixelBuffer(format, src_width, src_height);
+ src_data = &(src_buffer->data);
+ }
} else {
scaling = false;
+ if (src_buffer) delete src_buffer;
+ src_buffer = 0;
+ src_data = 0;
}
ScaledPixelBuffer::setScale(scale_);
+ recreateScaledBuffer();
}
-void ScaledDIBSectionBuffer::setPF(const PixelFormat &pf) {
- if (scaling) src_buffer->setPF(pf);
- DIBSectionBuffer::setPF(pf);
+void ScaledDIBSectionBuffer::setPF(const PixelFormat &pf_) {
+ if (scaling) {
+ ScaledPixelBuffer::setPF(pf_);
+ src_buffer->setPF(pf_);
+ }
+ DIBSectionBuffer::setPF(pf_);
scaled_data = data;
}
setItemChecked(IDC_ACCEPT_BELL, dlg->options.acceptBell);
setItemChecked(IDC_AUTO_RECONNECT, dlg->options.autoReconnect);
setItemChecked(IDC_SHOW_TOOLBAR, dlg->options.showToolbar);
+ char scale_values[8][20] = {
+ "25","50","75","90","100","125","150","Auto"
+ };
+ HWND hScaleCombo = GetDlgItem(handle, IDC_COMBO_SCALE);
+ for (int i = 0; i <= 7; i++) {
+ SendMessage(hScaleCombo, CB_INSERTSTRING,
+ (WPARAM)i, (LPARAM)(int FAR*)scale_values[i]);
+ }
+ SetDlgItemText(handle, IDC_COMBO_SCALE, "100");
}
virtual bool onOk() {
dlg->options.shared = isItemChecked(IDC_CONN_SHARED);
#define IDC_FTREMOTELIST 1094
#define IDC_ALLOW_JPEG 1095
#define IDC_FTLOCALRELOAD 1096
+#define IDC_STATIC_SCALE 1097
+#define IDC_COMBO_SCALE 1098
+#define IDC_STATIC_PERCENT 1099
#define ID_TOOLBAR 40002
#define ID_CLOSE 40003
#define ID_OPTIONS 40004
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 134
#define _APS_NEXT_COMMAND_VALUE 40028
-#define _APS_NEXT_CONTROL_VALUE 1097
+#define _APS_NEXT_CONTROL_VALUE 1100
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
CONTROL "Show toolbar",IDC_SHOW_TOOLBAR,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,106,25,100,15
CONTROL "Render cursor locally",IDC_LOCAL_CURSOR,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,7,40,199,15
+ BS_AUTOCHECKBOX | WS_TABSTOP,7,40,99,15
CONTROL "Allow dynamic desktop resizing",IDC_DESKTOP_RESIZE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,55,199,15
CONTROL "Only use protocol version 3.3",IDC_PROTOCOL_3_3,"Button",
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,85,199,15
CONTROL "Offer to automatically reconnect",IDC_AUTO_RECONNECT,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,100,199,15
+ LTEXT "Scale by:",IDC_STATIC_SCALE,106,40,34,15,SS_CENTERIMAGE
+ COMBOBOX IDC_COMBO_SCALE,140,40,40,30,CBS_DROPDOWN | CBS_SORT |
+ WS_VSCROLL | WS_TABSTOP
+ LTEXT "%",IDC_STATIC_PERCENT,185,40,21,15,SS_CENTERIMAGE
END
IDD_INPUTS DIALOG DISCARDABLE 0, 0, 186, 162