Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9259989

Browse files
committed
Agg: Increase maximum size to 2**23
With 32-bit scan lines, we are able to take advantage of the full 32-bit range of coordinates. However, as noted in `extern/agg24-svn/include/agg_rasterizer_scanline_aa.h`, Agg uses 24.8-bit fixed point coordinates. With one bit taken for the sign, the maximum coordinate is now 2**23.
1 parent 474bb4f commit 9259989

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Increased Figure limits with Agg renderer
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
Figures using the Agg renderer are now limited to 2**23 pixels in each
5+
direction, instead of 2**16. Additionally, bugs that caused artists to not
6+
render past 2**15 pixels horizontally have been fixed.
7+
8+
Note that if you are using a GUI backend, it may have its own smaller limits
9+
(which may themselves depend on screen size.)

lib/matplotlib/tests/test_agg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def process_image(self, padded_src, dpi):
199199

200200

201201
def test_too_large_image():
202-
fig = plt.figure(figsize=(300, 1000))
202+
fig = plt.figure(figsize=(300, 2**25))
203203
buff = io.BytesIO()
204204
with pytest.raises(ValueError):
205205
fig.savefig(buff)

src/_backend_agg.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ RendererAgg::RendererAgg(unsigned int width, unsigned int height, double dpi)
3333
throw std::range_error("dpi must be positive");
3434
}
3535

36-
if (width >= 1 << 16 || height >= 1 << 16) {
36+
if (width >= 1 << 23 || height >= 1 << 23) {
3737
throw std::range_error(
3838
"Image size of " + std::to_string(width) + "x" + std::to_string(height) +
39-
" pixels is too large. It must be less than 2^16 in each direction.");
39+
" pixels is too large. It must be less than 2^23 in each direction.");
4040
}
4141

4242
unsigned stride(width * 4);

0 commit comments

Comments
 (0)