Bug 1209780. Use the DrawResult return value of imgIContainer::Draw in the cocoa code. r=seth
authorTimothy Nikkel <tnikkel@gmail.com>
Tue, 29 Mar 2016 01:14:45 -0500
changeset 290902 0ce8b97e0e6921dde82f2eb30b33ba4042e822df
parent 290782 72c2846e2d161e3c73f04c679e52717ccde38f7b
child 290903 f292de4328044cae93428f9af7281a138a0f9749
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersseth
bugs1209780
milestone48.0a1
Bug 1209780. Use the DrawResult return value of imgIContainer::Draw in the cocoa code. r=seth
widget/cocoa/nsCocoaUtils.mm
--- a/widget/cocoa/nsCocoaUtils.mm
+++ b/widget/cocoa/nsCocoaUtils.mm
@@ -487,19 +487,24 @@ nsresult nsCocoaUtils::CreateNSImageFrom
     }
 
     RefPtr<gfxContext> context = new gfxContext(drawTarget);
     if (!context) {
       NS_ERROR("Failed to create gfxContext");
       return NS_ERROR_FAILURE;
     }
 
-    aImage->Draw(context, scaledSize, ImageRegion::Create(scaledSize),
-                 aWhichFrame, Filter::POINT, Nothing(),
-                 imgIContainer::FLAG_SYNC_DECODE);
+    mozilla::image::DrawResult res =
+      aImage->Draw(context, scaledSize, ImageRegion::Create(scaledSize),
+                   aWhichFrame, Filter::POINT, Nothing(),
+                   imgIContainer::FLAG_SYNC_DECODE);
+
+    if (res != mozilla::image::DrawResult::SUCCESS) {
+      return NS_ERROR_FAILURE;
+    }
 
     surface = drawTarget->Snapshot();
   } else {
     surface = aImage->GetFrame(aWhichFrame, imgIContainer::FLAG_SYNC_DECODE);
   }
 
   NS_ENSURE_TRUE(surface, NS_ERROR_FAILURE);