Skip to content

Commit 8d28672

Browse files
committed
Revert "fix: uncaught exceptions, still need to reject promise"
This reverts commit 5faa5f6.
1 parent 5faa5f6 commit 8d28672

2 files changed

Lines changed: 20 additions & 28 deletions

File tree

js/load-image-orientation.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,8 @@ Exif orientation values to correctly display the letter F:
8787
$.orientation = img.width === 2 && img.height === 3
8888
if ($.orientation) {
8989
var canvas = $.createCanvas(1, 1, true)
90-
try {
91-
var ctx = canvas.getContext('2d')
92-
ctx.drawImage(img, 1, 1, 1, 1, 0, 0, 1, 1)
93-
} catch (error) {
94-
// @todo: reject promise
95-
}
90+
var ctx = canvas.getContext('2d')
91+
ctx.drawImage(img, 1, 1, 1, 1, 0, 0, 1, 1)
9692
// Check if the source image coordinates (sX, sY, sWidth, sHeight) are
9793
// correctly applied to the auto-orientated image, which should result
9894
// in a white opaque pixel (e.g. in Safari).

js/load-image-scale.js

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -96,29 +96,25 @@
9696
destHeight,
9797
options
9898
) {
99-
try {
100-
var ctx = canvas.getContext('2d')
101-
if (options.imageSmoothingEnabled === false) {
102-
ctx.msImageSmoothingEnabled = false
103-
ctx.imageSmoothingEnabled = false
104-
} else if (options.imageSmoothingQuality) {
105-
ctx.imageSmoothingQuality = options.imageSmoothingQuality
106-
}
107-
ctx.drawImage(
108-
img,
109-
sourceX,
110-
sourceY,
111-
sourceWidth,
112-
sourceHeight,
113-
0,
114-
0,
115-
destWidth,
116-
destHeight
117-
)
118-
return ctx
119-
} catch (error) {
120-
// @todo: reject promise upon error
99+
var ctx = canvas.getContext('2d')
100+
if (options.imageSmoothingEnabled === false) {
101+
ctx.msImageSmoothingEnabled = false
102+
ctx.imageSmoothingEnabled = false
103+
} else if (options.imageSmoothingQuality) {
104+
ctx.imageSmoothingQuality = options.imageSmoothingQuality
121105
}
106+
ctx.drawImage(
107+
img,
108+
sourceX,
109+
sourceY,
110+
sourceWidth,
111+
sourceHeight,
112+
0,
113+
0,
114+
destWidth,
115+
destHeight
116+
)
117+
return ctx
122118
}
123119

124120
// Determines if the target image should be a canvas element:

0 commit comments

Comments
 (0)