Bug 764125; pretty sure this inverted logic will break something on windows; r=Bas
authorAnthony Jones <ajones@mozilla.com>
Tue, 24 Jul 2012 22:18:38 +1200
changeset 100539 b39cdd954a20241fef7e67b60567e006b1434fc8
parent 100538 d420f6ee14c7411dca057b48cc9dc06910f9e2d0
child 100540 0cbb007e25e1c79ff570e90c5df549967282cc98
push idunknown
push userunknown
push dateunknown
reviewersBas
bugs764125
milestone17.0a1
Bug 764125; pretty sure this inverted logic will break something on windows; r=Bas
gfx/thebes/gfxPlatform.cpp
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -527,21 +527,18 @@ gfxPlatform::GetSourceSurfaceForSurface(
     }
     srcBuffer = aTarget->CreateSourceSurfaceFromNativeSurface(surf);
   }
 #endif
 
   if (!srcBuffer) {
     nsRefPtr<gfxImageSurface> imgSurface = aSurface->GetAsImageSurface();
 
-    bool isWin32ImageSurf = false;
-
-    if (imgSurface && aSurface->GetType() != gfxASurface::SurfaceTypeWin32) {
-      isWin32ImageSurf = true;
-    }
+    bool isWin32ImageSurf = imgSurface &&
+                            aSurface->GetType() == gfxASurface::SurfaceTypeWin32;
 
     if (!imgSurface) {
       imgSurface = new gfxImageSurface(aSurface->GetSize(), OptimalFormatForContent(aSurface->GetContentType()));
       nsRefPtr<gfxContext> ctx = new gfxContext(imgSurface);
       ctx->SetSource(aSurface);
       ctx->SetOperator(gfxContext::OPERATOR_SOURCE);
       ctx->Paint();
     }
@@ -567,18 +564,18 @@ gfxPlatform::GetSourceSurfaceForSurface(
     IntSize size = IntSize(imgSurface->GetSize().width, imgSurface->GetSize().height);
     srcBuffer = aTarget->CreateSourceSurfaceFromData(imgSurface->Data(),
                                                      size,
                                                      imgSurface->Stride(),
                                                      format);
 
     if (!srcBuffer) {
       // We need to check if our gfxASurface will keep the underlying data
-      // alive! This is true if gfxASurface actually -is- an ImageSurface or
-      // if it is a gfxWindowsSurface which supportes GetAsImageSurface.
+      // alive. This is true if gfxASurface actually -is- an ImageSurface or
+      // if it is a gfxWindowsSurface which supports GetAsImageSurface.
       if (imgSurface != aSurface && !isWin32ImageSurf) {
         // This shouldn't happen for now, it can be easily supported by making
         // a copy. For now let's just abort.
         NS_RUNTIMEABORT("Attempt to create unsupported SourceSurface from"
             "non-image surface.");
         return nsnull;
       }