Просмотр исходного кода

Merge pull request #1517 from AtomicGameEngine/JME-ATOMIC-GLWINWEBVIEW

Fix for OpenGL + Windows incorrect pixel adjustment
JoshEngebretson 8 лет назад
Родитель
Сommit
15639892dd

+ 1 - 1
Source/AtomicWebView/UIWebView.cpp

@@ -114,7 +114,7 @@ public:
 
 #ifdef ATOMIC_PLATFORM_WINDOWS
 
-#ifndef ATOMIC_D3D11
+#if !defined(ATOMIC_D3D11) && !defined(ATOMIC_OPENGL)
         //Direct3D9 Adjustment
         x += 0.5f;
         y += 0.5f;

+ 7 - 9
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
@@ -271,15 +271,15 @@ public:
     }
 
     void OnPaint(CefRefPtr<CefBrowser> browser, PaintElementType type, const RectList &dirtyRects,
-                 const void *buffer, int width, int height) OVERRIDE
+        const void *buffer, int width, int height) OVERRIDE
     {
 
         if (type == PET_VIEW)
         {
             if (dirtyRects.size() == 1 &&
-                    dirtyRects[0] == CefRect(0, 0, webTexture2D_->GetWidth(), webTexture2D_->GetHeight()))
+                dirtyRects[0] == CefRect(0, 0, webTexture2D_->GetWidth(), webTexture2D_->GetHeight()))
             {
-                D3DBlit(IntRect(0, 0, width, height), (unsigned char*) buffer, width * 4, true);
+                D3DBlit(IntRect(0, 0, width, height), (unsigned char*)buffer, width * 4, true);
                 return;
             }
 
@@ -289,7 +289,7 @@ public:
             for (; i != dirtyRects.end(); ++i)
             {
                 const CefRect& rect = *i;
-                unsigned char* src = (unsigned char*) buffer;
+                unsigned char* src = (unsigned char*)buffer;
                 src += rect.y * (width * 4) + (rect.x * 4);
                 D3DBlit(IntRect(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height), src, width * 4, false);
             }
@@ -322,15 +322,13 @@ public:
                 h -= y + h - viewheight;
             }
 
-            unsigned char* src = (unsigned char*) buffer;
+            unsigned char* src = (unsigned char*)buffer;
             D3DBlit(IntRect(x, y, x + w, y + h), src, width * 4, false);
 
         }
 
 #endif
-
     }
-
 #endif
 
 private:
@@ -410,4 +408,4 @@ void WebTexture2D::SetSize(int width, int height)
 
 }
 
-}
+}

+ 4 - 0
Source/ThirdParty/TurboBadger/CMakeLists.txt

@@ -9,6 +9,10 @@ endif(APPLE)
 add_definitions(-DTB_FONT_RENDERER_FREETYPE)
 #add_definitions(-DTB_FONT_RENDERER_STB)
 
+if (ATOMIC_OPENGL)
+    add_definitions(-DATOMIC_OPENGL=1)
+endif ()
+
 # Define source files
 file (GLOB C_FILES *.cpp image/*.cpp animation/*.cpp parser/*.cpp renderers/*.cpp utf8/*.cpp)
 file (GLOB H_FILES *.h image/*.h animation/*.h parser/*.h renderers/*.h utf8/*.h)