Handle delayed redrawing of the canvas.
358729
def delayed_redraw(self):
        """"""

        # This is the optimized redraw method
        with self._defer_lock:
            # pick up the lowest necessary level of redrawing
            whence = self._defer_whence
            self._defer_whence = self._defer_whence_reset
            flag = self._defer_flag
            self._defer_flag = False

        if flag:
            # If a redraw was scheduled, do it now
            self.redraw_now(whence=whence)
368000
def _redraw(self):
        
        # Only draw when no sub application was started.
        if self._is_running and self._sub_cli is None:
            self.render_counter += 1
            self.renderer.render(self, self.layout, is_done=self.is_done)

            # Fire render event.
            self.on_render.fire()
397865
def _repaint(self, drawing_context):
        """"""

        # canvas size
        canvas_width = self.canvas_size[1]
        canvas_height = self.canvas_size[0]

        # draw background
        if self.background_color:
            with drawing_context.saver():
                drawing_context.begin_path()
                drawing_context.move_to(0,0)
                drawing_context.line_to(canvas_width,0)
                drawing_context.line_to(canvas_width,canvas_height)
                drawing_context.line_to(0,canvas_height)
                drawing_context.close_path()
                drawing_context.fill_style = self.background_color
                drawing_context.fill()

        # draw the data, if any
        if (self.data is not None and len(self.data) > 0):

            # draw the histogram itself
            with drawing_context.saver():
                drawing_context.begin_path()
                binned_data = Image.rebin_1d(self.data, int(canvas_width), self.__retained_rebin_1d) if int(canvas_width) != self.data.shape[0] else self.data
                for i in range(canvas_width):
                    drawing_context.move_to(i, canvas_height)
                    drawing_context.line_to(i, canvas_height * (1 - binned_data[i]))
                drawing_context.line_width = 1
                drawing_context.stroke_style = "#444"
                drawing_context.stroke()
1065591
protected void allBlocksFinished ()
    {
        recomputeVisible();
        log.info("Restoring repaint... ", "left", _pendingBlocks, "view",
            StringUtil.toString(_vbounds));
        _delayRepaint = false;
        // Need to restore visibility as it may have been turned of as a result of the delay
        setVisible(true);
        _remgr.invalidateRegion(_vbounds);
    }
1368500
private void redraw() {
        double width  = getWidth() - getInsets().getLeft() - getInsets().getRight();
        double height = getHeight() - getInsets().getTop() - getInsets().getBottom();
        size          = width < height ? width : height;

        if (size > 0) {
            if (getWidth() > getHeight()) {
                setTranslateX(0.5 * (getWidth() - size));
            } else if (getHeight() > getWidth()) {
                setTranslateY(0.5 * (getHeight() - size));
            }

            frame.setPrefSize(size, size);
            frame.setBorder(gaugeDesign.getBorder(size));

            background.setCenterX(size * 0.5);
            background.setCenterY(size * 0.5);
            background.setRadius(size * 0.4375);

            background.setFill(gaugeBackground.getPaint(background.getLayoutBounds().getMinX(), background.getLayoutBounds().getMinY(),
                                                        background.getLayoutBounds().getMaxX(), background.getLayoutBounds().getMaxY()));

            switch(gaugeDesign) {
                case NONE:
                    frame.setVisible(false);
                    foreground.setVisible(false);
                    background.setVisible(false);
                    break;
                case ENZO:
                    background.setFill(Color.rgb(240, 240, 240));
                    innerShadow.setRadius(0.07407407 * size);
                    innerShadow.setOffsetX(0);
                    innerShadow.setOffsetY(0.07407407 * size);
                    innerShadow.setColor(Color.rgb(0, 0, 0, 0.35));
                    foreground.setFill(Color.TRANSPARENT);
                    foreground.setStroke(null);
                    break;
                default:
                    frame.setVisible(true);
                    foreground.setVisible(true);
                    background.setVisible(true);
                    innerShadow.setColor(Color.rgb(0, 0, 0, 0.65));
                    innerShadow.setRadius(0.08 * size);
                    innerShadow.setOffsetX(0);
                    innerShadow.setOffsetY(0.0 * size);
                    foreground.setFill(new RadialGradient(0, 0, size * 0.5, size * gaugeDesign.FRAME_FACTOR * 0.5, size, false, CycleMethod.NO_CYCLE,
                                                          new Stop(0, Color.rgb(255, 255, 255, 0.6)),
                                                          new Stop(0.4, Color.TRANSPARENT)));
                    foreground.setStroke(null);
                    break;
            }

            gauge.setPrefSize(size * (1.0 - gaugeDesign.FRAME_FACTOR * 2.0), size * (1.0 - gaugeDesign.FRAME_FACTOR * 2.0));
            gauge.relocate(gaugeDesign.FRAME_FACTOR * size, gaugeDesign.FRAME_FACTOR * size);

            foreground.setCenterX(size * 0.5);
            foreground.setCenterY(size * 0.5);
            foreground.setRadius(size * 0.42);
        }
    }
