Hi,
gibt es irgendeinen Trick um die Prozessorauslastung durch GDI+ zu reduzieren?
mfg
Hi,
gibt es irgendeinen Trick um die Prozessorauslastung durch GDI+ zu reduzieren?
mfg
Du kannst z.B. mit _GDIPlus_GraphicsSetInterpolationMode (GDIp.au3) oder _GDIPlus_GraphicsSetSmoothingMode schnellere Algorithmen einstellen.
Meinst du das?
Damit verändert man ja die Renderqualität des Grafik-Objekts, das will ich allerdings nicht. Daher eher an irgendeinen Trick um z.b. GDI+ statt mit der CPU mit der GPU render zu lassen oder dergleiche.
Sowas ist mir nicht bekannt.
Welche CPU-Auslastung hat denn dein Script?
Also z.b. bei diesem hier ist es, bei einem AMD Athlon 64 X2 4600+ (2,4 GHz), bei 46 wenn die Maus nicht bewegt wird und 50 Prozent wenn die Maus bewegt wird:
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
Opt("GuiOnEventMode", 1)
Opt("MouseCoordMode", 0)
OnAutoItExitRegister("_end")
[/autoit] [autoit][/autoit] [autoit]$Gui = GUICreate("Beispiel", 800, 600)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUISetState(@SW_SHOW)
_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]$chipset = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\chipsets\1.png")
[/autoit] [autoit][/autoit] [autoit]$graphic = _GDIPlus_GraphicsCreateFromHWND($Gui)
$bitmap = _GDIPlus_BitmapCreateFromGraphics(800, 600, $graphic)
$buffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
;~ _GDIPlus_GraphicsDrawImageRectRect($buffer, $chipset, 0, 0, 256, 1024, 672, 0, 128, 512)
;~ _GDIPlus_GraphicsDrawImageRectRect($buffer, $chipset, 0, 0, 256, 1024, 0, 515, 128 / 6, 512 / 6)
;~ _GDIPlus_GraphicsDrawImage($graphic, $bitmap, 0, 0)
;~ _GDIPlus_GraphicsClear($buffer, 0xFF000000)
$mouscordsalt = MouseGetPos()
While 1
$mouscords = MouseGetPos()
If $mouscordsalt[0] <> $mouscords[0] Or $mouscordsalt[1] <> $mouscords[1] Then
;~ $mouscordsalt[0] = $mouscords[0]
;~ $mouscordsalt[1] = $mouscords[1]
;~
;~ If $mouscords[0] Or $mouscordsalt[1] <> $mouscords[1] Then
_GDIPlus_GraphicsDrawImageRectRect($buffer, $chipset, 0, 0, 256, 1024, 672, 0, 128, 512)
_GDIPlus_GraphicsDrawImage($graphic, $bitmap, 0, 0)
_GDIPlus_GraphicsClear($buffer, 0xFF000000)
;~ EndIf
EndIf
WEnd
Func CLOSEClicked()
Exit
EndFunc ;==>CLOSEClicked
Func _end()
_GDIPlus_ImageDispose($chipset)
_GDIPlus_GraphicsDispose($graphic)
_GDIPlus_GraphicsDispose($buffer)
_GDIPlus_BitmapDispose($bitmap)
_GDIPlus_Shutdown()
EndFunc ;==>_end
Das liegt nicht an GDI+, du brauchst nur ein Sleep(10) in der Schleife
Mh bei anderen Scripten ohne GDI+ habe ich das nicht, darum dachte ich es liegt an GDI+
Dann hast du bisher immer GuiGetMsg verwendet, welches intern ein Sleep macht, wenn die Maus nicht bewegt wird...
selbst dieses Script:
While 1
WEnd
hat etwa 50% bei mir
Ja stimmt sonst hatte ich immer GuiGetMsg.