mirror of
https://github.com/sheumann/VNCviewGS.git
synced 2024-06-09 20:29:33 +00:00
Use a static (instead of dynamically allocated) buffer for SHR pixels generated from raw decoding.
The program code is moved to a separate segment to make room for the buffer.
This commit is contained in:
parent
141739c985
commit
12999358b5
|
@ -1,6 +1,7 @@
|
||||||
#if __ORCAC__
|
#if __ORCAC__
|
||||||
#pragma lint -1
|
#pragma lint -1
|
||||||
#pragma noroot
|
#pragma noroot
|
||||||
|
segment "VNCview GS";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <window.h>
|
#include <window.h>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#if __ORCAC__
|
#if __ORCAC__
|
||||||
#pragma lint -1
|
#pragma lint -1
|
||||||
#pragma noroot
|
#pragma noroot
|
||||||
|
segment "VNCview GS";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#if __ORCAC__
|
#if __ORCAC__
|
||||||
#pragma lint -1
|
#pragma lint -1
|
||||||
#pragma noroot
|
#pragma noroot
|
||||||
|
segment "VNCview GS";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <window.h>
|
#include <window.h>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#if __ORCAC__
|
#if __ORCAC__
|
||||||
#pragma lint -1
|
#pragma lint -1
|
||||||
#pragma noroot
|
#pragma noroot
|
||||||
|
segment "VNCview GS";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <window.h>
|
#include <window.h>
|
||||||
|
@ -53,8 +54,8 @@ void DoDesktopSize (void) {
|
||||||
|
|
||||||
oldWinHeight = winHeight;
|
oldWinHeight = winHeight;
|
||||||
oldWinWidth = winWidth;
|
oldWinWidth = winWidth;
|
||||||
winHeight = 174;
|
winHeight = WIN_HEIGHT;
|
||||||
winWidth = (hRez == 640) ? 613 : 302;
|
winWidth = (hRez == 640) ? WIN_WIDTH_640 : WIN_WIDTH_320;
|
||||||
if (fbWidth < winWidth)
|
if (fbWidth < winWidth)
|
||||||
winWidth = fbWidth;
|
winWidth = fbWidth;
|
||||||
if (fbHeight < winHeight)
|
if (fbHeight < winHeight)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#if __ORCAC__
|
#if __ORCAC__
|
||||||
#pragma lint -1
|
#pragma lint -1
|
||||||
#pragma noroot
|
#pragma noroot
|
||||||
|
segment "VNCview GS";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <window.h>
|
#include <window.h>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#if __ORCAC__
|
#if __ORCAC__
|
||||||
#pragma lint -1
|
#pragma lint -1
|
||||||
#pragma noroot
|
#pragma noroot
|
||||||
|
segment "VNCview GS";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <window.h>
|
#include <window.h>
|
||||||
|
|
1
mouse.cc
1
mouse.cc
|
@ -1,6 +1,7 @@
|
||||||
#if __ORCAC__
|
#if __ORCAC__
|
||||||
#pragma lint -1
|
#pragma lint -1
|
||||||
#pragma noroot
|
#pragma noroot
|
||||||
|
segment "VNCview GS";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <window.h>
|
#include <window.h>
|
||||||
|
|
34
raw.cc
34
raw.cc
|
@ -1,6 +1,7 @@
|
||||||
#if __ORCAC__
|
#if __ORCAC__
|
||||||
#pragma lint -1
|
#pragma lint -1
|
||||||
#pragma noroot
|
#pragma noroot
|
||||||
|
segment "VNCview GS";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <window.h>
|
#include <window.h>
|
||||||
|
@ -39,6 +40,11 @@ static unsigned long pixels;
|
||||||
static unsigned int drawingLine; /* Line to be drawn while displaying */
|
static unsigned int drawingLine; /* Line to be drawn while displaying */
|
||||||
static BOOLEAN extraByteAdvance;
|
static BOOLEAN extraByteAdvance;
|
||||||
|
|
||||||
|
/* Buffer to hold all SHR pixel data from one update (defined in tables.asm).
|
||||||
|
* Must be big enough: at least (WIN_WIDTH_640/4 + 1) * WIN_HEIGHT. */
|
||||||
|
#define DESTBUF_SIZE 0x8001
|
||||||
|
extern unsigned char destBuf[];
|
||||||
|
|
||||||
static unsigned char *destPtr;
|
static unsigned char *destPtr;
|
||||||
|
|
||||||
/* Ends drawing of a raw rectangle when it is complete or aborted
|
/* Ends drawing of a raw rectangle when it is complete or aborted
|
||||||
|
@ -46,7 +52,6 @@ static unsigned char *destPtr;
|
||||||
*/
|
*/
|
||||||
static void StopRawDrawing (void) {
|
static void StopRawDrawing (void) {
|
||||||
HUnlock(readBufferHndl);
|
HUnlock(readBufferHndl);
|
||||||
free(srcLocInfo.ptrToPixImage); /* Allocated as destPtr */
|
|
||||||
|
|
||||||
displayInProgress = FALSE;
|
displayInProgress = FALSE;
|
||||||
|
|
||||||
|
@ -274,11 +279,7 @@ static void RawDrawLine (void) {
|
||||||
lineBytes = rectWidth/2;
|
lineBytes = rectWidth/2;
|
||||||
}
|
}
|
||||||
|
|
||||||
destPtr = calloc(lineBytes, 1);
|
destPtr = destBuf;
|
||||||
if (!destPtr) { /* Couldn't allocate memory */
|
|
||||||
DoClose(vncWindow);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
srcLocInfo.ptrToPixImage = destPtr;
|
srcLocInfo.ptrToPixImage = destPtr;
|
||||||
srcLocInfo.width = lineBytes;
|
srcLocInfo.width = lineBytes;
|
||||||
|
@ -350,8 +351,6 @@ static void RawDrawLine (void) {
|
||||||
/* Process rectangle data in raw encoding and write it to screen.
|
/* Process rectangle data in raw encoding and write it to screen.
|
||||||
*/
|
*/
|
||||||
void DoRawRect (void) {
|
void DoRawRect (void) {
|
||||||
unsigned long bufferLength;
|
|
||||||
|
|
||||||
pixels = (unsigned long) rectWidth * rectHeight;
|
pixels = (unsigned long) rectWidth * rectHeight;
|
||||||
|
|
||||||
/* Try to read data */
|
/* Try to read data */
|
||||||
|
@ -370,11 +369,9 @@ void DoRawRect (void) {
|
||||||
if (hRez == 640) {
|
if (hRez == 640) {
|
||||||
if (rectWidth & 0x03) { /* Width not an exact multiple of 4 */
|
if (rectWidth & 0x03) { /* Width not an exact multiple of 4 */
|
||||||
lineBytes = rectWidth/4 + 1;
|
lineBytes = rectWidth/4 + 1;
|
||||||
extraByteAdvance = TRUE;
|
|
||||||
}
|
}
|
||||||
else { /* Width is a multiple of 4 */
|
else { /* Width is a multiple of 4 */
|
||||||
lineBytes = rectWidth/4;
|
lineBytes = rectWidth/4;
|
||||||
extraByteAdvance = FALSE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { /* 320 mode */
|
else { /* 320 mode */
|
||||||
|
@ -388,12 +385,21 @@ void DoRawRect (void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bufferLength = lineBytes * rectHeight;
|
/* If we get an oversized update, ignore it and ask for another one.
|
||||||
destPtr = calloc(bufferLength, 1);
|
* Shouldn't normally happen, except possibly if there are outstanding
|
||||||
if (!destPtr) { /* Couldn't allocate memory */
|
* update requests for multiple screen regions due to scrolling.
|
||||||
DoClose(vncWindow);
|
*/
|
||||||
|
if (lineBytes * rectHeight >= DESTBUF_SIZE) {
|
||||||
|
unsigned long contentOrigin;
|
||||||
|
Point * contentOriginPtr = (void *) &contentOrigin;
|
||||||
|
|
||||||
|
contentOrigin = GetContentOrigin(vncWindow);
|
||||||
|
SendFBUpdateRequest(FALSE, contentOriginPtr->h, contentOriginPtr->v,
|
||||||
|
winWidth, winHeight);
|
||||||
|
StopRawDrawing();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
destPtr = destBuf;
|
||||||
|
|
||||||
srcLocInfo.ptrToPixImage = destPtr;
|
srcLocInfo.ptrToPixImage = destPtr;
|
||||||
srcLocInfo.width = lineBytes;
|
srcLocInfo.width = lineBytes;
|
||||||
|
|
|
@ -30,3 +30,10 @@ bigcoltab640b data
|
||||||
bigcoltab320 data
|
bigcoltab320 data
|
||||||
dc i4'BCT320'
|
dc i4'BCT320'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
* Buffer for SHR pixel data generated during raw decoding
|
||||||
|
* Must be big enough to hold at least the full window area full of pixels.
|
||||||
|
|
||||||
|
destBuf data
|
||||||
|
ds $8001
|
||||||
|
end
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#if __ORCAC__
|
#if __ORCAC__
|
||||||
#pragma lint -1
|
#pragma lint -1
|
||||||
#pragma noroot
|
#pragma noroot
|
||||||
|
segment "VNCview GS";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <window.h>
|
#include <window.h>
|
||||||
|
@ -95,8 +96,8 @@ static void ChangeResolution(int rez) {
|
||||||
|
|
||||||
hRez = rez;
|
hRez = rez;
|
||||||
|
|
||||||
winHeight = 174;
|
winHeight = WIN_HEIGHT;
|
||||||
winWidth = (rez == 640) ? 613 : 302;
|
winWidth = (rez == 640) ? WIN_WIDTH_640 : WIN_WIDTH_320;
|
||||||
|
|
||||||
/* Set up pixel translation table for correct graphics mode */
|
/* Set up pixel translation table for correct graphics mode */
|
||||||
if (rez == 320)
|
if (rez == 320)
|
||||||
|
|
|
@ -17,6 +17,10 @@ extern unsigned int rectHeight;
|
||||||
#define encodingCursor 0xffffff11
|
#define encodingCursor 0xffffff11
|
||||||
#define encodingDesktopSize 0xffffff21
|
#define encodingDesktopSize 0xffffff21
|
||||||
|
|
||||||
|
#define WIN_WIDTH_320 302
|
||||||
|
#define WIN_WIDTH_640 613
|
||||||
|
#define WIN_HEIGHT 174
|
||||||
|
|
||||||
extern GrafPortPtr vncWindow;
|
extern GrafPortPtr vncWindow;
|
||||||
|
|
||||||
/* VNC session window dimensions */
|
/* VNC session window dimensions */
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#if __ORCAC__
|
#if __ORCAC__
|
||||||
#pragma lint -1
|
#pragma lint -1
|
||||||
#pragma noroot
|
#pragma noroot
|
||||||
|
segment "VNCview GS";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#if __ORCAC__
|
#if __ORCAC__
|
||||||
#pragma lint -1
|
#pragma lint -1
|
||||||
|
segment "VNCview GS";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
|
Loading…
Reference in New Issue
Block a user