bool success = true;
bool redraw = false;
- Scene& scene = *(executor->getScene());
+ Scene* scene = (executor->getScene());
- CommandListIterator iter = scene.m_toBeCommittedList.begin();
- CommandListIterator iterEnd = scene.m_toBeCommittedList.end();
+ CommandListIterator iter = scene->m_toBeCommittedList.begin();
+ CommandListIterator iterEnd = scene->m_toBeCommittedList.end();
for (; iter != iterEnd; ++iter)
{
delete command;
}
}
- scene.m_toBeCommittedList.clear();
+ scene->m_toBeCommittedList.clear();
ExecutionResult returnValue = ExecutionFailed;
// pseudo require EGL to have been initialised
// we dont really need the handle
};
- void swapPixmap(unsigned char* src,unsigned char* dest,unsigned int width,unsigned int height,bool swaprgb);
+ void swapPixmap(unsigned char* src,unsigned char* dest,unsigned int width,unsigned int height,bool swaprgb,bool includeAlpha);
bool bindSurfaceTexture(Surface* surface);
void createClientBuffer(Surface* surface);
void destroyClientBuffer(Surface* surface);
GLenum sourceType = GL_RGBA;
unsigned char* swapedData = NULL;
bool swaprgb = false;
+ bool includeAlpha = false;
if (surface != NULL )
{
nativeSurface = (XPlatformSurface*)surface->platform;
glBindTexture(GL_TEXTURE_2D, nativeSurface->texture);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- if ( xim->depth == 24 )
+ if ( surface->getPixelFormat() == PIXELFORMAT_RGB888)
{
targetType = GL_RGB;
sourceType = GL_RGB;
- swaprgb = true;
+ swaprgb = true;
swapedData = new unsigned char[surface->OriginalSourceWidth*surface->OriginalSourceHeight*3];
- } else {
- swapedData = new unsigned char[surface->OriginalSourceWidth*surface->OriginalSourceHeight*4];
- }
- swapPixmap((unsigned char*)xim->data, swapedData, surface->OriginalSourceWidth, surface->OriginalSourceHeight,swaprgb);
+ }
+ else if ( surface->getPixelFormat() == PIXELFORMAT_RGBA8888)
+ {
+ if (xim->depth == 24)
+ {
+ includeAlpha = true;
+ }
+ swapedData = new unsigned char[surface->OriginalSourceWidth*surface->OriginalSourceHeight*4];
+ }
+ else
+ {
+ LOG_ERROR("X11CopyGLES","Pixelformat currently not supported : " << surface->getPixelFormat());
+ XDestroyImage(xim);
+ return false;
+ }
+ swapPixmap((unsigned char*)xim->data, swapedData, surface->OriginalSourceWidth, surface->OriginalSourceHeight,swaprgb,includeAlpha);
glTexImage2D(GL_TEXTURE_2D, 0, sourceType, surface->OriginalSourceWidth, surface->OriginalSourceHeight, 0, targetType, GL_UNSIGNED_BYTE, swapedData);
XDestroyImage(xim);
delete[] swapedData;
}
return false;
}
-void X11CopyGLES::swapPixmap(unsigned char* src,unsigned char* dest, unsigned int width,unsigned int height,bool swaprgb)
+void X11CopyGLES::swapPixmap(unsigned char* src,unsigned char* dest, unsigned int width,unsigned int height,bool swaprgb,bool includeAlpha)
{
unsigned int count = 0;
if (swaprgb == false)
dest[j*4]=src[j*4+2];
dest[j*4+1]=src[j*4+1];
dest[j*4+2]=src[j*4];
- dest[j*4+3]=src[j*4+3];
+ dest[j*4+3]=src[j*4+3];
+ if (includeAlpha)
+ {
+ dest[j*4+3]=255;
+ }
}
} else {
- count = width*height;
+ count = width*height;
for (int j=0;j<count; j++)
{
dest[j*3]=src[j*3+2];