Skip to content

Commit 34b13ef

Browse files
authored
Remove pixel scaling for default framebuffer from WebGL backend (#2805)
1 parent ab5ca56 commit 34b13ef

File tree

1 file changed

+3
-21
lines changed

1 file changed

+3
-21
lines changed

arcade/gl/backends/webgl/framebuffer.py

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -256,21 +256,15 @@ def __init__(self, ctx: WebGLContext):
256256

257257
@DefaultFrameBuffer.viewport.setter
258258
def viewport(self, value: tuple[int, int, int, int]):
259-
# This is the exact same as the WebGLFramebuffer setter
259+
# This is very similar to the OpenGL backend setter
260260
# WebGL backend doesn't need to handle pixel scaling for the
261261
# default framebuffer like desktop does, the browser does that
262262
# for us. However we need a separate implementation for the
263263
# function because of ABC
264264
if not isinstance(value, tuple) or len(value) != 4:
265265
raise ValueError("viewport shouldbe a 4-component tuple")
266266

267-
ratio = self.ctx.window.get_pixel_ratio()
268-
self._viewport = (
269-
int(value[0] * ratio),
270-
int(value[1] * ratio),
271-
int(value[2] * ratio),
272-
int(value[3] * ratio),
273-
)
267+
self._viewport = value
274268

275269
if self._ctx.active_framebuffer == self:
276270
self._ctx._gl.viewport(*self._viewport)
@@ -281,23 +275,11 @@ def viewport(self, value: tuple[int, int, int, int]):
281275

282276
@DefaultFrameBuffer.scissor.setter
283277
def scissor(self, value):
284-
# This is the exact same as the WebGLFramebuffer setter
285-
# WebGL backend doesn't need to handle pixel scaling for the
286-
# default framebuffer like desktop does, the browser does that
287-
# for us. However we need a separate implementation for the
288-
# function because of ABC
289278
if value is None:
290279
self._scissor = None
291280
if self._ctx.active_framebuffer == self:
292281
self._ctx._gl.scissor(*self._viewport)
293282
else:
294-
ratio = self.ctx.window.get_pixel_ratio()
295-
self._scissor = (
296-
int(value[0] * ratio),
297-
int(value[1] * ratio),
298-
int(value[2] * ratio),
299-
int(value[3] * ratio),
300-
)
301-
283+
self._scissor = value
302284
if self._ctx.active_framebuffer == self:
303285
self._ctx._gl.scissor(*self._scissor)

0 commit comments

Comments
 (0)