Roxen.git/
server/
base_server/
roxen.pike
Branch:
Tag:
Non-build tags
All tags
No tags
1999-05-25
1999-05-25 09:49:02 by Per Hedbor <ph@opera.com>
000c7830156956c2f1bed3289a3441e4666aa80b (
35
lines) (+
23
/-
12
)
[
Show
|
Annotate
]
Branch:
5.2
Fixes to the argument and image caches
Rev: server/base_server/roxen.pike:1.288
1:
/*
-
* $Id: roxen.pike,v 1.
287
1999/05/
24
12
:
39
:
18
grubba
Exp $
+
* $Id: roxen.pike,v 1.
288
1999/05/
25
09
:
49
:
02
per
Exp $
* * The Roxen Challenger main program. *
7:
*/ // ABS and suicide systems contributed freely by Francesco Chemolli
-
constant cvs_version="$Id: roxen.pike,v 1.
287
1999/05/
24
12
:
39
:
18
grubba
Exp $";
+
constant cvs_version="$Id: roxen.pike,v 1.
288
1999/05/
25
09
:
49
:
02
per
Exp $";
object backend_thread; object argcache;
1904:
static void draw( string name, RequestID id ) { mapping args = argcache->lookup( name );
-
mixed reply = draw_function( args, id );
+
mixed reply = draw_function(
copy_value(
args
)
, id );
mapping meta; string data;
1920:
if( args->fs || dither == "fs" ) dither = "floyd_steinberg";
+
if( dither == "random" )
+
dither = "random_dither";
+
if( format == "jpg" ) format = "jpeg";
1965:
if( quant || (format=="gif") ) {
-
ct
=
Image.Colortable( reply,
quant||id->misc->defquant||16 );
+
int
ncols
= quant||id->misc->defquant||16
;
+
if( ncols > 200
)
+
ncols = 250
;
+
ct = Image.Colortable( reply, ncols );
if( dither )
-
if( ct[dither] )
-
ct[dither]();
+
if( ct[
dither
] )
+
ct[
dither
]();
else ct->ordered(); }
1989:
switch(format) { case "gif":
+
if( catch {
if( alpha ) data = Image.GIF.encode_trans( reply, ct, alpha ); else data = Image.GIF.encode( reply, ct );
-
+
})
+
data = Image.GIF.encode( reply );
break; case "png": if( ct )
2287:
string id = create_key( data ); cache[ data ] = ({ 0, 0 });
-
cache[ data ][ CACHE_VALUE ] = args;
+
cache[ data ][ CACHE_VALUE ] =
copy_value(
args
)
;
cache[ data ][ CACHE_SKEY ] = id; cache[ id ] = data;
2302:
mapping lookup( string id ) {
+
LOCK();
if(cache[id]) return cache[cache[id]][CACHE_VALUE];