#FEATURE by stefan
authorStefan Vogel <sv@exept.de>
Tue, 13 Sep 2016 17:41:00 +0200
changeset 3743 0ba1dd49957d
parent 3742 634868214786
child 3744 a4f0771a81a2
child 3745 fcabc71e2930
#FEATURE by stefan class: Icon added: #releaseCachedIconsFromDevice: comment/format in: #constantNamed:put: changed: #constantNamed:ifAbsentPut:
Icon.st
--- a/Icon.st	Tue Sep 13 14:45:18 2016 +0200
+++ b/Icon.st	Tue Sep 13 17:41:00 2016 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1995 by Claus Gittinger
 	      All Rights Reserved
@@ -145,11 +147,12 @@
 
     |image|
 
-    (image := self constantNamed:aName searchForFile:false) isNil
-    ifTrue:[
-        self constantNamed:aName put:(image := aBlock value)
+    image := self constantNamed:aName searchForFile:false.
+    image isNil ifTrue:[
+        image := aBlock value.
+        self constantNamed:aName put:image.
     ].
-    ^image
+    ^ image
 !
 
 constantNamed:aName ifAbsentPutImageFromFile:aFileName
@@ -167,7 +170,7 @@
     "register anImage under aName."
 
     KnownIcons isNil ifTrue:[
-	self initialize
+        self initialize
     ].
     KnownIcons at:aName put:anImage
 
@@ -601,6 +604,17 @@
      (do not save them in the image)"
     
     self flushCachedIcons
+!
+
+releaseCachedIconsFromDevice:aGraphicsDevice 
+    KnownIcons do:[:eachImage | 
+        eachImage graphicsDevice == aGraphicsDevice ifTrue:[
+            eachImage release
+        ]
+    ].
+
+    "
+     Icon releaseIconsFromDevice:Display"
 ! !
 
 !Icon class methodsFor:'documentation'!