mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +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
|
@ -89,8 +89,8 @@ pub enum Canvas2dMsg {
|
|||
Arc(Point2D<f32>, f32, f32, f32, bool),
|
||||
ArcTo(Point2D<f32>, Point2D<f32>, f32),
|
||||
DrawImage(IpcSnapshot, Rect<f64>, Rect<f64>, bool),
|
||||
DrawEmptyImage(Size2D<f64>, Rect<f64>, Rect<f64>),
|
||||
DrawImageInOther(CanvasId, Size2D<f64>, Rect<f64>, Rect<f64>, bool),
|
||||
DrawEmptyImage(Size2D<u32>, Rect<f64>, Rect<f64>),
|
||||
DrawImageInOther(CanvasId, Size2D<u32>, Rect<f64>, Rect<f64>, bool),
|
||||
BeginPath,
|
||||
BezierCurveTo(Point2D<f32>, Point2D<f32>, Point2D<f32>),
|
||||
ClearRect(Rect<f32>),
|
||||
|
@ -102,14 +102,14 @@ pub enum Canvas2dMsg {
|
|||
FillPath(FillOrStrokeStyle, Vec<PathSegment>),
|
||||
FillText(String, f64, f64, Option<f64>, FillOrStrokeStyle, bool),
|
||||
FillRect(Rect<f32>, FillOrStrokeStyle),
|
||||
GetImageData(Rect<u64>, Size2D<u64>, IpcSender<IpcSnapshot>),
|
||||
GetImageData(Rect<u32>, Size2D<u32>, IpcSender<IpcSnapshot>),
|
||||
GetTransform(IpcSender<Transform2D<f32>>),
|
||||
IsPointInCurrentPath(f64, f64, FillRule, IpcSender<bool>),
|
||||
IsPointInPath(Vec<PathSegment>, f64, f64, FillRule, IpcSender<bool>),
|
||||
LineTo(Point2D<f32>),
|
||||
MoveTo(Point2D<f32>),
|
||||
MeasureText(String, IpcSender<TextMetrics>),
|
||||
PutImageData(Rect<u64>, IpcBytesReceiver),
|
||||
PutImageData(Rect<u32>, IpcBytesReceiver),
|
||||
QuadraticCurveTo(Point2D<f32>, Point2D<f32>),
|
||||
Rect(Rect<f32>),
|
||||
RestoreContext,
|
||||
|
|
|
@ -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