@@ -379,56 +379,10 @@ Image::resize(const Py::Tuple& args, const Py::Dict& kwargs) {
379
379
380
380
double x0, y0, x1, y1;
381
381
382
- if (interpolation==NEAREST) {
383
- x0 = 0.0 ;
384
- x1 = colsIn;
385
- y0 = 0.0 ;
386
- y1 = rowsIn;
387
- }
388
- else {
389
- // if interpolation != nearest, create a new input buffer with the
390
- // edges mirrored on all size. Then new buffer size is colsIn+2 by
391
- // rowsIn+2
392
-
393
- x0 = 1.0 ;
394
- x1 = colsIn+1 ;
395
- y0 = 1.0 ;
396
- y1 = rowsIn+1 ;
397
-
398
-
399
- bufferPad = new agg::int8u[(rowsIn+2 ) * (colsIn+2 ) * BPP];
400
- if (bufferPad ==NULL )
401
- throw Py::MemoryError (" Image::resize could not allocate memory" );
402
- rbufPad.attach (bufferPad, colsIn+2 , rowsIn+2 , (colsIn+2 ) * BPP);
403
-
404
- pixfmt pixfpad (rbufPad);
405
- renderer_base rbpad (pixfpad);
406
-
407
- pixfmt pixfin (*rbufIn);
408
- renderer_base rbin (pixfin);
409
-
410
- rbpad.copy_from (*rbufIn, 0 , 1 , 1 );
411
-
412
- agg::rect_base<int > firstrow (0 , 0 , colsIn-1 , 0 );
413
- rbpad.copy_from (*rbufIn, &firstrow, 1 , 0 );
414
-
415
- agg::rect_base<int > lastrow (0 , rowsIn-1 , colsIn-1 , rowsIn-1 );
416
- rbpad.copy_from (*rbufIn, &lastrow, 1 , 2 );
417
-
418
- agg::rect_base<int > firstcol (0 , 0 , 0 , rowsIn-1 );
419
- rbpad.copy_from (*rbufIn, &firstcol, 0 , 1 );
420
-
421
- agg::rect_base<int > lastcol (colsIn-1 , 0 , colsIn-1 , rowsIn-1 );
422
- rbpad.copy_from (*rbufIn, &lastcol, 2 , 1 );
423
-
424
- rbpad.copy_pixel (0 , 0 , rbin.pixel (0 ,0 ) );
425
- rbpad.copy_pixel (0 , colsIn+1 , rbin.pixel (0 ,colsIn-1 ) );
426
- rbpad.copy_pixel (rowsIn+1 , 0 , rbin.pixel (rowsIn-1 ,0 ) );
427
- rbpad.copy_pixel (rowsIn+1 , colsIn+1 , rbin.pixel (rowsIn-1 ,colsIn-1 ) );
428
-
429
-
430
- }
431
-
382
+ x0 = 0.0 ;
383
+ x1 = colsIn;
384
+ y0 = 0.0 ;
385
+ y1 = rowsIn;
432
386
433
387
path.move_to (x0, y0);
434
388
path.line_to (x1, y0);
@@ -439,7 +393,7 @@ Image::resize(const Py::Tuple& args, const Py::Dict& kwargs) {
439
393
ras.add_path (imageBox);
440
394
441
395
typedef agg::image_accessor_clip<pixfmt> img_accessor_type;
442
-
396
+
443
397
pixfmt pixfmtin (*rbufIn);
444
398
img_accessor_type ia (pixfmtin, background);
445
399
switch (interpolation)
0 commit comments