Roxen.git/
server/
modules/
graphics/
graphic_text.pike
Branch:
Tag:
Non-build tags
All tags
No tags
1997-09-01
1997-09-01 14:20:48 by Per Hedbor <ph@opera.com>
7faa95f235247457e859a1ad89ada4095619514a (
159
lines) (+
83
/-
76
)
[
Show
|
Annotate
]
Branch:
5.2
Optimized rendering when running threaded.
Rev: server/modules/graphics/graphic_text.pike:1.61
1:
-
constant cvs_version="$Id: graphic_text.pike,v 1.
60
1997/09/01
01
:
44
:
21
per Exp $";
+
constant cvs_version="$Id: graphic_text.pike,v 1.
61
1997/09/01
14
:
20
:
48
per Exp $";
constant thread_safe=1; #include <module.h>
602:
array(int)|string write_text(int _args, string text, int size, object id) {
+
string key = base_key+_args;
+
array err;
+
text = replace(text, ({ "<", ">", "&" }), ({ "<", ">", "&" }));
+
+
err = catch
+
{
object img; mapping args = find_cached_args(_args);
-
if(!args) {
+
if(!args)
+
{
args=(["fg":"black","bg":"white"]); text="Please reload this page"; }
-
-
string key = base_key+_args;
-
-
text = replace(text, ({ "<", ">", "&" }), ({ "<", ">", "&" }));
-
+
// Check the cache first..
-
if
(mixed data = cache_lookup(key, text))
+
while
(mixed data = cache_lookup(key, text))
{
-
+
if(data == "rendering") { sleep(0.1); continue; }
if(args->nocache) // Remove from cache. Very usable for access counters cache_remove(key, text); if(size) return data[1]; return data[0]; } // Nothing found in the cache. Generate a new image.
-
+
cache_set(key, text, "rendering");
-
+
#if efun(get_font) if(args->nfont) {
698:
cache_set(key, text, data); if(size) return data[1]; return data[0];
+
};
+
cache_set(key, text, 0);
+
throw(err);
}