498611
def paused(self):
        
        self.mainloop.stop()
        try:
            yield
        finally:
            self.mainloop.start()

            # make sure urwid renders its canvas at the correct size
            self.mainloop.screen_size = None
            self.mainloop.draw_screen()
511677
function() {
			var _this = this;
			this.canvas = document.createElement('canvas');
			// Scale to same size as original canvas
			this.resize(true);
			document.body.appendChild(this.canvas);
			this.ctx = this.canvas.getContext( '2d');
			window.addEventListener( 'resize', function() {
				setTimeout(function(){ GameController.resize.call(_this); }, 10);
			});

			// Set the touch events for this new canvas
			this.setTouchEvents();

			// Load in the initial UI elements
			this.loadSide('left');
			this.loadSide('right');

			// Starts up the rendering / drawing
			this.render();

			// pause until a touch event
			if( !this.touches || !this.touches.length ) this.paused = true;
		}
1047727
def on_draw(self):
        """"""
        # Skip the drawing if the program hasn't been built yet.
        # The program is built by the interact.
        if self.program:
            # Draw the program.
            self.program.draw(self.gl_primitive_type)
        else:  # pragma: no cover
            logger.debug("Skipping drawing visual `%s` because the program "
                         "has not been built yet.", self)
827385
def __execute_rot(self, surface):
        """"""
        self.image = pygame.transform.rotate(surface, self.__rotation)
        self.__resize_surface_extents()
1108916
def redraw_cuts(self):
        """"""
        self.logger.debug("redrawing cuts")
        for cutstag in self.tags:
            if cutstag == self._new_cut:
                continue
            obj = self.canvas.get_object_by_tag(cutstag)
            if obj.kind != 'compound':
                continue
            self._update_tines(obj)
        self.canvas.redraw(whence=3)
362737
private void runAfterImageDraw(final Runnable action) {
        image.getViewTreeObserver().addOnPreDrawListener(new OnPreDrawListener() {
            @Override
            public boolean onPreDraw() {
                image.getViewTreeObserver().removeOnPreDrawListener(this);
                runOnNextFrame(action);
                return true;
            }
        });
        image.invalidate();
    }
770625
def redraw(self):
        
        if self._multiscat is not None:
            self._multiscat._update()
        self.vispy_widget.canvas.update()
248040
function wait(times, interval, callback) {
        Delay.setEditorTimeout(editor, function () {
          resize({});

          if (times--) {
            wait(times, interval, callback);
          } else if (callback) {
            callback();
          }
        }, interval);
      }
775984
protected void onDraw(Canvas c, Canvas acceleratedCanvas, MapView osmv, boolean shadow) {
		onDraw(c, osmv, shadow);
	}
632853
function processFrame(imageBitmap) {
  canvas.width = imageBitmap.width;
  canvas.height = imageBitmap.height;
  canvas.getContext('2d').drawImage(imageBitmap, 0, 0);
}
1312683
function postDraw(renderer) {
         if (typeof this.mask !== "undefined") {
           renderer.clearMask();
         }

         if (typeof this.tint !== "undefined") {
           renderer.clearTint();
         } // restore the context


         renderer.restore();
       }
949428
public void redraw() {
		groups.clear();
		mapWidget.getVectorContext().deleteGroup(editingService.getGeometry());
		draw(editingService.getGeometry());
	}