Skip to content

Commit 068d6b0

Browse files
ncsoregiwrupdater
authored and
wrupdater
committed
Backed out changeset 93f7dc3084a1 (bug 1531217) for wrench failures. CLOSED TREE
[wrupdater] From https://hg.mozilla.org/mozilla-central/rev/a066481987fbbf72b10e6fb60d2e2eb190586f4d
1 parent 1a025c0 commit 068d6b0

28 files changed

+438
-497
lines changed

examples/alpha_perf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl Example for App {
2525
_api: &RenderApi,
2626
builder: &mut DisplayListBuilder,
2727
_txn: &mut Transaction,
28-
_framebuffer_size: FramebufferIntSize,
28+
_framebuffer_size: DeviceIntSize,
2929
pipeline_id: PipelineId,
3030
_document_id: DocumentId,
3131
) {

examples/animation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ impl Example for App {
106106
_api: &RenderApi,
107107
builder: &mut DisplayListBuilder,
108108
_txn: &mut Transaction,
109-
_framebuffer_size: FramebufferIntSize,
109+
_framebuffer_size: DeviceIntSize,
110110
pipeline_id: PipelineId,
111111
_document_id: DocumentId,
112112
) {

examples/basic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ impl Example for App {
185185
api: &RenderApi,
186186
builder: &mut DisplayListBuilder,
187187
txn: &mut Transaction,
188-
_: FramebufferIntSize,
188+
_: DeviceIntSize,
189189
pipeline_id: PipelineId,
190190
_document_id: DocumentId,
191191
) {

examples/blob.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ impl Example for App {
199199
api: &RenderApi,
200200
builder: &mut DisplayListBuilder,
201201
txn: &mut Transaction,
202-
_framebuffer_size: api::FramebufferIntSize,
202+
_framebuffer_size: api::DeviceIntSize,
203203
pipeline_id: PipelineId,
204204
_document_id: DocumentId,
205205
) {

examples/common/boilerplate.rs

+27-21
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ pub trait Example {
7979
api: &RenderApi,
8080
builder: &mut DisplayListBuilder,
8181
txn: &mut Transaction,
82-
framebuffer_size: FramebufferIntSize,
82+
framebuffer_size: DeviceIntSize,
8383
pipeline_id: PipelineId,
8484
document_id: DocumentId,
8585
);
@@ -164,7 +164,7 @@ pub fn main_wrapper<E: Example>(
164164
.get_inner_size()
165165
.unwrap()
166166
.to_physical(device_pixel_ratio as f64);
167-
FramebufferIntSize::new(size.width as i32, size.height as i32)
167+
DeviceIntSize::new(size.width as i32, size.height as i32)
168168
};
169169
let notifier = Box::new(Notifier::new(events_loop.create_proxy()));
170170
let (mut renderer, sender) = webrender::Renderer::new(gl.clone(), notifier, opts, None).unwrap();
@@ -212,19 +212,18 @@ pub fn main_wrapper<E: Example>(
212212
let mut custom_event = true;
213213

214214
let old_flags = debug_flags;
215-
let win_event = match global_event {
216-
winit::Event::WindowEvent { event, .. } => event,
217-
_ => return winit::ControlFlow::Continue,
218-
};
219-
match win_event {
220-
winit::WindowEvent::CloseRequested => return winit::ControlFlow::Break,
221-
// skip high-frequency events
222-
winit::WindowEvent::AxisMotion { .. } |
223-
winit::WindowEvent::CursorMoved { .. } => return winit::ControlFlow::Continue,
224-
winit::WindowEvent::KeyboardInput {
225-
input: winit::KeyboardInput {
226-
state: winit::ElementState::Pressed,
227-
virtual_keycode: Some(key),
215+
match global_event {
216+
winit::Event::WindowEvent {
217+
event: winit::WindowEvent::CloseRequested,
218+
..
219+
} => return winit::ControlFlow::Break,
220+
winit::Event::WindowEvent {
221+
event: winit::WindowEvent::KeyboardInput {
222+
input: winit::KeyboardInput {
223+
state: winit::ElementState::Pressed,
224+
virtual_keycode: Some(key),
225+
..
226+
},
228227
..
229228
},
230229
..
@@ -242,12 +241,14 @@ pub fn main_wrapper<E: Example>(
242241
DebugFlags::NEW_FRAME_INDICATOR | DebugFlags::NEW_SCENE_INDICATOR
243242
),
244243
winit::VirtualKeyCode::G => debug_flags.toggle(DebugFlags::GPU_CACHE_DBG),
245-
winit::VirtualKeyCode::Key1 => txn.set_document_view(
246-
framebuffer_size.into(),
244+
winit::VirtualKeyCode::Key1 => txn.set_window_parameters(
245+
framebuffer_size,
246+
DeviceIntRect::new(DeviceIntPoint::zero(), framebuffer_size),
247247
1.0
248248
),
249-
winit::VirtualKeyCode::Key2 => txn.set_document_view(
250-
framebuffer_size.into(),
249+
winit::VirtualKeyCode::Key2 => txn.set_window_parameters(
250+
framebuffer_size,
251+
DeviceIntRect::new(DeviceIntPoint::zero(), framebuffer_size),
251252
2.0
252253
),
253254
winit::VirtualKeyCode::M => api.notify_memory_pressure(),
@@ -259,18 +260,23 @@ pub fn main_wrapper<E: Example>(
259260
api.save_capture(path, bits);
260261
},
261262
_ => {
263+
let win_event = match global_event {
264+
winit::Event::WindowEvent { event, .. } => event,
265+
_ => unreachable!()
266+
};
262267
custom_event = example.on_event(
263268
win_event,
264269
&api,
265270
document_id,
266271
)
267272
},
268273
},
269-
other => custom_event = example.on_event(
270-
other,
274+
winit::Event::WindowEvent { event, .. } => custom_event = example.on_event(
275+
event,
271276
&api,
272277
document_id,
273278
),
279+
_ => return winit::ControlFlow::Continue,
274280
};
275281

276282
if debug_flags != old_flags {

examples/document.rs

+15-17
Original file line numberDiff line numberDiff line change
@@ -33,52 +33,50 @@ impl App {
3333
fn init(
3434
&mut self,
3535
api: &RenderApi,
36+
framebuffer_size: DeviceIntSize,
3637
device_pixel_ratio: f32,
3738
) {
3839
let init_data = vec![
3940
(
4041
PipelineId(1, 0),
41-
1,
42+
-1,
4243
ColorF::new(0.0, 1.0, 0.0, 1.0),
43-
FramebufferIntPoint::new(0, 400),
44+
DeviceIntPoint::new(0, 0),
4445
),
4546
(
4647
PipelineId(2, 0),
47-
2,
48+
-2,
4849
ColorF::new(1.0, 1.0, 0.0, 1.0),
49-
FramebufferIntPoint::new(200, 400),
50+
DeviceIntPoint::new(200, 0),
5051
),
5152
(
5253
PipelineId(3, 0),
53-
3,
54+
-3,
5455
ColorF::new(1.0, 0.0, 0.0, 1.0),
55-
FramebufferIntPoint::new(200, 600),
56+
DeviceIntPoint::new(200, 200),
5657
),
5758
(
5859
PipelineId(4, 0),
59-
4,
60+
-4,
6061
ColorF::new(1.0, 0.0, 1.0, 1.0),
61-
FramebufferIntPoint::new(0, 600),
62+
DeviceIntPoint::new(0, 200),
6263
),
6364
];
6465

6566
for (pipeline_id, layer, color, offset) in init_data {
66-
let size = FramebufferIntSize::new(250, 250);
67-
let bounds = FramebufferIntRect::new(offset, size);
67+
let size = DeviceIntSize::new(250, 250);
68+
let bounds = DeviceIntRect::new(offset, size);
6869

6970
let document_id = api.add_document(size, layer);
7071
let mut txn = Transaction::new();
71-
txn.set_document_view(bounds, device_pixel_ratio);
72+
txn.set_window_parameters(framebuffer_size, bounds, device_pixel_ratio);
7273
txn.set_root_pipeline(pipeline_id);
7374
api.send_transaction(document_id, txn);
7475

7576
self.documents.push(Document {
7677
id: document_id,
7778
pipeline_id,
78-
content_rect: LayoutRect::new(
79-
LayoutPoint::origin(),
80-
bounds.size.to_f32() / TypedScale::new(device_pixel_ratio),
81-
),
79+
content_rect: bounds.to_f32() / TypedScale::new(device_pixel_ratio),
8280
color,
8381
});
8482
}
@@ -91,7 +89,7 @@ impl Example for App {
9189
api: &RenderApi,
9290
base_builder: &mut DisplayListBuilder,
9391
_txn: &mut Transaction,
94-
framebuffer_size: FramebufferIntSize,
92+
framebuffer_size: DeviceIntSize,
9593
_pipeline_id: PipelineId,
9694
_: DocumentId,
9795
) {
@@ -100,7 +98,7 @@ impl Example for App {
10098
base_builder.content_size().width;
10199
// this is the first run, hack around the boilerplate,
102100
// which assumes an example only needs one document
103-
self.init(api, device_pixel_ratio);
101+
self.init(api, framebuffer_size, device_pixel_ratio);
104102
}
105103

106104
for doc in &self.documents {

examples/frame_output.rs

+13-18
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ struct ExternalHandler {
4242
}
4343

4444
impl webrender::OutputImageHandler for OutputHandler {
45-
fn lock(&mut self, _id: PipelineId) -> Option<(u32, FramebufferIntSize)> {
46-
Some((self.texture_id, FramebufferIntSize::new(500, 500)))
45+
fn lock(&mut self, _id: PipelineId) -> Option<(u32, DeviceIntSize)> {
46+
Some((self.texture_id, DeviceIntSize::new(500, 500)))
4747
}
4848

4949
fn unlock(&mut self, _id: PipelineId) {}
@@ -68,7 +68,7 @@ impl App {
6868
fn init_output_document(
6969
&mut self,
7070
api: &RenderApi,
71-
framebuffer_size: FramebufferIntSize,
71+
framebuffer_size: DeviceIntSize,
7272
device_pixel_ratio: f32,
7373
) {
7474
// Generate the external image key that will be used to render the output document to the root document.
@@ -77,29 +77,24 @@ impl App {
7777
let pipeline_id = PipelineId(1, 0);
7878
let layer = 1;
7979
let color = ColorF::new(1., 1., 0., 1.);
80+
let bounds = DeviceIntRect::new(DeviceIntPoint::zero(), framebuffer_size);
8081
let document_id = api.add_document(framebuffer_size, layer);
81-
api.enable_frame_output(document_id, pipeline_id, true);
82-
api.set_document_view(
83-
document_id,
84-
FramebufferIntRect::new(
85-
FramebufferIntPoint::new(0, 1000),
86-
framebuffer_size,
87-
),
88-
device_pixel_ratio,
89-
);
9082

9183
let document = Document {
9284
id: document_id,
9385
pipeline_id,
94-
content_rect: LayoutRect::new(
95-
LayoutPoint::zero(),
96-
framebuffer_size.to_f32() / TypedScale::new(device_pixel_ratio),
97-
),
86+
content_rect: bounds.to_f32() / TypedScale::new(device_pixel_ratio),
9887
color,
9988
};
10089

10190
let mut txn = Transaction::new();
10291

92+
txn.enable_frame_output(document.pipeline_id, true);
93+
94+
api.send_transaction(document.id, txn);
95+
96+
let mut txn = Transaction::new();
97+
10398
txn.add_image(
10499
self.external_image_key.unwrap(),
105100
ImageDescriptor::new(100, 100, ImageFormat::BGRA8, true, false),
@@ -146,14 +141,14 @@ impl Example for App {
146141
api: &RenderApi,
147142
builder: &mut DisplayListBuilder,
148143
_txn: &mut Transaction,
149-
framebuffer_size: FramebufferIntSize,
144+
framebuffer_size: DeviceIntSize,
150145
pipeline_id: PipelineId,
151146
_document_id: DocumentId,
152147
) {
153148
if self.output_document.is_none() {
154149
let device_pixel_ratio = framebuffer_size.width as f32 /
155150
builder.content_size().width;
156-
self.init_output_document(api, FramebufferIntSize::new(200, 200), device_pixel_ratio);
151+
self.init_output_document(api, DeviceIntSize::new(200, 200), device_pixel_ratio);
157152
}
158153

159154
let info = LayoutPrimitiveInfo::new((100, 100).to(200, 200));

examples/iframe.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl Example for App {
2525
api: &RenderApi,
2626
builder: &mut DisplayListBuilder,
2727
_txn: &mut Transaction,
28-
_framebuffer_size: FramebufferIntSize,
28+
_framebuffer_size: DeviceIntSize,
2929
pipeline_id: PipelineId,
3030
document_id: DocumentId,
3131
) {

examples/image_resize.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl Example for App {
2525
_api: &RenderApi,
2626
builder: &mut DisplayListBuilder,
2727
txn: &mut Transaction,
28-
_framebuffer_size: FramebufferIntSize,
28+
_framebuffer_size: DeviceIntSize,
2929
pipeline_id: PipelineId,
3030
_document_id: DocumentId,
3131
) {

examples/multiwindow.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ impl Window {
103103
.get_inner_size()
104104
.unwrap()
105105
.to_physical(device_pixel_ratio as f64);
106-
FramebufferIntSize::new(size.width as i32, size.height as i32)
106+
DeviceIntSize::new(size.width as i32, size.height as i32)
107107
};
108108
let notifier = Box::new(Notifier::new(events_loop.create_proxy()));
109109
let (renderer, sender) = webrender::Renderer::new(gl.clone(), notifier, opts, None).unwrap();
@@ -182,7 +182,7 @@ impl Window {
182182
.get_inner_size()
183183
.unwrap()
184184
.to_physical(device_pixel_ratio as f64);
185-
FramebufferIntSize::new(size.width as i32, size.height as i32)
185+
DeviceIntSize::new(size.width as i32, size.height as i32)
186186
};
187187
let layout_size = framebuffer_size.to_f32() / euclid::TypedScale::new(device_pixel_ratio);
188188
let mut txn = Transaction::new();

examples/scrolling.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl Example for App {
2626
_api: &RenderApi,
2727
builder: &mut DisplayListBuilder,
2828
_txn: &mut Transaction,
29-
_framebuffer_size: FramebufferIntSize,
29+
_framebuffer_size: DeviceIntSize,
3030
pipeline_id: PipelineId,
3131
_document_id: DocumentId,
3232
) {

examples/texture_cache_stress.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl Example for App {
9090
api: &RenderApi,
9191
builder: &mut DisplayListBuilder,
9292
txn: &mut Transaction,
93-
_framebuffer_size: FramebufferIntSize,
93+
_framebuffer_size: DeviceIntSize,
9494
pipeline_id: PipelineId,
9595
_document_id: DocumentId,
9696
) {

examples/yuv.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ impl Example for App {
8787
api: &RenderApi,
8888
builder: &mut DisplayListBuilder,
8989
txn: &mut Transaction,
90-
_framebuffer_size: FramebufferIntSize,
90+
_framebuffer_size: DeviceIntSize,
9191
pipeline_id: PipelineId,
9292
_document_id: DocumentId,
9393
) {

webrender/src/debug_render.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

55
use api::{ColorU, ColorF, ImageFormat, TextureTarget};
6-
use api::units::*;
6+
use api::{DeviceIntRect, DeviceRect, DevicePoint, DeviceSize, DeviceIntSize};
77
use debug_font_data;
88
use device::{Device, Program, Texture, TextureSlot, VertexDescriptor, ShaderError, VAO};
99
use device::{TextureFilter, VertexAttribute, VertexAttributeKind, VertexUsageHint};
@@ -312,7 +312,7 @@ impl DebugRenderer {
312312
pub fn render(
313313
&mut self,
314314
device: &mut Device,
315-
viewport_size: Option<FramebufferIntSize>,
315+
viewport_size: Option<DeviceIntSize>,
316316
) {
317317
if let Some(viewport_size) = viewport_size {
318318
device.disable_depth();

0 commit comments

Comments
 (0)