Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1c9f9b5

Browse filesBrowse files
committed
When using nearest neighbor interpolation and not actually scaling, just copy the data. (Note we don't do this for other kinds of interpolation, because the filtering on those interpolations could have an effect even when not actually scaling.)
1 parent bd94c0d commit 1c9f9b5
Copy full SHA for 1c9f9b5

File tree

Expand file treeCollapse file tree

1 file changed

+9
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-5
lines changed

‎src/_image.cpp

Copy file name to clipboardExpand all lines: src/_image.cpp
+9-5Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -439,11 +439,15 @@ Image::resize(const Py::Tuple& args, const Py::Dict& kwargs)
439439

440440
case NEAREST:
441441
{
442-
typedef agg::span_image_filter_rgba_nn<img_accessor_type, interpolator_type> span_gen_type;
443-
typedef agg::renderer_scanline_aa<renderer_base, span_alloc_type, span_gen_type> renderer_type;
444-
span_gen_type sg(ia, interpolator);
445-
renderer_type ri(rb, sa, sg);
446-
agg::render_scanlines(ras, sl, ri);
442+
if (colsIn == numcols && rowsIn == numrows) {
443+
memcpy(bufferOut, bufferIn, colsIn * rowsIn * 4);
444+
} else {
445+
typedef agg::span_image_filter_rgba_nn<img_accessor_type, interpolator_type> span_gen_type;
446+
typedef agg::renderer_scanline_aa<renderer_base, span_alloc_type, span_gen_type> renderer_type;
447+
span_gen_type sg(ia, interpolator);
448+
renderer_type ri(rb, sa, sg);
449+
agg::render_scanlines(ras, sl, ri);
450+
}
447451
}
448452
break;
449453

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.