зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 93f7dc3084a1 (bug 1531217) for wrench failures. CLOSED TREE
This commit is contained in:
Родитель
beb91522fe
Коммит
b2672c85cf
|
@ -935,7 +935,7 @@ mozilla::ipc::IPCResult WebRenderBridgeParent::RecvSetDisplayList(
|
|||
if (IsRootWebRenderBridgeParent()) {
|
||||
LayoutDeviceIntSize widgetSize = mWidget->GetClientSize();
|
||||
LayoutDeviceIntRect docRect(LayoutDeviceIntPoint(), widgetSize);
|
||||
txn.SetDocumentView(docRect);
|
||||
txn.SetWindowParameters(widgetSize, docRect);
|
||||
}
|
||||
gfx::Color clearColor(0.f, 0.f, 0.f, 0.f);
|
||||
txn.SetDisplayList(clearColor, wrEpoch,
|
||||
|
|
|
@ -199,14 +199,18 @@ bool TransactionBuilder::IsResourceUpdatesEmpty() const {
|
|||
return wr_transaction_resource_updates_is_empty(mTxn);
|
||||
}
|
||||
|
||||
void TransactionBuilder::SetDocumentView(
|
||||
void TransactionBuilder::SetWindowParameters(
|
||||
const LayoutDeviceIntSize& aWindowSize,
|
||||
const LayoutDeviceIntRect& aDocumentRect) {
|
||||
wr::FramebufferIntRect wrDocRect;
|
||||
wr::DeviceIntSize wrWindowSize;
|
||||
wrWindowSize.width = aWindowSize.width;
|
||||
wrWindowSize.height = aWindowSize.height;
|
||||
wr::DeviceIntRect wrDocRect;
|
||||
wrDocRect.origin.x = aDocumentRect.x;
|
||||
wrDocRect.origin.y = aDocumentRect.y;
|
||||
wrDocRect.size.width = aDocumentRect.width;
|
||||
wrDocRect.size.height = aDocumentRect.height;
|
||||
wr_transaction_set_document_view(mTxn, &wrDocRect);
|
||||
wr_transaction_set_window_parameters(mTxn, &wrWindowSize, &wrDocRect);
|
||||
}
|
||||
|
||||
void TransactionBuilder::UpdateScrollPosition(
|
||||
|
@ -289,7 +293,7 @@ already_AddRefed<WebRenderAPI> WebRenderAPI::Clone() {
|
|||
|
||||
already_AddRefed<WebRenderAPI> WebRenderAPI::CreateDocument(
|
||||
LayoutDeviceIntSize aSize, int8_t aLayerIndex) {
|
||||
wr::FramebufferIntSize wrSize;
|
||||
wr::DeviceIntSize wrSize;
|
||||
wrSize.width = aSize.width;
|
||||
wrSize.height = aSize.height;
|
||||
wr::DocumentHandle* newDoc;
|
||||
|
|
|
@ -103,7 +103,8 @@ class TransactionBuilder {
|
|||
const nsTArray<wr::WrOpacityProperty>& aOpacityArray,
|
||||
const nsTArray<wr::WrTransformProperty>& aTransformArray);
|
||||
|
||||
void SetDocumentView(const LayoutDeviceIntRect& aDocRect);
|
||||
void SetWindowParameters(const LayoutDeviceIntSize& aWindowSize,
|
||||
const LayoutDeviceIntRect& aDocRect);
|
||||
|
||||
void UpdateScrollPosition(
|
||||
const wr::WrPipelineId& aPipelineId,
|
||||
|
|
|
@ -207,7 +207,7 @@ pub struct DocumentHandle {
|
|||
}
|
||||
|
||||
impl DocumentHandle {
|
||||
pub fn new(api: RenderApi, size: FramebufferIntSize, layer: i8) -> DocumentHandle {
|
||||
pub fn new(api: RenderApi, size: DeviceIntSize, layer: i8) -> DocumentHandle {
|
||||
let doc = api.add_document(size, layer);
|
||||
DocumentHandle {
|
||||
api: api,
|
||||
|
@ -676,7 +676,7 @@ pub extern "C" fn wr_renderer_render(renderer: &mut Renderer,
|
|||
if had_slow_frame {
|
||||
renderer.notify_slow_frame();
|
||||
}
|
||||
match renderer.render(FramebufferIntSize::new(width, height)) {
|
||||
match renderer.render(DeviceIntSize::new(width, height)) {
|
||||
Ok(results) => {
|
||||
*out_stats = results.stats;
|
||||
true
|
||||
|
@ -704,7 +704,9 @@ pub unsafe extern "C" fn wr_renderer_readback(renderer: &mut Renderer,
|
|||
assert!(is_in_render_thread());
|
||||
|
||||
let mut slice = make_slice_mut(dst_buffer, buffer_size);
|
||||
renderer.read_pixels_into(FramebufferIntSize::new(width, height).into(),
|
||||
renderer.read_pixels_into(DeviceIntRect::new(
|
||||
DeviceIntPoint::new(0, 0),
|
||||
DeviceIntSize::new(width, height)),
|
||||
ReadPixelsFormat::Standard(ImageFormat::BGRA8),
|
||||
&mut slice);
|
||||
}
|
||||
|
@ -1177,7 +1179,7 @@ pub extern "C" fn wr_window_new(window_id: WrWindowId,
|
|||
unsafe {
|
||||
*out_max_texture_size = renderer.get_max_texture_size();
|
||||
}
|
||||
let window_size = FramebufferIntSize::new(window_width, window_height);
|
||||
let window_size = DeviceIntSize::new(window_width, window_height);
|
||||
let layer = 0;
|
||||
*out_handle = Box::into_raw(Box::new(
|
||||
DocumentHandle::new(sender.create_api_by_client(next_namespace_id()), window_size, layer)));
|
||||
|
@ -1190,7 +1192,7 @@ pub extern "C" fn wr_window_new(window_id: WrWindowId,
|
|||
pub extern "C" fn wr_api_create_document(
|
||||
root_dh: &mut DocumentHandle,
|
||||
out_handle: &mut *mut DocumentHandle,
|
||||
doc_size: FramebufferIntSize,
|
||||
doc_size: DeviceIntSize,
|
||||
layer: i8,
|
||||
) {
|
||||
assert!(unsafe { is_in_compositor_thread() });
|
||||
|
@ -1377,11 +1379,13 @@ pub extern "C" fn wr_transaction_set_display_list(
|
|||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_transaction_set_document_view(
|
||||
pub extern "C" fn wr_transaction_set_window_parameters(
|
||||
txn: &mut Transaction,
|
||||
doc_rect: &FramebufferIntRect,
|
||||
window_size: &DeviceIntSize,
|
||||
doc_rect: &DeviceIntRect,
|
||||
) {
|
||||
txn.set_document_view(
|
||||
txn.set_window_parameters(
|
||||
*window_size,
|
||||
*doc_rect,
|
||||
1.0,
|
||||
);
|
||||
|
|
|
@ -25,7 +25,7 @@ impl Example for App {
|
|||
_api: &RenderApi,
|
||||
builder: &mut DisplayListBuilder,
|
||||
_txn: &mut Transaction,
|
||||
_framebuffer_size: FramebufferIntSize,
|
||||
_framebuffer_size: DeviceIntSize,
|
||||
pipeline_id: PipelineId,
|
||||
_document_id: DocumentId,
|
||||
) {
|
||||
|
|
|
@ -106,7 +106,7 @@ impl Example for App {
|
|||
_api: &RenderApi,
|
||||
builder: &mut DisplayListBuilder,
|
||||
_txn: &mut Transaction,
|
||||
_framebuffer_size: FramebufferIntSize,
|
||||
_framebuffer_size: DeviceIntSize,
|
||||
pipeline_id: PipelineId,
|
||||
_document_id: DocumentId,
|
||||
) {
|
||||
|
|
|
@ -185,7 +185,7 @@ impl Example for App {
|
|||
api: &RenderApi,
|
||||
builder: &mut DisplayListBuilder,
|
||||
txn: &mut Transaction,
|
||||
_: FramebufferIntSize,
|
||||
_: DeviceIntSize,
|
||||
pipeline_id: PipelineId,
|
||||
_document_id: DocumentId,
|
||||
) {
|
||||
|
|
|
@ -199,7 +199,7 @@ impl Example for App {
|
|||
api: &RenderApi,
|
||||
builder: &mut DisplayListBuilder,
|
||||
txn: &mut Transaction,
|
||||
_framebuffer_size: api::FramebufferIntSize,
|
||||
_framebuffer_size: api::DeviceIntSize,
|
||||
pipeline_id: PipelineId,
|
||||
_document_id: DocumentId,
|
||||
) {
|
||||
|
|
|
@ -79,7 +79,7 @@ pub trait Example {
|
|||
api: &RenderApi,
|
||||
builder: &mut DisplayListBuilder,
|
||||
txn: &mut Transaction,
|
||||
framebuffer_size: FramebufferIntSize,
|
||||
framebuffer_size: DeviceIntSize,
|
||||
pipeline_id: PipelineId,
|
||||
document_id: DocumentId,
|
||||
);
|
||||
|
@ -164,7 +164,7 @@ pub fn main_wrapper<E: Example>(
|
|||
.get_inner_size()
|
||||
.unwrap()
|
||||
.to_physical(device_pixel_ratio as f64);
|
||||
FramebufferIntSize::new(size.width as i32, size.height as i32)
|
||||
DeviceIntSize::new(size.width as i32, size.height as i32)
|
||||
};
|
||||
let notifier = Box::new(Notifier::new(events_loop.create_proxy()));
|
||||
let (mut renderer, sender) = webrender::Renderer::new(gl.clone(), notifier, opts, None).unwrap();
|
||||
|
@ -212,22 +212,21 @@ pub fn main_wrapper<E: Example>(
|
|||
let mut custom_event = true;
|
||||
|
||||
let old_flags = debug_flags;
|
||||
let win_event = match global_event {
|
||||
winit::Event::WindowEvent { event, .. } => event,
|
||||
_ => return winit::ControlFlow::Continue,
|
||||
};
|
||||
match win_event {
|
||||
winit::WindowEvent::CloseRequested => return winit::ControlFlow::Break,
|
||||
// skip high-frequency events
|
||||
winit::WindowEvent::AxisMotion { .. } |
|
||||
winit::WindowEvent::CursorMoved { .. } => return winit::ControlFlow::Continue,
|
||||
winit::WindowEvent::KeyboardInput {
|
||||
match global_event {
|
||||
winit::Event::WindowEvent {
|
||||
event: winit::WindowEvent::CloseRequested,
|
||||
..
|
||||
} => return winit::ControlFlow::Break,
|
||||
winit::Event::WindowEvent {
|
||||
event: winit::WindowEvent::KeyboardInput {
|
||||
input: winit::KeyboardInput {
|
||||
state: winit::ElementState::Pressed,
|
||||
virtual_keycode: Some(key),
|
||||
..
|
||||
},
|
||||
..
|
||||
},
|
||||
..
|
||||
} => match key {
|
||||
winit::VirtualKeyCode::Escape => return winit::ControlFlow::Break,
|
||||
winit::VirtualKeyCode::P => debug_flags.toggle(DebugFlags::PROFILER_DBG),
|
||||
|
@ -242,12 +241,14 @@ pub fn main_wrapper<E: Example>(
|
|||
DebugFlags::NEW_FRAME_INDICATOR | DebugFlags::NEW_SCENE_INDICATOR
|
||||
),
|
||||
winit::VirtualKeyCode::G => debug_flags.toggle(DebugFlags::GPU_CACHE_DBG),
|
||||
winit::VirtualKeyCode::Key1 => txn.set_document_view(
|
||||
framebuffer_size.into(),
|
||||
winit::VirtualKeyCode::Key1 => txn.set_window_parameters(
|
||||
framebuffer_size,
|
||||
DeviceIntRect::new(DeviceIntPoint::zero(), framebuffer_size),
|
||||
1.0
|
||||
),
|
||||
winit::VirtualKeyCode::Key2 => txn.set_document_view(
|
||||
framebuffer_size.into(),
|
||||
winit::VirtualKeyCode::Key2 => txn.set_window_parameters(
|
||||
framebuffer_size,
|
||||
DeviceIntRect::new(DeviceIntPoint::zero(), framebuffer_size),
|
||||
2.0
|
||||
),
|
||||
winit::VirtualKeyCode::M => api.notify_memory_pressure(),
|
||||
|
@ -259,6 +260,10 @@ pub fn main_wrapper<E: Example>(
|
|||
api.save_capture(path, bits);
|
||||
},
|
||||
_ => {
|
||||
let win_event = match global_event {
|
||||
winit::Event::WindowEvent { event, .. } => event,
|
||||
_ => unreachable!()
|
||||
};
|
||||
custom_event = example.on_event(
|
||||
win_event,
|
||||
&api,
|
||||
|
@ -266,11 +271,12 @@ pub fn main_wrapper<E: Example>(
|
|||
)
|
||||
},
|
||||
},
|
||||
other => custom_event = example.on_event(
|
||||
other,
|
||||
winit::Event::WindowEvent { event, .. } => custom_event = example.on_event(
|
||||
event,
|
||||
&api,
|
||||
document_id,
|
||||
),
|
||||
_ => return winit::ControlFlow::Continue,
|
||||
};
|
||||
|
||||
if debug_flags != old_flags {
|
||||
|
|
|
@ -33,52 +33,50 @@ impl App {
|
|||
fn init(
|
||||
&mut self,
|
||||
api: &RenderApi,
|
||||
framebuffer_size: DeviceIntSize,
|
||||
device_pixel_ratio: f32,
|
||||
) {
|
||||
let init_data = vec![
|
||||
(
|
||||
PipelineId(1, 0),
|
||||
1,
|
||||
-1,
|
||||
ColorF::new(0.0, 1.0, 0.0, 1.0),
|
||||
FramebufferIntPoint::new(0, 400),
|
||||
DeviceIntPoint::new(0, 0),
|
||||
),
|
||||
(
|
||||
PipelineId(2, 0),
|
||||
2,
|
||||
-2,
|
||||
ColorF::new(1.0, 1.0, 0.0, 1.0),
|
||||
FramebufferIntPoint::new(200, 400),
|
||||
DeviceIntPoint::new(200, 0),
|
||||
),
|
||||
(
|
||||
PipelineId(3, 0),
|
||||
3,
|
||||
-3,
|
||||
ColorF::new(1.0, 0.0, 0.0, 1.0),
|
||||
FramebufferIntPoint::new(200, 600),
|
||||
DeviceIntPoint::new(200, 200),
|
||||
),
|
||||
(
|
||||
PipelineId(4, 0),
|
||||
4,
|
||||
-4,
|
||||
ColorF::new(1.0, 0.0, 1.0, 1.0),
|
||||
FramebufferIntPoint::new(0, 600),
|
||||
DeviceIntPoint::new(0, 200),
|
||||
),
|
||||
];
|
||||
|
||||
for (pipeline_id, layer, color, offset) in init_data {
|
||||
let size = FramebufferIntSize::new(250, 250);
|
||||
let bounds = FramebufferIntRect::new(offset, size);
|
||||
let size = DeviceIntSize::new(250, 250);
|
||||
let bounds = DeviceIntRect::new(offset, size);
|
||||
|
||||
let document_id = api.add_document(size, layer);
|
||||
let mut txn = Transaction::new();
|
||||
txn.set_document_view(bounds, device_pixel_ratio);
|
||||
txn.set_window_parameters(framebuffer_size, bounds, device_pixel_ratio);
|
||||
txn.set_root_pipeline(pipeline_id);
|
||||
api.send_transaction(document_id, txn);
|
||||
|
||||
self.documents.push(Document {
|
||||
id: document_id,
|
||||
pipeline_id,
|
||||
content_rect: LayoutRect::new(
|
||||
LayoutPoint::origin(),
|
||||
bounds.size.to_f32() / TypedScale::new(device_pixel_ratio),
|
||||
),
|
||||
content_rect: bounds.to_f32() / TypedScale::new(device_pixel_ratio),
|
||||
color,
|
||||
});
|
||||
}
|
||||
|
@ -91,7 +89,7 @@ impl Example for App {
|
|||
api: &RenderApi,
|
||||
base_builder: &mut DisplayListBuilder,
|
||||
_txn: &mut Transaction,
|
||||
framebuffer_size: FramebufferIntSize,
|
||||
framebuffer_size: DeviceIntSize,
|
||||
_pipeline_id: PipelineId,
|
||||
_: DocumentId,
|
||||
) {
|
||||
|
@ -100,7 +98,7 @@ impl Example for App {
|
|||
base_builder.content_size().width;
|
||||
// this is the first run, hack around the boilerplate,
|
||||
// which assumes an example only needs one document
|
||||
self.init(api, device_pixel_ratio);
|
||||
self.init(api, framebuffer_size, device_pixel_ratio);
|
||||
}
|
||||
|
||||
for doc in &self.documents {
|
||||
|
|
|
@ -42,8 +42,8 @@ struct ExternalHandler {
|
|||
}
|
||||
|
||||
impl webrender::OutputImageHandler for OutputHandler {
|
||||
fn lock(&mut self, _id: PipelineId) -> Option<(u32, FramebufferIntSize)> {
|
||||
Some((self.texture_id, FramebufferIntSize::new(500, 500)))
|
||||
fn lock(&mut self, _id: PipelineId) -> Option<(u32, DeviceIntSize)> {
|
||||
Some((self.texture_id, DeviceIntSize::new(500, 500)))
|
||||
}
|
||||
|
||||
fn unlock(&mut self, _id: PipelineId) {}
|
||||
|
@ -68,7 +68,7 @@ impl App {
|
|||
fn init_output_document(
|
||||
&mut self,
|
||||
api: &RenderApi,
|
||||
framebuffer_size: FramebufferIntSize,
|
||||
framebuffer_size: DeviceIntSize,
|
||||
device_pixel_ratio: f32,
|
||||
) {
|
||||
// Generate the external image key that will be used to render the output document to the root document.
|
||||
|
@ -77,29 +77,24 @@ impl App {
|
|||
let pipeline_id = PipelineId(1, 0);
|
||||
let layer = 1;
|
||||
let color = ColorF::new(1., 1., 0., 1.);
|
||||
let bounds = DeviceIntRect::new(DeviceIntPoint::zero(), framebuffer_size);
|
||||
let document_id = api.add_document(framebuffer_size, layer);
|
||||
api.enable_frame_output(document_id, pipeline_id, true);
|
||||
api.set_document_view(
|
||||
document_id,
|
||||
FramebufferIntRect::new(
|
||||
FramebufferIntPoint::new(0, 1000),
|
||||
framebuffer_size,
|
||||
),
|
||||
device_pixel_ratio,
|
||||
);
|
||||
|
||||
let document = Document {
|
||||
id: document_id,
|
||||
pipeline_id,
|
||||
content_rect: LayoutRect::new(
|
||||
LayoutPoint::zero(),
|
||||
framebuffer_size.to_f32() / TypedScale::new(device_pixel_ratio),
|
||||
),
|
||||
content_rect: bounds.to_f32() / TypedScale::new(device_pixel_ratio),
|
||||
color,
|
||||
};
|
||||
|
||||
let mut txn = Transaction::new();
|
||||
|
||||
txn.enable_frame_output(document.pipeline_id, true);
|
||||
|
||||
api.send_transaction(document.id, txn);
|
||||
|
||||
let mut txn = Transaction::new();
|
||||
|
||||
txn.add_image(
|
||||
self.external_image_key.unwrap(),
|
||||
ImageDescriptor::new(100, 100, ImageFormat::BGRA8, true, false),
|
||||
|
@ -146,14 +141,14 @@ impl Example for App {
|
|||
api: &RenderApi,
|
||||
builder: &mut DisplayListBuilder,
|
||||
_txn: &mut Transaction,
|
||||
framebuffer_size: FramebufferIntSize,
|
||||
framebuffer_size: DeviceIntSize,
|
||||
pipeline_id: PipelineId,
|
||||
_document_id: DocumentId,
|
||||
) {
|
||||
if self.output_document.is_none() {
|
||||
let device_pixel_ratio = framebuffer_size.width as f32 /
|
||||
builder.content_size().width;
|
||||
self.init_output_document(api, FramebufferIntSize::new(200, 200), device_pixel_ratio);
|
||||
self.init_output_document(api, DeviceIntSize::new(200, 200), device_pixel_ratio);
|
||||
}
|
||||
|
||||
let info = LayoutPrimitiveInfo::new((100, 100).to(200, 200));
|
||||
|
|
|
@ -25,7 +25,7 @@ impl Example for App {
|
|||
api: &RenderApi,
|
||||
builder: &mut DisplayListBuilder,
|
||||
_txn: &mut Transaction,
|
||||
_framebuffer_size: FramebufferIntSize,
|
||||
_framebuffer_size: DeviceIntSize,
|
||||
pipeline_id: PipelineId,
|
||||
document_id: DocumentId,
|
||||
) {
|
||||
|
|
|
@ -25,7 +25,7 @@ impl Example for App {
|
|||
_api: &RenderApi,
|
||||
builder: &mut DisplayListBuilder,
|
||||
txn: &mut Transaction,
|
||||
_framebuffer_size: FramebufferIntSize,
|
||||
_framebuffer_size: DeviceIntSize,
|
||||
pipeline_id: PipelineId,
|
||||
_document_id: DocumentId,
|
||||
) {
|
||||
|
|
|
@ -103,7 +103,7 @@ impl Window {
|
|||
.get_inner_size()
|
||||
.unwrap()
|
||||
.to_physical(device_pixel_ratio as f64);
|
||||
FramebufferIntSize::new(size.width as i32, size.height as i32)
|
||||
DeviceIntSize::new(size.width as i32, size.height as i32)
|
||||
};
|
||||
let notifier = Box::new(Notifier::new(events_loop.create_proxy()));
|
||||
let (renderer, sender) = webrender::Renderer::new(gl.clone(), notifier, opts, None).unwrap();
|
||||
|
@ -182,7 +182,7 @@ impl Window {
|
|||
.get_inner_size()
|
||||
.unwrap()
|
||||
.to_physical(device_pixel_ratio as f64);
|
||||
FramebufferIntSize::new(size.width as i32, size.height as i32)
|
||||
DeviceIntSize::new(size.width as i32, size.height as i32)
|
||||
};
|
||||
let layout_size = framebuffer_size.to_f32() / euclid::TypedScale::new(device_pixel_ratio);
|
||||
let mut txn = Transaction::new();
|
||||
|
|
|
@ -26,7 +26,7 @@ impl Example for App {
|
|||
_api: &RenderApi,
|
||||
builder: &mut DisplayListBuilder,
|
||||
_txn: &mut Transaction,
|
||||
_framebuffer_size: FramebufferIntSize,
|
||||
_framebuffer_size: DeviceIntSize,
|
||||
pipeline_id: PipelineId,
|
||||
_document_id: DocumentId,
|
||||
) {
|
||||
|
|
|
@ -90,7 +90,7 @@ impl Example for App {
|
|||
api: &RenderApi,
|
||||
builder: &mut DisplayListBuilder,
|
||||
txn: &mut Transaction,
|
||||
_framebuffer_size: FramebufferIntSize,
|
||||
_framebuffer_size: DeviceIntSize,
|
||||
pipeline_id: PipelineId,
|
||||
_document_id: DocumentId,
|
||||
) {
|
||||
|
|
|
@ -87,7 +87,7 @@ impl Example for App {
|
|||
api: &RenderApi,
|
||||
builder: &mut DisplayListBuilder,
|
||||
txn: &mut Transaction,
|
||||
_framebuffer_size: FramebufferIntSize,
|
||||
_framebuffer_size: DeviceIntSize,
|
||||
pipeline_id: PipelineId,
|
||||
_document_id: DocumentId,
|
||||
) {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use api::{ColorU, ColorF, ImageFormat, TextureTarget};
|
||||
use api::units::*;
|
||||
use api::{DeviceIntRect, DeviceRect, DevicePoint, DeviceSize, DeviceIntSize};
|
||||
use debug_font_data;
|
||||
use device::{Device, Program, Texture, TextureSlot, VertexDescriptor, ShaderError, VAO};
|
||||
use device::{TextureFilter, VertexAttribute, VertexAttributeKind, VertexUsageHint};
|
||||
|
@ -312,7 +312,7 @@ impl DebugRenderer {
|
|||
pub fn render(
|
||||
&mut self,
|
||||
device: &mut Device,
|
||||
viewport_size: Option<FramebufferIntSize>,
|
||||
viewport_size: Option<DeviceIntSize>,
|
||||
) {
|
||||
if let Some(viewport_size) = viewport_size {
|
||||
device.disable_depth();
|
||||
|
|
|
@ -3,9 +3,11 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use super::super::shader_source::SHADERS;
|
||||
use api::{ColorF, ImageDescriptor, ImageFormat, MemoryReport};
|
||||
use api::{TextureTarget, VoidPtrToSizeFn};
|
||||
use api::units::*;
|
||||
use api::{ColorF, ImageFormat, MemoryReport};
|
||||
use api::{DeviceIntPoint, DeviceIntRect, DeviceIntSize};
|
||||
use api::TextureTarget;
|
||||
use api::VoidPtrToSizeFn;
|
||||
use api::ImageDescriptor;
|
||||
use euclid::Transform3D;
|
||||
use gleam::gl;
|
||||
use internal_types::{FastHashMap, LayerIndex, RenderTargetInfo};
|
||||
|
@ -973,12 +975,7 @@ pub struct Device {
|
|||
pub enum DrawTarget<'a> {
|
||||
/// Use the device's default draw target, with the provided dimensions,
|
||||
/// which are used to set the viewport.
|
||||
Default {
|
||||
/// Target rectangle to draw.
|
||||
rect: FramebufferIntRect,
|
||||
/// Total size of the target.
|
||||
total_size: FramebufferIntSize,
|
||||
},
|
||||
Default(DeviceIntSize),
|
||||
/// Use the provided texture.
|
||||
Texture {
|
||||
/// The target texture.
|
||||
|
@ -991,17 +988,10 @@ pub enum DrawTarget<'a> {
|
|||
}
|
||||
|
||||
impl<'a> DrawTarget<'a> {
|
||||
pub fn new_default(size: FramebufferIntSize) -> Self {
|
||||
DrawTarget::Default {
|
||||
rect: size.into(),
|
||||
total_size: size,
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns true if this draw target corresponds to the default framebuffer.
|
||||
pub fn is_default(&self) -> bool {
|
||||
match *self {
|
||||
DrawTarget::Default {..} => true,
|
||||
DrawTarget::Default(..) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
@ -1009,49 +999,38 @@ impl<'a> DrawTarget<'a> {
|
|||
/// Returns the dimensions of this draw-target.
|
||||
pub fn dimensions(&self) -> DeviceIntSize {
|
||||
match *self {
|
||||
DrawTarget::Default { total_size, .. } => DeviceIntSize::from_untyped(&total_size.to_untyped()),
|
||||
DrawTarget::Default(d) => d,
|
||||
DrawTarget::Texture { texture, .. } => texture.get_dimensions(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_framebuffer_rect(&self, device_rect: DeviceIntRect) -> FramebufferIntRect {
|
||||
let mut fb_rect = FramebufferIntRect::from_untyped(&device_rect.to_untyped());
|
||||
match *self {
|
||||
DrawTarget::Default { ref rect, .. } => {
|
||||
// perform a Y-flip here
|
||||
fb_rect.origin.y = rect.origin.y + rect.size.height - fb_rect.origin.y - fb_rect.size.height;
|
||||
fb_rect.origin.x += rect.origin.x;
|
||||
}
|
||||
DrawTarget::Texture { .. } => (),
|
||||
}
|
||||
fb_rect
|
||||
}
|
||||
|
||||
/// Given a scissor rect, convert it to the right coordinate space
|
||||
/// depending on the draw target kind. If no scissor rect was supplied,
|
||||
/// returns a scissor rect that encloses the entire render target.
|
||||
pub fn build_scissor_rect(
|
||||
&self,
|
||||
scissor_rect: Option<DeviceIntRect>,
|
||||
content_origin: DeviceIntPoint,
|
||||
) -> FramebufferIntRect {
|
||||
framebuffer_target_rect: DeviceIntRect,
|
||||
) -> DeviceIntRect {
|
||||
let dimensions = self.dimensions();
|
||||
|
||||
match scissor_rect {
|
||||
Some(scissor_rect) => match *self {
|
||||
DrawTarget::Default { ref rect, .. } => {
|
||||
self.to_framebuffer_rect(scissor_rect.translate(&-content_origin.to_vector()))
|
||||
.intersection(rect)
|
||||
.unwrap_or_else(FramebufferIntRect::zero)
|
||||
}
|
||||
DrawTarget::Texture { .. } => {
|
||||
FramebufferIntRect::from_untyped(&scissor_rect.to_untyped())
|
||||
Some(scissor_rect) => {
|
||||
// Note: `framebuffer_target_rect` needs a Y-flip before going to GL
|
||||
if self.is_default() {
|
||||
let mut rect = scissor_rect
|
||||
.intersection(&framebuffer_target_rect.to_i32())
|
||||
.unwrap_or(DeviceIntRect::zero());
|
||||
rect.origin.y = dimensions.height as i32 - rect.origin.y - rect.size.height;
|
||||
rect
|
||||
} else {
|
||||
scissor_rect
|
||||
}
|
||||
}
|
||||
None => {
|
||||
FramebufferIntRect::new(
|
||||
FramebufferIntPoint::zero(),
|
||||
FramebufferIntSize::from_untyped(&dimensions.to_untyped()),
|
||||
DeviceIntRect::new(
|
||||
DeviceIntPoint::zero(),
|
||||
dimensions,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -1075,7 +1054,7 @@ pub enum ReadTarget<'a> {
|
|||
impl<'a> From<DrawTarget<'a>> for ReadTarget<'a> {
|
||||
fn from(t: DrawTarget<'a>) -> Self {
|
||||
match t {
|
||||
DrawTarget::Default { .. } => ReadTarget::Default,
|
||||
DrawTarget::Default(..) => ReadTarget::Default,
|
||||
DrawTarget::Texture { texture, layer, .. } =>
|
||||
ReadTarget::Texture { texture, layer },
|
||||
}
|
||||
|
@ -1449,17 +1428,14 @@ impl Device {
|
|||
&mut self,
|
||||
target: DrawTarget,
|
||||
) {
|
||||
let (fbo_id, rect, depth_available) = match target {
|
||||
DrawTarget::Default { rect, .. } => (self.default_draw_fbo, rect, true),
|
||||
let (fbo_id, dimensions, depth_available) = match target {
|
||||
DrawTarget::Default(d) => (self.default_draw_fbo, d, true),
|
||||
DrawTarget::Texture { texture, layer, with_depth } => {
|
||||
let rect = FramebufferIntRect::new(
|
||||
FramebufferIntPoint::zero(),
|
||||
FramebufferIntSize::from_untyped(&texture.get_dimensions().to_untyped()),
|
||||
);
|
||||
let dim = texture.get_dimensions();
|
||||
if with_depth {
|
||||
(texture.fbos_with_depth[layer], rect, true)
|
||||
(texture.fbos_with_depth[layer], dim, true)
|
||||
} else {
|
||||
(texture.fbos[layer], rect, false)
|
||||
(texture.fbos[layer], dim, false)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1467,10 +1443,10 @@ impl Device {
|
|||
self.depth_available = depth_available;
|
||||
self.bind_draw_target_impl(fbo_id);
|
||||
self.gl.viewport(
|
||||
rect.origin.x,
|
||||
rect.origin.y,
|
||||
rect.size.width,
|
||||
rect.size.height,
|
||||
0,
|
||||
0,
|
||||
dimensions.width as _,
|
||||
dimensions.height as _,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1821,10 +1797,7 @@ impl Device {
|
|||
}
|
||||
} else {
|
||||
// Note that zip() truncates to the shorter of the two iterators.
|
||||
let rect = FramebufferIntRect::new(
|
||||
FramebufferIntPoint::zero(),
|
||||
FramebufferIntSize::from_untyped(&src.get_dimensions().to_untyped()),
|
||||
);
|
||||
let rect = DeviceIntRect::new(DeviceIntPoint::zero(), src.get_dimensions().to_i32());
|
||||
for (read_fbo, draw_fbo) in src.fbos.iter().zip(&dst.fbos) {
|
||||
self.bind_read_target_impl(*read_fbo);
|
||||
self.bind_draw_target_impl(*draw_fbo);
|
||||
|
@ -1981,8 +1954,8 @@ impl Device {
|
|||
|
||||
pub fn blit_render_target(
|
||||
&mut self,
|
||||
src_rect: FramebufferIntRect,
|
||||
dest_rect: FramebufferIntRect,
|
||||
src_rect: DeviceIntRect,
|
||||
dest_rect: DeviceIntRect,
|
||||
filter: TextureFilter,
|
||||
) {
|
||||
debug_assert!(self.inside_frame);
|
||||
|
@ -2011,8 +1984,8 @@ impl Device {
|
|||
/// origin-top-left).
|
||||
pub fn blit_render_target_invert_y(
|
||||
&mut self,
|
||||
src_rect: FramebufferIntRect,
|
||||
dest_rect: FramebufferIntRect,
|
||||
src_rect: DeviceIntRect,
|
||||
dest_rect: DeviceIntRect,
|
||||
) {
|
||||
debug_assert!(self.inside_frame);
|
||||
self.gl.blit_framebuffer(
|
||||
|
@ -2264,7 +2237,7 @@ impl Device {
|
|||
/// Read rectangle of pixels into the specified output slice.
|
||||
pub fn read_pixels_into(
|
||||
&mut self,
|
||||
rect: FramebufferIntRect,
|
||||
rect: DeviceIntRect,
|
||||
format: ReadPixelsFormat,
|
||||
output: &mut [u8],
|
||||
) {
|
||||
|
@ -2639,7 +2612,7 @@ impl Device {
|
|||
&self,
|
||||
color: Option<[f32; 4]>,
|
||||
depth: Option<f32>,
|
||||
rect: Option<FramebufferIntRect>,
|
||||
rect: Option<DeviceIntRect>,
|
||||
) {
|
||||
let mut clear_bits = 0;
|
||||
|
||||
|
@ -2706,7 +2679,7 @@ impl Device {
|
|||
self.gl.disable(gl::STENCIL_TEST);
|
||||
}
|
||||
|
||||
pub fn set_scissor_rect(&self, rect: FramebufferIntRect) {
|
||||
pub fn set_scissor_rect(&self, rect: DeviceIntRect) {
|
||||
self.gl.scissor(
|
||||
rect.origin.x,
|
||||
rect.origin.y,
|
||||
|
|
|
@ -305,8 +305,9 @@ impl<'a> DisplayListFlattener<'a> {
|
|||
new_scene.pipelines = scene.pipelines.clone();
|
||||
|
||||
FrameBuilder::with_display_list_flattener(
|
||||
DeviceIntSize::from_untyped(&view.framebuffer_rect.size.to_untyped()).into(),
|
||||
view.inner_rect,
|
||||
background_color,
|
||||
view.window_size,
|
||||
flattener,
|
||||
)
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use api::{ColorF, DebugFlags, DocumentLayer, FontRenderMode, PremultipliedColorF};
|
||||
use api::{PipelineId, RasterSpace};
|
||||
use api::units::*;
|
||||
use api::{ColorF, DeviceIntPoint, DevicePixelScale, LayoutPixel, PicturePixel, RasterPixel};
|
||||
use api::{DeviceIntRect, DeviceIntSize, DocumentLayer, FontRenderMode, DebugFlags, PremultipliedColorF};
|
||||
use api::{LayoutPoint, LayoutRect, LayoutSize, PipelineId, RasterSpace, WorldPoint, WorldRect, WorldPixel};
|
||||
use clip::{ClipDataStore, ClipStore, ClipChainStack};
|
||||
use clip_scroll_tree::{ClipScrollTree, ROOT_SPATIAL_NODE_INDEX, SpatialNodeIndex};
|
||||
use display_list_flattener::{DisplayListFlattener};
|
||||
|
@ -95,8 +95,9 @@ impl FrameGlobalResources {
|
|||
/// A builder structure for `tiling::Frame`
|
||||
#[cfg_attr(feature = "capture", derive(Serialize))]
|
||||
pub struct FrameBuilder {
|
||||
output_rect: DeviceIntRect,
|
||||
screen_rect: DeviceIntRect,
|
||||
background_color: Option<ColorF>,
|
||||
window_size: DeviceIntSize,
|
||||
root_pic_index: PictureIndex,
|
||||
/// Cache of surface tiles from the previous frame builder
|
||||
/// that can optionally be consumed by this frame builder.
|
||||
|
@ -222,7 +223,8 @@ impl FrameBuilder {
|
|||
hit_testing_runs: Vec::new(),
|
||||
prim_store: PrimitiveStore::new(&PrimitiveStoreStats::empty()),
|
||||
clip_store: ClipStore::new(),
|
||||
output_rect: DeviceIntRect::zero(),
|
||||
screen_rect: DeviceIntRect::zero(),
|
||||
window_size: DeviceIntSize::zero(),
|
||||
background_color: None,
|
||||
root_pic_index: PictureIndex(0),
|
||||
pending_retained_tiles: RetainedTiles::new(),
|
||||
|
@ -253,8 +255,9 @@ impl FrameBuilder {
|
|||
}
|
||||
|
||||
pub fn with_display_list_flattener(
|
||||
output_rect: DeviceIntRect,
|
||||
screen_rect: DeviceIntRect,
|
||||
background_color: Option<ColorF>,
|
||||
window_size: DeviceIntSize,
|
||||
flattener: DisplayListFlattener,
|
||||
) -> Self {
|
||||
FrameBuilder {
|
||||
|
@ -262,8 +265,9 @@ impl FrameBuilder {
|
|||
prim_store: flattener.prim_store,
|
||||
clip_store: flattener.clip_store,
|
||||
root_pic_index: flattener.root_pic_index,
|
||||
output_rect,
|
||||
screen_rect,
|
||||
background_color,
|
||||
window_size,
|
||||
pending_retained_tiles: RetainedTiles::new(),
|
||||
config: flattener.config,
|
||||
globals: FrameGlobalResources::empty(),
|
||||
|
@ -471,8 +475,11 @@ impl FrameBuilder {
|
|||
.take_render_tasks();
|
||||
|
||||
let root_render_task = RenderTask::new_picture(
|
||||
RenderTaskLocation::Fixed(self.output_rect),
|
||||
self.output_rect.size.to_f32(),
|
||||
// The rect here is the whole window. If we were to use the screen_rect,
|
||||
// any offset in that rect would doubly apply for cached pictures.
|
||||
RenderTaskLocation::Fixed(DeviceIntRect::new(DeviceIntPoint::zero(),
|
||||
self.window_size).to_i32()),
|
||||
self.window_size.to_f32(),
|
||||
self.root_pic_index,
|
||||
DeviceIntPoint::zero(),
|
||||
child_tasks,
|
||||
|
@ -499,7 +506,6 @@ impl FrameBuilder {
|
|||
pipelines: &FastHashMap<PipelineId, Arc<ScenePipeline>>,
|
||||
global_device_pixel_scale: DevicePixelScale,
|
||||
layer: DocumentLayer,
|
||||
framebuffer_origin: FramebufferIntPoint,
|
||||
pan: WorldPoint,
|
||||
texture_cache_profile: &mut TextureCacheProfileCounters,
|
||||
gpu_cache_profile: &mut GpuCacheProfileCounters,
|
||||
|
@ -511,6 +517,10 @@ impl FrameBuilder {
|
|||
) -> Frame {
|
||||
profile_scope!("build");
|
||||
profile_marker!("BuildFrame");
|
||||
debug_assert!(
|
||||
DeviceIntRect::new(DeviceIntPoint::zero(), self.window_size)
|
||||
.contains_rect(&self.screen_rect)
|
||||
);
|
||||
|
||||
let mut profile_counters = FrameProfileCounters::new();
|
||||
profile_counters
|
||||
|
@ -536,8 +546,8 @@ impl FrameBuilder {
|
|||
);
|
||||
let mut surfaces = Vec::new();
|
||||
|
||||
let output_size = self.output_rect.size.to_i32();
|
||||
let screen_world_rect = (self.output_rect.to_f32() / global_device_pixel_scale).round_out();
|
||||
let screen_size = self.screen_rect.size.to_i32();
|
||||
let screen_world_rect = (self.screen_rect.to_f32() / global_device_pixel_scale).round_out();
|
||||
|
||||
let main_render_task_id = self.build_layer_screen_rects_and_cull_layers(
|
||||
screen_world_rect,
|
||||
|
@ -574,12 +584,12 @@ impl FrameBuilder {
|
|||
|
||||
// Add passes as required for our cached render tasks.
|
||||
if !render_tasks.cacheable_render_tasks.is_empty() {
|
||||
passes.push(RenderPass::new_off_screen(output_size, self.config.gpu_supports_fast_clears));
|
||||
passes.push(RenderPass::new_off_screen(screen_size, self.config.gpu_supports_fast_clears));
|
||||
for cacheable_render_task in &render_tasks.cacheable_render_tasks {
|
||||
render_tasks.assign_to_passes(
|
||||
*cacheable_render_task,
|
||||
0,
|
||||
output_size,
|
||||
screen_size,
|
||||
&mut passes,
|
||||
self.config.gpu_supports_fast_clears,
|
||||
);
|
||||
|
@ -589,11 +599,11 @@ impl FrameBuilder {
|
|||
|
||||
if let Some(main_render_task_id) = main_render_task_id {
|
||||
let passes_start = passes.len();
|
||||
passes.push(RenderPass::new_main_framebuffer(output_size, self.config.gpu_supports_fast_clears));
|
||||
passes.push(RenderPass::new_main_framebuffer(screen_size, self.config.gpu_supports_fast_clears));
|
||||
render_tasks.assign_to_passes(
|
||||
main_render_task_id,
|
||||
passes_start,
|
||||
output_size,
|
||||
screen_size,
|
||||
&mut passes,
|
||||
self.config.gpu_supports_fast_clears,
|
||||
);
|
||||
|
@ -649,11 +659,8 @@ impl FrameBuilder {
|
|||
resource_cache.end_frame(texture_cache_profile);
|
||||
|
||||
Frame {
|
||||
content_origin: self.output_rect.origin,
|
||||
framebuffer_rect: FramebufferIntRect::new(
|
||||
framebuffer_origin,
|
||||
FramebufferIntSize::from_untyped(&self.output_rect.size.to_untyped()),
|
||||
),
|
||||
window_size: self.window_size,
|
||||
inner_rect: self.screen_rect,
|
||||
background_color: self.background_color,
|
||||
layer,
|
||||
profile_counters,
|
||||
|
|
|
@ -11,11 +11,12 @@
|
|||
use api::{ApiMsg, BuiltDisplayList, ClearCache, DebugCommand, DebugFlags};
|
||||
#[cfg(feature = "debugger")]
|
||||
use api::{BuiltDisplayListIter, SpecificDisplayItem};
|
||||
use api::{DevicePixelScale, DeviceIntPoint, DeviceIntRect, DeviceIntSize};
|
||||
use api::{DocumentId, DocumentLayer, ExternalScrollId, FrameMsg, HitTestFlags, HitTestResult};
|
||||
use api::{IdNamespace, MemoryReport, PipelineId, RenderNotifier, SceneMsg, ScrollClamping};
|
||||
use api::{IdNamespace, LayoutPoint, PipelineId, RenderNotifier, SceneMsg, ScrollClamping};
|
||||
use api::{MemoryReport};
|
||||
use api::{ScrollLocation, ScrollNodeState, TransactionMsg, ResourceUpdate, BlobImageKey};
|
||||
use api::{NotificationRequest, Checkpoint};
|
||||
use api::units::*;
|
||||
use api::channel::{MsgReceiver, MsgSender, Payload};
|
||||
#[cfg(feature = "capture")]
|
||||
use api::CaptureBits;
|
||||
|
@ -61,12 +62,12 @@ use tiling::Frame;
|
|||
use time::precise_time_ns;
|
||||
use util::{Recycler, VecHelper, drain_filter};
|
||||
|
||||
|
||||
#[cfg_attr(feature = "capture", derive(Serialize))]
|
||||
#[cfg_attr(feature = "replay", derive(Deserialize))]
|
||||
#[derive(Clone)]
|
||||
pub struct DocumentView {
|
||||
pub framebuffer_rect: FramebufferIntRect,
|
||||
pub window_size: DeviceIntSize,
|
||||
pub inner_rect: DeviceIntRect,
|
||||
pub layer: DocumentLayer,
|
||||
pub pan: DeviceIntPoint,
|
||||
pub device_pixel_ratio: f32,
|
||||
|
@ -355,7 +356,7 @@ struct Document {
|
|||
impl Document {
|
||||
pub fn new(
|
||||
id: DocumentId,
|
||||
size: FramebufferIntSize,
|
||||
window_size: DeviceIntSize,
|
||||
layer: DocumentLayer,
|
||||
default_device_pixel_ratio: f32,
|
||||
) -> Self {
|
||||
|
@ -363,7 +364,8 @@ impl Document {
|
|||
scene: Scene::new(),
|
||||
removed_pipelines: Vec::new(),
|
||||
view: DocumentView {
|
||||
framebuffer_rect: FramebufferIntRect::new(FramebufferIntPoint::zero(), size),
|
||||
window_size,
|
||||
inner_rect: DeviceIntRect::new(DeviceIntPoint::zero(), window_size),
|
||||
layer,
|
||||
pan: DeviceIntPoint::zero(),
|
||||
page_zoom_factor: 1.0,
|
||||
|
@ -391,7 +393,7 @@ impl Document {
|
|||
}
|
||||
|
||||
fn has_pixels(&self) -> bool {
|
||||
!self.view.framebuffer_rect.size.is_empty_or_negative()
|
||||
!self.view.window_size.is_empty_or_negative()
|
||||
}
|
||||
|
||||
fn process_frame_msg(
|
||||
|
@ -402,6 +404,13 @@ impl Document {
|
|||
FrameMsg::UpdateEpoch(pipeline_id, epoch) => {
|
||||
self.scene.update_epoch(pipeline_id, epoch);
|
||||
}
|
||||
FrameMsg::EnableFrameOutput(pipeline_id, enable) => {
|
||||
if enable {
|
||||
self.output_pipelines.insert(pipeline_id);
|
||||
} else {
|
||||
self.output_pipelines.remove(&pipeline_id);
|
||||
}
|
||||
}
|
||||
FrameMsg::Scroll(delta, cursor) => {
|
||||
profile_scope!("Scroll");
|
||||
|
||||
|
@ -512,7 +521,6 @@ impl Document {
|
|||
&self.scene.pipelines,
|
||||
accumulated_scale_factor,
|
||||
self.view.layer,
|
||||
self.view.framebuffer_rect.origin,
|
||||
pan,
|
||||
&mut resource_profile.texture_cache,
|
||||
&mut resource_profile.gpu_cache,
|
||||
|
@ -749,11 +757,13 @@ impl RenderBackend {
|
|||
SceneMsg::SetPageZoom(factor) => {
|
||||
doc.view.page_zoom_factor = factor.get();
|
||||
}
|
||||
SceneMsg::SetDocumentView {
|
||||
framebuffer_rect,
|
||||
SceneMsg::SetWindowParameters {
|
||||
window_size,
|
||||
inner_rect,
|
||||
device_pixel_ratio,
|
||||
} => {
|
||||
doc.view.framebuffer_rect = framebuffer_rect;
|
||||
doc.view.window_size = window_size;
|
||||
doc.view.inner_rect = inner_rect;
|
||||
doc.view.device_pixel_ratio = device_pixel_ratio;
|
||||
}
|
||||
SceneMsg::SetDisplayList {
|
||||
|
@ -823,19 +833,14 @@ impl RenderBackend {
|
|||
}
|
||||
SceneMsg::SetRootPipeline(pipeline_id) => {
|
||||
profile_scope!("SetRootPipeline");
|
||||
|
||||
txn.set_root_pipeline = Some(pipeline_id);
|
||||
}
|
||||
SceneMsg::RemovePipeline(pipeline_id) => {
|
||||
profile_scope!("RemovePipeline");
|
||||
|
||||
txn.removed_pipelines.push(pipeline_id);
|
||||
}
|
||||
SceneMsg::EnableFrameOutput(pipeline_id, enable) => {
|
||||
if enable {
|
||||
doc.output_pipelines.insert(pipeline_id);
|
||||
} else {
|
||||
doc.output_pipelines.remove(&pipeline_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1095,6 +1100,7 @@ impl RenderBackend {
|
|||
let captured = CapturedDocument {
|
||||
document_id: *id,
|
||||
root_pipeline_id: doc.scene.root_pipeline_id,
|
||||
window_size: doc.view.window_size,
|
||||
};
|
||||
tx.send(captured).unwrap();
|
||||
|
||||
|
|
|
@ -21,27 +21,15 @@
|
|||
//! directly with the `RenderBackend`. Aside from a few high-level operations
|
||||
//! like 'render now', most of interesting commands from the consumer go over
|
||||
//! that channel and operate on the `RenderBackend`.
|
||||
//!
|
||||
//! ## Space conversion guidelines
|
||||
//! At this stage, we shuld be operating with `DevicePixel` and `FramebufferPixel` only.
|
||||
//! "Framebuffer" space represents the final destination of our rendeing,
|
||||
//! and it happens to be Y-flipped on OpenGL. The conversion is done as follows:
|
||||
//! - for rasterized primitives, the orthographics projection transforms
|
||||
//! the content rectangle to -1 to 1
|
||||
//! - the viewport transformation is setup to map the whole range to
|
||||
//! the framebuffer rectangle provided by the document view, stored in `DrawTarget`
|
||||
//! - all the direct framebuffer operations, like blitting, reading pixels, and setting
|
||||
//! up the scissor, are accepting already transformed coordinates, which we can get by
|
||||
//! calling `DrawTarget::to_framebuffer_rect`
|
||||
|
||||
use api::{BlobImageHandler, ColorF, ColorU};
|
||||
use api::{BlobImageHandler, ColorF, ColorU, DeviceIntPoint, DeviceIntRect, DeviceIntSize};
|
||||
use api::{DocumentId, Epoch, ExternalImageId};
|
||||
use api::{ExternalImageType, FontRenderMode, FrameMsg, ImageFormat, PipelineId};
|
||||
use api::{ImageRendering, Checkpoint, NotificationRequest};
|
||||
use api::{DebugCommand, MemoryReport, VoidPtrToSizeFn};
|
||||
use api::{MemoryReport, VoidPtrToSizeFn};
|
||||
use api::{RenderApiSender, RenderNotifier, TexelRect, TextureTarget};
|
||||
use api::channel;
|
||||
use api::units::*;
|
||||
use api::{channel};
|
||||
use api::DebugCommand;
|
||||
pub use api::DebugFlags;
|
||||
use api::channel::PayloadReceiverHelperMethods;
|
||||
use batch::{BatchKind, BatchTextures, BrushBatchKind, ClipBatchList};
|
||||
|
@ -1585,7 +1573,7 @@ pub struct Renderer {
|
|||
/// Notification requests to be fulfilled after rendering.
|
||||
notifications: Vec<NotificationRequest>,
|
||||
|
||||
framebuffer_size: Option<FramebufferIntSize>,
|
||||
framebuffer_size: Option<DeviceIntSize>,
|
||||
|
||||
/// A lazily created texture for the zoom debugging widget.
|
||||
zoom_debug_texture: Option<Texture>,
|
||||
|
@ -2052,10 +2040,6 @@ impl Renderer {
|
|||
Ok((renderer, sender))
|
||||
}
|
||||
|
||||
pub fn framebuffer_size(&self) -> Option<FramebufferIntSize> {
|
||||
self.framebuffer_size
|
||||
}
|
||||
|
||||
/// Update the current position of the debug cursor.
|
||||
pub fn set_cursor_position(
|
||||
&mut self,
|
||||
|
@ -2493,11 +2477,11 @@ impl Renderer {
|
|||
.filter_map(|&(_, ref render_doc)| {
|
||||
match render_doc.frame.passes.last() {
|
||||
Some(&RenderPass { kind: RenderPassKind::MainFramebuffer(ref target), .. })
|
||||
if target.needs_depth() => Some(render_doc.frame.framebuffer_rect),
|
||||
if target.needs_depth() => Some(render_doc.frame.inner_rect),
|
||||
_ => None,
|
||||
}
|
||||
})
|
||||
.collect::<SmallVec<[_; 3]>>();
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
for (i, rect) in document_rects.iter().enumerate() {
|
||||
for other in &document_rects[i+1 ..] {
|
||||
|
@ -2519,7 +2503,7 @@ impl Renderer {
|
|||
/// A Frame is supplied by calling [`generate_frame()`][webrender_api::Transaction::generate_frame].
|
||||
pub fn render(
|
||||
&mut self,
|
||||
framebuffer_size: FramebufferIntSize,
|
||||
framebuffer_size: DeviceIntSize,
|
||||
) -> Result<RenderResults, Vec<RendererError>> {
|
||||
self.framebuffer_size = Some(framebuffer_size);
|
||||
|
||||
|
@ -2545,7 +2529,7 @@ impl Renderer {
|
|||
// avoid doing a full frame render.
|
||||
fn render_impl(
|
||||
&mut self,
|
||||
framebuffer_size: Option<FramebufferIntSize>,
|
||||
framebuffer_size: Option<DeviceIntSize>,
|
||||
) -> Result<RenderResults, Vec<RendererError>> {
|
||||
profile_scope!("render");
|
||||
let mut results = RenderResults::default();
|
||||
|
@ -2657,9 +2641,6 @@ impl Renderer {
|
|||
fb_clear_depth,
|
||||
);
|
||||
|
||||
if let Some(_) = framebuffer_size {
|
||||
self.draw_frame_debug_items(&frame.debug_items);
|
||||
}
|
||||
if self.debug_flags.contains(DebugFlags::PROFILER_DBG) {
|
||||
frame_profiles.push(frame.profile_counters.clone());
|
||||
}
|
||||
|
@ -2673,14 +2654,6 @@ impl Renderer {
|
|||
self.active_documents = active_documents;
|
||||
});
|
||||
|
||||
if let Some(framebuffer_size) = framebuffer_size {
|
||||
self.draw_render_target_debug(framebuffer_size);
|
||||
self.draw_texture_cache_debug(framebuffer_size);
|
||||
self.draw_gpu_cache_debug(framebuffer_size);
|
||||
self.draw_zoom_debug(framebuffer_size);
|
||||
self.draw_epoch_debug();
|
||||
}
|
||||
|
||||
let current_time = precise_time_ns();
|
||||
if framebuffer_size.is_some() {
|
||||
let ns = current_time - self.last_time;
|
||||
|
@ -2980,16 +2953,15 @@ impl Renderer {
|
|||
size
|
||||
}
|
||||
TextureUpdateSource::DebugClear => {
|
||||
let draw_target = DrawTarget::Texture {
|
||||
self.device.bind_draw_target(DrawTarget::Texture {
|
||||
texture,
|
||||
layer: layer_index as usize,
|
||||
with_depth: false,
|
||||
};
|
||||
self.device.bind_draw_target(draw_target);
|
||||
});
|
||||
self.device.clear_target(
|
||||
Some(TEXTURE_CACHE_DBG_CLEAR_COLOR),
|
||||
None,
|
||||
Some(draw_target.to_framebuffer_rect(rect.to_i32()))
|
||||
Some(rect.to_i32())
|
||||
);
|
||||
0
|
||||
}
|
||||
|
@ -3068,50 +3040,46 @@ impl Renderer {
|
|||
self.profile_counters.vertices.add(6 * data.len());
|
||||
}
|
||||
|
||||
//TODO: make this nicer. Currently we can't accept `&mut self` because the `DrawTarget` parameter
|
||||
// needs to borrow self.texture_resolver
|
||||
fn handle_blits(
|
||||
gpu_profile: &mut GpuProfiler<GpuProfileTag>,
|
||||
device: &mut Device,
|
||||
texture_resolver: &TextureResolver,
|
||||
&mut self,
|
||||
blits: &[BlitJob],
|
||||
render_tasks: &RenderTaskTree,
|
||||
draw_target: DrawTarget,
|
||||
content_origin: &DeviceIntPoint,
|
||||
) {
|
||||
if blits.is_empty() {
|
||||
return;
|
||||
}
|
||||
|
||||
let _timer = gpu_profile.start_timer(GPU_TAG_BLIT);
|
||||
let _timer = self.gpu_profile.start_timer(GPU_TAG_BLIT);
|
||||
|
||||
// TODO(gw): For now, we don't bother batching these by source texture.
|
||||
// If if ever shows up as an issue, we can easily batch them.
|
||||
for blit in blits {
|
||||
let (source, layer, source_rect) = match blit.source {
|
||||
let source_rect = match blit.source {
|
||||
BlitJobSource::Texture(texture_id, layer, source_rect) => {
|
||||
// A blit from a texture into this target.
|
||||
(texture_id, layer as usize, source_rect)
|
||||
let texture = self.texture_resolver
|
||||
.resolve(&texture_id)
|
||||
.expect("BUG: invalid source texture");
|
||||
self.device.bind_read_target(ReadTarget::Texture { texture, layer: layer as usize });
|
||||
source_rect
|
||||
}
|
||||
BlitJobSource::RenderTask(task_id) => {
|
||||
// A blit from the child render task into this target.
|
||||
// TODO(gw): Support R8 format here once we start
|
||||
// creating mips for alpha masks.
|
||||
let texture = self.texture_resolver
|
||||
.resolve(&TextureSource::PrevPassColor)
|
||||
.expect("BUG: invalid source texture");
|
||||
let source = &render_tasks[task_id];
|
||||
let (source_rect, layer) = source.get_target_rect();
|
||||
(TextureSource::PrevPassColor, layer.0, source_rect)
|
||||
self.device.bind_read_target(ReadTarget::Texture { texture, layer: layer.0 });
|
||||
source_rect
|
||||
}
|
||||
};
|
||||
debug_assert_eq!(source_rect.size, blit.target_rect.size);
|
||||
let texture = texture_resolver
|
||||
.resolve(&source)
|
||||
.expect("BUG: invalid source texture");
|
||||
let read_target = DrawTarget::Texture { texture, layer, with_depth: false };
|
||||
|
||||
device.bind_read_target(read_target.into());
|
||||
device.blit_render_target(
|
||||
read_target.to_framebuffer_rect(source_rect),
|
||||
draw_target.to_framebuffer_rect(blit.target_rect.translate(&-content_origin.to_vector())),
|
||||
self.device.blit_render_target(
|
||||
source_rect,
|
||||
blit.target_rect,
|
||||
TextureFilter::Linear,
|
||||
);
|
||||
}
|
||||
|
@ -3156,7 +3124,7 @@ impl Renderer {
|
|||
&mut self,
|
||||
draw_target: DrawTarget,
|
||||
target: &ColorRenderTarget,
|
||||
content_origin: DeviceIntPoint,
|
||||
framebuffer_target_rect: DeviceIntRect,
|
||||
clear_color: Option<[f32; 4]>,
|
||||
clear_depth: Option<f32>,
|
||||
render_tasks: &RenderTaskTree,
|
||||
|
@ -3188,15 +3156,8 @@ impl Renderer {
|
|||
self.device.enable_depth_write();
|
||||
}
|
||||
|
||||
let clear_rect = match draw_target {
|
||||
DrawTarget::Default { rect, total_size } if rect.origin == FramebufferIntPoint::zero() && rect.size == total_size => {
|
||||
// whole screen is covered, no need for scissor
|
||||
None
|
||||
}
|
||||
DrawTarget::Default { rect, .. } => {
|
||||
Some(rect)
|
||||
}
|
||||
DrawTarget::Texture { .. } if self.enable_clear_scissor => {
|
||||
let clear_rect = if !draw_target.is_default() {
|
||||
if self.enable_clear_scissor {
|
||||
// TODO(gw): Applying a scissor rect and minimal clear here
|
||||
// is a very large performance win on the Intel and nVidia
|
||||
// GPUs that I have tested with. It's possible it may be a
|
||||
|
@ -3207,11 +3168,20 @@ impl Renderer {
|
|||
// target slices were minimum 2048x2048. Now that we size
|
||||
// them adaptively, this may be less of a win (except perhaps
|
||||
// on a mostly-unused last slice of a large texture array).
|
||||
Some(draw_target.to_framebuffer_rect(target.used_rect()))
|
||||
}
|
||||
DrawTarget::Texture { .. } => {
|
||||
Some(target.used_rect())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
} else if framebuffer_target_rect == DeviceIntRect::new(DeviceIntPoint::zero(), draw_target.dimensions()) {
|
||||
// whole screen is covered, no need for scissor
|
||||
None
|
||||
} else {
|
||||
let mut rect = framebuffer_target_rect.to_i32();
|
||||
// Note: `framebuffer_target_rect` needs a Y-flip before going to GL
|
||||
// Note: at this point, the target rectangle is not guaranteed to be within the main framebuffer bounds
|
||||
// but `clear_target_rect` is totally fine with negative origin, as long as width & height are positive
|
||||
rect.origin.y = draw_target.dimensions().height as i32 - rect.origin.y - rect.size.height;
|
||||
Some(rect)
|
||||
};
|
||||
|
||||
self.device.clear_target(
|
||||
|
@ -3226,10 +3196,7 @@ impl Renderer {
|
|||
}
|
||||
|
||||
// Handle any blits from the texture cache to this target.
|
||||
Self::handle_blits(
|
||||
&mut self.gpu_profile, &mut self.device, &self.texture_resolver,
|
||||
&target.blits, render_tasks, draw_target, &content_origin,
|
||||
);
|
||||
self.handle_blits(&target.blits, render_tasks);
|
||||
|
||||
// Draw any blurs for this target.
|
||||
// Blurs are rendered as a standard 2-pass
|
||||
|
@ -3293,7 +3260,7 @@ impl Renderer {
|
|||
self.device.enable_scissor();
|
||||
let scissor_rect = draw_target.build_scissor_rect(
|
||||
alpha_batch_container.task_scissor_rect,
|
||||
content_origin,
|
||||
framebuffer_target_rect,
|
||||
);
|
||||
self.device.set_scissor_rect(scissor_rect)
|
||||
}
|
||||
|
@ -3329,7 +3296,7 @@ impl Renderer {
|
|||
if let Some(region) = region {
|
||||
let scissor_rect = draw_target.build_scissor_rect(
|
||||
Some(region),
|
||||
content_origin,
|
||||
framebuffer_target_rect,
|
||||
);
|
||||
self.device.set_scissor_rect(scissor_rect);
|
||||
}
|
||||
|
@ -3407,7 +3374,7 @@ impl Renderer {
|
|||
if let Some(region) = region {
|
||||
let scissor_rect = draw_target.build_scissor_rect(
|
||||
Some(region),
|
||||
content_origin,
|
||||
framebuffer_target_rect,
|
||||
);
|
||||
self.device.set_scissor_rect(scissor_rect);
|
||||
}
|
||||
|
@ -3465,28 +3432,36 @@ impl Renderer {
|
|||
.resolve(&blit.target.texture_id)
|
||||
.expect("BUG: invalid target texture");
|
||||
|
||||
let blit_target = DrawTarget::Texture {
|
||||
self.device.bind_draw_target(DrawTarget::Texture {
|
||||
texture,
|
||||
layer: blit.target.texture_layer as usize,
|
||||
with_depth: false,
|
||||
};
|
||||
self.device.bind_draw_target(blit_target);
|
||||
});
|
||||
|
||||
let src_rect = draw_target.to_framebuffer_rect(DeviceIntRect::new(
|
||||
blit.src_offset - content_origin.to_vector(),
|
||||
let mut src_rect = DeviceIntRect::new(
|
||||
blit.src_offset,
|
||||
blit.size,
|
||||
));
|
||||
);
|
||||
|
||||
let target_rect = blit.target.uv_rect.to_i32();
|
||||
|
||||
let dest_rect = blit_target.to_framebuffer_rect(DeviceIntRect::new(
|
||||
blit.dest_offset + (target_rect.origin - content_origin),
|
||||
let mut dest_rect = DeviceIntRect::new(
|
||||
DeviceIntPoint::new(
|
||||
blit.dest_offset.x + target_rect.origin.x,
|
||||
blit.dest_offset.y + target_rect.origin.y,
|
||||
),
|
||||
blit.size,
|
||||
));
|
||||
);
|
||||
|
||||
self.device.blit_render_target_invert_y(
|
||||
// Modify the src/dest rects since we are blitting from the framebuffer
|
||||
src_rect.origin.y = draw_target.dimensions().height as i32 - src_rect.size.height - src_rect.origin.y;
|
||||
dest_rect.origin.y += dest_rect.size.height;
|
||||
dest_rect.size.height = -dest_rect.size.height;
|
||||
|
||||
self.device.blit_render_target(
|
||||
src_rect,
|
||||
dest_rect,
|
||||
TextureFilter::Linear,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -3517,12 +3492,15 @@ impl Renderer {
|
|||
}
|
||||
};
|
||||
let (src_rect, _) = render_tasks[output.task_id].get_target_rect();
|
||||
let mut dest_rect = DeviceIntRect::new(DeviceIntPoint::zero(), output_size);
|
||||
|
||||
// Invert Y coordinates, to correctly convert between coordinate systems.
|
||||
dest_rect.origin.y += dest_rect.size.height;
|
||||
dest_rect.size.height *= -1;
|
||||
|
||||
self.device.bind_read_target(draw_target.into());
|
||||
self.device.bind_external_draw_target(fbo_id);
|
||||
self.device.blit_render_target_invert_y(
|
||||
draw_target.to_framebuffer_rect(src_rect.translate(&-content_origin.to_vector())),
|
||||
output_size.into(),
|
||||
);
|
||||
self.device.blit_render_target(src_rect, dest_rect, TextureFilter::Linear);
|
||||
handler.unlock(output.pipeline_id);
|
||||
}
|
||||
}
|
||||
|
@ -3622,7 +3600,7 @@ impl Renderer {
|
|||
self.device.clear_target(
|
||||
Some(zero_color),
|
||||
None,
|
||||
Some(draw_target.to_framebuffer_rect(rect)),
|
||||
Some(rect),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -3632,7 +3610,7 @@ impl Renderer {
|
|||
self.device.clear_target(
|
||||
Some(one_color),
|
||||
None,
|
||||
Some(draw_target.to_framebuffer_rect(rect)),
|
||||
Some(rect),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -3743,31 +3721,23 @@ impl Renderer {
|
|||
let texture = self.texture_resolver
|
||||
.resolve(&texture_source)
|
||||
.expect("BUG: invalid target texture");
|
||||
let draw_target = DrawTarget::Texture {
|
||||
self.device.bind_draw_target(DrawTarget::Texture {
|
||||
texture,
|
||||
layer,
|
||||
with_depth: false,
|
||||
};
|
||||
self.device.bind_draw_target(draw_target);
|
||||
});
|
||||
}
|
||||
|
||||
self.device.disable_depth();
|
||||
self.device.disable_depth_write();
|
||||
self.set_blend(false, FramebufferKind::Other);
|
||||
|
||||
for rect in &target.clears {
|
||||
self.device.clear_target(
|
||||
Some([0.0, 0.0, 0.0, 0.0]),
|
||||
None,
|
||||
Some(draw_target.to_framebuffer_rect(*rect)),
|
||||
);
|
||||
self.device.clear_target(Some([0.0, 0.0, 0.0, 0.0]), None, Some(*rect));
|
||||
}
|
||||
|
||||
// Handle any blits to this texture from child tasks.
|
||||
Self::handle_blits(
|
||||
&mut self.gpu_profile, &mut self.device, &self.texture_resolver,
|
||||
&target.blits, render_tasks, draw_target, &DeviceIntPoint::zero(),
|
||||
);
|
||||
}
|
||||
self.handle_blits(&target.blits, render_tasks);
|
||||
|
||||
// Draw any borders for this target.
|
||||
if !target.border_segments_solid.is_empty() ||
|
||||
|
@ -4090,7 +4060,7 @@ impl Renderer {
|
|||
fn draw_tile_frame(
|
||||
&mut self,
|
||||
frame: &mut Frame,
|
||||
framebuffer_size: Option<FramebufferIntSize>,
|
||||
framebuffer_size: Option<DeviceIntSize>,
|
||||
frame_id: GpuFrameId,
|
||||
stats: &mut RendererStats,
|
||||
fb_clear_color: Option<ColorF>,
|
||||
|
@ -4128,24 +4098,19 @@ impl Renderer {
|
|||
if let Some(framebuffer_size) = framebuffer_size {
|
||||
stats.color_target_count += 1;
|
||||
|
||||
let offset = frame.content_origin.to_f32();
|
||||
let size = frame.framebuffer_rect.size.to_f32();
|
||||
let projection = Transform3D::ortho(
|
||||
offset.x,
|
||||
offset.x + size.width,
|
||||
offset.y + size.height,
|
||||
offset.y,
|
||||
0.0,
|
||||
framebuffer_size.width as f32,
|
||||
framebuffer_size.height as f32,
|
||||
0.0,
|
||||
ORTHO_NEAR_PLANE,
|
||||
ORTHO_FAR_PLANE,
|
||||
);
|
||||
|
||||
self.draw_color_target(
|
||||
DrawTarget::Default {
|
||||
rect: frame.framebuffer_rect,
|
||||
total_size: framebuffer_size,
|
||||
},
|
||||
DrawTarget::Default(framebuffer_size),
|
||||
target,
|
||||
frame.content_origin,
|
||||
frame.inner_rect,
|
||||
fb_clear_color.map(|color| color.to_array()),
|
||||
fb_clear_depth,
|
||||
&frame.render_tasks,
|
||||
|
@ -4226,7 +4191,7 @@ impl Renderer {
|
|||
self.draw_color_target(
|
||||
draw_target,
|
||||
target,
|
||||
frame.content_origin,
|
||||
frame.inner_rect,
|
||||
Some([0.0, 0.0, 0.0, 0.0]),
|
||||
clear_depth,
|
||||
&frame.render_tasks,
|
||||
|
@ -4346,7 +4311,7 @@ impl Renderer {
|
|||
}
|
||||
}
|
||||
|
||||
fn draw_render_target_debug(&mut self, framebuffer_size: FramebufferIntSize) {
|
||||
fn draw_render_target_debug(&mut self, framebuffer_size: DeviceIntSize) {
|
||||
if !self.debug_flags.contains(DebugFlags::RENDER_TARGET_DBG) {
|
||||
return;
|
||||
}
|
||||
|
@ -4371,7 +4336,7 @@ impl Renderer {
|
|||
|
||||
fn draw_zoom_debug(
|
||||
&mut self,
|
||||
framebuffer_size: FramebufferIntSize,
|
||||
framebuffer_size: DeviceIntSize,
|
||||
) {
|
||||
if !self.debug_flags.contains(DebugFlags::ZOOM_DBG) {
|
||||
return;
|
||||
|
@ -4407,9 +4372,9 @@ impl Renderer {
|
|||
target_size,
|
||||
);
|
||||
|
||||
let texture_rect = FramebufferIntRect::new(
|
||||
FramebufferIntPoint::zero(),
|
||||
FramebufferIntSize::from_untyped(&source_rect.size.to_untyped()),
|
||||
let texture_rect = DeviceIntRect::new(
|
||||
DeviceIntPoint::zero(),
|
||||
source_rect.size,
|
||||
);
|
||||
|
||||
debug_renderer.add_rect(
|
||||
|
@ -4432,15 +4397,20 @@ impl Renderer {
|
|||
}
|
||||
|
||||
// Copy frame buffer into the zoom texture
|
||||
let read_target = DrawTarget::new_default(framebuffer_size);
|
||||
self.device.bind_read_target(read_target.into());
|
||||
self.device.bind_read_target(ReadTarget::Default);
|
||||
self.device.bind_draw_target(DrawTarget::Texture {
|
||||
texture: self.zoom_debug_texture.as_ref().unwrap(),
|
||||
layer: 0,
|
||||
with_depth: false,
|
||||
});
|
||||
self.device.blit_render_target(
|
||||
read_target.to_framebuffer_rect(source_rect),
|
||||
DeviceIntRect::new(
|
||||
DeviceIntPoint::new(
|
||||
source_rect.origin.x,
|
||||
framebuffer_size.height - source_rect.size.height - source_rect.origin.y,
|
||||
),
|
||||
source_rect.size,
|
||||
),
|
||||
texture_rect,
|
||||
TextureFilter::Nearest,
|
||||
);
|
||||
|
@ -4450,15 +4420,21 @@ impl Renderer {
|
|||
texture: self.zoom_debug_texture.as_ref().unwrap(),
|
||||
layer: 0,
|
||||
});
|
||||
self.device.bind_draw_target(read_target);
|
||||
self.device.bind_draw_target(DrawTarget::Default(framebuffer_size));
|
||||
self.device.blit_render_target(
|
||||
texture_rect,
|
||||
read_target.to_framebuffer_rect(target_rect),
|
||||
DeviceIntRect::new(
|
||||
DeviceIntPoint::new(
|
||||
target_rect.origin.x,
|
||||
framebuffer_size.height - target_rect.size.height - target_rect.origin.y,
|
||||
),
|
||||
target_rect.size,
|
||||
),
|
||||
TextureFilter::Nearest,
|
||||
);
|
||||
}
|
||||
|
||||
fn draw_texture_cache_debug(&mut self, framebuffer_size: FramebufferIntSize) {
|
||||
fn draw_texture_cache_debug(&mut self, framebuffer_size: DeviceIntSize) {
|
||||
if !self.debug_flags.contains(DebugFlags::TEXTURE_CACHE_DBG) {
|
||||
return;
|
||||
}
|
||||
|
@ -4493,7 +4469,7 @@ impl Renderer {
|
|||
device: &mut Device,
|
||||
debug_renderer: &mut DebugRenderer,
|
||||
mut textures: Vec<&Texture>,
|
||||
framebuffer_size: FramebufferIntSize,
|
||||
framebuffer_size: DeviceIntSize,
|
||||
bottom: i32,
|
||||
select_color: &Fn(&Texture) -> [f32; 4],
|
||||
) {
|
||||
|
@ -4523,9 +4499,9 @@ impl Renderer {
|
|||
for texture in textures.iter() {
|
||||
let y = spacing + bottom;
|
||||
let dimensions = texture.get_dimensions();
|
||||
let src_rect = FramebufferIntRect::new(
|
||||
FramebufferIntPoint::zero(),
|
||||
FramebufferIntSize::new(dimensions.width as i32, dimensions.height as i32),
|
||||
let src_rect = DeviceIntRect::new(
|
||||
DeviceIntPoint::zero(),
|
||||
DeviceIntSize::new(dimensions.width as i32, dimensions.height as i32),
|
||||
);
|
||||
|
||||
let layer_count = texture.get_layer_count() as usize;
|
||||
|
@ -4539,19 +4515,13 @@ impl Renderer {
|
|||
return;
|
||||
}
|
||||
|
||||
//TODO: properly use FramebufferPixel coordinates
|
||||
|
||||
// Draw the info tag.
|
||||
let text_margin = 1;
|
||||
let text_height = 14; // Visually aproximated.
|
||||
let tag_height = text_height + text_margin * 2;
|
||||
let tag_rect = rect(x, y, size, tag_height);
|
||||
let tag_color = select_color(texture);
|
||||
device.clear_target(
|
||||
Some(tag_color),
|
||||
None,
|
||||
Some(FramebufferIntRect::from_untyped(&tag_rect.to_untyped())),
|
||||
);
|
||||
device.clear_target(Some(tag_color), None, Some(tag_rect));
|
||||
|
||||
// Draw the dimensions onto the tag.
|
||||
let dim = texture.get_dimensions();
|
||||
|
@ -4570,10 +4540,7 @@ impl Renderer {
|
|||
// we're blitting from a texture to the main framebuffer, which
|
||||
// use different conventions.
|
||||
let dest_rect = rect(x, y + tag_height, size, size);
|
||||
device.blit_render_target_invert_y(
|
||||
src_rect,
|
||||
FramebufferIntRect::from_untyped(&dest_rect),
|
||||
);
|
||||
device.blit_render_target_invert_y(src_rect, dest_rect);
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
|
@ -4616,7 +4583,7 @@ impl Renderer {
|
|||
);
|
||||
}
|
||||
|
||||
fn draw_gpu_cache_debug(&mut self, framebuffer_size: FramebufferIntSize) {
|
||||
fn draw_gpu_cache_debug(&mut self, framebuffer_size: DeviceIntSize) {
|
||||
if !self.debug_flags.contains(DebugFlags::GPU_CACHE_DBG) {
|
||||
return;
|
||||
}
|
||||
|
@ -4654,24 +4621,24 @@ impl Renderer {
|
|||
}
|
||||
|
||||
/// Pass-through to `Device::read_pixels_into`, used by Gecko's WR bindings.
|
||||
pub fn read_pixels_into(&mut self, rect: FramebufferIntRect, format: ReadPixelsFormat, output: &mut [u8]) {
|
||||
pub fn read_pixels_into(&mut self, rect: DeviceIntRect, format: ReadPixelsFormat, output: &mut [u8]) {
|
||||
self.device.read_pixels_into(rect, format, output);
|
||||
}
|
||||
|
||||
pub fn read_pixels_rgba8(&mut self, rect: FramebufferIntRect) -> Vec<u8> {
|
||||
pub fn read_pixels_rgba8(&mut self, rect: DeviceIntRect) -> Vec<u8> {
|
||||
let mut pixels = vec![0; (rect.size.width * rect.size.height * 4) as usize];
|
||||
self.device.read_pixels_into(rect, ReadPixelsFormat::Rgba8, &mut pixels);
|
||||
pixels
|
||||
}
|
||||
|
||||
pub fn read_gpu_cache(&mut self) -> (FramebufferIntSize, Vec<u8>) {
|
||||
pub fn read_gpu_cache(&mut self) -> (DeviceIntSize, Vec<u8>) {
|
||||
let texture = self.gpu_cache_texture.texture.as_ref().unwrap();
|
||||
let size = FramebufferIntSize::from_untyped(&texture.get_dimensions().to_untyped());
|
||||
let size = texture.get_dimensions();
|
||||
let mut texels = vec![0; (size.width * size.height * 16) as usize];
|
||||
self.device.begin_frame();
|
||||
self.device.bind_read_target(ReadTarget::Texture { texture, layer: 0 });
|
||||
self.device.read_pixels_into(
|
||||
size.into(),
|
||||
DeviceIntRect::new(DeviceIntPoint::zero(), size),
|
||||
ReadPixelsFormat::Standard(ImageFormat::RGBAF32),
|
||||
&mut texels,
|
||||
);
|
||||
|
@ -4863,7 +4830,7 @@ pub trait ExternalImageHandler {
|
|||
/// call succeeds, when WR has issued the GL commands to copy the output
|
||||
/// to the texture handle.
|
||||
pub trait OutputImageHandler {
|
||||
fn lock(&mut self, pipeline_id: PipelineId) -> Option<(u32, FramebufferIntSize)>;
|
||||
fn lock(&mut self, pipeline_id: PipelineId) -> Option<(u32, DeviceIntSize)>;
|
||||
fn unlock(&mut self, pipeline_id: PipelineId);
|
||||
}
|
||||
|
||||
|
@ -5064,7 +5031,6 @@ struct PlainTexture {
|
|||
#[cfg_attr(feature = "capture", derive(Serialize))]
|
||||
#[cfg_attr(feature = "replay", derive(Deserialize))]
|
||||
struct PlainRenderer {
|
||||
framebuffer_size: Option<FramebufferIntSize>,
|
||||
gpu_cache: PlainTexture,
|
||||
gpu_cache_frame_id: FrameId,
|
||||
textures: FastHashMap<CacheTextureId, PlainTexture>,
|
||||
|
@ -5099,7 +5065,7 @@ impl ExternalImageHandler for DummyExternalImageHandler {
|
|||
|
||||
#[cfg(feature = "replay")]
|
||||
impl OutputImageHandler for () {
|
||||
fn lock(&mut self, _: PipelineId) -> Option<(u32, FramebufferIntSize)> {
|
||||
fn lock(&mut self, _: PipelineId) -> Option<(u32, DeviceIntSize)> {
|
||||
None
|
||||
}
|
||||
fn unlock(&mut self, _: PipelineId) {
|
||||
|
@ -5125,26 +5091,27 @@ impl Renderer {
|
|||
|
||||
let bytes_per_pixel = texture.get_format().bytes_per_pixel();
|
||||
let read_format = ReadPixelsFormat::Standard(texture.get_format());
|
||||
let rect_size = texture.get_dimensions();
|
||||
let rect = DeviceIntRect::new(
|
||||
DeviceIntPoint::zero(),
|
||||
texture.get_dimensions(),
|
||||
);
|
||||
|
||||
let mut file = fs::File::create(root.join(&short_path))
|
||||
.expect(&format!("Unable to create {}", short_path));
|
||||
let bytes_per_layer = (rect_size.width * rect_size.height * bytes_per_pixel) as usize;
|
||||
let bytes_per_layer = (rect.size.width * rect.size.height * bytes_per_pixel) as usize;
|
||||
let mut data = vec![0; bytes_per_layer];
|
||||
|
||||
//TODO: instead of reading from an FBO with `read_pixels*`, we could
|
||||
// read from textures directly with `get_tex_image*`.
|
||||
|
||||
for layer_id in 0 .. texture.get_layer_count() {
|
||||
let rect = FramebufferIntSize::from_untyped(&rect_size.to_untyped()).into();
|
||||
|
||||
device.attach_read_texture(texture, layer_id);
|
||||
#[cfg(feature = "png")]
|
||||
{
|
||||
let mut png_data;
|
||||
let (data_ref, format) = match texture.get_format() {
|
||||
ImageFormat::RGBAF32 => {
|
||||
png_data = vec![0; (rect_size.width * rect_size.height * 4) as usize];
|
||||
png_data = vec![0; (rect.size.width * rect.size.height * 4) as usize];
|
||||
device.read_pixels_into(rect, ReadPixelsFormat::Rgba8, &mut png_data);
|
||||
(&png_data, ReadPixelsFormat::Rgba8)
|
||||
}
|
||||
|
@ -5152,7 +5119,7 @@ impl Renderer {
|
|||
};
|
||||
CaptureConfig::save_png(
|
||||
root.join(format!("textures/{}-{}.png", name, layer_id)),
|
||||
rect_size, format,
|
||||
rect.size, format,
|
||||
data_ref,
|
||||
);
|
||||
}
|
||||
|
@ -5163,7 +5130,7 @@ impl Renderer {
|
|||
|
||||
PlainTexture {
|
||||
data: short_path,
|
||||
size: (rect_size, texture.get_layer_count()),
|
||||
size: (rect.size, texture.get_layer_count()),
|
||||
format: texture.get_format(),
|
||||
filter: texture.get_filter(),
|
||||
}
|
||||
|
@ -5299,7 +5266,6 @@ impl Renderer {
|
|||
info!("saving GPU cache");
|
||||
self.update_gpu_cache(); // flush pending updates
|
||||
let mut plain_self = PlainRenderer {
|
||||
framebuffer_size: self.framebuffer_size,
|
||||
gpu_cache: Self::save_texture(
|
||||
&self.gpu_cache_texture.texture.as_ref().unwrap(),
|
||||
"gpu", &config.root, &mut self.device,
|
||||
|
@ -5362,7 +5328,6 @@ impl Renderer {
|
|||
|
||||
if let Some(renderer) = CaptureConfig::deserialize::<PlainRenderer, _>(&root, "renderer") {
|
||||
info!("loading cached textures");
|
||||
self.framebuffer_size = renderer.framebuffer_size;
|
||||
self.device.begin_frame();
|
||||
|
||||
for (_id, texture) in self.texture_resolver.texture_cache_map.drain() {
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use api::{ColorF, BorderStyle, MixBlendMode, PipelineId};
|
||||
use api::{DocumentLayer, FilterData, FilterOp, ImageFormat};
|
||||
use api::units::*;
|
||||
use api::{ColorF, BorderStyle, DeviceIntPoint, DeviceIntRect, DeviceIntSize, DevicePixelScale};
|
||||
use api::{DocumentLayer, FilterOp, FilterData, ImageFormat, DevicePoint};
|
||||
use api::{MixBlendMode, PipelineId, DeviceRect, LayoutSize, WorldRect};
|
||||
use batch::{AlphaBatchBuilder, AlphaBatchContainer, ClipBatcher, resolve_image};
|
||||
use clip::ClipStore;
|
||||
use clip_scroll_tree::{ClipScrollTree};
|
||||
|
@ -1132,10 +1132,9 @@ impl CompositeOps {
|
|||
#[cfg_attr(feature = "capture", derive(Serialize))]
|
||||
#[cfg_attr(feature = "replay", derive(Deserialize))]
|
||||
pub struct Frame {
|
||||
/// The origin on content produced by the render tasks.
|
||||
pub content_origin: DeviceIntPoint,
|
||||
/// The rectangle to show the frame in, on screen.
|
||||
pub framebuffer_rect: FramebufferIntRect,
|
||||
//TODO: share the fields with DocumentView struct
|
||||
pub window_size: DeviceIntSize,
|
||||
pub inner_rect: DeviceIntRect,
|
||||
pub background_color: Option<ColorF>,
|
||||
pub layer: DocumentLayer,
|
||||
pub passes: Vec<RenderPass>,
|
||||
|
|
|
@ -199,26 +199,21 @@ impl Transaction {
|
|||
self.notifications.push(event);
|
||||
}
|
||||
|
||||
/// Setup the output region in the framebuffer for a given document.
|
||||
pub fn set_document_view(
|
||||
pub fn set_window_parameters(
|
||||
&mut self,
|
||||
framebuffer_rect: FramebufferIntRect,
|
||||
window_size: DeviceIntSize,
|
||||
inner_rect: DeviceIntRect,
|
||||
device_pixel_ratio: f32,
|
||||
) {
|
||||
self.scene_ops.push(
|
||||
SceneMsg::SetDocumentView {
|
||||
framebuffer_rect,
|
||||
SceneMsg::SetWindowParameters {
|
||||
window_size,
|
||||
inner_rect,
|
||||
device_pixel_ratio,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// Enable copying of the output of this pipeline id to
|
||||
/// an external texture for callers to consume.
|
||||
pub fn enable_frame_output(&mut self, pipeline_id: PipelineId, enable: bool) {
|
||||
self.scene_ops.push(SceneMsg::EnableFrameOutput(pipeline_id, enable));
|
||||
}
|
||||
|
||||
/// Scrolls the scrolling layer under the `cursor`
|
||||
///
|
||||
/// WebRender looks for the layer closest to the user
|
||||
|
@ -283,6 +278,12 @@ impl Transaction {
|
|||
self.frame_ops.push(FrameMsg::AppendDynamicProperties(properties));
|
||||
}
|
||||
|
||||
/// Enable copying of the output of this pipeline id to
|
||||
/// an external texture for callers to consume.
|
||||
pub fn enable_frame_output(&mut self, pipeline_id: PipelineId, enable: bool) {
|
||||
self.frame_ops.push(FrameMsg::EnableFrameOutput(pipeline_id, enable));
|
||||
}
|
||||
|
||||
/// Consumes this object and just returns the frame ops.
|
||||
pub fn get_frame_ops(self) -> Vec<FrameMsg> {
|
||||
self.frame_ops
|
||||
|
@ -584,7 +585,6 @@ pub enum SceneMsg {
|
|||
SetPageZoom(ZoomFactor),
|
||||
SetRootPipeline(PipelineId),
|
||||
RemovePipeline(PipelineId),
|
||||
EnableFrameOutput(PipelineId, bool),
|
||||
SetDisplayList {
|
||||
list_descriptor: BuiltDisplayListDescriptor,
|
||||
epoch: Epoch,
|
||||
|
@ -594,8 +594,9 @@ pub enum SceneMsg {
|
|||
content_size: LayoutSize,
|
||||
preserve_frame_state: bool,
|
||||
},
|
||||
SetDocumentView {
|
||||
framebuffer_rect: FramebufferIntRect,
|
||||
SetWindowParameters {
|
||||
window_size: DeviceIntSize,
|
||||
inner_rect: DeviceIntRect,
|
||||
device_pixel_ratio: f32,
|
||||
},
|
||||
}
|
||||
|
@ -606,6 +607,7 @@ pub enum FrameMsg {
|
|||
UpdateEpoch(PipelineId, Epoch),
|
||||
HitTest(Option<PipelineId>, WorldPoint, HitTestFlags, MsgSender<HitTestResult>),
|
||||
SetPan(DeviceIntPoint),
|
||||
EnableFrameOutput(PipelineId, bool),
|
||||
Scroll(ScrollLocation, WorldPoint),
|
||||
ScrollNodeWithId(LayoutPoint, di::ExternalScrollId, ScrollClamping),
|
||||
GetScrollNodeState(MsgSender<Vec<ScrollNodeState>>),
|
||||
|
@ -621,8 +623,7 @@ impl fmt::Debug for SceneMsg {
|
|||
SceneMsg::SetDisplayList { .. } => "SceneMsg::SetDisplayList",
|
||||
SceneMsg::SetPageZoom(..) => "SceneMsg::SetPageZoom",
|
||||
SceneMsg::RemovePipeline(..) => "SceneMsg::RemovePipeline",
|
||||
SceneMsg::EnableFrameOutput(..) => "SceneMsg::EnableFrameOutput",
|
||||
SceneMsg::SetDocumentView { .. } => "SceneMsg::SetDocumentView",
|
||||
SceneMsg::SetWindowParameters { .. } => "SceneMsg::SetWindowParameters",
|
||||
SceneMsg::SetRootPipeline(..) => "SceneMsg::SetRootPipeline",
|
||||
})
|
||||
}
|
||||
|
@ -637,6 +638,7 @@ impl fmt::Debug for FrameMsg {
|
|||
FrameMsg::Scroll(..) => "FrameMsg::Scroll",
|
||||
FrameMsg::ScrollNodeWithId(..) => "FrameMsg::ScrollNodeWithId",
|
||||
FrameMsg::GetScrollNodeState(..) => "FrameMsg::GetScrollNodeState",
|
||||
FrameMsg::EnableFrameOutput(..) => "FrameMsg::EnableFrameOutput",
|
||||
FrameMsg::UpdateDynamicProperties(..) => "FrameMsg::UpdateDynamicProperties",
|
||||
FrameMsg::AppendDynamicProperties(..) => "FrameMsg::AppendDynamicProperties",
|
||||
FrameMsg::SetPinchZoom(..) => "FrameMsg::SetPinchZoom",
|
||||
|
@ -673,6 +675,7 @@ bitflags!{
|
|||
pub struct CapturedDocument {
|
||||
pub document_id: DocumentId,
|
||||
pub root_pipeline_id: Option<PipelineId>,
|
||||
pub window_size: DeviceIntSize,
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize, Serialize)]
|
||||
|
@ -724,7 +727,7 @@ pub enum ApiMsg {
|
|||
/// Adds a new document namespace.
|
||||
CloneApiByClient(IdNamespace),
|
||||
/// Adds a new document with given initial size.
|
||||
AddDocument(DocumentId, FramebufferIntSize, DocumentLayer),
|
||||
AddDocument(DocumentId, DeviceIntSize, DocumentLayer),
|
||||
/// A message targeted at a particular document.
|
||||
UpdateDocument(DocumentId, TransactionMsg),
|
||||
/// Deletes an existing document.
|
||||
|
@ -1043,7 +1046,7 @@ impl RenderApi {
|
|||
RenderApiSender::new(self.api_sender.clone(), self.payload_sender.clone())
|
||||
}
|
||||
|
||||
pub fn add_document(&self, initial_size: FramebufferIntSize, layer: DocumentLayer) -> DocumentId {
|
||||
pub fn add_document(&self, initial_size: DeviceIntSize, layer: DocumentLayer) -> DocumentId {
|
||||
let new_id = self.next_unique_id();
|
||||
let document_id = DocumentId(self.namespace_id, new_id);
|
||||
|
||||
|
@ -1221,35 +1224,19 @@ impl RenderApi {
|
|||
rx.recv().unwrap()
|
||||
}
|
||||
|
||||
/// Setup the output region in the framebuffer for a given document.
|
||||
pub fn set_document_view(
|
||||
pub fn set_window_parameters(
|
||||
&self,
|
||||
document_id: DocumentId,
|
||||
framebuffer_rect: FramebufferIntRect,
|
||||
window_size: DeviceIntSize,
|
||||
inner_rect: DeviceIntRect,
|
||||
device_pixel_ratio: f32,
|
||||
) {
|
||||
self.send_scene_msg(
|
||||
document_id,
|
||||
SceneMsg::SetDocumentView { framebuffer_rect, device_pixel_ratio },
|
||||
SceneMsg::SetWindowParameters { window_size, inner_rect, device_pixel_ratio, },
|
||||
);
|
||||
}
|
||||
|
||||
/// Setup the output region in the framebuffer for a given document.
|
||||
/// Enable copying of the output of this pipeline id to
|
||||
/// an external texture for callers to consume.
|
||||
pub fn enable_frame_output(
|
||||
&self,
|
||||
document_id: DocumentId,
|
||||
pipeline_id: PipelineId,
|
||||
enable: bool,
|
||||
) {
|
||||
self.send_scene_msg(
|
||||
document_id,
|
||||
SceneMsg::EnableFrameOutput(pipeline_id, enable),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
pub fn get_scroll_node_state(&self, document_id: DocumentId) -> Vec<ScrollNodeState> {
|
||||
let (tx, rx) = channel::msg_channel().unwrap();
|
||||
self.send_frame_msg(document_id, FrameMsg::GetScrollNodeState(tx));
|
||||
|
|
|
@ -48,7 +48,7 @@ mod display_list;
|
|||
mod font;
|
||||
mod gradient_builder;
|
||||
mod image;
|
||||
pub mod units;
|
||||
mod units;
|
||||
|
||||
pub use api::*;
|
||||
pub use color::*;
|
||||
|
@ -57,5 +57,4 @@ pub use display_list::*;
|
|||
pub use font::*;
|
||||
pub use gradient_builder::*;
|
||||
pub use image::*;
|
||||
//TODO: stop re-exporting this
|
||||
pub use units::*;
|
||||
|
|
|
@ -36,15 +36,6 @@ pub type DeviceVector2D = TypedVector2D<f32, DevicePixel>;
|
|||
pub type DeviceSize = TypedSize2D<f32, DevicePixel>;
|
||||
pub type DeviceHomogeneousVector = HomogeneousVector<f32, DevicePixel>;
|
||||
|
||||
/// Geometry in the coordinate system of the framebuffer in physical pixels.
|
||||
/// It's Y-flipped comparing to DevicePixel.
|
||||
#[derive(Hash, Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Serialize, Deserialize)]
|
||||
pub struct FramebufferPixel;
|
||||
|
||||
pub type FramebufferIntPoint = TypedPoint2D<i32, FramebufferPixel>;
|
||||
pub type FramebufferIntSize = TypedSize2D<i32, FramebufferPixel>;
|
||||
pub type FramebufferIntRect = TypedRect<i32, FramebufferPixel>;
|
||||
|
||||
/// Geometry in the coordinate system of a Picture (intermediate
|
||||
/// surface) in physical pixels.
|
||||
#[derive(Hash, Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd)]
|
||||
|
|
|
@ -179,18 +179,18 @@ impl WindowWrapper {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_inner_size(&self) -> FramebufferIntSize {
|
||||
fn inner_size(window: &winit::Window) -> FramebufferIntSize {
|
||||
fn get_inner_size(&self) -> DeviceIntSize {
|
||||
fn inner_size(window: &winit::Window) -> DeviceIntSize {
|
||||
let size = window
|
||||
.get_inner_size()
|
||||
.unwrap()
|
||||
.to_physical(window.get_hidpi_factor());
|
||||
FramebufferIntSize::new(size.width as i32, size.height as i32)
|
||||
DeviceIntSize::new(size.width as i32, size.height as i32)
|
||||
}
|
||||
match *self {
|
||||
WindowWrapper::Window(ref window, _) => inner_size(window.window()),
|
||||
WindowWrapper::Angle(ref window, ..) => inner_size(window),
|
||||
WindowWrapper::Headless(ref context, _) => FramebufferIntSize::new(context.width, context.height),
|
||||
WindowWrapper::Headless(ref context, _) => DeviceIntSize::new(context.width, context.height),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@ impl WindowWrapper {
|
|||
}
|
||||
}
|
||||
|
||||
fn resize(&mut self, size: FramebufferIntSize) {
|
||||
fn resize(&mut self, size: DeviceIntSize) {
|
||||
match *self {
|
||||
WindowWrapper::Window(ref mut window, _) => {
|
||||
window.set_inner_size(LogicalSize::new(size.width as f64, size.height as f64))
|
||||
|
@ -240,7 +240,7 @@ impl WindowWrapper {
|
|||
}
|
||||
|
||||
fn make_window(
|
||||
size: FramebufferIntSize,
|
||||
size: DeviceIntSize,
|
||||
dp_ratio: Option<f32>,
|
||||
vsync: bool,
|
||||
events_loop: &Option<winit::EventsLoop>,
|
||||
|
@ -411,20 +411,20 @@ fn main() {
|
|||
});
|
||||
let size = args.value_of("size")
|
||||
.map(|s| if s == "720p" {
|
||||
FramebufferIntSize::new(1280, 720)
|
||||
DeviceIntSize::new(1280, 720)
|
||||
} else if s == "1080p" {
|
||||
FramebufferIntSize::new(1920, 1080)
|
||||
DeviceIntSize::new(1920, 1080)
|
||||
} else if s == "4k" {
|
||||
FramebufferIntSize::new(3840, 2160)
|
||||
DeviceIntSize::new(3840, 2160)
|
||||
} else {
|
||||
let x = s.find('x').expect(
|
||||
"Size must be specified exactly as 720p, 1080p, 4k, or width x height",
|
||||
);
|
||||
let w = s[0 .. x].parse::<i32>().expect("Invalid size width");
|
||||
let h = s[x + 1 ..].parse::<i32>().expect("Invalid size height");
|
||||
FramebufferIntSize::new(w, h)
|
||||
DeviceIntSize::new(w, h)
|
||||
})
|
||||
.unwrap_or(FramebufferIntSize::new(1920, 1080));
|
||||
.unwrap_or(DeviceIntSize::new(1920, 1080));
|
||||
let zoom_factor = args.value_of("zoom").map(|z| z.parse::<f32>().unwrap());
|
||||
let chase_primitive = match args.value_of("chase") {
|
||||
Some(s) => {
|
||||
|
@ -528,7 +528,7 @@ fn main() {
|
|||
fn render<'a>(
|
||||
wrench: &mut Wrench,
|
||||
window: &mut WindowWrapper,
|
||||
size: FramebufferIntSize,
|
||||
size: DeviceIntSize,
|
||||
events_loop: &mut Option<winit::EventsLoop>,
|
||||
subargs: &clap::ArgMatches<'a>,
|
||||
) {
|
||||
|
@ -540,9 +540,7 @@ fn render<'a>(
|
|||
let mut documents = wrench.api.load_capture(input_path);
|
||||
println!("loaded {:?}", documents.iter().map(|cd| cd.document_id).collect::<Vec<_>>());
|
||||
let captured = documents.swap_remove(0);
|
||||
if let Some(fb_size) = wrench.renderer.framebuffer_size() {
|
||||
window.resize(fb_size);
|
||||
}
|
||||
window.resize(captured.window_size);
|
||||
wrench.document_id = captured.document_id;
|
||||
Box::new(captured) as Box<WrenchThing>
|
||||
} else {
|
||||
|
@ -770,7 +768,8 @@ fn render<'a>(
|
|||
match *events_loop {
|
||||
None => {
|
||||
while body(wrench, vec![winit::Event::Awakened]) == winit::ControlFlow::Continue {}
|
||||
let pixels = wrench.renderer.read_pixels_rgba8(size.into());
|
||||
let rect = DeviceIntRect::new(DeviceIntPoint::zero(), size);
|
||||
let pixels = wrench.renderer.read_pixels_rgba8(rect);
|
||||
save_flipped("screenshot.png", pixels, size);
|
||||
}
|
||||
Some(ref mut events_loop) => {
|
||||
|
|
|
@ -25,7 +25,7 @@ pub struct SaveSettings {
|
|||
pub fn save<P: Clone + AsRef<Path>>(
|
||||
path: P,
|
||||
orig_pixels: Vec<u8>,
|
||||
size: FramebufferIntSize,
|
||||
size: DeviceIntSize,
|
||||
settings: SaveSettings
|
||||
) {
|
||||
let mut width = size.width as u32;
|
||||
|
@ -66,7 +66,7 @@ pub fn save<P: Clone + AsRef<Path>>(
|
|||
pub fn save_flipped<P: Clone + AsRef<Path>>(
|
||||
path: P,
|
||||
orig_pixels: Vec<u8>,
|
||||
size: FramebufferIntSize,
|
||||
size: DeviceIntSize,
|
||||
) {
|
||||
save(path, orig_pixels, size, SaveSettings {
|
||||
flip_vertical: true,
|
||||
|
@ -87,12 +87,13 @@ pub fn png(
|
|||
rx.recv().unwrap();
|
||||
wrench.render();
|
||||
|
||||
let (fb_size, data, settings) = match surface {
|
||||
let (device_size, data, settings) = match surface {
|
||||
ReadSurface::Screen => {
|
||||
let dim = window.get_inner_size();
|
||||
let rect = DeviceIntRect::new(DeviceIntPoint::zero(), dim);
|
||||
let data = wrench.renderer
|
||||
.read_pixels_rgba8(dim.into());
|
||||
(dim, data, SaveSettings {
|
||||
.read_pixels_rgba8(rect);
|
||||
(rect.size, data, SaveSettings {
|
||||
flip_vertical: true,
|
||||
try_crop: true,
|
||||
})
|
||||
|
@ -110,5 +111,5 @@ pub fn png(
|
|||
let mut out_path = reader.yaml_path().clone();
|
||||
out_path.set_extension("png");
|
||||
|
||||
save(out_path, data, fb_size, settings);
|
||||
save(out_path, data, device_size, settings);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use {WindowWrapper, NotifierEvent};
|
||||
use blob;
|
||||
use euclid::{point2, size2, rect};
|
||||
use euclid::{TypedRect, TypedSize2D, TypedPoint2D, point2, size2};
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicIsize, Ordering};
|
||||
use std::sync::mpsc::Receiver;
|
||||
|
@ -17,6 +17,17 @@ pub struct RawtestHarness<'a> {
|
|||
window: &'a mut WindowWrapper,
|
||||
}
|
||||
|
||||
fn point<T: Copy, U>(x: T, y: T) -> TypedPoint2D<T, U> {
|
||||
TypedPoint2D::new(x, y)
|
||||
}
|
||||
|
||||
fn size<T: Copy, U>(x: T, y: T) -> TypedSize2D<T, U> {
|
||||
TypedSize2D::new(x, y)
|
||||
}
|
||||
|
||||
fn rect<T: Copy, U>(x: T, y: T, width: T, height: T) -> TypedRect<T, U> {
|
||||
TypedRect::new(point(x, y), size(width, height))
|
||||
}
|
||||
|
||||
impl<'a> RawtestHarness<'a> {
|
||||
pub fn new(wrench: &'a mut Wrench,
|
||||
|
@ -45,7 +56,7 @@ impl<'a> RawtestHarness<'a> {
|
|||
self.test_zero_height_window();
|
||||
}
|
||||
|
||||
fn render_and_get_pixels(&mut self, window_rect: FramebufferIntRect) -> Vec<u8> {
|
||||
fn render_and_get_pixels(&mut self, window_rect: DeviceIntRect) -> Vec<u8> {
|
||||
self.rx.recv().unwrap();
|
||||
self.wrench.render();
|
||||
self.wrench.renderer.read_pixels_rgba8(window_rect)
|
||||
|
@ -102,8 +113,8 @@ impl<'a> RawtestHarness<'a> {
|
|||
builder.push_image(
|
||||
&info,
|
||||
&SpaceAndClipInfo::root_scroll(self.wrench.root_pipeline_id),
|
||||
size2(64.0, 64.0),
|
||||
size2(64.0, 64.0),
|
||||
size(64.0, 64.0),
|
||||
size(64.0, 64.0),
|
||||
ImageRendering::Auto,
|
||||
AlphaType::PremultipliedAlpha,
|
||||
img,
|
||||
|
@ -131,8 +142,8 @@ impl<'a> RawtestHarness<'a> {
|
|||
builder.push_image(
|
||||
&info,
|
||||
&SpaceAndClipInfo::root_scroll(self.wrench.root_pipeline_id),
|
||||
size2(1024.0, 1024.0),
|
||||
size2(1024.0, 1024.0),
|
||||
size(1024.0, 1024.0),
|
||||
size(1024.0, 1024.0),
|
||||
ImageRendering::Auto,
|
||||
AlphaType::PremultipliedAlpha,
|
||||
img,
|
||||
|
@ -157,8 +168,8 @@ impl<'a> RawtestHarness<'a> {
|
|||
builder.push_image(
|
||||
&info,
|
||||
&SpaceAndClipInfo::root_scroll(self.wrench.root_pipeline_id),
|
||||
size2(1024.0, 1024.0),
|
||||
size2(1024.0, 1024.0),
|
||||
size(1024.0, 1024.0),
|
||||
size(1024.0, 1024.0),
|
||||
ImageRendering::Auto,
|
||||
AlphaType::PremultipliedAlpha,
|
||||
img,
|
||||
|
@ -196,8 +207,8 @@ impl<'a> RawtestHarness<'a> {
|
|||
builder.push_image(
|
||||
&info,
|
||||
&SpaceAndClipInfo::root_scroll(self.wrench.root_pipeline_id),
|
||||
size2(151., 56.0),
|
||||
size2(151.0, 56.0),
|
||||
size(151., 56.0),
|
||||
size(151.0, 56.0),
|
||||
ImageRendering::Auto,
|
||||
AlphaType::PremultipliedAlpha,
|
||||
blob_img.as_image(),
|
||||
|
@ -225,10 +236,10 @@ impl<'a> RawtestHarness<'a> {
|
|||
|
||||
let window_size = self.window.get_inner_size();
|
||||
|
||||
let test_size = FramebufferIntSize::new(800, 800);
|
||||
let test_size = DeviceIntSize::new(800, 800);
|
||||
|
||||
let window_rect = FramebufferIntRect::new(
|
||||
FramebufferIntPoint::new(0, window_size.height - test_size.height),
|
||||
let window_rect = DeviceIntRect::new(
|
||||
DeviceIntPoint::new(0, window_size.height - test_size.height),
|
||||
test_size,
|
||||
);
|
||||
|
||||
|
@ -255,7 +266,7 @@ impl<'a> RawtestHarness<'a> {
|
|||
|
||||
let info = LayoutPrimitiveInfo::new(rect(0., -9600.0, 1510.000031, 111256.));
|
||||
|
||||
let image_size = size2(1510., 111256.);
|
||||
let image_size = size(1510., 111256.);
|
||||
|
||||
let root_space_and_clip = SpaceAndClipInfo::root_scroll(self.wrench.root_pipeline_id);
|
||||
let clip_id = builder.define_clip(
|
||||
|
@ -344,13 +355,13 @@ impl<'a> RawtestHarness<'a> {
|
|||
assert_eq!(self.wrench.device_pixel_ratio, 1.);
|
||||
|
||||
let window_size = self.window.get_inner_size();
|
||||
let test_size = FramebufferIntSize::new(800, 800);
|
||||
let window_rect = FramebufferIntRect::new(
|
||||
point2(0, window_size.height - test_size.height),
|
||||
let test_size = DeviceIntSize::new(800, 800);
|
||||
let window_rect = DeviceIntRect::new(
|
||||
DeviceIntPoint::new(0, window_size.height - test_size.height),
|
||||
test_size,
|
||||
);
|
||||
let layout_size = LayoutSize::new(800.0, 800.0);
|
||||
let image_size = size2(800.0, 800.0);
|
||||
let image_size = size(800.0, 800.0);
|
||||
let info = LayoutPrimitiveInfo::new(rect(0.0, 0.0, 800.0, 800.0));
|
||||
let space_and_clip = SpaceAndClipInfo::root_scroll(self.wrench.root_pipeline_id);
|
||||
|
||||
|
@ -437,9 +448,10 @@ impl<'a> RawtestHarness<'a> {
|
|||
|
||||
let window_size = self.window.get_inner_size();
|
||||
|
||||
let test_size = FramebufferIntSize::new(800, 800);
|
||||
let window_rect = FramebufferIntRect::new(
|
||||
point2(0, window_size.height - test_size.height),
|
||||
let test_size = DeviceIntSize::new(800, 800);
|
||||
|
||||
let window_rect = DeviceIntRect::new(
|
||||
DeviceIntPoint::new(0, window_size.height - test_size.height),
|
||||
test_size,
|
||||
);
|
||||
let space_and_clip = SpaceAndClipInfo::root_scroll(self.wrench.root_pipeline_id);
|
||||
|
@ -460,7 +472,7 @@ impl<'a> RawtestHarness<'a> {
|
|||
|
||||
let info = LayoutPrimitiveInfo::new(rect(0., 0.0, 1510., 1510.));
|
||||
|
||||
let image_size = size2(1510., 1510.);
|
||||
let image_size = size(1510., 1510.);
|
||||
|
||||
// setup some malicious image size parameters
|
||||
builder.push_image(
|
||||
|
@ -486,7 +498,7 @@ impl<'a> RawtestHarness<'a> {
|
|||
|
||||
let info = LayoutPrimitiveInfo::new(rect(-10000., 0.0, 1510., 1510.));
|
||||
|
||||
let image_size = size2(1510., 1510.);
|
||||
let image_size = size(1510., 1510.);
|
||||
|
||||
// setup some malicious image size parameters
|
||||
builder.push_image(
|
||||
|
@ -517,7 +529,7 @@ impl<'a> RawtestHarness<'a> {
|
|||
|
||||
let info = LayoutPrimitiveInfo::new(rect(0., 0.0, 1510., 1510.));
|
||||
|
||||
let image_size = size2(1510., 1510.);
|
||||
let image_size = size(1510., 1510.);
|
||||
|
||||
// setup some malicious image size parameters
|
||||
builder.push_image(
|
||||
|
@ -551,9 +563,10 @@ impl<'a> RawtestHarness<'a> {
|
|||
let blob_img;
|
||||
let window_size = self.window.get_inner_size();
|
||||
|
||||
let test_size = FramebufferIntSize::new(400, 400);
|
||||
let window_rect = FramebufferIntRect::new(
|
||||
FramebufferIntPoint::new(0, window_size.height - test_size.height),
|
||||
let test_size = DeviceIntSize::new(400, 400);
|
||||
|
||||
let window_rect = DeviceIntRect::new(
|
||||
DeviceIntPoint::new(0, window_size.height - test_size.height),
|
||||
test_size,
|
||||
);
|
||||
let layout_size = LayoutSize::new(400., 400.);
|
||||
|
@ -586,8 +599,8 @@ impl<'a> RawtestHarness<'a> {
|
|||
builder.push_image(
|
||||
&info,
|
||||
&space_and_clip,
|
||||
size2(200.0, 200.0),
|
||||
size2(0.0, 0.0),
|
||||
size(200.0, 200.0),
|
||||
size(0.0, 0.0),
|
||||
ImageRendering::Auto,
|
||||
AlphaType::PremultipliedAlpha,
|
||||
blob_img.as_image(),
|
||||
|
@ -610,8 +623,8 @@ impl<'a> RawtestHarness<'a> {
|
|||
builder.push_image(
|
||||
&info,
|
||||
&space_and_clip,
|
||||
size2(200.0, 200.0),
|
||||
size2(0.0, 0.0),
|
||||
size(200.0, 200.0),
|
||||
size(0.0, 0.0),
|
||||
ImageRendering::Auto,
|
||||
AlphaType::PremultipliedAlpha,
|
||||
blob_img.as_image(),
|
||||
|
@ -642,9 +655,10 @@ impl<'a> RawtestHarness<'a> {
|
|||
let (blob_img, blob_img2);
|
||||
let window_size = self.window.get_inner_size();
|
||||
|
||||
let test_size = FramebufferIntSize::new(400, 400);
|
||||
let window_rect = FramebufferIntRect::new(
|
||||
point2(0, window_size.height - test_size.height),
|
||||
let test_size = DeviceIntSize::new(400, 400);
|
||||
|
||||
let window_rect = DeviceIntRect::new(
|
||||
point(0, window_size.height - test_size.height),
|
||||
test_size,
|
||||
);
|
||||
let layout_size = LayoutSize::new(400., 400.);
|
||||
|
@ -697,8 +711,8 @@ impl<'a> RawtestHarness<'a> {
|
|||
builder.push_image(
|
||||
&info,
|
||||
&space_and_clip,
|
||||
size2(200.0, 200.0),
|
||||
size2(0.0, 0.0),
|
||||
size(200.0, 200.0),
|
||||
size(0.0, 0.0),
|
||||
ImageRendering::Auto,
|
||||
AlphaType::PremultipliedAlpha,
|
||||
blob_img.as_image(),
|
||||
|
@ -707,8 +721,8 @@ impl<'a> RawtestHarness<'a> {
|
|||
builder.push_image(
|
||||
&info2,
|
||||
&space_and_clip,
|
||||
size2(200.0, 200.0),
|
||||
size2(0.0, 0.0),
|
||||
size(200.0, 200.0),
|
||||
size(0.0, 0.0),
|
||||
ImageRendering::Auto,
|
||||
AlphaType::PremultipliedAlpha,
|
||||
blob_img2.as_image(),
|
||||
|
@ -772,9 +786,10 @@ impl<'a> RawtestHarness<'a> {
|
|||
println!("\tblob update test...");
|
||||
let window_size = self.window.get_inner_size();
|
||||
|
||||
let test_size = FramebufferIntSize::new(400, 400);
|
||||
let window_rect = FramebufferIntRect::new(
|
||||
point2(0, window_size.height - test_size.height),
|
||||
let test_size = DeviceIntSize::new(400, 400);
|
||||
|
||||
let window_rect = DeviceIntRect::new(
|
||||
point(0, window_size.height - test_size.height),
|
||||
test_size,
|
||||
);
|
||||
let layout_size = LayoutSize::new(400., 400.);
|
||||
|
@ -799,8 +814,8 @@ impl<'a> RawtestHarness<'a> {
|
|||
builder.push_image(
|
||||
&info,
|
||||
&space_and_clip,
|
||||
size2(200.0, 200.0),
|
||||
size2(0.0, 0.0),
|
||||
size(200.0, 200.0),
|
||||
size(0.0, 0.0),
|
||||
ImageRendering::Auto,
|
||||
AlphaType::PremultipliedAlpha,
|
||||
blob_img.as_image(),
|
||||
|
@ -827,8 +842,8 @@ impl<'a> RawtestHarness<'a> {
|
|||
builder.push_image(
|
||||
&info,
|
||||
&space_and_clip,
|
||||
size2(200.0, 200.0),
|
||||
size2(0.0, 0.0),
|
||||
size(200.0, 200.0),
|
||||
size(0.0, 0.0),
|
||||
ImageRendering::Auto,
|
||||
AlphaType::PremultipliedAlpha,
|
||||
blob_img.as_image(),
|
||||
|
@ -853,8 +868,8 @@ impl<'a> RawtestHarness<'a> {
|
|||
builder.push_image(
|
||||
&info,
|
||||
&space_and_clip,
|
||||
size2(200.0, 200.0),
|
||||
size2(0.0, 0.0),
|
||||
size(200.0, 200.0),
|
||||
size(0.0, 0.0),
|
||||
ImageRendering::Auto,
|
||||
AlphaType::PremultipliedAlpha,
|
||||
blob_img.as_image(),
|
||||
|
@ -873,9 +888,10 @@ impl<'a> RawtestHarness<'a> {
|
|||
println!("\tsave/restore...");
|
||||
let window_size = self.window.get_inner_size();
|
||||
|
||||
let test_size = FramebufferIntSize::new(400, 400);
|
||||
let window_rect = FramebufferIntRect::new(
|
||||
point2(0, window_size.height - test_size.height),
|
||||
let test_size = DeviceIntSize::new(400, 400);
|
||||
|
||||
let window_rect = DeviceIntRect::new(
|
||||
DeviceIntPoint::new(0, window_size.height - test_size.height),
|
||||
test_size,
|
||||
);
|
||||
let layout_size = LayoutSize::new(400., 400.);
|
||||
|
@ -968,9 +984,10 @@ impl<'a> RawtestHarness<'a> {
|
|||
println!("\tblur cache...");
|
||||
let window_size = self.window.get_inner_size();
|
||||
|
||||
let test_size = FramebufferIntSize::new(400, 400);
|
||||
let window_rect = FramebufferIntRect::new(
|
||||
point2(0, window_size.height - test_size.height),
|
||||
let test_size = DeviceIntSize::new(400, 400);
|
||||
|
||||
let window_rect = DeviceIntRect::new(
|
||||
DeviceIntPoint::new(0, window_size.height - test_size.height),
|
||||
test_size,
|
||||
);
|
||||
let layout_size = LayoutSize::new(400., 400.);
|
||||
|
@ -1020,9 +1037,9 @@ impl<'a> RawtestHarness<'a> {
|
|||
let path = "../captures/test";
|
||||
let layout_size = LayoutSize::new(400., 400.);
|
||||
let dim = self.window.get_inner_size();
|
||||
let window_rect = FramebufferIntRect::new(
|
||||
point2(0, dim.height - layout_size.height as i32),
|
||||
size2(layout_size.width as i32, layout_size.height as i32),
|
||||
let window_rect = DeviceIntRect::new(
|
||||
point(0, dim.height - layout_size.height as i32),
|
||||
size(layout_size.width as i32, layout_size.height as i32),
|
||||
);
|
||||
|
||||
// 1. render some scene
|
||||
|
@ -1041,8 +1058,8 @@ impl<'a> RawtestHarness<'a> {
|
|||
builder.push_image(
|
||||
&LayoutPrimitiveInfo::new(rect(300.0, 70.0, 150.0, 50.0)),
|
||||
&SpaceAndClipInfo::root_scroll(self.wrench.root_pipeline_id),
|
||||
size2(150.0, 50.0),
|
||||
size2(0.0, 0.0),
|
||||
size(150.0, 50.0),
|
||||
size(0.0, 0.0),
|
||||
ImageRendering::Auto,
|
||||
AlphaType::PremultipliedAlpha,
|
||||
image,
|
||||
|
@ -1103,7 +1120,7 @@ impl<'a> RawtestHarness<'a> {
|
|||
println!("\tzero height test...");
|
||||
|
||||
let layout_size = LayoutSize::new(120.0, 0.0);
|
||||
let window_size = FramebufferIntSize::new(layout_size.width as i32, layout_size.height as i32);
|
||||
let window_size = DeviceIntSize::new(layout_size.width as i32, layout_size.height as i32);
|
||||
let doc_id = self.wrench.api.add_document(window_size, 1);
|
||||
|
||||
let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size);
|
||||
|
|
|
@ -121,7 +121,7 @@ impl Display for Reftest {
|
|||
|
||||
struct ReftestImage {
|
||||
data: Vec<u8>,
|
||||
size: FramebufferIntSize,
|
||||
size: DeviceIntSize,
|
||||
}
|
||||
enum ReftestImageComparison {
|
||||
Equal,
|
||||
|
@ -518,14 +518,14 @@ impl<'a> ReftestHarness<'a> {
|
|||
let size = img.dimensions();
|
||||
ReftestImage {
|
||||
data: img.into_raw(),
|
||||
size: FramebufferIntSize::new(size.0 as i32, size.1 as i32),
|
||||
size: DeviceIntSize::new(size.0 as i32, size.1 as i32),
|
||||
}
|
||||
}
|
||||
|
||||
fn render_yaml(
|
||||
&mut self,
|
||||
filename: &Path,
|
||||
size: FramebufferIntSize,
|
||||
size: DeviceIntSize,
|
||||
font_render_mode: Option<FontRenderMode>,
|
||||
allow_mipmaps: bool,
|
||||
) -> YamlRenderOutput {
|
||||
|
@ -548,10 +548,7 @@ impl<'a> ReftestHarness<'a> {
|
|||
);
|
||||
|
||||
// taking the bottom left sub-rectangle
|
||||
let rect = FramebufferIntRect::new(
|
||||
FramebufferIntPoint::new(0, window_size.height - size.height),
|
||||
size,
|
||||
);
|
||||
let rect = DeviceIntRect::new(DeviceIntPoint::new(0, window_size.height - size.height), size);
|
||||
let pixels = self.wrench.renderer.read_pixels_rgba8(rect);
|
||||
self.window.swap_buffers();
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ impl WrenchThing for CapturedDocument {
|
|||
}
|
||||
|
||||
pub struct Wrench {
|
||||
window_size: FramebufferIntSize,
|
||||
window_size: DeviceIntSize,
|
||||
pub device_pixel_ratio: f32,
|
||||
page_zoom_factor: ZoomFactor,
|
||||
|
||||
|
@ -171,7 +171,7 @@ impl Wrench {
|
|||
shader_override_path: Option<PathBuf>,
|
||||
dp_ratio: f32,
|
||||
save_type: Option<SaveType>,
|
||||
size: FramebufferIntSize,
|
||||
size: DeviceIntSize,
|
||||
do_rebuild: bool,
|
||||
no_subpixel_aa: bool,
|
||||
verbose: bool,
|
||||
|
@ -511,7 +511,7 @@ impl Wrench {
|
|||
self.api.update_resources(txn.resource_updates);
|
||||
}
|
||||
|
||||
pub fn update(&mut self, dim: FramebufferIntSize) {
|
||||
pub fn update(&mut self, dim: DeviceIntSize) {
|
||||
if dim != self.window_size {
|
||||
self.window_size = dim;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче