projects
/
fms.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
version 0.3.17
[fms.git]
/
src
/
freenet
/
captcha
/
alternatecaptcha2.cpp
diff --git
a/src/freenet/captcha/alternatecaptcha2.cpp
b/src/freenet/captcha/alternatecaptcha2.cpp
index
08cbdd6
..
7495f36
100644
(file)
--- a/
src/freenet/captcha/alternatecaptcha2.cpp
+++ b/
src/freenet/captcha/alternatecaptcha2.cpp
@@
-5,6
+5,7
@@
\r
#include <cmath>
\r
#include <vector>
\r
\r
#include <cmath>
\r
#include <vector>
\r
+#include <cstdlib>
\r
\r
#ifdef ALTERNATE_CAPTCHA
\r
\r
\r
#ifdef ALTERNATE_CAPTCHA
\r
\r
@@
-16,6
+17,11
@@
AlternateCaptcha2::AlternateCaptcha2()
\r
void AlternateCaptcha2::Generate()
\r
{
\r
\r
void AlternateCaptcha2::Generate()
\r
{
\r
+ if(m_fonts.size()==0)
\r
+ {
\r
+ return;
\r
+ }
\r
+
\r
std::string puzzlestring=GenerateRandomString(6);
\r
std::vector<int> fontnums(puzzlestring.size(),0);
\r
\r
std::string puzzlestring=GenerateRandomString(6);
\r
std::vector<int> fontnums(puzzlestring.size(),0);
\r
\r
@@
-42,9
+48,9
@@
void AlternateCaptcha2::Generate()
for(int i=0; i<numlines; i++)
\r
{
\r
int x1=rand()%150;
\r
for(int i=0; i<numlines; i++)
\r
{
\r
int x1=rand()%150;
\r
- int y1=(rand()%
100)+10
0;
\r
+ int y1=(rand()%
80)+11
0;
\r
int x2=(rand()%150)+150;
\r
int x2=(rand()%150)+150;
\r
- int y2=(rand()%
100)+10
0;
\r
+ int y2=(rand()%
80)+11
0;
\r
bigbmp.Line(x1,y1,x2,y2,white);
\r
bigbmp.Line(x1+1,y1,x2+1,y2,white);
\r
}
\r
bigbmp.Line(x1,y1,x2,y2,white);
\r
bigbmp.Line(x1+1,y1,x2+1,y2,white);
\r
}
\r
@@
-78,7
+84,7
@@
void AlternateCaptcha2::Generate()
}
\r
\r
// rotate the big bitmap back to (almost) horizontal
\r
}
\r
\r
// rotate the big bitmap back to (almost) horizontal
\r
- bigbmp.Rotate(-lastrot+((rand()%
10)-5
),0,0,150,150);
\r
+ bigbmp.Rotate(-lastrot+((rand()%
20)-10
),0,0,150,150);
\r
\r
// grab the center of the big bitmap as the final bitmap
\r
FreeImage::Bitmap bmp(110,50,32);
\r
\r
// grab the center of the big bitmap as the final bitmap
\r
FreeImage::Bitmap bmp(110,50,32);
\r