renderer: remove unused helper methods
This commit is contained in:
parent
864f506b1e
commit
bcc85c8b1b
2 changed files with 0 additions and 132 deletions
|
|
@ -570,33 +570,6 @@ impl dyn GfxFramebuffer {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn render_custom(
|
|
||||||
self: &Rc<Self>,
|
|
||||||
acquire_sync: AcquireSync,
|
|
||||||
release_sync: ReleaseSync,
|
|
||||||
cd: &Rc<ColorDescription>,
|
|
||||||
scale: Scale,
|
|
||||||
clear: Option<&Color>,
|
|
||||||
clear_cd: &Rc<LinearColorDescription>,
|
|
||||||
blend_buffer: Option<&Rc<dyn GfxBlendBuffer>>,
|
|
||||||
blend_cd: &Rc<ColorDescription>,
|
|
||||||
f: &mut dyn FnMut(&mut RendererBase),
|
|
||||||
) -> Result<Option<FdSync>, GfxError> {
|
|
||||||
let mut ops = vec![];
|
|
||||||
let mut renderer = self.renderer_base(&mut ops, scale, Transform::None);
|
|
||||||
f(&mut renderer);
|
|
||||||
self.render(
|
|
||||||
acquire_sync,
|
|
||||||
release_sync,
|
|
||||||
cd,
|
|
||||||
&ops,
|
|
||||||
clear,
|
|
||||||
clear_cd,
|
|
||||||
blend_buffer,
|
|
||||||
blend_cd,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn create_render_pass(
|
pub fn create_render_pass(
|
||||||
&self,
|
&self,
|
||||||
node: &dyn Node,
|
node: &dyn Node,
|
||||||
|
|
@ -967,45 +940,6 @@ impl Debug for GfxError {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GfxFormat {
|
|
||||||
pub fn cross_intersect(&self, other: &GfxFormat) -> GfxFormat {
|
|
||||||
assert_eq!(self.format, other.format);
|
|
||||||
GfxFormat {
|
|
||||||
format: self.format,
|
|
||||||
read_modifiers: self
|
|
||||||
.read_modifiers
|
|
||||||
.iter()
|
|
||||||
.copied()
|
|
||||||
.filter(|m| other.write_modifiers.contains_key(m))
|
|
||||||
.collect(),
|
|
||||||
write_modifiers: self
|
|
||||||
.write_modifiers
|
|
||||||
.iter()
|
|
||||||
.map(|(m, v)| (*m, v.clone()))
|
|
||||||
.filter(|(m, _)| other.read_modifiers.contains(m))
|
|
||||||
.collect(),
|
|
||||||
supports_shm: self.supports_shm && other.supports_shm,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn cross_intersect_formats(
|
|
||||||
local: &AHashMap<u32, GfxFormat>,
|
|
||||||
remote: &AHashMap<u32, GfxFormat>,
|
|
||||||
) -> AHashMap<u32, GfxFormat> {
|
|
||||||
let mut res = AHashMap::new();
|
|
||||||
for lf in local.values() {
|
|
||||||
if let Some(rf) = remote.get(&lf.format.drm) {
|
|
||||||
let f = lf.cross_intersect(rf);
|
|
||||||
if f.read_modifiers.is_empty() && f.write_modifiers.is_empty() {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
res.insert(f.format.drm, f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
res
|
|
||||||
}
|
|
||||||
|
|
||||||
impl PendingShmTransfer {
|
impl PendingShmTransfer {
|
||||||
pub fn new(cancel: Rc<dyn AsyncShmGfxTextureTransferCancellable>, id: u64) -> Self {
|
pub fn new(cancel: Rc<dyn AsyncShmGfxTextureTransferCancellable>, id: u64) -> Self {
|
||||||
Self { cancel, id }
|
Self { cancel, id }
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,6 @@ pub struct RendererBase<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RendererBase<'_> {
|
impl RendererBase<'_> {
|
||||||
pub fn scale(&self) -> Scale {
|
|
||||||
self.scale
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn scale_point(&self, mut x: i32, mut y: i32) -> (i32, i32) {
|
pub fn scale_point(&self, mut x: i32, mut y: i32) -> (i32, i32) {
|
||||||
if self.scaled {
|
if self.scaled {
|
||||||
[x, y] = self.scale.pixel_size([x, y]);
|
[x, y] = self.scale.pixel_size([x, y]);
|
||||||
|
|
@ -38,14 +34,6 @@ impl RendererBase<'_> {
|
||||||
(x, y)
|
(x, y)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn scale_point_f(&self, mut x: f32, mut y: f32) -> (f32, f32) {
|
|
||||||
if self.scaled {
|
|
||||||
x = (x as f64 * self.scalef) as _;
|
|
||||||
y = (y as f64 * self.scalef) as _;
|
|
||||||
}
|
|
||||||
(x, y)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn scale_rect(&self, mut rect: Rect) -> Rect {
|
pub fn scale_rect(&self, mut rect: Rect) -> Rect {
|
||||||
if self.scaled {
|
if self.scaled {
|
||||||
let [x1, y1, x2, y2] =
|
let [x1, y1, x2, y2] =
|
||||||
|
|
@ -56,17 +44,6 @@ impl RendererBase<'_> {
|
||||||
rect
|
rect
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn scale_rect_f(&self, mut rect: (f32, f32, f32, f32)) -> (f32, f32, f32, f32) {
|
|
||||||
if self.scaled {
|
|
||||||
let x1 = (rect.0 as f64 * self.scalef).round() as _;
|
|
||||||
let y1 = (rect.1 as f64 * self.scalef).round() as _;
|
|
||||||
let x2 = (rect.2 as f64 * self.scalef).round() as _;
|
|
||||||
let y2 = (rect.3 as f64 * self.scalef).round() as _;
|
|
||||||
rect = (x1, y1, x2, y2)
|
|
||||||
}
|
|
||||||
rect
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn fill_scaled_boxes(
|
pub fn fill_scaled_boxes(
|
||||||
&mut self,
|
&mut self,
|
||||||
boxes: &[Rect],
|
boxes: &[Rect],
|
||||||
|
|
@ -138,49 +115,6 @@ impl RendererBase<'_> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn fill_boxes_f(
|
|
||||||
&mut self,
|
|
||||||
boxes: &[(f32, f32, f32, f32)],
|
|
||||||
color: &Color,
|
|
||||||
cd: &Rc<LinearColorDescription>,
|
|
||||||
render_intent: RenderIntent,
|
|
||||||
) {
|
|
||||||
self.fill_boxes2_f(boxes, color, cd, render_intent, 0.0, 0.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn fill_boxes2_f(
|
|
||||||
&mut self,
|
|
||||||
boxes: &[(f32, f32, f32, f32)],
|
|
||||||
color: &Color,
|
|
||||||
cd: &Rc<LinearColorDescription>,
|
|
||||||
render_intent: RenderIntent,
|
|
||||||
dx: f32,
|
|
||||||
dy: f32,
|
|
||||||
) {
|
|
||||||
if boxes.is_empty() || *color == Color::TRANSPARENT {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let (dx, dy) = self.scale_point_f(dx, dy);
|
|
||||||
for bx in boxes {
|
|
||||||
let (x1, y1, x2, y2) = self.scale_rect_f(*bx);
|
|
||||||
self.ops.push(GfxApiOpt::FillRect(FillRect {
|
|
||||||
rect: FramebufferRect::new(
|
|
||||||
x1 + dx,
|
|
||||||
y1 + dy,
|
|
||||||
x2 + dx,
|
|
||||||
y2 + dy,
|
|
||||||
self.transform,
|
|
||||||
self.fb_width,
|
|
||||||
self.fb_height,
|
|
||||||
),
|
|
||||||
color: *color,
|
|
||||||
alpha: None,
|
|
||||||
render_intent,
|
|
||||||
cd: cd.clone(),
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn render_texture(
|
pub fn render_texture(
|
||||||
&mut self,
|
&mut self,
|
||||||
texture: &Rc<dyn GfxTexture>,
|
texture: &Rc<dyn GfxTexture>,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue