From patchwork Tue Mar 5 11:06:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 777978 Delivered-To: patch@linaro.org Received: by 2002:a5d:48c8:0:b0:33e:474f:8c56 with SMTP id p8csp372932wrs; Tue, 5 Mar 2024 03:09:54 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV8zvEtX1Uz12JOUuQ5Pc6yV7BsDsF//KPZ6/3Ys64jDV9b4M/fYbPgdWAXpKQyl/LldKcQwzR2ahuqdsy8o8k3 X-Google-Smtp-Source: AGHT+IFvsuJPSWbnnxur9cahgxKqEoLM0E22lldRwIA/ZsqcytdtAS9GJ+skTKjiMTgJPsS1elPJ X-Received: by 2002:a05:6122:4b18:b0:4d1:34a1:c896 with SMTP id fc24-20020a0561224b1800b004d134a1c896mr1281019vkb.8.1709636994514; Tue, 05 Mar 2024 03:09:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709636994; cv=none; d=google.com; s=arc-20160816; b=Xs2e1GVoEkjnnK4OFo/f+12c/BbT8P5pOCTfFm6MniJM72ucWynFhbts4BUdBeiyQv WtNBvBjw3Wb3jqjMdTLKSc/3Boh7QA6D+6oQD8K5qcAByuSS+MbojgyG01Cl8EQ/yLnQ nnRPKTn81dHChDUeS1bos9LbT+MGCzWEcyz8wV/LrbtI3Ns2X9gWUSm067Nw3fs8hkRE /wq0DTPb3jKe4mpE009lD3LLYnwld2or/qoao8Ml27bFLnzLlCmEB1eQgF0j76l/BEu8 H+koIxH72mEpnnDtndfYmab3Bzt3exWSthpsyeVi1p0c5oNrZxvw94YTHg+0hm++Fdjy /8/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aEncxItvyBuKzeJwaGvPvRwTlJqcX1dHZlco9vuriMg=; fh=lnLpXpuHHACtmFCFYDz84qQIx2RASFfAeprBY3P3HzE=; b=da8OGnrvAjoSbJzLUgJUhFuhzkTCBvQ+F1h2CYeUFmWwfnq3Y0ryNCR0N5Qn/hs0Zk 8UfL+OycYth5dlfyfRJzF5Z36aOSiyC9V1Mg52jEzfavSFeSqR7oCR8RKO5gF4wL7X2X 0DrB8H0VPvyNCXE8Xs2UyH2H8A6oCeSwuB3vvuiYyUWZhVA9xfUyQYvJtIc9nGs1UszD QE/bPhJgnwC+dazX9z/r+amaBOBCrZFvMsIezSpp2LAsiLJs5wjC9fDp/orVmMwgtNeT uxPq2J6/eHpU2mLP+mOC/gzf2ojWC2iFlQKDnX1sT3KH7x7cCDyxgFnGrapQLiM7YTa5 NkLQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MYfIyrQ6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g14-20020a05620a40ce00b00788136b7872si8904704qko.175.2024.03.05.03.09.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Mar 2024 03:09:54 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MYfIyrQ6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rhSdR-00085I-Ju; Tue, 05 Mar 2024 06:07:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rhSdK-0007ue-Bj for qemu-devel@nongnu.org; Tue, 05 Mar 2024 06:06:54 -0500 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rhSdG-0002o1-89 for qemu-devel@nongnu.org; Tue, 05 Mar 2024 06:06:53 -0500 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-565b434f90aso7948390a12.3 for ; Tue, 05 Mar 2024 03:06:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709636807; x=1710241607; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aEncxItvyBuKzeJwaGvPvRwTlJqcX1dHZlco9vuriMg=; b=MYfIyrQ6angPUoj52gNZRbOnQHpige8CSZv8khb+kr9S250dK8VOEihxva/gA9dohR URVVvcZC7FfGCLs6l0PeAbM0cxgquT2HtSfvkItO/LiANSu3Wcj4Ck48/1Yat7pAAtm2 8hGFDLryQWUWk08tKjAg2zIx/5+KMLhGS8jG1dFg12gxacs5MWmA0u1S3ulEOejmTOPV jEScj3aeYaXIr/4jFcaySuB4dd9cwO9vzh5xycUoPZKb7wHJo77jT0XJcSshGC2GVFYs OuOlPWg0R1W7GM1/3ejEDvG6H4fILnt0AMyhhkgnoUketRop80BpKeP2j8f3FPUcBsvr vzhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709636807; x=1710241607; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aEncxItvyBuKzeJwaGvPvRwTlJqcX1dHZlco9vuriMg=; b=IVzki+chIfwoYuPOG7weDniAsvQcpYcIJJuhznXAhjqwf4FrtYoV6fbPi3MRZT43hu VE9G/4Nh8ChoSZQVsInwuWnNyg8dmOmnrf7024qofnVXDDSYWghSe2md/47T/4L0UTtD t7m1mhOE5oj4Wz7wHpkR1Q+UoAJPlgBK24yViTk+P0EAkOGIOmw0xH1LTf1HdGnFmWiG peg4764mtVAGVs/c1q4Yerwrh97Vf0Tk+Mg24YtmW6lEsB5Z0olvGF8M/TQkR0kI7CRO fLKh5eyMUjweFG2o2G+MNu+FHgnWASi2g2XcijsYJQ/6OY2iN2tKcfcXICPiZ+qolmfQ LK8A== X-Gm-Message-State: AOJu0YxMehvtw1i4Fb8KpFlpXNL3rbokvzXAGTM0WaLICWJSgX20AgVY mLHSuviohMnNCfX2/VP4n2IHOo7+AgrN8xf68QIJoRb1dw3Urt0LqV3oe3tuXeaMnexluDw/zTf E X-Received: by 2002:a17:906:a24f:b0:a45:aa4a:6495 with SMTP id bi15-20020a170906a24f00b00a45aa4a6495mr804115ejb.37.1709636806828; Tue, 05 Mar 2024 03:06:46 -0800 (PST) Received: from m1x-phil.lan ([176.176.177.70]) by smtp.gmail.com with ESMTPSA id w9-20020a1709064a0900b00a44f0d99d58sm3477672eju.208.2024.03.05.03.06.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 05 Mar 2024 03:06:46 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Akihiko Odaki , Rene Engel , Peter Maydell , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Gerd Hoffmann , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 06/12] ui/cocoa: Scale with NSView instead of Core Graphics Date: Tue, 5 Mar 2024 12:06:01 +0100 Message-ID: <20240305110608.21618-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240305110608.21618-1-philmd@linaro.org> References: <20240305110608.21618-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::534; envelope-from=philmd@linaro.org; helo=mail-ed1-x534.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki Core Graphics is not accelerated and slow. Signed-off-by: Akihiko Odaki Tested-by: Rene Engel Reviewed-by: Peter Maydell Message-ID: <20240224-cocoa-v12-4-e89f70bdda71@daynix.com> Signed-off-by: Philippe Mathieu-Daudé --- ui/cocoa.m | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index e156527082..6e8cd24e88 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -504,10 +504,8 @@ - (void) drawRect:(NSRect) rect [self getRectsBeingDrawn:&rectList count:&rectCount]; for (i = 0; i < rectCount; i++) { - clipRect.origin.x = rectList[i].origin.x / cdx; - clipRect.origin.y = (float)h - (rectList[i].origin.y + rectList[i].size.height) / cdy; - clipRect.size.width = rectList[i].size.width / cdx; - clipRect.size.height = rectList[i].size.height / cdy; + clipRect = rectList[i]; + clipRect.origin.y = (float)h - (clipRect.origin.y + clipRect.size.height); clipImageRef = CGImageCreateWithImageInRect( imageRef, clipRect @@ -553,6 +551,11 @@ - (void) setContentDimensions } } +- (void) updateBounds +{ + [self setBoundsSize:NSMakeSize(screen.width, screen.height)]; +} + - (void) updateUIInfoLocked { /* Must be called with the BQL, i.e. via updateUIInfo */ @@ -642,6 +645,7 @@ - (void) switchSurface:(pixman_image_t *)image screen.height = h; [self setContentDimensions]; [self setFrame:NSMakeRect(cx, cy, cw, ch)]; + [self updateBounds]; } // update screenBuffer @@ -1305,6 +1309,7 @@ - (void)windowDidChangeScreen:(NSNotification *)notification - (void)windowDidResize:(NSNotification *)notification { + [cocoaView updateBounds]; [cocoaView updateUIInfo]; } @@ -1967,16 +1972,7 @@ static void cocoa_update(DisplayChangeListener *dcl, COCOA_DEBUG("qemu_cocoa: cocoa_update\n"); dispatch_async(dispatch_get_main_queue(), ^{ - NSRect rect; - if ([cocoaView cdx] == 1.0) { - rect = NSMakeRect(x, [cocoaView gscreen].height - y - h, w, h); - } else { - rect = NSMakeRect( - x * [cocoaView cdx], - ([cocoaView gscreen].height - y - h) * [cocoaView cdy], - w * [cocoaView cdx], - h * [cocoaView cdy]); - } + NSRect rect = NSMakeRect(x, [cocoaView gscreen].height - y - h, w, h); [cocoaView setNeedsDisplayInRect:rect]; }); }