qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/2] ui/cocoa: Draw black rectangle if we have no da


From: Peter Maydell
Subject: [Qemu-devel] [PATCH 2/2] ui/cocoa: Draw black rectangle if we have no data yet
Date: Tue, 24 Dec 2013 02:51:47 +0000

If our redraw method is called before we have any data from the guest,
then draw a black rectangle rather than leaving the window empty.
This mostly only matters when the guest machine has no framebuffer
device, but it is more in line with the behaviour of other QEMU UIs.

Signed-off-by: Peter Maydell <address@hidden>
---
 ui/cocoa.m | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/ui/cocoa.m b/ui/cocoa.m
index 9e22d21..39c62ad 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -322,7 +322,12 @@ QemuCocoaView *cocoaView;
     CGContextSetShouldAntialias (viewContextRef, NO);
 
     // draw screen bitmap directly to Core Graphics context
-    if (dataProviderRef) {
+    if (!dataProviderRef) {
+        // Draw request before any guest device has set up a framebuffer:
+        // just draw an opaque black rectangle
+        CGContextSetRGBFillColor(viewContextRef, 0, 0, 0, 1.0);
+        CGContextFillRect(viewContextRef, NSRectToCGRect(rect));
+    } else {
         CGImageRef imageRef = CGImageCreate(
             screen.width, //width
             screen.height, //height
-- 
1.7.11.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]