summaryrefslogtreecommitdiffstats
path: root/dom/canvas/CanvasRenderingContext2D.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-23 04:29:08 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-23 04:29:08 +0000
commit0ce6c14b1b17b78e45c0592bd3e404adbc26ed3e (patch)
treec8c48fae9c5a35b94ab93af4fc24cf1d2fb4bdf1 /dom/canvas/CanvasRenderingContext2D.h
parentAdding upstream version 125.0.1. (diff)
downloadfirefox-0ce6c14b1b17b78e45c0592bd3e404adbc26ed3e.tar.xz
firefox-0ce6c14b1b17b78e45c0592bd3e404adbc26ed3e.zip
Adding upstream version 125.0.2.upstream/125.0.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/canvas/CanvasRenderingContext2D.h')
-rw-r--r--dom/canvas/CanvasRenderingContext2D.h22
1 files changed, 16 insertions, 6 deletions
diff --git a/dom/canvas/CanvasRenderingContext2D.h b/dom/canvas/CanvasRenderingContext2D.h
index 75a57ab14f..bfcbfccec2 100644
--- a/dom/canvas/CanvasRenderingContext2D.h
+++ b/dom/canvas/CanvasRenderingContext2D.h
@@ -364,14 +364,18 @@ class CanvasRenderingContext2D : public nsICanvasRenderingContextInternal,
}
void ClosePath() {
- EnsureWritablePath();
+ if (!EnsureWritablePath()) {
+ return;
+ }
mPathBuilder->Close();
mPathPruned = false;
}
void MoveTo(double aX, double aY) {
- EnsureWritablePath();
+ if (!EnsureWritablePath()) {
+ return;
+ }
mozilla::gfx::Point pos(ToFloat(aX), ToFloat(aY));
if (!pos.IsFinite()) {
@@ -383,13 +387,17 @@ class CanvasRenderingContext2D : public nsICanvasRenderingContextInternal,
}
void LineTo(double aX, double aY) {
- EnsureWritablePath();
+ if (!EnsureWritablePath()) {
+ return;
+ }
LineTo(mozilla::gfx::Point(ToFloat(aX), ToFloat(aY)));
}
void QuadraticCurveTo(double aCpx, double aCpy, double aX, double aY) {
- EnsureWritablePath();
+ if (!EnsureWritablePath()) {
+ return;
+ }
mozilla::gfx::Point cp1(ToFloat(aCpx), ToFloat(aCpy));
mozilla::gfx::Point cp2(ToFloat(aX), ToFloat(aY));
@@ -408,7 +416,9 @@ class CanvasRenderingContext2D : public nsICanvasRenderingContextInternal,
void BezierCurveTo(double aCp1x, double aCp1y, double aCp2x, double aCp2y,
double aX, double aY) {
- EnsureWritablePath();
+ if (!EnsureWritablePath()) {
+ return;
+ }
BezierTo(mozilla::gfx::Point(ToFloat(aCp1x), ToFloat(aCp1y)),
mozilla::gfx::Point(ToFloat(aCp2x), ToFloat(aCp2y)),
@@ -680,7 +690,7 @@ class CanvasRenderingContext2D : public nsICanvasRenderingContextInternal,
/* This function ensures there is a writable pathbuilder available
*/
- void EnsureWritablePath();
+ bool EnsureWritablePath();
// Ensures a path in UserSpace is available.
void EnsureUserSpacePath(