Browse Source

Another small cleanup

Josh Engebretson 8 years ago
parent
commit
79fd5d9d36
1 changed files with 11 additions and 12 deletions
  1. 11 12
      Source/AtomicWebView/WebTexture2D.cpp

+ 11 - 12
Source/AtomicWebView/WebTexture2D.cpp

@@ -381,24 +381,23 @@ void WebTexture2D::SetSize(int width, int height)
 
 
     // initialize to white (color should probably be an option)
     // initialize to white (color should probably be an option)
 
 
-#ifndef ATOMIC_D3D11
-    if (!texture_->SetSize(width, height, Graphics::GetRGBAFormat(), TEXTURE_DYNAMIC))
-    {
-        ATOMIC_LOGERRORF("Unable to set WebTexture2D size to %i x %i", width, height);
-        return;
-    }
+    TextureUsage textureUsage = TEXTURE_DYNAMIC;
+    unsigned format = Graphics::GetRGBAFormat();
+
+#ifdef ATOMIC_D3D11
 
 
-#else
-    
     // D3D11 uses a static texture (in BGRA format), required for subresource update with rectangle
     // D3D11 uses a static texture (in BGRA format), required for subresource update with rectangle
-    if (!texture_->SetSize(width, height, DXGI_FORMAT_B8G8R8A8_UNORM, TEXTURE_STATIC))
+    textureUsage = TEXTURE_STATIC;
+    format = DXGI_FORMAT_B8G8R8A8_UNORM;
+
+#endif
+
+    if (!texture_->SetSize(width, height, format, textureUsage))
     {
     {
         ATOMIC_LOGERRORF("Unable to set WebTexture2D size to %i x %i", width, height);
         ATOMIC_LOGERRORF("Unable to set WebTexture2D size to %i x %i", width, height);
         return;
         return;
     }
     }
-
-#endif
-
+    
     SharedArrayPtr<unsigned> cleardata(new unsigned[width * height]);
     SharedArrayPtr<unsigned> cleardata(new unsigned[width * height]);
     unsigned color = clearColor_.ToUInt();
     unsigned color = clearColor_.ToUInt();
     unsigned* ptr = cleardata.Get();
     unsigned* ptr = cleardata.Get();