Bug 902474 - Require a minimum size of 16x16 to use SkiaGL r=mattwoodrow
☠☠ backed out by 99219212d2ba ☠ ☠
authorJames Willcox <jwillcox@mozilla.com>
Mon, 05 Aug 2013 16:46:31 -0400
changeset 154608 ecf856c2113611513b6d2314bd254f62c2339b9a
parent 154607 6f782ebc49e6d05564cf1391400ebf20a57238e2
child 154609 5e519aedb9d1ab6afdaa3e75a2808f6ccbe84f74
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs902474
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 902474 - Require a minimum size of 16x16 to use SkiaGL r=mattwoodrow
content/canvas/src/CanvasRenderingContext2D.cpp
--- a/content/canvas/src/CanvasRenderingContext2D.cpp
+++ b/content/canvas/src/CanvasRenderingContext2D.cpp
@@ -794,16 +794,23 @@ CanvasRenderingContext2D::DemoteOldestCo
 }
 
 void
 CanvasRenderingContext2D::AddDemotableContext(CanvasRenderingContext2D* context)
 {
   DemotableContexts().push_back(context);
 }
 
+#define MIN_SKIA_GL_DIMENSION 16
+
+bool
+CheckSizeForSkiaGL(IntSize size) {
+  return size.width > MIN_SKIA_GL_DIMENSION && size.height > MIN_SKIA_GL_DIMENSION;
+}
+
 #endif
 
 void
 CanvasRenderingContext2D::EnsureTarget()
 {
   if (mTarget) {
     return;
   }
@@ -839,17 +846,17 @@ CanvasRenderingContext2D::EnsureTarget()
 #endif
 
         DemoteOldestContextIfNecessary();
 
         nsRefPtr<GLContext> glContext;
         nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
         nsString vendor;
 
-        if (!mForceSoftware)
+        if (!mForceSoftware && CheckSizeForSkiaGL(size))
         {
           glContext = GLContextProvider::CreateOffscreen(gfxIntSize(size.width, size.height),
                                                          caps, GLContext::ContextFlagsNone);
         }
 
         if (glContext) {
           SkAutoTUnref<GrGLInterface> i(CreateGrGLInterfaceFromGLContext(glContext));
           mTarget = Factory::CreateDrawTargetSkiaWithGLContextAndGrGLInterface(glContext, i, size, format);