- float x[4];
- float y[4];
- float u[4];
- float v[4];
-
- x[0]=0.0f-shadow.left;
- x[1]=x[0]+border.left;
- x[3]=wd+shadow.right;
- x[2]=x[3]-border.right;
-
- y[0]=0.0f-shadow.bottom;
- y[1]=y[0]+border.bottom;
- y[3]=ht+shadow.top;
- y[2]=y[3]-border.top;
-
- const unsigned twidth=texture->get_width();
- u[0]=static_cast<float>(slice.x)/twidth;
- u[1]=static_cast<float>(slice.x+border.left)/twidth;
- u[2]=static_cast<float>(slice.x+slice.w-border.right)/twidth;
- u[3]=static_cast<float>(slice.x+slice.w)/twidth;
-
- const unsigned theight=texture->get_height();
- v[0]=static_cast<float>(slice.y)/theight;
- v[1]=static_cast<float>(slice.y+border.bottom)/theight;
- v[2]=static_cast<float>(slice.y+slice.h-border.top)/theight;
- v[3]=static_cast<float>(slice.y+slice.h)/theight;
-
- texture->bind();
- unsigned xmin=border.left ? 0 : 1;
- unsigned xmax=border.right ? 3 : 2;
- unsigned ymin=border.bottom ? 0 : 1;
- unsigned ymax=border.top ? 3 : 2;
-
- GL::Immediate imm((GL::TEXCOORD2,GL::VERTEX2));
- for(unsigned i=ymin; i<ymax; ++i)
+ vector<float> x, y;
+ create_coords(0.0f-shadow.left, wd+shadow.right, border.left, border.right, slice.w-border.left-border.right, x);
+ create_coords(0.0f-shadow.bottom, ht+shadow.top, border.bottom, border.top, slice.h-border.bottom-border.top, y);
+
+ vector<float> u, v;
+ create_texcoords(slice.x, slice.x+slice.w, border.left, border.right, texture->get_width(), u);
+ create_texcoords(slice.y, slice.y+slice.h, border.bottom, border.top, texture->get_height(), v);
+
+ unsigned xmin = border.left ? 0 : 1;
+ unsigned xmax = x.size()-(border.right ? 2 : 3);
+ unsigned ymin = border.bottom ? 0 : 1;
+ unsigned ymax = y.size()-(border.top ? 2 : 3);
+
+ bld.color(1.0f, 1.0f, 1.0f);
+ for(unsigned i=ymin; i<=ymax; ++i)