- else
- {
- //style is wxFLOOD_BORDER
- // fill up to testColor border - if already testColour don't do anything
- if ( GetRed(x,y) != testColour.Red()
- || GetGreen(x,y) != testColour.Green()
- || GetBlue(x,y) != testColour.Blue() )
- {
- //prepare memory for queue
- //queue save, start, read
- size_t *qs, *qst, *qr;
-
- //queue size (physical)
- long qSz= height * width * 2;
- qst = new size_t [qSz];
-
- //temporary x and y locations
- int xt, yt;
-
- for (int i=0; i < qSz; i++)
- qst[i] = 0;
-
- // start queue
- qs=qr=qst;
- *qs=xt=x;
- qs++;
- *qs=yt=y;
- qs++;
-
- SetRGB(xt,yt,r,g,b);
-
- //Main queue loop
- while(qr!=qs)
- {
- //Add new members to queue
- //Above current pixel
- if(!MatchBoundaryPixel(xt,yt-1,width,height,fillColour,testColour))
- {
- *qs=xt;
- qs++;
- *qs=yt-1;
- qs++;
- SetRGB(xt,yt-1,r,g,b);
-
- //Loop back to beginning of queue
- if(qs>=(qst+qSz)) qs=qst;
- }
-
- //Below current pixel
- if(!MatchBoundaryPixel(xt,yt+1,width,height,fillColour,testColour))
- {
- *qs=xt;
- qs++;
- *qs=yt+1;
- qs++;
- SetRGB(xt,yt+1,r,g,b);
- if(qs>=(qst+qSz)) qs=qst;
- }
-
- //Left of current pixel
- if(!MatchBoundaryPixel(xt-1,yt,width,height,fillColour,testColour))
- {
- *qs=xt-1;
- qs++;
- *qs=yt;
- qs++;
- SetRGB(xt-1,yt,r,g,b);
- if(qs>=(qst+qSz)) qs=qst;
- }
-
- //Right of current pixel
- if(!MatchBoundaryPixel(xt+1,yt,width,height,fillColour,testColour))
- {
- *qs=xt+1;
- qs++;
- *qs=yt;
- qs++;
- SetRGB(xt+1,yt,r,g,b);
- if(qs>=(qst+qSz)) qs=qst;
- }
-
- //Retrieve current queue member
- qr+=2;