From 9ee1545d6d4087156b69d56fe5d068ae0807e955 Mon Sep 17 00:00:00 2001 From: JosePereira Date: Sat, 5 May 2012 14:49:14 +0100 Subject: [PATCH] forgot to add --- jni/vnc/displaybinder.cpp | 75 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100755 jni/vnc/displaybinder.cpp diff --git a/jni/vnc/displaybinder.cpp b/jni/vnc/displaybinder.cpp new file mode 100755 index 0000000..703c8f6 --- /dev/null +++ b/jni/vnc/displaybinder.cpp @@ -0,0 +1,75 @@ +/* +droid vnc server - Android VNC server +Copyright (C) 2009 Jose Pereira + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 3 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "displaybinder.h" +#include "common.h" + +#include +#include +#include + +#include +#include +#include + +using namespace android; + +ScreenshotClient *screenshotclient; + +extern "C" int initGingerbreadMethod() +{ + + L("--Initializing gingerbread access method--\n"); + + screenshotclient=new ScreenshotClient(); + int err=screenshotclient->update(); + if (err != NO_ERROR) { + L("screen capture failed: %s\n", strerror(-err)); + //mandar msg incompatible + return -1; + } + + PixelFormat f=screenshotclient->getFormat(); + + PixelFormatInfo pf; + getPixelFormatInfo(f,&pf); + + + displayInfo.bpp = pf.bitsPerPixel; + displayInfo.width = screenshotclient->getWidth(); + displayInfo.height = screenshotclient->getHeight();; + displayInfo.size = pf.bitsPerPixel*displayInfo.width*displayInfo.height/CHAR_BIT; + displayInfo.red_offset = pf.l_red; + displayInfo.red_length = pf.h_red; + displayInfo.green_offset = pf.l_green; + displayInfo.green_length = pf.h_green-pf.h_red; + displayInfo.blue_offset = pf.l_blue; + displayInfo.blue_length = pf.h_blue-pf.h_green; + displayInfo.alpha_offset = pf.l_alpha; + displayInfo.alpha_length = pf.h_alpha-pf.h_blue; + + return 0; + } + +extern "C" void updateScreen() +{ + screenshotclient->update(); + gingerbuf=(unsigned int*)screenshotclient->getPixels(); +} +