From 1ae2eb0b58a028349d3857eb079cad389e67aa53 Mon Sep 17 00:00:00 2001 From: Constantin Kaplinsky Date: Fri, 26 May 2006 05:24:24 +0000 Subject: [PATCH] Merged the changes from revision range 582:588 into reorganized sources. These changes accidentally were not included in files copied during directory structure reorganization. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@594 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- common/rfb/ScaledPixelBuffer.cxx | 20 +++++++++++------- common/rfb/ScaledPixelBuffer.h | 10 +++++---- unix/xc/programs/Xserver/vnc/Xvnc/Imakefile | 4 ++-- unix/xc/programs/Xserver/vnc/Xvnc/xvnc.cc | 11 ++++------ win/rfb_win32/ScaledDIBSectionBuffer.cxx | 23 +++++++++++++-------- win/vncviewer/OptionsDialog.cxx | 9 ++++++++ win/vncviewer/resource.h | 5 ++++- win/vncviewer/vncviewer.rc | 6 +++++- 8 files changed, 56 insertions(+), 32 deletions(-) diff --git a/common/rfb/ScaledPixelBuffer.cxx b/common/rfb/ScaledPixelBuffer.cxx index bf4612de..5892a97b 100644 --- a/common/rfb/ScaledPixelBuffer.cxx +++ b/common/rfb/ScaledPixelBuffer.cxx @@ -18,6 +18,7 @@ // -=- ScaledPixelBuffer.cxx +#include #include #include @@ -27,15 +28,16 @@ using namespace rdr; 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() { @@ -46,7 +48,13 @@ void ScaledPixelBuffer::setSourceBuffer(U8 **src_data_, int w, int h) { 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_) { @@ -54,7 +62,6 @@ void ScaledPixelBuffer::setScale(int scale_) { scale = scale_; scale_ratio = double(scale) / 100; calculateScaledBufferSize(); - recreateScaledBuffer(); } } @@ -127,6 +134,3 @@ void ScaledPixelBuffer::calculateScaledBufferSize() { scaled_width = (int)ceil(src_width * scale_ratio); scaled_height = (int)ceil(src_height * scale_ratio); } - -void ScaledPixelBuffer::recreateScaledBuffer() { -} diff --git a/common/rfb/ScaledPixelBuffer.h b/common/rfb/ScaledPixelBuffer.h index 3b6aa7ef..d69f0ac1 100644 --- a/common/rfb/ScaledPixelBuffer.h +++ b/common/rfb/ScaledPixelBuffer.h @@ -24,6 +24,7 @@ #include #include +#include using namespace rdr; @@ -31,7 +32,7 @@ namespace rfb { 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(); @@ -51,6 +52,9 @@ namespace rfb { // 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); @@ -68,14 +72,12 @@ namespace rfb { // 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; diff --git a/unix/xc/programs/Xserver/vnc/Xvnc/Imakefile b/unix/xc/programs/Xserver/vnc/Xvnc/Imakefile index 93885ae3..1223c576 100644 --- a/unix/xc/programs/Xserver/vnc/Xvnc/Imakefile +++ b/unix/xc/programs/Xserver/vnc/Xvnc/Imakefile @@ -60,12 +60,12 @@ DEFINES = $(OS_DEFINES) $(SHMDEF) $(MMAPDEF) $(FB_DEFINES) \ $(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 diff --git a/unix/xc/programs/Xserver/vnc/Xvnc/xvnc.cc b/unix/xc/programs/Xserver/vnc/Xvnc/xvnc.cc index fcb73e65..5daf663d 100644 --- a/unix/xc/programs/Xserver/vnc/Xvnc/xvnc.cc +++ b/unix/xc/programs/Xserver/vnc/Xvnc/xvnc.cc @@ -87,9 +87,11 @@ extern "C" { #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; @@ -203,11 +205,6 @@ vfbBitsPerPixel(int depth) extern "C" { - /* ddxInitGlobals - called by |InitGlobals| from os/util.c in XOrg */ - void ddxInitGlobals(void) - { - } - void ddxGiveUp() { int i; diff --git a/win/rfb_win32/ScaledDIBSectionBuffer.cxx b/win/rfb_win32/ScaledDIBSectionBuffer.cxx index e6c15b8e..bd6b4d37 100644 --- a/win/rfb_win32/ScaledDIBSectionBuffer.cxx +++ b/win/rfb_win32/ScaledDIBSectionBuffer.cxx @@ -40,23 +40,28 @@ ScaledDIBSectionBuffer::~ScaledDIBSectionBuffer() { 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; } diff --git a/win/vncviewer/OptionsDialog.cxx b/win/vncviewer/OptionsDialog.cxx index 2e43b38f..5bb21fd9 100644 --- a/win/vncviewer/OptionsDialog.cxx +++ b/win/vncviewer/OptionsDialog.cxx @@ -163,6 +163,15 @@ public: 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); diff --git a/win/vncviewer/resource.h b/win/vncviewer/resource.h index 5493fd0b..7fb32fe3 100644 --- a/win/vncviewer/resource.h +++ b/win/vncviewer/resource.h @@ -120,6 +120,9 @@ #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 @@ -148,7 +151,7 @@ #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 diff --git a/win/vncviewer/vncviewer.rc b/win/vncviewer/vncviewer.rc index ea5dd65c..b71f1802 100644 --- a/win/vncviewer/vncviewer.rc +++ b/win/vncviewer/vncviewer.rc @@ -223,7 +223,7 @@ BEGIN 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", @@ -232,6 +232,10 @@ BEGIN "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 -- 2.39.5