| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,8 +24,8 @@ matrix: | |||
| 24 | 24 | ||
| 25 | 25 | install: | |
| 26 | 26 | - pip install -q --use-mirrors nose python-dateutil $NUMPY pep8 pyparsing pillow | |
| 27 | - - sudo apt-get update && sudo apt-get -qq install inkscape libav-tools | ||
| 28 | - # We use --no-install-recommends to avoid pulling in additional large latex docs that we don't need | ||
| 27 | + - sudo apt-get update && sudo apt-get -qq install inkscape libav-tools gdb | ||
| 28 | + # We use --no-install-recommends to avoid pulling in additional large latex docs that we don't need | ||
| 29 | 29 | - if [[ $BUILD_DOCS == true ]]; then sudo apt-get install -qq --no-install-recommends dvipng texlive-latex-base texlive-latex-extra texlive-fonts-recommended graphviz; fi | |
| 30 | 30 | - if [[ $BUILD_DOCS == true ]]; then pip install sphinx numpydoc linkchecker; fi | |
| 31 | 31 | - python setup.py install | |
@@ -37,11 +37,12 @@ script: | |||
| 37 | 37 | - echo Testing using 8 processes | |
| 38 | 38 | # Generate the font caches in a single process before starting the | |
| 39 | 39 | # multiple processes | |
| 40 | + - gcc --version | ||
| 40 | 41 | - python -c "from matplotlib import font_manager" | |
| 41 | 42 | - if [[ $BUILD_DOCS == false ]]; then export MPL_REPO_DIR=$PWD; fi # pep8-conformance test of the examples | |
| 42 | 43 | - if [[ $BUILD_DOCS == false ]]; then mkdir ../tmp_test_dir; fi | |
| 43 | 44 | - if [[ $BUILD_DOCS == false ]]; then cd ../tmp_test_dir; fi | |
| 44 | - - if [[ $BUILD_DOCS == false ]]; then python ../matplotlib/tests.py -sv --processes=8 --process-timeout=300 $TEST_ARGS; fi | ||
| 45 | + - if [[ $BUILD_DOCS == false ]]; then gdb -return-child-result -batch -ex r -ex bt --args python ../matplotlib/tests.py -sv $TEST_ARGS; fi | ||
| 45 | 46 | - if [[ $BUILD_DOCS == true ]]; then cd doc; python make.py html --small; fi | |
| 46 | 47 | # We don't build the LaTeX docs here, so linkchecker will complain | |
| 47 | 48 | - if [[ $BUILD_DOCS == true ]]; then touch build/html/Matplotlib.pdf; fi | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,12 +8,7 @@ | |||
| 8 | 8 | fig.canvas.draw() | |
| 9 | 9 | ||
| 10 | 10 | # grab the pixel buffer and dump it into a numpy array | |
| 11 | - buf = fig.canvas.buffer_rgba() | ||
| 12 | - l, b, w, h = fig.bbox.bounds | ||
| 13 | - # The array needs to be copied, because the underlying buffer | ||
| 14 | - # may be reallocated when the window is resized. | ||
| 15 | - X = np.frombuffer(buf, np.uint8).copy() | ||
| 16 | - X.shape = h,w,4 | ||
| 11 | + X = np.array(fig.canvas.renderer._renderer) | ||
| 17 | 12 | ||
| 18 | 13 | # now display the array X as an Axes in a new figure | |
| 19 | 14 | fig2 = plt.figure() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,5 +24,4 @@ | |||
| 24 | 24 | ||
| 25 | 25 | ax.set_title(r'$\Delta_i^j \hspace{0.4} \mathrm{versus} \hspace{0.4} \Delta_{i+1}^j$', fontsize=20) | |
| 26 | 26 | ||
| 27 | - | ||
| 28 | 27 | show() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1405,6 +1405,13 @@ def tk_window_focus(): | |||
| 1405 | 1405 | ||
| 1406 | 1406 | def test(verbosity=1): | |
| 1407 | 1407 | """run the matplotlib test suite""" | |
| 1408 | + try: | ||
| 1409 | + import faulthandler | ||
| 1410 | + except ImportError: | ||
| 1411 | + pass | ||
| 1412 | + else: | ||
| 1413 | + faulthandler.enable() | ||
| 1414 | + | ||
| 1408 | 1415 | old_backend = rcParams['backend'] | |
| 1409 | 1416 | try: | |
| 1410 | 1417 | use('agg') | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2063,8 +2063,8 @@ def draw(self, renderer=None, inframe=False): | |||
| 2063 | 2063 | for z, im in zorder_images] | |
| 2064 | 2064 | ||
| 2065 | 2065 | l, b, r, t = self.bbox.extents | |
| 2066 | - width = mag * ((round(r) + 0.5) - (round(l) - 0.5)) | ||
| 2067 | - height = mag * ((round(t) + 0.5) - (round(b) - 0.5)) | ||
| 2066 | + width = int(mag * ((round(r) + 0.5) - (round(l) - 0.5))) | ||
| 2067 | + height = int(mag * ((round(t) + 0.5) - (round(b) - 0.5))) | ||
| 2068 | 2068 | im = mimage.from_images(height, | |
| 2069 | 2069 | width, | |
| 2070 | 2070 | ims) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -127,15 +127,19 @@ def draw_path_collection(self, *kl, **kw): | |||
| 127 | 127 | return self._renderer.draw_path_collection(*kl, **kw) | |
| 128 | 128 | ||
| 129 | 129 | def _update_methods(self): | |
| 130 | - #self.draw_path = self._renderer.draw_path # see below | ||
| 131 | - #self.draw_markers = self._renderer.draw_markers | ||
| 132 | - #self.draw_path_collection = self._renderer.draw_path_collection | ||
| 133 | 130 | self.draw_quad_mesh = self._renderer.draw_quad_mesh | |
| 134 | 131 | self.draw_gouraud_triangle = self._renderer.draw_gouraud_triangle | |
| 135 | 132 | self.draw_gouraud_triangles = self._renderer.draw_gouraud_triangles | |
| 136 | 133 | self.draw_image = self._renderer.draw_image | |
| 137 | 134 | self.copy_from_bbox = self._renderer.copy_from_bbox | |
| 138 | - self.tostring_rgba_minimized = self._renderer.tostring_rgba_minimized | ||
| 135 | + self.get_content_extents = self._renderer.get_content_extents | ||
| 136 | + | ||
| 137 | + def tostring_rgba_minimized(self): | ||
| 138 | + extents = self.get_content_extents() | ||
| 139 | + bbox = [[extents[0], self.height - (extents[1] + extents[3])], | ||
| 140 | + [extents[0] + extents[2], self.height - extents[1]]] | ||
| 141 | + region = self.copy_from_bbox(bbox) | ||
| 142 | + return np.array(region), extents | ||
| 139 | 143 | ||
| 140 | 144 | def draw_path(self, gc, path, transform, rgbFace=None): | |
| 141 | 145 | """ | |
@@ -203,7 +207,7 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None): | |||
| 203 | 207 | ||
| 204 | 208 | #print x, y, int(x), int(y), s | |
| 205 | 209 | self._renderer.draw_text_image( | |
| 206 | - font.get_image(), np.round(x - xd), np.round(y + yd) + 1, angle, gc) | ||
| 210 | + font, np.round(x - xd), np.round(y + yd) + 1, angle, gc) | ||
| 207 | 211 | ||
| 208 | 212 | def get_text_width_height_descent(self, s, prop, ismath): | |
| 209 | 213 | """ | |
@@ -354,7 +358,7 @@ def restore_region(self, region, bbox=None, xy=None): | |||
| 354 | 358 | else: | |
| 355 | 359 | ox, oy = xy | |
| 356 | 360 | ||
| 357 | - self._renderer.restore_region2(region, x1, y1, x2, y2, ox, oy) | ||
| 361 | + self._renderer.restore_region(region, x1, y1, x2, y2, ox, oy) | ||
| 358 | 362 | ||
| 359 | 363 | else: | |
| 360 | 364 | self._renderer.restore_region(region) | |
@@ -394,7 +398,7 @@ def post_processing(image, dpi): | |||
| 394 | 398 | ||
| 395 | 399 | width, height = int(self.width), int(self.height) | |
| 396 | 400 | ||
| 397 | - buffer, bounds = self._renderer.tostring_rgba_minimized() | ||
| 401 | + buffer, bounds = self.tostring_rgba_minimized() | ||
| 398 | 402 | ||
| 399 | 403 | l, b, w, h = bounds | |
| 400 | 404 | ||
@@ -407,7 +411,6 @@ def post_processing(image, dpi): | |||
| 407 | 411 | img, ox, oy = post_processing(img.reshape((h, w, 4)) / 255., | |
| 408 | 412 | self.dpi) | |
| 409 | 413 | image = fromarray(img, 1) | |
| 410 | - image.flipud_out() | ||
| 411 | 414 | ||
| 412 | 415 | gc = self.new_gc() | |
| 413 | 416 | self._renderer.draw_image(gc, | |
@@ -505,12 +508,13 @@ def print_raw(self, filename_or_obj, *args, **kwargs): | |||
| 505 | 508 | original_dpi = renderer.dpi | |
| 506 | 509 | renderer.dpi = self.figure.dpi | |
| 507 | 510 | if is_string_like(filename_or_obj): | |
| 508 | - filename_or_obj = open(filename_or_obj, 'wb') | ||
| 511 | + fileobj = open(filename_or_obj, 'wb') | ||
| 509 | 512 | close = True | |
| 510 | 513 | else: | |
| 514 | + fileobj = filename_or_obj | ||
| 511 | 515 | close = False | |
| 512 | 516 | try: | |
| 513 | - renderer._renderer.write_rgba(filename_or_obj) | ||
| 517 | + fileobj.write(renderer._renderer.buffer_rgba()) | ||
| 514 | 518 | finally: | |
| 515 | 519 | if close: | |
| 516 | 520 | filename_or_obj.close() | |
@@ -528,9 +532,7 @@ def print_png(self, filename_or_obj, *args, **kwargs): | |||
| 528 | 532 | else: | |
| 529 | 533 | close = False | |
| 530 | 534 | try: | |
| 531 | - _png.write_png(renderer._renderer.buffer_rgba(), | ||
| 532 | - renderer.width, renderer.height, | ||
| 533 | - filename_or_obj, self.figure.dpi) | ||
| 535 | + _png.write_png(renderer._renderer, filename_or_obj, self.figure.dpi) | ||
| 534 | 536 | finally: | |
| 535 | 537 | if close: | |
| 536 | 538 | filename_or_obj.close() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -167,8 +167,6 @@ def draw_image(self, gc, x, y, im): | |||
| 167 | 167 | # bbox - not currently used | |
| 168 | 168 | if _debug: print('%s.%s()' % (self.__class__.__name__, _fn_name())) | |
| 169 | 169 | ||
| 170 | - im.flipud_out() | ||
| 171 | - | ||
| 172 | 170 | rows, cols, buf = im.color_conv (BYTE_FORMAT) | |
| 173 | 171 | surface = cairo.ImageSurface.create_for_data ( | |
| 174 | 172 | buf, cairo.FORMAT_ARGB32, cols, rows, cols*4) | |
@@ -183,8 +181,6 @@ def draw_image(self, gc, x, y, im): | |||
| 183 | 181 | ctx.paint() | |
| 184 | 182 | ctx.restore() | |
| 185 | 183 | ||
| 186 | - im.flipud_out() | ||
| 187 | - | ||
| 188 | 184 | def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None): | |
| 189 | 185 | # Note: x,y are device/display coords, not user-coords, unlike other | |
| 190 | 186 | # draw_* methods | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -109,7 +109,6 @@ def draw_image(self, gc, x, y, im): | |||
| 109 | 109 | # int(w), int(h)) | |
| 110 | 110 | # set clip rect? | |
| 111 | 111 | ||
| 112 | - im.flipud_out() | ||
| 113 | 112 | rows, cols, image_str = im.as_rgba_str() | |
| 114 | 113 | ||
| 115 | 114 | image_array = np.fromstring(image_str, np.uint8) | |
@@ -120,7 +119,7 @@ def draw_image(self, gc, x, y, im): | |||
| 120 | 119 | width=cols, height=rows) | |
| 121 | 120 | ||
| 122 | 121 | array = pixbuf_get_pixels_array(pixbuf) | |
| 123 | - array[:,:,:] = image_array | ||
| 122 | + array[:,:,:] = image_array[::-1] | ||
| 124 | 123 | ||
| 125 | 124 | gc = self.new_gc() | |
| 126 | 125 | ||
@@ -138,9 +137,6 @@ def draw_image(self, gc, x, y, im): | |||
| 138 | 137 | int(x), int(y), cols, rows, | |
| 139 | 138 | gdk.RGB_DITHER_NONE, 0, 0) | |
| 140 | 139 | ||
| 141 | - # unflip | ||
| 142 | - im.flipud_out() | ||
| 143 | - | ||
| 144 | 140 | ||
| 145 | 141 | def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None): | |
| 146 | 142 | x, y = int(x), int(y) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -110,10 +110,8 @@ def get_image_magnification(self): | |||
| 110 | 110 | return self.gc.get_image_magnification() | |
| 111 | 111 | ||
| 112 | 112 | def draw_image(self, gc, x, y, im): | |
| 113 | - im.flipud_out() | ||
| 114 | 113 | nrows, ncols, data = im.as_rgba_str() | |
| 115 | 114 | gc.draw_image(x, y, nrows, ncols, data) | |
| 116 | - im.flipud_out() | ||
| 117 | 115 | ||
| 118 | 116 | def draw_tex(self, gc, x, y, s, prop, angle, ismath='TeX!', mtext=None): | |
| 119 | 117 | # todo, handle props, angle, origins | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -121,7 +121,6 @@ def stop_rasterizing(self): | |||
| 121 | 121 | if w > 0 and h > 0: | |
| 122 | 122 | image = frombuffer(buffer, w, h, True) | |
| 123 | 123 | image.is_grayscale = False | |
| 124 | - image.flipud_out() | ||
| 125 | 124 | gc = self._renderer.new_gc() | |
| 126 | 125 | # TODO: If the mixedmode resolution differs from the figure's | |
| 127 | 126 | # dpi, the image must be scaled (dpi->_figdpi). Not all | |
| Back | FazBrowse Home | New Git URL |
0 commit comments