Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/external/source/vncdll/winvnc/translate.cpp
Views: 11780
/*1* translate.c - translate between different pixel formats2*/34/*5* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.6*7* This is free software; you can redistribute it and/or modify8* it under the terms of the GNU General Public License as published by9* the Free Software Foundation; either version 2 of the License, or10* (at your option) any later version.11*12* This software is distributed in the hope that it will be useful,13* but WITHOUT ANY WARRANTY; without even the implied warranty of14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15* GNU General Public License for more details.16*17* You should have received a copy of the GNU General Public License18* along with this software; if not, write to the Free Software19* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,20* USA.21*/2223#include "stdhdrs.h"2425#include "translate.h"26#include <stdio.h>27#include "rfb.h"2829#define CONCAT2(a,b) a##b30#define CONCAT2E(a,b) CONCAT2(a,b)31#define CONCAT4(a,b,c,d) a##b##c##d32#define CONCAT4E(a,b,c,d) CONCAT4(a,b,c,d)3334#define OUTBPP 835#include "tableinittctemplate.cpp"36#include "tableinitcmtemplate.cpp"37#define INBPP 838#include "tabletranstemplate.cpp"39#undef INBPP40#define INBPP 1641#include "tabletranstemplate.cpp"42#undef INBPP43#define INBPP 3244#include "tabletranstemplate.cpp"45#undef INBPP46#undef OUTBPP4748#define OUTBPP 1649#include "tableinittctemplate.cpp"50#include "tableinitcmtemplate.cpp"51#define INBPP 852#include "tabletranstemplate.cpp"53#undef INBPP54#define INBPP 1655#include "tabletranstemplate.cpp"56#undef INBPP57#define INBPP 3258#include "tabletranstemplate.cpp"59#undef INBPP60#undef OUTBPP6162#define OUTBPP 3263#include "tableinittctemplate.cpp"64#include "tableinitcmtemplate.cpp"65#define INBPP 866#include "tabletranstemplate.cpp"67#undef INBPP68#define INBPP 1669#include "tabletranstemplate.cpp"70#undef INBPP71#define INBPP 3272#include "tabletranstemplate.cpp"73#undef INBPP74#undef OUTBPP7576rfbInitTableFnType rfbInitTrueColourSingleTableFns[3] = {77rfbInitTrueColourSingleTable8,78rfbInitTrueColourSingleTable16,79rfbInitTrueColourSingleTable3280};8182rfbInitTableFnType rfbInitColourMapSingleTableFns[3] = {83rfbInitColourMapSingleTable8,84rfbInitColourMapSingleTable16,85rfbInitColourMapSingleTable3286};8788rfbInitTableFnType rfbInitTrueColourRGBTablesFns[3] = {89rfbInitTrueColourRGBTables8,90rfbInitTrueColourRGBTables16,91rfbInitTrueColourRGBTables3292};9394rfbTranslateFnType rfbTranslateWithSingleTableFns[3][3] = {95{ rfbTranslateWithSingleTable8to8,96rfbTranslateWithSingleTable8to16,97rfbTranslateWithSingleTable8to32 },98{ rfbTranslateWithSingleTable16to8,99rfbTranslateWithSingleTable16to16,100rfbTranslateWithSingleTable16to32 },101{ rfbTranslateWithSingleTable32to8,102rfbTranslateWithSingleTable32to16,103rfbTranslateWithSingleTable32to32 }104};105106rfbTranslateFnType rfbTranslateWithRGBTablesFns[3][3] = {107{ rfbTranslateWithRGBTables8to8,108rfbTranslateWithRGBTables8to16,109rfbTranslateWithRGBTables8to32 },110{ rfbTranslateWithRGBTables16to8,111rfbTranslateWithRGBTables16to16,112rfbTranslateWithRGBTables16to32 },113{ rfbTranslateWithRGBTables32to8,114rfbTranslateWithRGBTables32to16,115rfbTranslateWithRGBTables32to32 }116};117118119120// rfbTranslateNone is used when no translation is required.121122void123rfbTranslateNone(char *table, rfbPixelFormat *in, rfbPixelFormat *out,124char *iptr, char *optr, int bytesBetweenInputLines,125int width, int height)126{127int bytesPerOutputLine = width * (out->bitsPerPixel / 8);128129while (height > 0) {130memcpy(optr, iptr, bytesPerOutputLine);131iptr += bytesBetweenInputLines;132optr += bytesPerOutputLine;133height--;134}135}136137138139