mirror of
https://github.com/servo/servo.git
synced 2025-09-04 12:08:21 +01:00
script: Always provide canvas epoch on update_rendering (#39024)
We never not provided it. Testing: Existing tests. Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
b44b461a76
commit
95adb6f673
4 changed files with 11 additions and 11 deletions
|
@ -70,9 +70,9 @@ pub(crate) trait CanvasContext {
|
|||
/// The WebRender [`ImageKey`] of this [`CanvasContext`] if any.
|
||||
fn image_key(&self) -> Option<ImageKey>;
|
||||
|
||||
/// Request that the [`CanvasContext`] update the rendering of its contents, returning
|
||||
/// the new [`Epoch`] of the image produced, if one was.
|
||||
fn update_rendering(&self, _canvas_epoch: Option<Epoch>) -> bool {
|
||||
/// Request that the [`CanvasContext`] update the rendering of its contents,
|
||||
/// returning `true` if new image was produced.
|
||||
fn update_rendering(&self, _canvas_epoch: Epoch) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
|
@ -250,7 +250,7 @@ impl CanvasContext for RenderingContext {
|
|||
}
|
||||
}
|
||||
|
||||
fn update_rendering(&self, canvas_epoch: Option<Epoch>) -> bool {
|
||||
fn update_rendering(&self, canvas_epoch: Epoch) -> bool {
|
||||
match self {
|
||||
RenderingContext::Placeholder(offscreen_canvas) => offscreen_canvas
|
||||
.context()
|
||||
|
@ -357,7 +357,7 @@ impl CanvasContext for OffscreenRenderingContext {
|
|||
None
|
||||
}
|
||||
|
||||
fn update_rendering(&self, canvas_epoch: Option<Epoch>) -> bool {
|
||||
fn update_rendering(&self, canvas_epoch: Epoch) -> bool {
|
||||
match self {
|
||||
OffscreenRenderingContext::Context2d(context) => context.update_rendering(canvas_epoch),
|
||||
OffscreenRenderingContext::BitmapRenderer(context) => {
|
||||
|
|
|
@ -123,11 +123,11 @@ impl CanvasContext for CanvasRenderingContext2D {
|
|||
Some(self.canvas.clone())
|
||||
}
|
||||
|
||||
fn update_rendering(&self, canvas_epoch: Option<Epoch>) -> bool {
|
||||
fn update_rendering(&self, canvas_epoch: Epoch) -> bool {
|
||||
if !self.onscreen() {
|
||||
return false;
|
||||
}
|
||||
self.canvas_state.update_rendering(canvas_epoch)
|
||||
self.canvas_state.update_rendering(Some(canvas_epoch))
|
||||
}
|
||||
|
||||
fn resize(&self) {
|
||||
|
|
|
@ -2690,7 +2690,7 @@ impl Document {
|
|||
.borrow_mut()
|
||||
.iter()
|
||||
.filter_map(|(_, context)| context.root())
|
||||
.filter(|context| context.update_rendering(Some(canvas_epoch)))
|
||||
.filter(|context| context.update_rendering(canvas_epoch))
|
||||
.map(|context| context.image_key()),
|
||||
);
|
||||
|
||||
|
@ -2698,7 +2698,7 @@ impl Document {
|
|||
self.dirty_2d_contexts
|
||||
.borrow_mut()
|
||||
.drain()
|
||||
.filter(|(_, context)| context.update_rendering(Some(canvas_epoch)))
|
||||
.filter(|(_, context)| context.update_rendering(canvas_epoch))
|
||||
.map(|(_, context)| context.image_key()),
|
||||
);
|
||||
|
||||
|
|
|
@ -278,13 +278,13 @@ impl CanvasContext for GPUCanvasContext {
|
|||
}
|
||||
|
||||
/// <https://gpuweb.github.io/gpuweb/#abstract-opdef-updating-the-rendering-of-a-webgpu-canvas>
|
||||
fn update_rendering(&self, canvas_epoch: Option<Epoch>) -> bool {
|
||||
fn update_rendering(&self, canvas_epoch: Epoch) -> bool {
|
||||
if !self.onscreen() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Step 1: Expire the current texture of context.
|
||||
self.expire_current_texture(canvas_epoch)
|
||||
self.expire_current_texture(Some(canvas_epoch))
|
||||
// Step 2: Set context.[[lastPresentedImage]] to context.[[drawingBuffer]].
|
||||
// TODO: Implement this.
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue