time | Calls | line |
---|
| | 1 | function tooBig = checkImageSizeForPrint(dpi, ~, width, height)
|
| | 2 | % CHECKIMAGESIZEFORPRINT Checks to see if the image that will be
|
| | 3 | % produced in the print path is within certain bounds. This
|
| | 4 | % undocumented helper function is for internal use.
|
| | 5 |
|
| | 6 | % This function is called during the print path. See usage in
|
| | 7 | % alternatePrintPath.m
|
| | 8 |
|
| | 9 | % Predict how big the image data will be based on the requested
|
| | 10 | % resolution and image size. Returns true if the image size is greater
|
| | 11 | % than the limit in imwrite.
|
| | 12 |
|
| | 13 | % Copyright 2013-2017 The MathWorks, Inc.
|
| | 14 |
|
< 0.001 | 10 | 15 | tooBig = false;
|
| | 16 |
|
< 0.001 | 10 | 17 | expectedWidth = width*dpi;
|
< 0.001 | 10 | 18 | expectedHeight = height*dpi;
|
| | 19 |
|
< 0.001 | 10 | 20 | maxInt32 = double(intmax('int32'));
|
| | 21 |
|
| | 22 | % If one of the dimensions is larger than maxInt32, or if the number of
|
| | 23 | % elements in the data (width*height*4 for RGBA data) is larger than
|
| | 24 | % maxInt32, then we won't be able to write outvfput through
|
| | 25 | % HGRasterOutputHelper->generateOutput (NIO buffer size limitation)
|
| | 26 | % It's better to exit early g1363602
|
| | 27 | %
|
| | 28 | % This case also cover imwrite() limitation as it allowed maximum
|
| | 29 | % buffer size of unsigned int 32-bit RGB data.
|
| | 30 |
|
< 0.001 | 10 | 31 | if expectedWidth > maxInt32 || expectedHeight > maxInt32
|
| | 32 | tooBig = true;
|
< 0.001 | 10 | 33 | elseif ((expectedWidth * expectedHeight * 4) > maxInt32)
|
| | 34 | tooBig = true;
|
< 0.001 | 10 | 35 | end
|
< 0.001 | 10 | 36 | end
|
Other subfunctions in this file are not included in this listing.