-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix blurry DefaultTtfFontAsBitmap text in CachedContainer when virtual size < window size #1760
Conversation
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## main #1760 +/- ##
==========================================
+ Coverage 51.11% 51.13% +0.01%
==========================================
Files 1737 1737
Lines 102045 102072 +27
Branches 14472 14474 +2
==========================================
+ Hits 52158 52192 +34
- Misses 45892 45908 +16
+ Partials 3995 3972 -23
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
Awesome. Thanks for implementing it! I have noticed a small tweak that could improve it further if you can change it |
var cache: Boolean = true | ||
var cache: Boolean = true, | ||
@property:ViewProperty | ||
var expensiveScaling: Boolean = true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have expensiveScaling: Boolean? = null
?
When constructing KorGE we have a quality
parameter. Can we use the quality parameter to determine the value when not specified?
Here's the quality:
enum class Quality { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR https://github.com/korlibs/korge/pull/1762/files will be needed, so it is possible to access tue GameWindow quality inside the RenderContext
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have
expensiveScaling: Boolean? = null
?
Excellent idea, implemented! 59cb483
val doExpensiveScaling = expensiveScaling ?: when(ctx.quality) { | ||
GameWindow.Quality.PERFORMANCE -> false | ||
else -> true | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think that by adding some properties to the Quality enum, could we avoid somehow the when
so the code gets simpler?
var cache: Boolean = true | ||
var cache: Boolean = true, | ||
@property:ViewProperty | ||
var expensiveScaling: Boolean? = null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this name. People might ask: In which way is this expensive? What scaling mean in this context?
Could we rename it, or pass something else to a Boolean?
Thanks @eaboll for implementing this! To avoid this getting outdated, I'm going to merge it and make a few adjustments. |
…ity (#1803) * Added `korlibs.image.Quality` and make `GameWindow.Quality` implement it + tests * Add Views.quality as an alias of GameWindow::quality * Make enumerable debug view properties to support nullable values * Add Missing Quality.LIST * Test Quality.LIST * Adds QualityProvider with a ViewPropertyProvider listing available Qualities * Adds CachedContainer.renderQuality, backporting changes from @eaboll in #1760 * Backport example from other PR, but do not change the virtual size to avoid it to be misleading; just scale the container
Adds
CachedContainer.expensiveScaling: Boolean?
, which enables scaling of the content based on the actual window size instead of just the virtual size. Set totrue
by default.This fixes part of issue #1748. The default non-bitmap font is still blurry regardless of whether or not it's in a CachedContainer.
In the sandbox: