Skip to content

Commit

Permalink
Remove comment about pixel density in offscreen surfaces (#2382)
Browse files Browse the repository at this point in the history
  • Loading branch information
wcandillon committed Apr 18, 2024
1 parent aeb5a85 commit 54138ee
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions package/src/renderer/Offscreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,10 @@ export const drawAsImage = (element: ReactElement, size: SkSize) => {
return drawAsImageFromPicture(drawAsPicture(element), size);
};

// TODO: We're not sure yet why PixelRatio is not needed here.
const pd = 1;
export const drawAsImageFromPicture = (picture: SkPicture, size: SkSize) => {
"worklet";
const surface = Skia.Surface.MakeOffscreen(
size.width * pd,
size.height * pd
)!;
const surface = Skia.Surface.MakeOffscreen(size.width, size.height)!;
const canvas = surface.getCanvas();
canvas.scale(pd, pd);
canvas.drawPicture(picture);
surface.flush();
const image = surface.makeImageSnapshot();
Expand Down

0 comments on commit 54138ee

Please sign in to comment.