and colorpicking is faster again

This commit is contained in:
Titus Tscharntke 2013-04-25 23:46:55 +00:00
parent 9d3c99d6d0
commit 77ca62240e

View File

@ -1667,10 +1667,13 @@ vector<int> BaseColorPickEntity::getPickedList(int x,int y,int w,int h,
map<int,bool> modelAlreadyPickedList;
map<unsigned char,map<unsigned char, map<unsigned char,bool> > > colorAlreadyPickedList;
int nEnd = w * h;
int skipSteps=4;
unsigned char *oldpixel = &pixelBuffer[0];
for(int x = 0; x < nEnd && pickedModels.size() < rendererModels.size(); x=x+4) {
int index = x * COLOR_COMPONENTS;
for(int hh = 0; hh < h && pickedModels.size() < rendererModels.size(); hh=hh+skipSteps) {
for(int ww=0;ww < w && pickedModels.size() < rendererModels.size(); ww=ww+skipSteps){
int index = (hh*w+ww) * COLOR_COMPONENTS;
unsigned char *pixel = &pixelBuffer[index];
if(pixel[3]==0) continue;
if(x>0)
@ -1679,9 +1682,6 @@ vector<int> BaseColorPickEntity::getPickedList(int x,int y,int w,int h,
if(memcmp(pixel,oldpixel,4)) continue;
}
// Skip duplicate scanned colors
map<unsigned char,map<unsigned char, map<unsigned char,bool> > >::const_iterator iterFind1 = colorAlreadyPickedList.find(pixel[0]);
if(iterFind1 != colorAlreadyPickedList.end()) {
@ -1711,6 +1711,7 @@ vector<int> BaseColorPickEntity::getPickedList(int x,int y,int w,int h,
}
}
}
}
//printf("In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
//delete pixmapScreenShot;