#if ENABLE(TIZEN_CAIROGLES_IMAGE_CACHE) || ENABLE(TIZEN_USE_XPIXMAP_DECODED_IMAGESOURCE)
#include <cairo-gl.h>
#if ENABLE(TIZEN_CAIROGLES_IMAGE_AUTOSCALE)
-#define CAIRO_GL_SURFACE_MAX_WIDTH 4096
-#define CAIRO_GL_SURFACE_MAX_HEIGHT 4096
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
#endif
#endif
}
int current_width = original_width;
int current_height = original_height;
+ static int cairo_gl_surface_max_size = 0;
+ if(cairo_gl_surface_max_size < 1)
+ glGetIntegerv(GL_MAX_TEXTURE_SIZE, &cairo_gl_surface_max_size);
#endif
if (surfaceType == CAIRO_SURFACE_TYPE_IMAGE && cairo_surface_get_type(surface) != CAIRO_SURFACE_TYPE_IMAGE) {
int w = cairo_image_surface_get_width(surface);
int h = cairo_image_surface_get_height(surface);
#if ENABLE(TIZEN_CAIROGLES_IMAGE_AUTOSCALE)
- if( w > CAIRO_GL_SURFACE_MAX_WIDTH || h > CAIRO_GL_SURFACE_MAX_HEIGHT) {
- float scaleX = CAIRO_GL_SURFACE_MAX_WIDTH / (float)w;
- float scaleY = CAIRO_GL_SURFACE_MAX_HEIGHT / (float)h;
+ if( w > cairo_gl_surface_max_size || h > cairo_gl_surface_max_size) {
+ float scaleX = cairo_gl_surface_max_size / (float)w;
+ float scaleY = cairo_gl_surface_max_size / (float)h;
RefPtr<cairo_surface_t> shrink_image = 0;
float scale = scaleX < scaleY ? scaleX : scaleY;
shrink_image = adoptRef(cairo_image_surface_create(cairo_image_surface_get_format (surface),