ID:2860643
 
Resolved
RenderIcon() incorectly included extra HUD tiles in its size calculations.
BYOND Version:515.1602
Operating System:Windows 10 Enterprise
Web Browser:Chrome 109.0.0.0
Applies to:Dream Seeker
Status: Resolved (515.1603)

This issue has been resolved.
Descriptive Problem Summary:
When trying to use rendericon to get proper icon to render near message in browser, their image got squished, so i decided to check what resolution icon is being rendered in, and it turned out to be wrong resolution. Then i decided to run the same snippet in project unrelated to mine, and it did exactly the same thing. Am i using it wrong or there's something wrong going on?
Will provide with additional information requested to resolve this, Thank you.

Trying out same code in two different projects
https://cdn.discordapp.com/attachments/1084896431049027694/ 1087047953564323910/image.png
https://cdn.discordapp.com/attachments/1084896431049027694/ 1087047953774035106/image.png

Code Snippet (if applicable) to Reproduce Problem:
world
fps = 20 // 25 frames per second
icon_size = 32 // 32x32 icon size by default
view = 7 // show up to 6 tiles outward from center (15x15 view)

//////////////////////////////////////////////////////

var/icon/I = icon(client.RenderIcon(object))
world << "[I.Width()]"
world << "[I.Height()]"
src << "\icon[I] Thats a [object.name]"


Expected Results:
Icon with 32x32 size

Actual Results:
Icon with 128x32 size

Does the problem occur:
Tested it on three separate projects, always had same result

When does the problem NOT occur?
Couldn't make it work proper

Workarounds:
Using old method of icon display in css
Created new project from scratch, this doesn't seem to occur in clean project, what could cause this in existing projects?
I have figured out way to replicate this issue.
Turns out, having any elements rendering outside of client view (anything that has screen loc that is less than 1) starts to give additional pixels icons that are made with RenderIcon()

Example:
Object has screen_loc of -2 leads to rendericon size of 128x32:
https://cdn.discordapp.com/attachments/1084896431049027694/ 1087070565052993546/image.png
https://cdn.discordapp.com/attachments/1084896431049027694/ 1087070599026839613/image.png

Removed any icons outside of client viewport leads to render icon output to have 32x32 icon size
https://cdn.discordapp.com/attachments/1084896431049027694/ 1087070708435275836/image.png
https://cdn.discordapp.com/attachments/1084896431049027694/ 1087070658967650404/image.png
BYOND has fallen
I'm gonna need a test project so I can reproduce this and investigate.

I also need you to edit your report to include the full BYOND version you're using.
In response to Lummox JR
https://cdn.discordapp.com/attachments/860992135304970240/ 1087102135444963338/Bug_Testing_Grounds.rar, just press test continously and it will increase rendericon size

If not comfortable with downloading files:
/mob/living
icon = 'icons/mob/human.dmi'
var/offset = 0
var/tests = list()

/mob/living/verb/test_render()
var/icon/I = icon(client.RenderIcon(src))
world << "RenderIcon width is now [I.Width()]"
world << "RenderIcon height is now [I.Height()]"
src << "\icon[I] Thats a [src.name]"

world << "press test button again"

client.screen.Cut()
var/obj/test/T = new(src)
T.screen_loc = "[offset],1"
tests += T
for(var/obj/O in tests)
client.screen += O

offset--

/obj/test
icon = 'icons/mob/human.dmi'
icon_state = "test"
Lummox JR resolved issue with message:
RenderIcon() incorectly included extra HUD tiles in its size calculations.