aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Hawthorn <john.hawthorn@gmail.com>2009-12-22 23:49:05 -0800
committerJohn Hawthorn <john.hawthorn@gmail.com>2009-12-22 23:49:05 -0800
commit63a954808a57f31490202efc3e08616a6ac6a6d0 (patch)
treee6b8f889f503c3904e92faf30bc4074013197fa0
parentad0dcfe1a57c2cc42de21471320d25e95a329e82 (diff)
downloadmirror-meh-63a954808a57f31490202efc3e08616a6ac6a6d0.tar.gz
mirror-meh-63a954808a57f31490202efc3e08616a6ac6a6d0.tar.bz2
mirror-meh-63a954808a57f31490202efc3e08616a6ac6a6d0.zip
aleays redraw after scaling, allows more responsive resizing.
-rw-r--r--src/main.c26
-rw-r--r--src/meh.h2
2 files changed, 17 insertions, 11 deletions
diff --git a/src/main.c b/src/main.c
index e22c7fb..3bf667a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -168,14 +168,14 @@ struct image *imageopen2(char *filename){
return NULL;
}
-int doredraw(struct image **i){
+void doredraw(struct image **i){
if(!*i){
if(mode == MODE_CTL){
if(images[0] == NULL)
- return 0;
+ return;
if(!(*i = imageopen2(images[0]))){
images[0] = NULL;
- return 0;
+ return;
}
}else{
int firstimg = imageidx;
@@ -219,17 +219,18 @@ int doredraw(struct image **i){
/* state should be set by format */
assert((*i)->state == LOADED || (*i)->state == FASTLOADED);
}else if(width && height){
- if(dstate == SCALED || dstate == FASTSCALED){
- (*i)->ximg = getimage(*i, width, height, dstate == FASTSCALED);
- (*i)->state = dstate;
- }else if(dstate == DRAWN || dstate == FASTDRAWN){
- assert((*i)->ximg);
- drawimage((*i)->ximg, width, height);
+ if(dstate == SCALED || dstate == FASTSCALED2 || dstate == FASTSCALED){
+ (*i)->ximg = getimage(*i, width, height, dstate != SCALED);
(*i)->state = dstate;
+ dstate++; /* Always draw after rendering */
}
}
+ if(dstate == DRAWN || dstate == FASTDRAWN || dstate == FASTDRAWN2){
+ assert((*i)->ximg);
+ drawimage((*i)->ximg, width, height);
+ (*i)->state = dstate;
+ }
}
- return (*i)->state != DRAWN;
}
void run(){
@@ -275,7 +276,10 @@ void run(){
}else if(ret == 0){
if(mode == MODE_CTL && images[0] == NULL){
tv = NULL;
- }else if(!doredraw(&curimg)){
+ }else if(!curimg || curimg->state != DRAWN){
+ doredraw(&curimg);
+ //}else if(!nextimg || nextimg->state != DRAWN){
+ }else{
/* If we get here everything has been drawn in full or we need more input to continue */
tv = NULL;
}
diff --git a/src/meh.h b/src/meh.h
index 602ecee..b8522d9 100644
--- a/src/meh.h
+++ b/src/meh.h
@@ -18,6 +18,8 @@ typedef enum{
FASTSCALED,
FASTDRAWN,
LOADED,
+ FASTSCALED2,
+ FASTDRAWN2,
SCALED,
DRAWN,
ERROR