choice images work

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@63 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2006-10-31 15:15:26 +00:00
parent 1ffaa5bd58
commit e2220a5a97
7 changed files with 103 additions and 17 deletions
+6 -5
View File
@@ -59,8 +59,9 @@ bool script_image_up_to_date(const ScriptValueP& value) {
// ----------------------------------------------------------------------------- : ScriptableImage
ScriptImageP ScriptableImage::generate(Context& ctx) const {
ScriptImageP ScriptableImage::generate(Context& ctx, Package& pkg) const {
try {
WITH_DYNAMIC_ARG(load_images_from, &pkg);
ScriptImageP img = to_script_image(script.invoke(ctx));
return img;
} catch (Error e) {
@@ -71,8 +72,8 @@ ScriptImageP ScriptableImage::generate(Context& ctx) const {
}
}
ScriptImageP ScriptableImage::generate(Context& ctx, UInt width, UInt height, PreserveAspect preserve_aspect, bool saturate) const {
ScriptImageP image = generate(ctx);
ScriptImageP ScriptableImage::generate(Context& ctx, Package& pkg, UInt width, UInt height, PreserveAspect preserve_aspect, bool saturate) const {
ScriptImageP image = generate(ctx, pkg);
if (!image->image.Ok()) {
// return an image so we don't fail
image->image = Image(1,1);
@@ -109,11 +110,11 @@ ScriptImageP ScriptableImage::generate(Context& ctx, UInt width, UInt height, Pr
return image;
}
ScriptImageP ScriptableImage::update(Context& ctx, UInt width, UInt height, PreserveAspect preserve_aspect, bool saturate) {
ScriptImageP ScriptableImage::update(Context& ctx, Package& pkg, UInt width, UInt height, PreserveAspect preserve_aspect, bool saturate) {
// up to date?
if (!cache || (UInt)cache->image.GetWidth() != width || (UInt)cache->image.GetHeight() != height || !upToDate(ctx, last_update)) {
// cache must be updated
cache = generate(ctx, width, height, preserve_aspect, saturate);
cache = generate(ctx, pkg, width, height, preserve_aspect, saturate);
last_update.update();
}
return cache;