Skip to main content

LayerPaint

Struct LayerPaint 

Source
pub struct LayerPaint {
    pub layer_id: LayerId,
    pub paint_list: Rc<PaintList>,
    pub is_dirty: bool,
    pub parent: Option<LayerId>,
    pub offset: Point,
    pub logical_size: Option<Size>,
    pub effect: LayerEffect,
}
Expand description

单个 layer 的 paint 输出

阶段 4-A 引入:

  • is_dirty = true:paint_list 是本帧新生成的,Renderer 需要画到 surface
  • is_dirty = false:paint_list 是 cache 里的旧版,Renderer 阶段 4-A 仍画 (因为没 GPU cache);阶段 4-B 会用 GPU texture 缓存,Renderer 看到 false 就 不重画,直接 blit cache texture 到 surface

阶段 4-D 扩展:

  • offset:layer 在父 layer (或 root) 内的 logical offset,Pass 2 blit 时 按这个 offset 把 layer texture 画到 surface 的 (offset.x, offset.y) 位置
  • logical_size:layer 的 logical size(从 RO.content_size 写入)。 Some(s) 时 layer texture 用 s 大小(省 fillrate);None 时 fallback 全屏

Fields§

§layer_id: LayerId§paint_list: Rc<PaintList>

与 Layer.cached_paint_list 共享同一份命令列表;clean layer 零拷贝。

§is_dirty: bool§parent: Option<LayerId>

父 layer(None = 顶层/虚拟 root) Renderer 用它递归累加祖先的 transform/opacity/clip。

§offset: Point

layer 在 surface 内的 logical offset(已累加祖先 layer 偏移)

§logical_size: Option<Size>

阶段 4-D:layer 的 logical size(用于 Renderer 决定 texture 物理大小)

§effect: LayerEffect

阶段 5:layer 合成到父 layer/surface 时的视觉效果 Renderer Pass 2 blit 时按 effect 走 shader 分支

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.