xfreerdp-client: initial xrender scaling test

This commit is contained in:
C-o-r-E 2013-05-02 20:31:22 -04:00
parent c4cbe69b9b
commit 9ac3f599d6
3 changed files with 133 additions and 6 deletions

View File

@ -101,12 +101,17 @@ set(XI_FEATURE_TYPE "RECOMMENDED")
set(XI_FEATURE_PURPOSE "input")
set(XI_FEATURE_DESCRIPTION "X11 input extension")
set(XRENDER_FEATURE_TYPE "RECOMMENDED")
set(XRENDER_FEATURE_PURPOSE "rendering")
set(XRENDER_FEATURE_DESCRIPTION "X11 render extension")
find_feature(XShm ${XSHM_FEATURE_TYPE} ${XSHM_FEATURE_PURPOSE} ${XSHM_FEATURE_DESCRIPTION})
find_feature(Xinerama ${XINERAMA_FEATURE_TYPE} ${XINERAMA_FEATURE_PURPOSE} ${XINERAMA_FEATURE_DESCRIPTION})
find_feature(Xext ${XEXT_FEATURE_TYPE} ${XEXT_FEATURE_PURPOSE} ${XEXT_FEATURE_DESCRIPTION})
find_feature(Xcursor ${XCURSOR_FEATURE_TYPE} ${XCURSOR_FEATURE_PURPOSE} ${XCURSOR_FEATURE_DESCRIPTION})
find_feature(Xv ${XV_FEATURE_TYPE} ${XV_FEATURE_PURPOSE} ${XV_FEATURE_DESCRIPTION})
find_feature(Xi ${XI_FEATURE_TYPE} ${XI_FEATURE_PURPOSE} ${XI_FEATURE_DESCRIPTION})
find_feature(Xrender ${XRENDER_FEATURE_TYPE} ${XRENDER_FEATURE_PURPOSE} ${XRENDER_FEATURE_DESCRIPTION})
if(WITH_XINERAMA)
add_definitions(-DWITH_XINERAMA)
@ -138,15 +143,21 @@ if(WITH_XI)
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XI_LIBRARIES})
endif()
if(WITH_XRENDER)
add_definitions(-DWITH_XRENDER)
include_directories(${XRENDER_INCLUDE_DIRS})
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XRENDER_LIBRARIES})
endif()
#find_package(ImageMagick COMPONENTS MagickCore)
#include_directories(${ImageMagick_MagickCore_INCLUDE_DIRS})
#set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${ImageMagick_MagickCore_LIBRARIES})
#SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} /usr/include/ImageMagick-6)
#SET(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -I/usr/include/ImageMagick-6)
message(Found MagickCore: ${ImageMagick_MagickCore_FOUND})
message(INCLUDE: ${ImageMagick_MagickCore_INCLUDE_DIRS})
message(LIBS: ${${MODULE_PREFIX}_LIBS})
#message(Found MagickCore: ${ImageMagick_MagickCore_FOUND})
#message(INCLUDE: ${ImageMagick_MagickCore_INCLUDE_DIRS})
#message(LIBS: ${${MODULE_PREFIX}_LIBS})
#if(NOT ${ImageMagick_MagickCore_FOUND})
@ -156,8 +167,8 @@ message(LIBS: ${${MODULE_PREFIX}_LIBS})
#endif()
#ubuntu
include_directories(/usr/include/ImageMagick)
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} /usr/lib/x86_64-linux-gnu/libMagickCore.so.5)
#include_directories(/usr/include/ImageMagick)
#set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} /usr/lib/x86_64-linux-gnu/libMagickCore.so.5)

View File

@ -25,6 +25,10 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#ifdef WITH_XRENDER
#include <X11/extensions/Xrender.h>
#endif
#ifdef WITH_XI
#include <X11/extensions/XInput2.h>
#endif
@ -210,7 +214,75 @@ void xf_sw_end_paint(rdpContext* context)
//combine xfi->primary with xfi->image
XPutImage(xfi->display, xfi->primary, xfi->gc, xfi->image, x, y, x, y, w, h);
XCopyArea(xfi->display, xfi->primary, xfi->window->handle, xfi->gc, x, y, w, h, x, y);
//XCopyArea(xfi->display, xfi->primary, xfi->window->handle, xfi->gc, x, y, w, h, x, y);
if(1)//(rtest < 1)
{
Picture pic_prim;
Picture pic_win;
XRenderPictureAttributes pa;
XRenderPictFormat* picFormat;
picFormat = XRenderFindStandardFormat(xfi->display, PictStandardRGB24);
pa.subwindow_mode = IncludeInferiors;//wtf is this?
pic_prim = XRenderCreatePicture(xfi->display, xfi->primary, picFormat, CPSubwindowMode, &pa);
pic_win = XRenderCreatePicture(xfi->display, xfi->window->handle, picFormat, CPSubwindowMode, &pa);
//normal
//XRenderComposite(xfi->display, PictOpSrc, pic_prim, pic_prim, pic_win, x, y, x, y, x, y, w, h);
//scale
{
int w2, h2;
int x2, y2;
XTransform transform;
double scale = 1.5;
w2 = (int)(w / scale);
h2 = (int)(h / scale);
x2 = (int)(x / scale);
y2 = (int)(y / scale);
if(w2 == 0)
w2++;
if(h2 == 0)
h2++;
transform.matrix[0][0] = XDoubleToFixed(scale);
transform.matrix[0][1] = XDoubleToFixed(0.0);
transform.matrix[0][2] = XDoubleToFixed(0.0);
transform.matrix[1][0] = XDoubleToFixed(0.0);
transform.matrix[1][1] = XDoubleToFixed(scale);
transform.matrix[1][2] = XDoubleToFixed(0.0);
transform.matrix[2][0] = XDoubleToFixed(0.0);
transform.matrix[2][1] = XDoubleToFixed(0.0);
transform.matrix[2][2] = XDoubleToFixed(1.0);
XRenderSetPictureTransform(xfi->display, pic_prim, &transform);
XRenderComposite(xfi->display, PictOpSrc, pic_prim, 0, pic_win, x, y, x, y, x, y, w, h);
}
rtest++;
}
/*
if(1)//(rtest < 2)
{

44
cmake/FindXrender.cmake Normal file
View File

@ -0,0 +1,44 @@
# - Find Xrender
# Find the Xrender libraries
#
# This module defines the following variables:
# Xrender_FOUND - true if Xrender_INCLUDE_DIR & Xrender_LIBRARY are found
# Xrender_LIBRARIES - Set when Xrender_LIBRARY is found
# Xrender_INCLUDE_DIRS - Set when Xrender_INCLUDE_DIR is found
#
# Xrender_INCLUDE_DIR - where to find Xrendernput2.h, etc.
# Xrender_LIBRARY - the Xrender library
#
#=============================================================================
# Copyright 2013 Corey Clayton <can.of.tuna@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#=============================================================================
find_path(Xrender_INCLUDE_DIR NAMES X11/extensions/Xrender.h
DOC "The Xrender include directory")
find_library(Xrender_LIBRARY NAMES Xrender
DOC "The Xrender library")
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Xrender DEFAULT_MSG Xrender_LIBRARY Xrender_INCLUDE_DIR)
if(Xrender_FOUND)
set(XRENDER_LIBRARIES ${Xrender_LIBRARY})
set(XRENDER_INCLUDE_DIRS ${Xrender_INCLUDE_DIR})
endif()
mark_as_advanced(Xrender_INCLUDE_DIR Xrender_LIBRARY)