From fb7bcbfa5b11f15a3800a8d004fd7d62b25e09f9 Mon Sep 17 00:00:00 2001 From: hecomi Date: Wed, 9 Nov 2016 00:13:55 +0900 Subject: [PATCH] change texture cache key. --- .../Scenes/Multiple Monitors Roundly.unity | Bin 14888 -> 14888 bytes Assets/uDesktopDuplication/Scripts/Cursor.cs | 10 +++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Assets/uDesktopDuplication/Examples/Scenes/Multiple Monitors Roundly.unity b/Assets/uDesktopDuplication/Examples/Scenes/Multiple Monitors Roundly.unity index 2f8d005a2615a8326429bd11300aee79b4547b7f..3c95cc39a0b5c3d1a88df1593fc4736cb118e0a3 100644 GIT binary patch delta 34 scmV+-0Nwwnbf|Q&xHbdVqwur4Hq8MD&CJX_005vslL0dvv#dCL0V~E2Hvj+t delta 34 qcmZ2cvZ7?e4l`y328YeN&CW7%FfcUOGcYW0n9OJ_vw4k04I=>7!3!z? diff --git a/Assets/uDesktopDuplication/Scripts/Cursor.cs b/Assets/uDesktopDuplication/Scripts/Cursor.cs index d0ff188..e14ec89 100644 --- a/Assets/uDesktopDuplication/Scripts/Cursor.cs +++ b/Assets/uDesktopDuplication/Scripts/Cursor.cs @@ -14,7 +14,7 @@ public class Cursor : MonoBehaviour private Texture uddTexture_; private Monitor monitor { get { return uddTexture_.monitor; } } - private Dictionary textures_ = new Dictionary(); + private Dictionary textures_ = new Dictionary(); void Start() { @@ -45,14 +45,14 @@ public class Cursor : MonoBehaviour var h = monitor.cursorShapeHeight; if (w == 0 || h == 0) return; - var scale = new Vector2(w, h); - if (!textures_.ContainsKey(scale)) { + var key = w + h * 100; + if (!textures_.ContainsKey(key)) { var texture = new Texture2D(w, h, TextureFormat.BGRA32, false); texture.wrapMode = TextureWrapMode.Clamp; - textures_.Add(scale, texture); + textures_.Add(key, texture); } - var cursorTexture = textures_[scale]; + var cursorTexture = textures_[key]; monitor.GetCursorTexture(cursorTexture.GetNativeTexturePtr()); uddTexture_.material.SetTexture("_CursorTex", cursorTexture); }