mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
Merge pull request #19732 from calixteman/rm_useless_beginpath
Remove few useless beginPaths
This commit is contained in:
commit
b7437376f1
1 changed files with 10 additions and 12 deletions
|
@ -1605,7 +1605,6 @@ class CanvasGraphics {
|
|||
const paths = this.pendingTextPaths;
|
||||
const ctx = this.ctx;
|
||||
if (paths === undefined) {
|
||||
ctx.beginPath();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1622,7 +1621,6 @@ class CanvasGraphics {
|
|||
}
|
||||
|
||||
ctx.clip(newPath);
|
||||
ctx.beginPath();
|
||||
delete this.pendingTextPaths;
|
||||
}
|
||||
|
||||
|
@ -2127,8 +2125,9 @@ class CanvasGraphics {
|
|||
}
|
||||
|
||||
setCharWidthAndBounds(xWidth, yWidth, llx, lly, urx, ury) {
|
||||
this.ctx.rect(llx, lly, urx - llx, ury - lly);
|
||||
this.ctx.clip();
|
||||
const clip = new Path2D();
|
||||
clip.rect(llx, lly, urx - llx, ury - lly);
|
||||
this.ctx.clip(clip);
|
||||
this.endPath();
|
||||
}
|
||||
|
||||
|
@ -2271,11 +2270,11 @@ class CanvasGraphics {
|
|||
this.baseTransform = getCurrentTransform(this.ctx);
|
||||
|
||||
if (bbox) {
|
||||
const width = bbox[2] - bbox[0];
|
||||
const height = bbox[3] - bbox[1];
|
||||
this.ctx.rect(bbox[0], bbox[1], width, height);
|
||||
this.current.updateRectMinMax(getCurrentTransform(this.ctx), bbox);
|
||||
this.clip();
|
||||
const [x0, y0, x1, y1] = bbox;
|
||||
const clip = new Path2D();
|
||||
clip.rect(x0, y0, x1 - x0, y1 - y0);
|
||||
this.ctx.clip(clip);
|
||||
this.endPath();
|
||||
}
|
||||
}
|
||||
|
@ -2503,9 +2502,9 @@ class CanvasGraphics {
|
|||
// Consume a potential path before clipping.
|
||||
this.endPath();
|
||||
|
||||
this.ctx.rect(rect[0], rect[1], width, height);
|
||||
this.ctx.clip();
|
||||
this.ctx.beginPath();
|
||||
const clip = new Path2D();
|
||||
clip.rect(rect[0], rect[1], width, height);
|
||||
this.ctx.clip(clip);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2902,7 +2901,6 @@ class CanvasGraphics {
|
|||
this.pendingClip = null;
|
||||
}
|
||||
this.current.startNewPathAndClipBox(this.current.clipBox);
|
||||
ctx.beginPath();
|
||||
}
|
||||
|
||||
getSinglePixelWidth() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue