1
0
Fork 0
forked from wry/wry

autocommit 2022-02-01 23:33:59 CET

This commit is contained in:
Julian Orth 2022-02-01 23:33:59 +01:00
parent 41c5f8cf89
commit 2dbe3ba732
21 changed files with 814 additions and 86 deletions

View file

@ -39,10 +39,11 @@ impl Framebuffer {
let seats = state.globals.lock_seats();
for seat in seats.values() {
if let Some(cursor) = seat.get_cursor() {
cursor.tick();
let extents = cursor.extents();
if extents.intersects(&rect) {
let (x, y) = rect.translate(extents.x1(), extents.y1());
renderer.render_surface(cursor.surface(), x, y);
cursor.render(&mut renderer, x, y);
}
}
}

View file

@ -18,6 +18,8 @@ use crate::tree::{
use std::ops::Deref;
use std::rc::Rc;
use std::slice;
use crate::format::Format;
use crate::render::Texture;
const NON_COLOR: (f32, f32, f32) = (0.2, 0.2, 0.2);
const CHILD_COLOR: (f32, f32, f32) = (0.8, 0.8, 0.8);
@ -218,10 +220,12 @@ impl Renderer<'_> {
}
pub fn render_buffer(&mut self, buffer: &WlBuffer, x: i32, y: i32) {
let texture = match buffer.texture.get() {
Some(t) => t,
_ => return,
};
if let Some(tex) = buffer.texture.get() {
self.render_texture(&tex, x, y, buffer.format);
}
}
pub fn render_texture(&mut self, texture: &Texture, x: i32, y: i32, format: &Format) {
assert!(Rc::ptr_eq(&self.ctx.ctx, &texture.ctx.ctx));
unsafe {
glActiveTexture(GL_TEXTURE0);
@ -229,7 +233,7 @@ impl Renderer<'_> {
glBindTexture(GL_TEXTURE_2D, texture.gl.tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
let prog = match buffer.format.has_alpha {
let prog = match format.has_alpha {
true => {
glEnable(GL_BLEND);
&self.ctx.tex_alpha_prog