| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e2c5918 commit 60cc436
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -327,6 +327,8 @@ def _draw_unsampled_image(self, renderer, gc): | |||
| 327 | 327 | im.reset_matrix() | |
| 328 | 328 | numrows, numcols = im.get_size() | |
| 329 | 329 | ||
| 330 | + if numrows <= 0 or numcols <= 0: | ||
| 331 | + return | ||
| 330 | 332 | im.resize(numcols, numrows) # just to create im.bufOut that | |
| 331 | 333 | # is required by backends. There | |
| 332 | 334 | # may be better solution -JJL | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -374,10 +374,10 @@ Image::resize(const Py::Tuple& args, const Py::Dict& kwargs) | |||
| 374 | 374 | int numcols = Py::Int(args[0]); | |
| 375 | 375 | int numrows = Py::Int(args[1]); | |
| 376 | 376 | ||
| 377 | - if (numcols < 0 || numrows < 0) | ||
| 377 | + if (numcols <= 0 || numrows <= 0) | ||
| 378 | 378 | { | |
| 379 | - throw Py::RuntimeError( | ||
| 380 | - "Width and height must have non-negative values"); | ||
| 379 | + throw Py::RuntimeError( | ||
| 380 | + "Width and height must have positive values"); | ||
| 381 | 381 | } | |
| 382 | 382 | ||
| 383 | 383 | colsOut = numcols; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -45,6 +45,12 @@ class Image : public Py::PythonExtension<Image> | |||
| 45 | 45 | inline Py::Object flipud_out(const Py::Tuple& args) | |
| 46 | 46 | { | |
| 47 | 47 | args.verify_length(0); | |
| 48 | + if (colsOut <= 0 || rowsOut <= 0) | ||
| 49 | + { | ||
| 50 | + throw Py::RuntimeError( | ||
| 51 | + "Width and height must have positive values"); | ||
| 52 | + } | ||
| 53 | + | ||
| 48 | 54 | int stride = rbufOut->stride(); | |
| 49 | 55 | //std::cout << "flip before: " << rbufOut->stride() << std::endl; | |
| 50 | 56 | rbufOut->attach(bufferOut, colsOut, rowsOut, -stride); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments