1
0
Fork 0
forked from wry/wry

tree: update to latest version of wp_fractional_scale

This commit is contained in:
Julian Orth 2022-11-12 15:05:58 +01:00
parent e61d6ab074
commit 5b2eb5855a
22 changed files with 104 additions and 54 deletions

View file

@ -16,6 +16,7 @@ use {
sys::{glBlendFunc, glFlush, glReadnPixels, GL_ONE, GL_ONE_MINUS_SRC_ALPHA},
RenderResult, Texture,
},
scale::Scale,
state::State,
tree::Node,
},
@ -61,7 +62,7 @@ impl Framebuffer {
glViewport(0, 0, self.gl.width, self.gl.height);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
}
let scale = Fixed::from_int(1);
let scale = Scale::from_int(1);
let mut renderer = Renderer {
base: RendererBase {
ctx: &self.ctx,
@ -114,7 +115,7 @@ impl Framebuffer {
});
}
pub fn render_custom(&self, scale: Fixed, f: impl FnOnce(&mut RendererBase)) {
pub fn render_custom(&self, scale: Scale, f: impl FnOnce(&mut RendererBase)) {
let _ = self.ctx.ctx.with_current(|| {
unsafe {
glBindFramebuffer(GL_FRAMEBUFFER, self.gl.fbo);
@ -143,7 +144,7 @@ impl Framebuffer {
cursor_rect: Option<Rect>,
on_output: bool,
result: &mut RenderResult,
scale: Fixed,
scale: Scale,
render_hardware_cursor: bool,
) {
let _ = self.ctx.ctx.with_current(|| {
@ -201,7 +202,7 @@ impl Framebuffer {
});
}
pub fn render_hardware_cursor(&self, cursor: &dyn Cursor, state: &State, scale: Fixed) {
pub fn render_hardware_cursor(&self, cursor: &dyn Cursor, state: &State, scale: Scale) {
let _ = self.ctx.ctx.with_current(|| {
unsafe {
glBindFramebuffer(GL_FRAMEBUFFER, self.gl.fbo);

View file

@ -1,6 +1,5 @@
use {
crate::{
fixed::Fixed,
format::ARGB8888,
ifs::{
wl_buffer::WlBuffer,
@ -12,6 +11,7 @@ use {
},
rect::Rect,
render::{gl::frame_buffer::with_scissor, renderer::renderer_base::RendererBase},
scale::Scale,
state::State,
theme::Color,
tree::{
@ -48,7 +48,7 @@ pub struct Renderer<'a> {
}
impl Renderer<'_> {
pub fn scale(&self) -> Fixed {
pub fn scale(&self) -> Scale {
self.base.scale
}

View file

@ -1,6 +1,5 @@
use {
crate::{
fixed::Fixed,
format::Format,
rect::Rect,
render::{
@ -18,6 +17,7 @@ use {
sys::{glClear, glClearColor, glDisable, glEnable, GL_BLEND, GL_COLOR_BUFFER_BIT},
Texture,
},
scale::Scale,
theme::Color,
utils::rc_eq::rc_eq,
},
@ -28,12 +28,12 @@ pub struct RendererBase<'a> {
pub(super) ctx: &'a Rc<RenderContext>,
pub(super) fb: &'a GlFrameBuffer,
pub(super) scaled: bool,
pub(super) scale: Fixed,
pub(super) scale: Scale,
pub(super) scalef: f64,
}
impl RendererBase<'_> {
pub fn scale(&self) -> Fixed {
pub fn scale(&self) -> Scale {
self.scale
}
@ -188,7 +188,7 @@ impl RendererBase<'_> {
format: &Format,
tpoints: Option<&[f32; 8]>,
tsize: Option<(i32, i32)>,
tscale: Fixed,
tscale: Scale,
) {
assert!(rc_eq(&self.ctx.ctx, &texture.ctx.ctx));
unsafe {