Hello all,
I'm still unable to get DirectFB to rotate by 90 or 270 degrees for a
display in portrait orientation; the program just ignores the parameter
and displays in zero degrees.
As Chuck McManis suggested, I now wrote a small test program to
illustrate the problem. The programm vid-test opens a full-screen view
and draws one rectangle, then waits for any keyboard input to quit.
I compiled this using the git version of DirectFB with the following
makefile:
vid-test: vid-test.o
g++ -o vid-test -lidn -lpthread -ldirectfb -ldfb++ vid-test.o
vid-test.o: vid-test.cpp
g++ -I /usr/include/directfb/ -I /usr/include/dfb++/ -c
vid-test.cpp
After that, I call the program using the following command line:
vid-test --dfb:layer-rotate=<x>,mode=1920x1080,depth=32,pixelformat=RGB32
where <x> is replaced by 0, 90, 180, or 270. 0 and 180 work as expected,
90 and 270 don't.
I'm banging my head against the wall here, expecially since the DirectFB
website suggests rotation has been working in DirectFB *for three
years*. Can anybody tell me what exactly I am doing wrong, and more
importantly, how to fix it? Otherwise, my only alternative would be
rewriting the whole 10000-line program using another display library
that really provides portrait mode and not just claims to do so (if
there even is such a thing).
Program follows:
------------------------------------------------------------------------------------------------------------------------------------------------------
#define _REENTRANT
#define __USE_BSD
#include <memory>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/signal.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <dfb++.h>
static IDirectFB *dfb = NULL;
static IDirectFBSurface *primary = NULL;
bool RunMe;
static IDirectFBInputDevice *keyboard = NULL;
static IDirectFBEventBuffer *keyboard_buffer = NULL;
DFBInputEvent keyboard_event;
DFBSurfaceDescription dsc;
IDirectFBDisplayLayer *prim_layer;
IDirectFBSurface *base_surface;
int main (int argc, char **argv)
{
printf("**********************************************************************\n");
try
{
printf("Calling dfb:Init...\n");
DirectFB::Init (&argc, &argv);
printf("Calling dfb:Create...\n");
dfb=DirectFB::Create();
printf("Calling dfb:GetDisplayLayer...\n");
prim_layer=dfb->GetDisplayLayer(DLID_PRIMARY);
if (prim_layer==NULL)
printf("Couldn't get primary layer\n");
printf("Calling dfb:SetCoopLevel...\n");
dfb->SetCooperativeLevel(DFSCL_EXCLUSIVE);
printf("Calling dfb:GetSurface...\n");
base_surface=prim_layer->GetSurface();
if (base_surface==NULL)
printf("Couldn't get base surface\n");
printf("Setting dfb:GetInputDevice...\n");
keyboard=dfb->GetInputDevice(DIDID_KEYBOARD);
if (keyboard!=NULL)
keyboard_buffer=keyboard->CreateEventBuffer();
else
printf("Keyboard input device not found...\n");
dsc.flags = DSDESC_CAPS;
DFB_ADD_SURFACE_CAPS( dsc.caps, DSCAPS_PRIMARY);
DFB_ADD_SURFACE_CAPS( dsc.caps, DSCAPS_SYSTEMONLY);
// DFB_ADD_SURFACE_CAPS( dsc.caps, DSCAPS_VIDEOONLY);
DFB_ADD_SURFACE_CAPS( dsc.caps, DSCAPS_DOUBLE);
DFB_ADD_SURFACE_DESC(dsc.flags, DSDESC_PIXELFORMAT);
dsc.pixelformat= DSPF_RGB32;
printf("Create primary surface...\n");
primary=dfb->CreateSurface(dsc);
primary->SetColor(0xff,0xff,0xff);
primary->DrawRectangle(100,100,400,200);
RunMe=true;
while(RunMe==true)
{
while (keyboard_buffer->HasEvent())
{
keyboard_buffer->GetEvent(DFB_EVENT(&keyboard_event));
if (keyboard_event.type==DIET_KEYPRESS)
{
RunMe=false;
};
};
primary->Flip(NULL, DSFLIP_WAITFORSYNC);
};
}
catch (DFBException *ex)
{
std::cerr << std::endl;
std::cerr << "Caught exception!" << std::endl;
std::cerr << " -- " << ex << std::endl;
RunMe=false;
};
printf("Releasing input devices...\n");
keyboard->Release();
printf("Releasing surfaces...\n");
primary->Release();
printf("Releasing DirectFB...\n");
dfb->Release();
printf("Quitting...\n");
exit(EXIT_SUCCESS);
printf("**********************************************************************\n");
}
------------------------------------------------------------------------------------------------------------------------------------------------------
Any help appreciated
Kasi Mir
_______________________________________________
directfb-users mailing list
directfb-users@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users