diff options
| author | Comment <tim@gray.(none)> | 2014-03-12 09:32:52 +0000 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2014-03-12 09:32:52 +0000 |
| commit | e8d3833a23ddc45fc8b6720b683356e78ed0329c (patch) | |
| tree | ca1b0ad2efc67e0c8cb9f35c70329a25deb0b416 /offsetProject/src/imageStore.h | |
| parent | 8f9a8b4c06bb168b91cb0a3971c3dc37fb67220f (diff) | |
drawing not that fast
Diffstat (limited to 'offsetProject/src/imageStore.h')
| -rw-r--r-- | offsetProject/src/imageStore.h | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/offsetProject/src/imageStore.h b/offsetProject/src/imageStore.h index 3cfb7eb..1db0ee2 100644 --- a/offsetProject/src/imageStore.h +++ b/offsetProject/src/imageStore.h @@ -3,7 +3,7 @@ #define IMAGE_STORE_SIZE 256 #define MIN_TILE_SIZE 8 -#define MAX_TILE_SIZE 32 +#define MAX_TILE_SIZE 16 #include "ofMain.h" #include "ofxJSONElement.h" @@ -121,19 +121,33 @@ class imageStore : public ofThread{ to_update.pop_front(); - int drawcount=0; - for (map<string,ofImage>::iterator i=images.begin();i!=images.end();++i){ - if(i->second.isUsingTexture()){ - drawcount++; - } - } + //int drawcount=0; + //for (map<string,ofImage>::iterator i=images.begin();i!=images.end();++i){ + // if(i->second.isUsingTexture()){ + // drawcount++; + // } + //} //cout<<"loaded "<<im<<" "<<ofToLong(im)%(long)(ofGetWidth()-images[im].getWidth()+1)<<","<<ofToLong(im)%(long)(ofGetHeight()-images[im].getHeight()+1)<<endl; } + /* for (map<string,ofImage>::iterator i=images.begin();i!=images.end();++i){ if(i->second.isUsingTexture()){ i->second.draw(ofToLong(i->first)%(long)(ofGetWidth()-i->second.getWidth()+1),ofToLong(i->first)%(long)(ofGetHeight()-i->second.getHeight()+1)); } } + */ + map<string,ofImage>::iterator it=images.begin(); + if (it!=images.end()){ + for (int i=0;i<ofGetWidth()/MAX_TILE_SIZE;i++){ + for (int j=0;j<ofGetHeight()/MAX_TILE_SIZE;j++){ + if (it->second.isUsingTexture()){ + it->second.draw(i*MAX_TILE_SIZE,j*MAX_TILE_SIZE); + } + it++; + if (it==images.end()) it=images.begin(); + } + } + } unlock(); } } |
