Browse Source

Fix for WebView on OpenGL on Windows (also fixes Monaco text editor on Windows WebGL which uses WebView).

darrylryan 8 years ago
parent
commit
60610e9710
1 changed files with 9 additions and 3 deletions
  1. 9 3
      Source/AtomicWebView/WebTexture2D.cpp

+ 9 - 3
Source/AtomicWebView/WebTexture2D.cpp

@@ -113,7 +113,7 @@ public:
         return true;
     }
 
-#ifndef ATOMIC_PLATFORM_WINDOWS
+#ifdef ATOMIC_OPENGL
 
     void OnPaint(CefRefPtr<CefBrowser> browser, PaintElementType type, const RectList &dirtyRects,
                  const void *buffer, int width, int height) OVERRIDE
@@ -329,8 +329,6 @@ public:
 
 #endif
 
-    }
-
 #endif
 
 private:
@@ -392,6 +390,14 @@ void WebTexture2D::SetSize(int width, int height)
 
 #endif
 
+#if defined(ATOMIC_OPENGL) && defined(ATOMIC_PLATFORM_WINDOWS) 
+	//Force width and height to multiples of 2 so that we don't squish pixels
+	//This doesn't seem to make the text completely sharp but it makes it usable for now.
+	width = (width | 2) + 1;
+	height = (height | 2) + 1;
+	texture_->SetFilterMode(TextureFilterMode::FILTER_NEAREST);
+#endif
+
     if (!texture_->SetSize(width, height, format, textureUsage))
     {
         ATOMIC_LOGERRORF("Unable to set WebTexture2D size to %i x %i", width, height);