mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
pixels: Move Snapshot
and related data structures to pixels
(#37590)
1. The `shared` directory is for the "_traits" crates, which will likely be moved out of this directly at some point and renamed "_api". These crates expose the API of crates to avoid circular dependencies. `Snapshot` isn't really this. 2. `Snapshot` is essentially a specialied kind of `Image` so it makes sense that it is grouped with other image-related things in `pixels`. Testing: This should not change any behavior so is covered by existing tests. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
80a7de8c9c
commit
309485d2db
32 changed files with 123 additions and 154 deletions
|
@ -28,7 +28,6 @@ pixels = { path = "../pixels" }
|
|||
range = { path = "../range" }
|
||||
raqote = "0.8.5"
|
||||
servo_arc = { workspace = true }
|
||||
snapshot = { workspace = true }
|
||||
stylo = { workspace = true }
|
||||
unicode-script = { workspace = true }
|
||||
webrender_api = { workspace = true }
|
||||
|
|
|
@ -17,9 +17,9 @@ use fonts::{
|
|||
};
|
||||
use ipc_channel::ipc::{IpcSender, IpcSharedMemory};
|
||||
use log::warn;
|
||||
use pixels::{Snapshot, SnapshotAlphaMode, SnapshotPixelFormat};
|
||||
use range::Range;
|
||||
use servo_arc::Arc as ServoArc;
|
||||
use snapshot::Snapshot;
|
||||
use style::color::AbsoluteColor;
|
||||
use style::properties::style_structs::Font as FontStyleStruct;
|
||||
use unicode_script::Script;
|
||||
|
@ -1336,8 +1336,8 @@ impl<'a, B: Backend> CanvasData<'a, B> {
|
|||
|
||||
Snapshot::from_vec(
|
||||
canvas_size,
|
||||
snapshot::PixelFormat::BGRA,
|
||||
snapshot::AlphaMode::Transparent {
|
||||
SnapshotPixelFormat::BGRA,
|
||||
SnapshotAlphaMode::Transparent {
|
||||
premultiplied: true,
|
||||
},
|
||||
data,
|
||||
|
|
|
@ -17,6 +17,7 @@ use ipc_channel::ipc::{self, IpcSender};
|
|||
use ipc_channel::router::ROUTER;
|
||||
use log::warn;
|
||||
use net_traits::ResourceThreads;
|
||||
use pixels::Snapshot;
|
||||
use style::color::AbsoluteColor;
|
||||
use style::properties::style_structs::Font as FontStyleStruct;
|
||||
use webrender_api::ImageKey;
|
||||
|
@ -420,7 +421,7 @@ impl Canvas<'_> {
|
|||
&mut self,
|
||||
read_rect: Option<Rect<u32>>,
|
||||
canvas_size: Option<Size2D<u32>>,
|
||||
) -> snapshot::Snapshot {
|
||||
) -> Snapshot {
|
||||
match self {
|
||||
Canvas::Raqote(canvas_data) => canvas_data.read_pixels(read_rect, canvas_size),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue