public bool StartRedrawWith(int width, int height) { if (render == null) { return(false); } StopRedraw(); width = GetActualWidth(width); height = GetActualHeight(height); if (Width != width || Height != height) { render.SetResolution(width, height, ViewportCallback); } else { StartCoroutine(RedrawCoroutine(image)); } return(true); }
public void StartRedraw(int width, int height) { if (render == null) { return; } StopRedraw(); var canvasSize = canvasTransform.rect.size; var clampedSize = new Vector2Int( Mathf.Min(width, (int)canvasSize.x), Mathf.Min(height, (int)canvasSize.y) ); if (CurrentRenderSize != clampedSize) { render.SetResolution(width, height, ViewportCallback); } else { StartCoroutine(RedrawCoroutine()); } }