check minimum size for gl canvas
authorKyungjin Kim <gen.kim@samsung.com>
Tue, 30 Apr 2013 12:08:11 +0000 (21:08 +0900)
committerKyungjin Kim <gen.kim@samsung.com>
Tue, 30 Apr 2013 12:12:22 +0000 (21:12 +0900)
[Title] check minimum size for gl canvas
[Issue#] N/A
[Problem] N_SE-36822
[Cause] if the canvas size is too small, no benefit to acceletate it
[Solution] set minimum size to 32 for gl canvas

Change-Id: I6377caae6a4ba7c742bd6ecb40b6ac4b02a18457

Source/WebCore/html/HTMLCanvasElement.cpp

index 148510b..c792ee5 100644 (file)
@@ -80,6 +80,8 @@ static const int DefaultHeight = 150;
 #if ENABLE(TIZEN_CANVAS_CAIRO_GLES_RENDERING)
 static const int MaxCairoGlSizeWidth = 4096;
 static const int MaxCairoGlSizeHeight = 4096;
+static const int MinCairoGlSizeWidth = 32;
+static const int MinCairoGlSizeHeight = 32;
 #endif
 // Firefox limits width/height to 32767 pixels, but slows down dramatically before it
 // reaches that limit. We limit by area instead, giving us larger maximum dimensions,
@@ -520,7 +522,7 @@ bool HTMLCanvasElement::shouldAccelerate(const IntSize& size) const
     return true;
 #elif ENABLE(TIZEN_ACCELERATED_2D_CANVAS_EFL)
 #if ENABLE(TIZEN_CANVAS_CAIRO_GLES_RENDERING)
-    if (size.width() > MaxCairoGlSizeWidth || size.height() > MaxCairoGlSizeHeight) {
+    if (size.width() > MaxCairoGlSizeWidth || size.height() > MaxCairoGlSizeHeight || size.width() < MinCairoGlSizeWidth || size.height() < MinCairoGlSizeHeight) {
         if (renderBox() && renderBox()->hasLayer())
             renderBox()->layer()->clearBacking();
         return false;