mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Upgrade WebRender to e491e1ae637b2eed1e7195855d88357e5eb3ddf9 (#30323)
* Upgrade vendored version of WebRender * Patch WebRender: upgrade version of gleam * Restore hit testing implementation * Fix WebRender warnings * Adapt Servo to new WebRender * Update results * Add a workaround for #30313 This slightly expands text boundaries in order to take into account the fact that layout isn't measuring glyph boundaries.
This commit is contained in:
parent
c079acb3c3
commit
a9d37cb85a
563 changed files with 48524 additions and 51657 deletions
8
third_party/webrender/examples/Cargo.toml
vendored
8
third_party/webrender/examples/Cargo.toml
vendored
|
@ -26,10 +26,6 @@ path = "blob.rs"
|
|||
name = "document"
|
||||
path = "document.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "frame_output"
|
||||
path = "frame_output.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "iframe"
|
||||
path = "iframe.rs"
|
||||
|
@ -55,13 +51,13 @@ name = "yuv"
|
|||
path = "yuv.rs"
|
||||
|
||||
[features]
|
||||
debug = ["webrender/capture", "webrender/debugger", "webrender/profiler"]
|
||||
debug = ["webrender/capture", "webrender/profiler"]
|
||||
|
||||
[dependencies]
|
||||
app_units = "0.7"
|
||||
env_logger = "0.5"
|
||||
euclid = "0.22"
|
||||
gleam = "0.12"
|
||||
gleam = "0.15"
|
||||
glutin = "0.21"
|
||||
rayon = "1"
|
||||
webrender = { path = "../webrender" }
|
||||
|
|
11
third_party/webrender/examples/alpha_perf.rs
vendored
11
third_party/webrender/examples/alpha_perf.rs
vendored
|
@ -2,11 +2,11 @@
|
|||
* 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 euclid;
|
||||
use gleam;
|
||||
use glutin;
|
||||
use webrender;
|
||||
use winit;
|
||||
extern crate euclid;
|
||||
extern crate gleam;
|
||||
extern crate glutin;
|
||||
extern crate webrender;
|
||||
extern crate winit;
|
||||
|
||||
#[path = "common/boilerplate.rs"]
|
||||
mod boilerplate;
|
||||
|
@ -14,6 +14,7 @@ mod boilerplate;
|
|||
use crate::boilerplate::{Example, HandyDandyRectBuilder};
|
||||
use std::cmp;
|
||||
use webrender::api::*;
|
||||
use webrender::render_api::*;
|
||||
use webrender::api::units::DeviceIntSize;
|
||||
|
||||
|
||||
|
|
18
third_party/webrender/examples/animation.rs
vendored
18
third_party/webrender/examples/animation.rs
vendored
|
@ -10,11 +10,11 @@
|
|||
//! rounded cornered rectangle, which is done automatically during the
|
||||
//! scene building for render optimization.
|
||||
|
||||
use euclid;
|
||||
use gleam;
|
||||
use glutin;
|
||||
use webrender;
|
||||
use winit;
|
||||
extern crate euclid;
|
||||
extern crate gleam;
|
||||
extern crate glutin;
|
||||
extern crate webrender;
|
||||
extern crate winit;
|
||||
|
||||
#[path = "common/boilerplate.rs"]
|
||||
mod boilerplate;
|
||||
|
@ -22,6 +22,7 @@ mod boilerplate;
|
|||
use crate::boilerplate::{Example, HandyDandyRectBuilder};
|
||||
use euclid::Angle;
|
||||
use webrender::api::*;
|
||||
use webrender::render_api::*;
|
||||
use webrender::api::units::*;
|
||||
|
||||
|
||||
|
@ -62,7 +63,10 @@ impl App {
|
|||
SpatialId::root_scroll_node(pipeline_id),
|
||||
TransformStyle::Flat,
|
||||
PropertyBinding::Binding(property_key, LayoutTransform::identity()),
|
||||
ReferenceFrameKind::Transform,
|
||||
ReferenceFrameKind::Transform {
|
||||
is_2d_scale_translation: false,
|
||||
should_snap: false,
|
||||
},
|
||||
);
|
||||
|
||||
builder.push_simple_stacking_context_with_filters(
|
||||
|
@ -194,7 +198,7 @@ impl Example for App {
|
|||
colors: vec![],
|
||||
},
|
||||
);
|
||||
txn.generate_frame();
|
||||
txn.generate_frame(0);
|
||||
api.send_transaction(document_id, txn);
|
||||
}
|
||||
_ => (),
|
||||
|
|
17
third_party/webrender/examples/basic.rs
vendored
17
third_party/webrender/examples/basic.rs
vendored
|
@ -2,11 +2,11 @@
|
|||
* 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 euclid;
|
||||
use gleam;
|
||||
use glutin;
|
||||
use webrender;
|
||||
use winit;
|
||||
extern crate euclid;
|
||||
extern crate gleam;
|
||||
extern crate glutin;
|
||||
extern crate webrender;
|
||||
extern crate winit;
|
||||
|
||||
#[path = "common/boilerplate.rs"]
|
||||
mod boilerplate;
|
||||
|
@ -17,6 +17,7 @@ use winit::TouchPhase;
|
|||
use std::collections::HashMap;
|
||||
use webrender::ShaderPrecacheFlags;
|
||||
use webrender::api::*;
|
||||
use webrender::render_api::*;
|
||||
use webrender::api::units::*;
|
||||
|
||||
|
||||
|
@ -190,7 +191,7 @@ impl Example for App {
|
|||
pipeline_id: PipelineId,
|
||||
_document_id: DocumentId,
|
||||
) {
|
||||
let content_bounds = LayoutRect::new(LayoutPoint::zero(), builder.content_size());
|
||||
let content_bounds = LayoutRect::new(LayoutPoint::zero(), LayoutSize::new(800.0, 600.0));
|
||||
let root_space_and_clip = SpaceAndClipInfo::root_scroll(pipeline_id);
|
||||
let spatial_id = root_space_and_clip.spatial_id;
|
||||
|
||||
|
@ -220,6 +221,8 @@ impl Example for App {
|
|||
let mask_clip_id = builder.define_clip_image_mask(
|
||||
&root_space_and_clip,
|
||||
mask,
|
||||
&vec![],
|
||||
FillRule::Nonzero,
|
||||
);
|
||||
let clip_id = builder.define_clip_rounded_rect(
|
||||
&SpaceAndClipInfo {
|
||||
|
@ -312,7 +315,7 @@ impl Example for App {
|
|||
}
|
||||
|
||||
if !txn.is_empty() {
|
||||
txn.generate_frame();
|
||||
txn.generate_frame(0);
|
||||
api.send_transaction(document_id, txn);
|
||||
}
|
||||
|
||||
|
|
13
third_party/webrender/examples/blob.rs
vendored
13
third_party/webrender/examples/blob.rs
vendored
|
@ -2,11 +2,11 @@
|
|||
* 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 gleam;
|
||||
use glutin;
|
||||
use rayon;
|
||||
use webrender;
|
||||
use winit;
|
||||
extern crate gleam;
|
||||
extern crate glutin;
|
||||
extern crate rayon;
|
||||
extern crate webrender;
|
||||
extern crate winit;
|
||||
|
||||
#[path = "common/boilerplate.rs"]
|
||||
mod boilerplate;
|
||||
|
@ -16,9 +16,10 @@ use rayon::{ThreadPool, ThreadPoolBuilder};
|
|||
use rayon::prelude::*;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use webrender::api::{self, DisplayListBuilder, DocumentId, PipelineId, PrimitiveFlags, RenderApi, Transaction};
|
||||
use webrender::api::{self, DisplayListBuilder, DocumentId, PipelineId, PrimitiveFlags};
|
||||
use webrender::api::{ColorF, CommonItemProperties, SpaceAndClipInfo, ImageDescriptorFlags};
|
||||
use webrender::api::units::*;
|
||||
use webrender::render_api::*;
|
||||
use webrender::euclid::size2;
|
||||
|
||||
// This example shows how to implement a very basic BlobImageHandler that can only render
|
||||
|
|
|
@ -10,6 +10,7 @@ use webrender;
|
|||
use winit;
|
||||
use webrender::{DebugFlags, ShaderPrecacheFlags};
|
||||
use webrender::api::*;
|
||||
use webrender::render_api::*;
|
||||
use webrender::api::units::*;
|
||||
|
||||
struct Notifier {
|
||||
|
@ -29,7 +30,7 @@ impl RenderNotifier for Notifier {
|
|||
})
|
||||
}
|
||||
|
||||
fn wake_up(&self) {
|
||||
fn wake_up(&self, _composite_needed: bool) {
|
||||
#[cfg(not(target_os = "android"))]
|
||||
let _ = self.events_proxy.wakeup();
|
||||
}
|
||||
|
@ -37,9 +38,9 @@ impl RenderNotifier for Notifier {
|
|||
fn new_frame_ready(&self,
|
||||
_: DocumentId,
|
||||
_scrolled: bool,
|
||||
_composite_needed: bool,
|
||||
composite_needed: bool,
|
||||
_render_time: Option<u64>) {
|
||||
self.wake_up();
|
||||
self.wake_up(composite_needed);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,12 +89,11 @@ pub trait Example {
|
|||
) -> bool {
|
||||
false
|
||||
}
|
||||
fn get_image_handlers(
|
||||
fn get_image_handler(
|
||||
&mut self,
|
||||
_gl: &dyn gl::Gl,
|
||||
) -> (Option<Box<dyn ExternalImageHandler>>,
|
||||
Option<Box<dyn OutputImageHandler>>) {
|
||||
(None, None)
|
||||
) -> Option<Box<dyn ExternalImageHandler>> {
|
||||
None
|
||||
}
|
||||
fn draw_custom(&mut self, _gl: &dyn gl::Gl) {
|
||||
}
|
||||
|
@ -183,16 +183,11 @@ pub fn main_wrapper<E: Example>(
|
|||
notifier,
|
||||
opts,
|
||||
None,
|
||||
device_size,
|
||||
).unwrap();
|
||||
let mut api = sender.create_api();
|
||||
let document_id = api.add_document(device_size, 0);
|
||||
let document_id = api.add_document(device_size);
|
||||
|
||||
let (external, output) = example.get_image_handlers(&*gl);
|
||||
|
||||
if let Some(output_image_handler) = output {
|
||||
renderer.set_output_image_handler(output_image_handler);
|
||||
}
|
||||
let external = example.get_image_handler(&*gl);
|
||||
|
||||
if let Some(external_image_handler) = external {
|
||||
renderer.set_external_image_handler(external_image_handler);
|
||||
|
@ -201,7 +196,7 @@ pub fn main_wrapper<E: Example>(
|
|||
let epoch = Epoch(0);
|
||||
let pipeline_id = PipelineId(0, 0);
|
||||
let layout_size = device_size.to_f32() / euclid::Scale::new(device_pixel_ratio);
|
||||
let mut builder = DisplayListBuilder::new(pipeline_id, layout_size);
|
||||
let mut builder = DisplayListBuilder::new(pipeline_id);
|
||||
let mut txn = Transaction::new();
|
||||
|
||||
example.render(
|
||||
|
@ -220,7 +215,7 @@ pub fn main_wrapper<E: Example>(
|
|||
true,
|
||||
);
|
||||
txn.set_root_pipeline(pipeline_id);
|
||||
txn.generate_frame();
|
||||
txn.generate_frame(0);
|
||||
api.send_transaction(document_id, txn);
|
||||
|
||||
println!("Entering event loop");
|
||||
|
@ -259,14 +254,10 @@ pub fn main_wrapper<E: Example>(
|
|||
winit::VirtualKeyCode::P => debug_flags.toggle(DebugFlags::PROFILER_DBG),
|
||||
winit::VirtualKeyCode::O => debug_flags.toggle(DebugFlags::RENDER_TARGET_DBG),
|
||||
winit::VirtualKeyCode::I => debug_flags.toggle(DebugFlags::TEXTURE_CACHE_DBG),
|
||||
winit::VirtualKeyCode::S => debug_flags.toggle(DebugFlags::COMPACT_PROFILER),
|
||||
winit::VirtualKeyCode::T => debug_flags.toggle(DebugFlags::PICTURE_CACHING_DBG),
|
||||
winit::VirtualKeyCode::Q => debug_flags.toggle(
|
||||
DebugFlags::GPU_TIME_QUERIES | DebugFlags::GPU_SAMPLE_QUERIES
|
||||
),
|
||||
winit::VirtualKeyCode::F => debug_flags.toggle(
|
||||
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(
|
||||
device_size.into(),
|
||||
|
@ -304,7 +295,7 @@ pub fn main_wrapper<E: Example>(
|
|||
}
|
||||
|
||||
if custom_event {
|
||||
let mut builder = DisplayListBuilder::new(pipeline_id, layout_size);
|
||||
let mut builder = DisplayListBuilder::new(pipeline_id);
|
||||
|
||||
example.render(
|
||||
&mut api,
|
||||
|
@ -321,12 +312,12 @@ pub fn main_wrapper<E: Example>(
|
|||
builder.finalize(),
|
||||
true,
|
||||
);
|
||||
txn.generate_frame();
|
||||
txn.generate_frame(0);
|
||||
}
|
||||
api.send_transaction(document_id, txn);
|
||||
|
||||
renderer.update();
|
||||
renderer.render(device_size).unwrap();
|
||||
renderer.render(device_size, 0).unwrap();
|
||||
let _ = renderer.flush_pipeline_info();
|
||||
example.draw_custom(&*gl);
|
||||
windowed_context.swap_buffers().ok();
|
||||
|
|
30
third_party/webrender/examples/document.rs
vendored
30
third_party/webrender/examples/document.rs
vendored
|
@ -2,11 +2,11 @@
|
|||
* 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 euclid;
|
||||
use gleam;
|
||||
use glutin;
|
||||
use webrender;
|
||||
use winit;
|
||||
extern crate euclid;
|
||||
extern crate gleam;
|
||||
extern crate glutin;
|
||||
extern crate webrender;
|
||||
extern crate winit;
|
||||
|
||||
#[path = "common/boilerplate.rs"]
|
||||
mod boilerplate;
|
||||
|
@ -14,6 +14,7 @@ mod boilerplate;
|
|||
use crate::boilerplate::Example;
|
||||
use euclid::Scale;
|
||||
use webrender::api::*;
|
||||
use webrender::render_api::*;
|
||||
use webrender::api::units::*;
|
||||
|
||||
// This example creates multiple documents overlapping each other with
|
||||
|
@ -39,35 +40,31 @@ impl App {
|
|||
let init_data = vec![
|
||||
(
|
||||
PipelineId(1, 0),
|
||||
-2,
|
||||
ColorF::new(0.0, 1.0, 0.0, 1.0),
|
||||
DeviceIntPoint::new(0, 0),
|
||||
),
|
||||
(
|
||||
PipelineId(2, 0),
|
||||
-1,
|
||||
ColorF::new(1.0, 1.0, 0.0, 1.0),
|
||||
DeviceIntPoint::new(200, 0),
|
||||
),
|
||||
(
|
||||
PipelineId(3, 0),
|
||||
0,
|
||||
ColorF::new(1.0, 0.0, 0.0, 1.0),
|
||||
DeviceIntPoint::new(200, 200),
|
||||
),
|
||||
(
|
||||
PipelineId(4, 0),
|
||||
1,
|
||||
ColorF::new(1.0, 0.0, 1.0, 1.0),
|
||||
DeviceIntPoint::new(0, 200),
|
||||
),
|
||||
];
|
||||
|
||||
for (pipeline_id, layer, color, offset) in init_data {
|
||||
for (pipeline_id, color, offset) in init_data {
|
||||
let size = DeviceIntSize::new(250, 250);
|
||||
let bounds = DeviceIntRect::new(offset, size);
|
||||
|
||||
let document_id = api.add_document(size, layer);
|
||||
let document_id = api.add_document(size);
|
||||
let mut txn = Transaction::new();
|
||||
txn.set_document_view(bounds, device_pixel_ratio);
|
||||
txn.set_root_pipeline(pipeline_id);
|
||||
|
@ -90,25 +87,22 @@ impl Example for App {
|
|||
fn render(
|
||||
&mut self,
|
||||
api: &mut RenderApi,
|
||||
base_builder: &mut DisplayListBuilder,
|
||||
_base_builder: &mut DisplayListBuilder,
|
||||
_txn: &mut Transaction,
|
||||
device_size: DeviceIntSize,
|
||||
_device_size: DeviceIntSize,
|
||||
_pipeline_id: PipelineId,
|
||||
_: DocumentId,
|
||||
) {
|
||||
if self.documents.is_empty() {
|
||||
let device_pixel_ratio = device_size.width as f32 /
|
||||
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, 1.0);
|
||||
}
|
||||
|
||||
for doc in &self.documents {
|
||||
let space_and_clip = SpaceAndClipInfo::root_scroll(doc.pipeline_id);
|
||||
let mut builder = DisplayListBuilder::new(
|
||||
doc.pipeline_id,
|
||||
doc.content_rect.size,
|
||||
);
|
||||
let local_rect = LayoutRect::new(
|
||||
LayoutPoint::zero(),
|
||||
|
@ -135,7 +129,7 @@ impl Example for App {
|
|||
builder.finalize(),
|
||||
true,
|
||||
);
|
||||
txn.generate_frame();
|
||||
txn.generate_frame(0);
|
||||
api.send_transaction(doc.id, txn);
|
||||
}
|
||||
}
|
||||
|
|
238
third_party/webrender/examples/frame_output.rs
vendored
238
third_party/webrender/examples/frame_output.rs
vendored
|
@ -1,238 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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 euclid;
|
||||
use gleam;
|
||||
use glutin;
|
||||
use webrender;
|
||||
use winit;
|
||||
|
||||
#[path = "common/boilerplate.rs"]
|
||||
mod boilerplate;
|
||||
|
||||
use crate::boilerplate::{Example, HandyDandyRectBuilder};
|
||||
use euclid::Scale;
|
||||
use gleam::gl;
|
||||
use webrender::api::*;
|
||||
use webrender::api::units::*;
|
||||
|
||||
|
||||
// This example demonstrates using the frame output feature to copy
|
||||
// the output of a WR framebuffer to a custom texture.
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Document {
|
||||
id: DocumentId,
|
||||
pipeline_id: PipelineId,
|
||||
content_rect: LayoutRect,
|
||||
color: ColorF,
|
||||
}
|
||||
|
||||
|
||||
struct App {
|
||||
external_image_key: Option<ImageKey>,
|
||||
output_document: Option<Document>
|
||||
}
|
||||
|
||||
struct OutputHandler {
|
||||
texture_id: gl::GLuint
|
||||
}
|
||||
|
||||
struct ExternalHandler {
|
||||
texture_id: gl::GLuint
|
||||
}
|
||||
|
||||
impl OutputImageHandler for OutputHandler {
|
||||
fn lock(&mut self, _id: PipelineId) -> Option<(u32, FramebufferIntSize)> {
|
||||
Some((self.texture_id, FramebufferIntSize::new(500, 500)))
|
||||
}
|
||||
|
||||
fn unlock(&mut self, _id: PipelineId) {}
|
||||
}
|
||||
|
||||
impl ExternalImageHandler for ExternalHandler {
|
||||
fn lock(
|
||||
&mut self,
|
||||
_key: ExternalImageId,
|
||||
_channel_index: u8,
|
||||
_rendering: ImageRendering
|
||||
) -> ExternalImage {
|
||||
ExternalImage {
|
||||
uv: TexelRect::new(0.0, 0.0, 1.0, 1.0),
|
||||
source: ExternalImageSource::NativeTexture(self.texture_id),
|
||||
}
|
||||
}
|
||||
fn unlock(&mut self, _key: ExternalImageId, _channel_index: u8) {}
|
||||
}
|
||||
|
||||
impl App {
|
||||
fn init_output_document(
|
||||
&mut self,
|
||||
api: &mut RenderApi,
|
||||
device_size: DeviceIntSize,
|
||||
device_pixel_ratio: f32,
|
||||
) {
|
||||
// Generate the external image key that will be used to render the output document to the root document.
|
||||
self.external_image_key = Some(api.generate_image_key());
|
||||
|
||||
let pipeline_id = PipelineId(1, 0);
|
||||
let layer = 1;
|
||||
let color = ColorF::new(1., 1., 0., 1.);
|
||||
let document_id = api.add_document(device_size, layer);
|
||||
api.enable_frame_output(document_id, pipeline_id, true);
|
||||
api.set_document_view(
|
||||
document_id,
|
||||
device_size.into(),
|
||||
device_pixel_ratio,
|
||||
);
|
||||
|
||||
let document = Document {
|
||||
id: document_id,
|
||||
pipeline_id,
|
||||
content_rect: LayoutRect::new(
|
||||
LayoutPoint::zero(),
|
||||
device_size.to_f32() / Scale::new(device_pixel_ratio),
|
||||
),
|
||||
color,
|
||||
};
|
||||
|
||||
let mut txn = Transaction::new();
|
||||
|
||||
txn.add_image(
|
||||
self.external_image_key.unwrap(),
|
||||
ImageDescriptor::new(100, 100, ImageFormat::BGRA8, ImageDescriptorFlags::IS_OPAQUE),
|
||||
ImageData::External(ExternalImageData {
|
||||
id: ExternalImageId(0),
|
||||
channel_index: 0,
|
||||
image_type: ExternalImageType::TextureHandle(TextureTarget::Default),
|
||||
}),
|
||||
None,
|
||||
);
|
||||
|
||||
let space_and_clip = SpaceAndClipInfo::root_scroll(pipeline_id);
|
||||
let mut builder = DisplayListBuilder::new(
|
||||
document.pipeline_id,
|
||||
document.content_rect.size,
|
||||
);
|
||||
|
||||
builder.push_simple_stacking_context(
|
||||
document.content_rect.origin,
|
||||
space_and_clip.spatial_id,
|
||||
PrimitiveFlags::IS_BACKFACE_VISIBLE,
|
||||
);
|
||||
|
||||
builder.push_rect(
|
||||
&CommonItemProperties::new(document.content_rect, space_and_clip),
|
||||
document.content_rect,
|
||||
ColorF::new(1.0, 1.0, 0.0, 1.0)
|
||||
);
|
||||
builder.pop_stacking_context();
|
||||
|
||||
txn.set_root_pipeline(pipeline_id);
|
||||
txn.set_display_list(
|
||||
Epoch(0),
|
||||
Some(document.color),
|
||||
document.content_rect.size,
|
||||
builder.finalize(),
|
||||
true,
|
||||
);
|
||||
txn.generate_frame();
|
||||
api.send_transaction(document.id, txn);
|
||||
self.output_document = Some(document);
|
||||
}
|
||||
}
|
||||
|
||||
impl Example for App {
|
||||
fn render(
|
||||
&mut self,
|
||||
api: &mut RenderApi,
|
||||
builder: &mut DisplayListBuilder,
|
||||
_txn: &mut Transaction,
|
||||
device_size: DeviceIntSize,
|
||||
pipeline_id: PipelineId,
|
||||
_document_id: DocumentId,
|
||||
) {
|
||||
if self.output_document.is_none() {
|
||||
let device_pixel_ratio = device_size.width as f32 /
|
||||
builder.content_size().width;
|
||||
self.init_output_document(api, DeviceIntSize::new(200, 200), device_pixel_ratio);
|
||||
}
|
||||
|
||||
let bounds = (100, 100).to(200, 200);
|
||||
let space_and_clip = SpaceAndClipInfo::root_scroll(pipeline_id);
|
||||
|
||||
builder.push_simple_stacking_context(
|
||||
bounds.origin,
|
||||
space_and_clip.spatial_id,
|
||||
PrimitiveFlags::IS_BACKFACE_VISIBLE,
|
||||
);
|
||||
|
||||
builder.push_image(
|
||||
&CommonItemProperties::new(bounds, space_and_clip),
|
||||
bounds,
|
||||
ImageRendering::Auto,
|
||||
AlphaType::PremultipliedAlpha,
|
||||
self.external_image_key.unwrap(),
|
||||
ColorF::WHITE,
|
||||
);
|
||||
|
||||
builder.pop_stacking_context();
|
||||
}
|
||||
|
||||
fn get_image_handlers(
|
||||
&mut self,
|
||||
gl: &dyn gl::Gl,
|
||||
) -> (Option<Box<dyn ExternalImageHandler>>,
|
||||
Option<Box<dyn OutputImageHandler>>) {
|
||||
let texture_id = gl.gen_textures(1)[0];
|
||||
|
||||
gl.bind_texture(gl::TEXTURE_2D, texture_id);
|
||||
gl.tex_parameter_i(
|
||||
gl::TEXTURE_2D,
|
||||
gl::TEXTURE_MAG_FILTER,
|
||||
gl::LINEAR as gl::GLint,
|
||||
);
|
||||
gl.tex_parameter_i(
|
||||
gl::TEXTURE_2D,
|
||||
gl::TEXTURE_MIN_FILTER,
|
||||
gl::LINEAR as gl::GLint,
|
||||
);
|
||||
gl.tex_parameter_i(
|
||||
gl::TEXTURE_2D,
|
||||
gl::TEXTURE_WRAP_S,
|
||||
gl::CLAMP_TO_EDGE as gl::GLint,
|
||||
);
|
||||
gl.tex_parameter_i(
|
||||
gl::TEXTURE_2D,
|
||||
gl::TEXTURE_WRAP_T,
|
||||
gl::CLAMP_TO_EDGE as gl::GLint,
|
||||
);
|
||||
gl.tex_image_2d(
|
||||
gl::TEXTURE_2D,
|
||||
0,
|
||||
gl::RGBA as gl::GLint,
|
||||
100,
|
||||
100,
|
||||
0,
|
||||
gl::BGRA,
|
||||
gl::UNSIGNED_BYTE,
|
||||
None,
|
||||
);
|
||||
gl.bind_texture(gl::TEXTURE_2D, 0);
|
||||
|
||||
(
|
||||
Some(Box::new(ExternalHandler { texture_id })),
|
||||
Some(Box::new(OutputHandler { texture_id }))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut app = App {
|
||||
external_image_key: None,
|
||||
output_document: None
|
||||
};
|
||||
|
||||
boilerplate::main_wrapper(&mut app, None);
|
||||
}
|
16
third_party/webrender/examples/iframe.rs
vendored
16
third_party/webrender/examples/iframe.rs
vendored
|
@ -2,16 +2,17 @@
|
|||
* 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 gleam;
|
||||
use glutin;
|
||||
use webrender;
|
||||
use winit;
|
||||
extern crate gleam;
|
||||
extern crate glutin;
|
||||
extern crate webrender;
|
||||
extern crate winit;
|
||||
|
||||
#[path = "common/boilerplate.rs"]
|
||||
mod boilerplate;
|
||||
|
||||
use crate::boilerplate::{Example, HandyDandyRectBuilder};
|
||||
use webrender::api::*;
|
||||
use webrender::render_api::*;
|
||||
use webrender::api::units::*;
|
||||
|
||||
// This example uses the push_iframe API to nest a second pipeline's displaylist
|
||||
|
@ -35,7 +36,7 @@ impl Example for App {
|
|||
let sub_bounds = (0, 0).to(sub_size.width as i32, sub_size.height as i32);
|
||||
|
||||
let sub_pipeline_id = PipelineId(pipeline_id.0, 42);
|
||||
let mut sub_builder = DisplayListBuilder::new(sub_pipeline_id, sub_bounds.size);
|
||||
let mut sub_builder = DisplayListBuilder::new(sub_pipeline_id);
|
||||
let mut space_and_clip = SpaceAndClipInfo::root_scroll(pipeline_id);
|
||||
|
||||
sub_builder.push_simple_stacking_context(
|
||||
|
@ -67,7 +68,10 @@ impl Example for App {
|
|||
space_and_clip.spatial_id,
|
||||
TransformStyle::Flat,
|
||||
PropertyBinding::Binding(PropertyBindingKey::new(42), LayoutTransform::identity()),
|
||||
ReferenceFrameKind::Transform,
|
||||
ReferenceFrameKind::Transform {
|
||||
is_2d_scale_translation: false,
|
||||
should_snap: false,
|
||||
},
|
||||
);
|
||||
|
||||
// And this is for the root pipeline
|
||||
|
|
11
third_party/webrender/examples/image_resize.rs
vendored
11
third_party/webrender/examples/image_resize.rs
vendored
|
@ -2,10 +2,10 @@
|
|||
* 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 gleam;
|
||||
use glutin;
|
||||
use webrender;
|
||||
use winit;
|
||||
extern crate gleam;
|
||||
extern crate glutin;
|
||||
extern crate webrender;
|
||||
extern crate winit;
|
||||
|
||||
#[path = "common/boilerplate.rs"]
|
||||
mod boilerplate;
|
||||
|
@ -14,6 +14,7 @@ mod image_helper;
|
|||
|
||||
use crate::boilerplate::{Example, HandyDandyRectBuilder};
|
||||
use webrender::api::*;
|
||||
use webrender::render_api::*;
|
||||
use webrender::api::units::*;
|
||||
|
||||
struct App {
|
||||
|
@ -103,7 +104,7 @@ impl Example for App {
|
|||
&DirtyRect::All,
|
||||
);
|
||||
let mut txn = Transaction::new();
|
||||
txn.generate_frame();
|
||||
txn.generate_frame(0);
|
||||
api.send_transaction(document_id, txn);
|
||||
}
|
||||
_ => {}
|
||||
|
|
29
third_party/webrender/examples/multiwindow.rs
vendored
29
third_party/webrender/examples/multiwindow.rs
vendored
|
@ -2,11 +2,11 @@
|
|||
* 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 euclid;
|
||||
use gleam;
|
||||
use glutin;
|
||||
use webrender;
|
||||
use winit;
|
||||
extern crate euclid;
|
||||
extern crate gleam;
|
||||
extern crate glutin;
|
||||
extern crate webrender;
|
||||
extern crate winit;
|
||||
|
||||
use gleam::gl;
|
||||
use glutin::NotCurrent;
|
||||
|
@ -14,6 +14,7 @@ use std::fs::File;
|
|||
use std::io::Read;
|
||||
use webrender::api::*;
|
||||
use webrender::api::units::*;
|
||||
use webrender::render_api::*;
|
||||
use webrender::DebugFlags;
|
||||
use winit::dpi::LogicalSize;
|
||||
|
||||
|
@ -34,7 +35,7 @@ impl RenderNotifier for Notifier {
|
|||
})
|
||||
}
|
||||
|
||||
fn wake_up(&self) {
|
||||
fn wake_up(&self, _composite_needed: bool) {
|
||||
#[cfg(not(target_os = "android"))]
|
||||
let _ = self.events_proxy.wakeup();
|
||||
}
|
||||
|
@ -42,9 +43,9 @@ impl RenderNotifier for Notifier {
|
|||
fn new_frame_ready(&self,
|
||||
_: DocumentId,
|
||||
_scrolled: bool,
|
||||
_composite_needed: bool,
|
||||
composite_needed: bool,
|
||||
_render_time: Option<u64>) {
|
||||
self.wake_up();
|
||||
self.wake_up(composite_needed);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,9 +105,9 @@ impl Window {
|
|||
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, device_size).unwrap();
|
||||
let (renderer, sender) = webrender::Renderer::new(gl.clone(), notifier, opts, None).unwrap();
|
||||
let mut api = sender.create_api();
|
||||
let document_id = api.add_document(device_size, 0);
|
||||
let document_id = api.add_document(device_size);
|
||||
|
||||
let epoch = Epoch(0);
|
||||
let pipeline_id = PipelineId(0, 0);
|
||||
|
@ -183,10 +184,10 @@ impl Window {
|
|||
};
|
||||
let layout_size = device_size.to_f32() / euclid::Scale::new(device_pixel_ratio);
|
||||
let mut txn = Transaction::new();
|
||||
let mut builder = DisplayListBuilder::new(self.pipeline_id, layout_size);
|
||||
let mut builder = DisplayListBuilder::new(self.pipeline_id);
|
||||
let space_and_clip = SpaceAndClipInfo::root_scroll(self.pipeline_id);
|
||||
|
||||
let bounds = LayoutRect::new(LayoutPoint::zero(), builder.content_size());
|
||||
let bounds = LayoutRect::new(LayoutPoint::zero(), layout_size);
|
||||
builder.push_simple_stacking_context(
|
||||
bounds.origin,
|
||||
space_and_clip.spatial_id,
|
||||
|
@ -284,11 +285,11 @@ impl Window {
|
|||
true,
|
||||
);
|
||||
txn.set_root_pipeline(self.pipeline_id);
|
||||
txn.generate_frame();
|
||||
txn.generate_frame(0);
|
||||
api.send_transaction(self.document_id, txn);
|
||||
|
||||
renderer.update();
|
||||
renderer.render(device_size).unwrap();
|
||||
renderer.render(device_size, 0).unwrap();
|
||||
context.swap_buffers().ok();
|
||||
|
||||
self.context = Some(unsafe { context.make_not_current().unwrap() });
|
||||
|
|
82
third_party/webrender/examples/scrolling.rs
vendored
82
third_party/webrender/examples/scrolling.rs
vendored
|
@ -2,11 +2,11 @@
|
|||
* 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 euclid;
|
||||
use gleam;
|
||||
use glutin;
|
||||
use webrender;
|
||||
use winit;
|
||||
extern crate euclid;
|
||||
extern crate gleam;
|
||||
extern crate glutin;
|
||||
extern crate webrender;
|
||||
extern crate winit;
|
||||
|
||||
#[path = "common/boilerplate.rs"]
|
||||
mod boilerplate;
|
||||
|
@ -14,12 +14,17 @@ mod boilerplate;
|
|||
use crate::boilerplate::{Example, HandyDandyRectBuilder};
|
||||
use euclid::SideOffsets2D;
|
||||
use webrender::api::*;
|
||||
use webrender::render_api::*;
|
||||
use webrender::api::units::*;
|
||||
use winit::dpi::LogicalPosition;
|
||||
|
||||
|
||||
const EXT_SCROLL_ID_ROOT: u64 = 1;
|
||||
const EXT_SCROLL_ID_CONTENT: u64 = 2;
|
||||
|
||||
struct App {
|
||||
cursor_position: WorldPoint,
|
||||
scroll_origin: LayoutPoint,
|
||||
}
|
||||
|
||||
impl Example for App {
|
||||
|
@ -51,7 +56,7 @@ impl Example for App {
|
|||
// set the scrolling clip
|
||||
let space_and_clip1 = builder.define_scroll_frame(
|
||||
&root_space_and_clip,
|
||||
None,
|
||||
ExternalScrollId(EXT_SCROLL_ID_ROOT, PipelineId::dummy()),
|
||||
(0, 0).by(1000, 1000),
|
||||
scrollbox,
|
||||
ScrollSensitivity::ScriptAndInputEvents,
|
||||
|
@ -60,22 +65,22 @@ impl Example for App {
|
|||
|
||||
// now put some content into it.
|
||||
// start with a white background
|
||||
let mut info = CommonItemProperties::new((0, 0).to(1000, 1000), space_and_clip1);
|
||||
info.hit_info = Some((0, 1));
|
||||
let info = CommonItemProperties::new((0, 0).to(1000, 1000), space_and_clip1);
|
||||
builder.push_hit_test(&info, (0, 1));
|
||||
builder.push_rect(&info, info.clip_rect, ColorF::new(1.0, 1.0, 1.0, 1.0));
|
||||
|
||||
// let's make a 50x50 blue square as a visual reference
|
||||
let mut info = CommonItemProperties::new((0, 0).to(50, 50), space_and_clip1);
|
||||
info.hit_info = Some((0, 2));
|
||||
let info = CommonItemProperties::new((0, 0).to(50, 50), space_and_clip1);
|
||||
builder.push_hit_test(&info, (0, 2));
|
||||
builder.push_rect(&info, info.clip_rect, ColorF::new(0.0, 0.0, 1.0, 1.0));
|
||||
|
||||
// and a 50x50 green square next to it with an offset clip
|
||||
// to see what that looks like
|
||||
let mut info = CommonItemProperties::new(
|
||||
let info = CommonItemProperties::new(
|
||||
(50, 0).to(100, 50).intersection(&(60, 10).to(110, 60)).unwrap(),
|
||||
space_and_clip1,
|
||||
);
|
||||
info.hit_info = Some((0, 3));
|
||||
builder.push_hit_test(&info, (0, 3));
|
||||
builder.push_rect(&info, info.clip_rect, ColorF::new(0.0, 1.0, 0.0, 1.0));
|
||||
|
||||
// Below the above rectangles, set up a nested scrollbox. It's still in
|
||||
|
@ -83,7 +88,7 @@ impl Example for App {
|
|||
// be relative to the stacking context.
|
||||
let space_and_clip2 = builder.define_scroll_frame(
|
||||
&space_and_clip1,
|
||||
None,
|
||||
ExternalScrollId(EXT_SCROLL_ID_CONTENT, PipelineId::dummy()),
|
||||
(0, 100).to(300, 1000),
|
||||
(0, 100).to(200, 300),
|
||||
ScrollSensitivity::ScriptAndInputEvents,
|
||||
|
@ -92,17 +97,17 @@ impl Example for App {
|
|||
|
||||
// give it a giant gray background just to distinguish it and to easily
|
||||
// visually identify the nested scrollbox
|
||||
let mut info = CommonItemProperties::new(
|
||||
let info = CommonItemProperties::new(
|
||||
(-1000, -1000).to(5000, 5000),
|
||||
space_and_clip2,
|
||||
);
|
||||
info.hit_info = Some((0, 4));
|
||||
builder.push_hit_test(&info, (0, 4));
|
||||
builder.push_rect(&info, info.clip_rect, ColorF::new(0.5, 0.5, 0.5, 1.0));
|
||||
|
||||
// add a teal square to visualize the scrolling/clipping behaviour
|
||||
// as you scroll the nested scrollbox
|
||||
let mut info = CommonItemProperties::new((0, 200).to(50, 250), space_and_clip2);
|
||||
info.hit_info = Some((0, 5));
|
||||
let info = CommonItemProperties::new((0, 200).to(50, 250), space_and_clip2);
|
||||
builder.push_hit_test(&info, (0, 5));
|
||||
builder.push_rect(&info, info.clip_rect, ColorF::new(0.0, 1.0, 1.0, 1.0));
|
||||
|
||||
// Add a sticky frame. It will "stick" twice while scrolling, once
|
||||
|
@ -118,14 +123,14 @@ impl Example for App {
|
|||
LayoutVector2D::new(0.0, 0.0)
|
||||
);
|
||||
|
||||
let mut info = CommonItemProperties::new(
|
||||
let info = CommonItemProperties::new(
|
||||
(50, 350).by(50, 50),
|
||||
SpaceAndClipInfo {
|
||||
spatial_id: sticky_id,
|
||||
clip_id: space_and_clip2.clip_id,
|
||||
},
|
||||
);
|
||||
info.hit_info = Some((0, 6));
|
||||
builder.push_hit_test(&info, (0, 6));
|
||||
builder.push_rect(
|
||||
&info,
|
||||
info.clip_rect,
|
||||
|
@ -134,11 +139,11 @@ impl Example for App {
|
|||
|
||||
// just for good measure add another teal square further down and to
|
||||
// the right, which can be scrolled into view by the user
|
||||
let mut info = CommonItemProperties::new(
|
||||
let info = CommonItemProperties::new(
|
||||
(250, 350).to(300, 400),
|
||||
space_and_clip2,
|
||||
);
|
||||
info.hit_info = Some((0, 7));
|
||||
builder.push_hit_test(&info, (0, 7));
|
||||
builder.push_rect(&info, info.clip_rect, ColorF::new(0.0, 1.0, 1.0, 1.0));
|
||||
|
||||
builder.pop_stacking_context();
|
||||
|
@ -159,10 +164,10 @@ impl Example for App {
|
|||
..
|
||||
} => {
|
||||
let offset = match key {
|
||||
winit::VirtualKeyCode::Down => Some((0.0, -10.0)),
|
||||
winit::VirtualKeyCode::Up => Some((0.0, 10.0)),
|
||||
winit::VirtualKeyCode::Right => Some((-10.0, 0.0)),
|
||||
winit::VirtualKeyCode::Left => Some((10.0, 0.0)),
|
||||
winit::VirtualKeyCode::Down => Some(LayoutVector2D::new(0.0, -10.0)),
|
||||
winit::VirtualKeyCode::Up => Some(LayoutVector2D::new(0.0, 10.0)),
|
||||
winit::VirtualKeyCode::Right => Some(LayoutVector2D::new(-10.0, 0.0)),
|
||||
winit::VirtualKeyCode::Left => Some(LayoutVector2D::new(10.0, 0.0)),
|
||||
_ => None,
|
||||
};
|
||||
let zoom = match key {
|
||||
|
@ -173,15 +178,18 @@ impl Example for App {
|
|||
};
|
||||
|
||||
if let Some(offset) = offset {
|
||||
txn.scroll(
|
||||
ScrollLocation::Delta(LayoutVector2D::new(offset.0, offset.1)),
|
||||
self.cursor_position,
|
||||
self.scroll_origin += offset;
|
||||
|
||||
txn.scroll_node_with_id(
|
||||
self.scroll_origin,
|
||||
ExternalScrollId(EXT_SCROLL_ID_CONTENT, PipelineId::dummy()),
|
||||
ScrollClamping::ToContentBounds,
|
||||
);
|
||||
txn.generate_frame();
|
||||
txn.generate_frame(0);
|
||||
}
|
||||
if let Some(zoom) = zoom {
|
||||
txn.set_pinch_zoom(ZoomFactor::new(zoom));
|
||||
txn.generate_frame();
|
||||
txn.generate_frame(0);
|
||||
}
|
||||
}
|
||||
winit::WindowEvent::CursorMoved { position: LogicalPosition { x, y }, .. } => {
|
||||
|
@ -194,18 +202,21 @@ impl Example for App {
|
|||
winit::MouseScrollDelta::PixelDelta(pos) => (pos.x as f32, pos.y as f32),
|
||||
};
|
||||
|
||||
txn.scroll(
|
||||
ScrollLocation::Delta(LayoutVector2D::new(dx, dy)),
|
||||
self.cursor_position,
|
||||
self.scroll_origin += LayoutVector2D::new(dx, dy);
|
||||
|
||||
txn.scroll_node_with_id(
|
||||
self.scroll_origin,
|
||||
ExternalScrollId(EXT_SCROLL_ID_CONTENT, PipelineId::dummy()),
|
||||
ScrollClamping::ToContentBounds,
|
||||
);
|
||||
txn.generate_frame();
|
||||
|
||||
txn.generate_frame(0);
|
||||
}
|
||||
winit::WindowEvent::MouseInput { .. } => {
|
||||
let results = api.hit_test(
|
||||
document_id,
|
||||
None,
|
||||
self.cursor_position,
|
||||
HitTestFlags::FIND_ALL
|
||||
);
|
||||
|
||||
println!("Hit test results:");
|
||||
|
@ -226,6 +237,7 @@ impl Example for App {
|
|||
fn main() {
|
||||
let mut app = App {
|
||||
cursor_position: WorldPoint::zero(),
|
||||
scroll_origin: LayoutPoint::zero(),
|
||||
};
|
||||
boilerplate::main_wrapper(&mut app, None);
|
||||
}
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
* 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 gleam;
|
||||
use glutin;
|
||||
use webrender;
|
||||
use winit;
|
||||
extern crate gleam;
|
||||
extern crate glutin;
|
||||
extern crate webrender;
|
||||
extern crate winit;
|
||||
|
||||
#[path = "common/boilerplate.rs"]
|
||||
mod boilerplate;
|
||||
|
@ -14,6 +14,7 @@ use crate::boilerplate::{Example, HandyDandyRectBuilder};
|
|||
use gleam::gl;
|
||||
use std::mem;
|
||||
use webrender::api::*;
|
||||
use webrender::render_api::*;
|
||||
use webrender::api::units::*;
|
||||
|
||||
|
||||
|
@ -301,12 +302,11 @@ impl Example for App {
|
|||
false
|
||||
}
|
||||
|
||||
fn get_image_handlers(
|
||||
fn get_image_handler(
|
||||
&mut self,
|
||||
_gl: &dyn gl::Gl,
|
||||
) -> (Option<Box<dyn ExternalImageHandler>>,
|
||||
Option<Box<dyn OutputImageHandler>>) {
|
||||
(Some(Box::new(ImageGenerator::new())), None)
|
||||
) -> Option<Box<dyn ExternalImageHandler>> {
|
||||
Some(Box::new(ImageGenerator::new()))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
27
third_party/webrender/examples/yuv.rs
vendored
27
third_party/webrender/examples/yuv.rs
vendored
|
@ -2,10 +2,10 @@
|
|||
* 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 gleam;
|
||||
use glutin;
|
||||
use webrender;
|
||||
use winit;
|
||||
extern crate gleam;
|
||||
extern crate glutin;
|
||||
extern crate webrender;
|
||||
extern crate winit;
|
||||
|
||||
#[path = "common/boilerplate.rs"]
|
||||
mod boilerplate;
|
||||
|
@ -13,6 +13,7 @@ mod boilerplate;
|
|||
use crate::boilerplate::Example;
|
||||
use gleam::gl;
|
||||
use webrender::api::*;
|
||||
use webrender::render_api::*;
|
||||
use webrender::api::units::*;
|
||||
|
||||
|
||||
|
@ -93,7 +94,7 @@ impl Example for App {
|
|||
pipeline_id: PipelineId,
|
||||
_document_id: DocumentId,
|
||||
) {
|
||||
let bounds = LayoutRect::new(LayoutPoint::zero(), builder.content_size());
|
||||
let bounds = LayoutRect::new(LayoutPoint::zero(), LayoutSize::new(500.0, 500.0));
|
||||
let space_and_clip = SpaceAndClipInfo::root_scroll(pipeline_id);
|
||||
|
||||
builder.push_simple_stacking_context(
|
||||
|
@ -113,7 +114,7 @@ impl Example for App {
|
|||
id: ExternalImageId(0),
|
||||
channel_index: 0,
|
||||
image_type: ExternalImageType::TextureHandle(
|
||||
TextureTarget::Default,
|
||||
ImageBufferKind::Texture2D,
|
||||
),
|
||||
}),
|
||||
None,
|
||||
|
@ -125,7 +126,7 @@ impl Example for App {
|
|||
id: ExternalImageId(1),
|
||||
channel_index: 0,
|
||||
image_type: ExternalImageType::TextureHandle(
|
||||
TextureTarget::Default,
|
||||
ImageBufferKind::Texture2D,
|
||||
),
|
||||
}),
|
||||
None,
|
||||
|
@ -137,7 +138,7 @@ impl Example for App {
|
|||
id: ExternalImageId(2),
|
||||
channel_index: 0,
|
||||
image_type: ExternalImageType::TextureHandle(
|
||||
TextureTarget::Default,
|
||||
ImageBufferKind::Texture2D,
|
||||
),
|
||||
}),
|
||||
None,
|
||||
|
@ -149,7 +150,7 @@ impl Example for App {
|
|||
id: ExternalImageId(3),
|
||||
channel_index: 0,
|
||||
image_type: ExternalImageType::TextureHandle(
|
||||
TextureTarget::Default,
|
||||
ImageBufferKind::Texture2D,
|
||||
),
|
||||
}),
|
||||
None,
|
||||
|
@ -195,14 +196,13 @@ impl Example for App {
|
|||
false
|
||||
}
|
||||
|
||||
fn get_image_handlers(
|
||||
fn get_image_handler(
|
||||
&mut self,
|
||||
gl: &dyn gl::Gl,
|
||||
) -> (Option<Box<dyn ExternalImageHandler>>,
|
||||
Option<Box<dyn OutputImageHandler>>) {
|
||||
) -> Option<Box<dyn ExternalImageHandler>> {
|
||||
let provider = YuvImageProvider::new(gl);
|
||||
self.texture_id = provider.texture_ids[0];
|
||||
(Some(Box::new(provider)), None)
|
||||
Some(Box::new(provider))
|
||||
}
|
||||
|
||||
fn draw_custom(&mut self, gl: &dyn gl::Gl) {
|
||||
|
@ -218,7 +218,6 @@ fn main() {
|
|||
};
|
||||
|
||||
let opts = webrender::RendererOptions {
|
||||
debug_flags: webrender::DebugFlags::NEW_FRAME_INDICATOR | webrender::DebugFlags::NEW_SCENE_INDICATOR,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue