Pārlūkot izejas kodu

Fix img2twit's rendering. Apparently CGAL's Delaunay triangulation module

does not work with negative indices.

git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@3529 92316355-f0b4-4df1-b90c-862c8a59935f
master
sam pirms 15 gadiem
vecāks
revīzija
ff93399050
1 mainītis faili ar 9 papildinājumiem un 9 dzēšanām
  1. +9
    -9
      examples/img2twit.cpp

+ 9
- 9
examples/img2twit.cpp Parādīt failu

@@ -648,23 +648,23 @@ static void render(pipi_image_t *dst,
{
float fx, fy, fr, fg, fb, fs;
get_point(i, &fx, &fy, &fr, &fg, &fb, &fs);
dt.insert(K::Point_2(fx, fy));
dt.insert(K::Point_2(fx + dw * RANGE_X, fy + dh * RANGE_Y));
/* Keep link to point */
lookup[(int)(fx * 2) + dw * RANGE_X * 2 * (int)(fy * 2)] = i;
}

/* Add fake points to close the triangulation */
dt.insert(K::Point_2(-dw * RANGE_X, -dh * RANGE_Y));
dt.insert(K::Point_2(2 * dw * RANGE_X, -dh * RANGE_Y));
dt.insert(K::Point_2(-dw * RANGE_X, 2 * dh * RANGE_Y));
dt.insert(K::Point_2(2 * dw * RANGE_X, 2 * dh * RANGE_Y));
dt.insert(K::Point_2(0, 0));
dt.insert(K::Point_2(3 * dw * RANGE_X, 0));
dt.insert(K::Point_2(0, 3 * dh * RANGE_Y));
dt.insert(K::Point_2(3 * dw * RANGE_X, 3 * dh * RANGE_Y));

for(y = ry; y < ry + rh; y++)
{
for(x = rx; x < rx + rw; x++)
{
K::Point_2 m((float)x * dw * RANGE_X / p->w,
(float)y * dh * RANGE_Y / p->h);
K::Point_2 m((float)x * dw * RANGE_X / p->w + dw * RANGE_X,
(float)y * dh * RANGE_Y / p->h + dh * RANGE_Y);
Point_coordinate_vector coords;
CGAL::Triple<
std::back_insert_iterator<Point_coordinate_vector>,
@@ -679,8 +679,8 @@ static void render(pipi_image_t *dst,
{
float fx, fy, fr, fg, fb, fs;

fx = (*it).first.x();
fy = (*it).first.y();
fx = (*it).first.x() - dw * RANGE_X;
fy = (*it).first.y() - dh * RANGE_Y;

if(fx < 0 || fy < 0
|| fx > dw * RANGE_X - 1 || fy > dh * RANGE_Y - 1)


Notiek ielāde…
Atcelt
Saglabāt