mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Change canvas/context/snapshot size from u64 -> u32 (#36827)
Replaces uses of `euclid::default::Size2D<u64>` with
`euclid::default::Size2D<u32>` for the canvas/context/snapshot.
This PR includes changes to the following components:
- canvas
- pixels
- script
- script_bindings
- shared/canvas
- shared/snapshot
Testing: https://github.com/hashcatHitman/servo/actions/runs/15426115391
(as of 892edc0048
)
Fixes: #36706
---------
Signed-off-by: hashcatHitman <155700084+hashcatHitman@users.noreply.github.com>
This commit is contained in:
parent
87de9fdf8c
commit
a625420b23
14 changed files with 69 additions and 69 deletions
|
@ -87,7 +87,7 @@ pub type IpcSnapshot = Snapshot<IpcSharedMemory>;
|
|||
/// <https://gpuweb.github.io/gpuweb/#abstract-opdef-get-a-copy-of-the-image-contents-of-a-context>
|
||||
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
|
||||
pub struct Snapshot<T = Data> {
|
||||
size: Size2D<u64>,
|
||||
size: Size2D<u32>,
|
||||
/// internal data (can be any format it will be converted on use if needed)
|
||||
data: T,
|
||||
/// RGBA/BGRA (reflect internal data)
|
||||
|
@ -97,7 +97,7 @@ pub struct Snapshot<T = Data> {
|
|||
}
|
||||
|
||||
impl<T> Snapshot<T> {
|
||||
pub const fn size(&self) -> Size2D<u64> {
|
||||
pub const fn size(&self) -> Size2D<u32> {
|
||||
self.size
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ impl Snapshot<Data> {
|
|||
}
|
||||
|
||||
/// Returns snapshot with provided size that is black transparent alpha
|
||||
pub fn cleared(size: Size2D<u64>) -> Self {
|
||||
pub fn cleared(size: Size2D<u32>) -> Self {
|
||||
Self {
|
||||
size,
|
||||
data: Data::Owned(vec![0; size.area() as usize * 4]),
|
||||
|
@ -143,7 +143,7 @@ impl Snapshot<Data> {
|
|||
}
|
||||
|
||||
pub fn from_vec(
|
||||
size: Size2D<u64>,
|
||||
size: Size2D<u32>,
|
||||
format: PixelFormat,
|
||||
alpha_mode: AlphaMode,
|
||||
data: Vec<u8>,
|
||||
|
@ -157,7 +157,7 @@ impl Snapshot<Data> {
|
|||
}
|
||||
|
||||
pub fn from_shared_memory(
|
||||
size: Size2D<u64>,
|
||||
size: Size2D<u32>,
|
||||
format: PixelFormat,
|
||||
alpha_mode: AlphaMode,
|
||||
ism: IpcSharedMemory,
|
||||
|
@ -177,7 +177,7 @@ impl Snapshot<Data> {
|
|||
/// This is safe if data is owned by this process only
|
||||
/// (ownership is transferred on send)
|
||||
pub unsafe fn from_shared_memory(
|
||||
size: Size2D<u64>,
|
||||
size: Size2D<u32>,
|
||||
format: PixelFormat,
|
||||
alpha_mode: AlphaMode,
|
||||
ism: IpcSharedMemory,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue