#FEATURE by stefan
class: Icon
added: #releaseCachedIconsFromDevice:
comment/format in: #constantNamed:put:
changed: #constantNamed:ifAbsentPut:
--- 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'!