瀏覽代碼

Adding AlphaMask example

JoshEngebretson 9 年之前
父節點
當前提交
5e6bcd1d9c

+ 6 - 0
Source/AtomicWebView/Internal/WebAppBrowser.cpp

@@ -35,9 +35,15 @@ WebAppBrowser::WebAppBrowser()
 
 void WebAppBrowser::OnBeforeCommandLineProcessing(const CefString& process_type, CefRefPtr<CefCommandLine> command_line)
 {
+
+    // media stream support
     command_line->AppendSwitch("--enable-media-stream");
     command_line->AppendSwitch("--enable-usermedia-screen-capturing");
 
+    // transparency support
+    command_line->AppendSwitch("--off-screen-rendering-enabled");
+    command_line->AppendSwitch("--transparent-painting-enabled");
+
     CefApp::OnBeforeCommandLineProcessing(process_type, command_line);
 }
 

+ 6 - 3
Source/AtomicWebView/WebBrowserHost.cpp

@@ -118,17 +118,20 @@ WebBrowserHost::WebBrowserHost(Context* context) : Object (context)
 
 
     // IMPORTANT: See flags being set in implementation of void WebAppBrowser::OnBeforeCommandLineProcessing
-    // these include "--enable-media-stream", "--enable-usermedia-screen-capturing"
+    // these include "--enable-media-stream", "--enable-usermedia-screen-capturing", "--off-screen-rendering-enabled", "--transparent-painting-enabled"
 
 #ifdef ATOMIC_PLATFORM_LINUX
-    static const char* _argv[3] = { "AtomicWebView", "--disable-setuid-sandbox", "--off-screen-rendering-enabled" };
+    static const char* _argv[3] = { "AtomicWebView", "--disable-setuid-sandbox" };
     CefMainArgs args(3, (char**) &_argv);
 #else
     CefMainArgs args;
 #endif
 
     CefSettings settings;
-    settings.windowless_rendering_enabled = true;
+    settings.windowless_rendering_enabled = 1;
+
+    // disable default background
+    settings.background_color = 0;
 
     if (productVersion_.Length())
     {

+ 4 - 3
Source/AtomicWebView/WebClient.cpp

@@ -347,7 +347,8 @@ public:
         browserSettings.universal_access_from_file_urls = STATE_ENABLED;
 
         windowInfo.width = width;
-        windowInfo.height = height;
+        windowInfo.height = height;        
+        windowInfo.transparent_painting_enabled = 1;
 
         Graphics* graphics = webClient_->GetSubsystem<Graphics>();
 
@@ -365,7 +366,7 @@ public:
 #endif
 
 #ifdef ATOMIC_PLATFORM_WINDOWS
-                windowInfo.SetAsWindowless(info.info.win.window, false);
+                windowInfo.SetAsWindowless(info.info.win.window, /*transparent*/ true);
 #endif
             }
 
@@ -374,7 +375,7 @@ public:
         {
 #ifndef ATOMIC_PLATFORM_LINUX
             // headless
-            windowInfo.SetAsWindowless(nullptr, false);
+            windowInfo.SetAsWindowless(nullptr, true);
 #endif
         }