45 #include <private/qimage_p.h> 46 #include <private/qwindowsurface_gl_p.h> 47 #include <private/qeglcontext_p.h> 48 #include <private/qapplication_p.h> 49 #include <private/qgraphicssystem_runtime_p.h> 80 Qt::ImageConversionFlags flags)
82 void *rawResource = static_cast <
void *> (((
QImage &) image).data_ptr()->data);
91 qWarning(
"QMeeGoPixmapData::fromImage called on non-know resource. Falling back...");
99 qFatal(
"Trying to build pixmap with an empty/null softimage!");
105 bool textureIsBound =
false;
107 GLint newWidth, newHeight;
109 glGenTextures(1, &newTextureId);
117 GLint err = glGetError();
119 textureIsBound =
true;
127 if (textureIsBound) {
134 qWarning(
"Failed to create a texture from a shared image!");
135 glDeleteTextures(1, &newTextureId);
147 glGenTextures(1, &textureId);
169 glDeleteTextures(1, &textureId);
175 qWarning(
"Failed to create shared image from pixmap/texture!");
188 qWarning(
"Ooops, looks like softImage changed dimensions since last updated! Corruption ahead?!");
197 while (i.hasNext()) {
199 if (i.value()->handle ==
h)
208 void *raw = static_cast <
void *> (((
QImage) si).data_ptr()->data);
214 info->rawFormat = si.
format();
218 if (info->handle != handle || info->rawFormat != si.
format())
219 qWarning(
"Inconsistency detected: overwriting entry in sharedImagesMap but handle/format different");
static void registerSharedImage(Qt::HANDLE handle, const QImage &si)
#define GL_TEXTURE_MIN_FILTER
virtual void fromImage(const QImage &image, Qt::ImageConversionFlags flags)
static mach_timebase_info_data_t info
unsigned short * convertARGB32_to_RGBA4444(const unsigned char *in, int width, int height, int stride)
static bool eglDestroySharedImageNOK(EGLDisplay dpy, EGLNativeSharedImageTypeNOK img)
static EGLint preserved_image_attribs[]
bool isNull() const
Returns true if it is a null image, otherwise returns false.
Q_OPENGL_EXPORT QGLWidget * qt_gl_share_widget()
unsigned short * convertRGB32_to_RGB565(const unsigned char *in, int width, int height, int stride)
#define GL_TEXTURE_WRAP_S
bool hasAlphaChannel() const
Returns true if the image has a format that respects the alpha channel, otherwise returns false...
int bytesPerLine() const
Returns the number of bytes per image scanline.
The QHash class is a template class that provides a hash-table-based dictionary.
void fromTexture(GLuint textureId, int w, int h, bool alpha)
QGLContext::BindOptions options
Format format() const
Returns the format of the image.
void * EGLNativeSharedImageTypeNOK
PixelType pixelType() const
QGLTexture * texture() const
#define GL_UNSIGNED_SHORT_5_6_5
static bool destroyEGLSharedImage(Qt::HANDLE h)
Q_GUI_EXPORT EGLDisplay display()
QPixmapData * createCompatiblePixmapData() const
void ensureCreated() const
static bool eglQueryImageNOK(EGLDisplay dpy, EGLImageKHR image, EGLint prop, EGLint *v)
Q_GUI_EXPORT EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img)
The QGLContext class encapsulates an OpenGL rendering context.
void resize(int width, int height)
Q_CORE_EXPORT void qWarning(const char *,...)
The QImage class provides a hardware-independent image representation that allows direct access to th...
static QHash< void *, QMeeGoImageInfo * > sharedImagesMap
unsigned char * convertBGRA32_to_RGBA32(const unsigned char *in, int width, int height, int stride)
#define GL_TEXTURE_WRAP_T
uchar * bits()
Returns a pointer to the first pixel data.
Q_CORE_EXPORT void qFatal(const char *,...)
#define EGL_IMAGE_PRESERVED_KHR
int width() const
Returns the width of the image.
static QEglContext * currentContext(QEgl::API api)
static Qt::HANDLE imageToEGLSharedImage(const QImage &image)
static void ensureInitialized()
void * data_ptr(const QTransform &t)
virtual QImage toImage() const
int height() const
Returns the height of the image.
virtual void fromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage)
Q_GUI_EXPORT EGLImageKHR eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list)
#define GL_TEXTURE_MAG_FILTER
void fromImage(const QImage &image, Qt::ImageConversionFlags flags)
virtual void updateFromSoftImage()
static EGLNativeSharedImageTypeNOK eglCreateSharedImageNOK(EGLDisplay dpy, EGLImageKHR image, EGLint *props)
#define EGL_SHARED_IMAGE_NOK
#define EGL_GL_TEXTURE_2D_KHR
#define glEGLImageTargetTexture2DOES