fix scaling artifacts

Former-commit-id: 7b90e7d033438a0c83e254ea7bcc791ad83808b3
This commit is contained in:
Imbris 2019-04-20 08:59:26 -04:00
parent 1143c58e37
commit 0daa8ef3f3
3 changed files with 6 additions and 7 deletions

View File

@ -81,7 +81,7 @@ impl<P: Pipeline> Texture<P> {
tex,
srv,
sampler: factory.create_sampler(gfx::texture::SamplerInfo::new(
gfx::texture::FilterMethod::Bilinear,
gfx::texture::FilterMethod::Scale,
gfx::texture::WrapMode::Clamp,
)),
_phantom: PhantomData,

View File

@ -57,22 +57,21 @@ impl GraphicCache {
{
match self
.rect_map
.get(&(graphic_id, dims, source.map(|e| e.to_bits())))
.get(&(graphic_id, dims, source.map(|e| e.to_bits()))) //<-------- TODO: Replace this with rounded representation of source
{
//<-------- TODO: Replace this with rounded representation of source
Some(aabr) => Some(*aabr),
None => match self.graphic_map.get(&graphic_id) {
Some(graphic) => {
// Allocate rectangle
let aabr = match self
.atlas
.allocate(size2(i32::from(dims.x + 2), i32::from(dims.y + 2)))
.allocate(size2(i32::from(dims.x), i32::from(dims.y)))
{
Some(Allocation { id, rectangle }) => {
let (min, max) = (rectangle.min, rectangle.max);
Aabr {
min: Vec2::new(min.x as u16 + 1, min.y as u16 + 1),
max: Vec2::new(max.x as u16 - 1, max.y as u16 - 1),
min: Vec2::new(min.x as u16, min.y as u16),
max: Vec2::new(max.x as u16, max.y as u16),
}
}
// Out of room

View File

@ -584,7 +584,7 @@ impl Ui {
self.scale.window_resized(new_dims, renderer);
let (w, h) = self.scale.scaled_window_size().into_tuple();
self.ui.handle_event(Input::Resize(w, h));
self.cache.clear_graphic_cache(renderer, new_dims.map(|e| (e * 4.0) as u16));
self.cache.clear_graphic_cache(renderer, renderer.get_resolution().map(|e| e * 4));
// TODO: probably need to resize glyph cache, see conrod's gfx backend for reference
}
}