Skip to content

Commit

Permalink
A variety of documentation fixes.
Browse files Browse the repository at this point in the history
* MainThreadDispatcher not a type.
  Since "MainThreadDispatcher" isn't a type but a concept, we'll call
  it "main thread dispatcher" instead.
* RenderApi::set_root_pipeline example.
  Let this example actually compile so that we can stop ignoring
  it during the doc tests.
* RenderApi::set_root_display_list: Re-order args.
  The arguments and the descriptions of the arguments should be in
  the same order.
* RenderDispatcher comment should be doc comment.
* Try using 'WebRender' as the name of the project.
  This is an attempt to start being more consistent about
  capitalization of the project name.
  • Loading branch information
waywardmonkeys committed Apr 4, 2017
1 parent 1c5a9bb commit a2d959b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# webrender
# WebRender
GPU renderer for the Web content, used by Servo.

## Update as a Dependency
After updating shaders in webrender, go to servo and:
After updating shaders in WebRender, go to servo and:

* Go to the servo directory and do ./mach update-cargo -p webrender
* Create a pull request to servo


## Use Webrender with Servo
To use a custom webrender with servo, go to your servo build directory and:
## Use WebRender with Servo
To use a custom WebRender with servo, go to your servo build directory and:

* Edit Cargo.toml
* Add at the end of the file:
Expand Down
6 changes: 3 additions & 3 deletions webrender/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
* 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/. */

//! A GPU based Webrender.
//! A GPU based renderer for the web.
//!
//! It serves as an experimental render backend for [Servo](https://servo.org/),
//! but it can also be used as such in a standalone application.
//!
//! # External dependencies
//! Webrender currently depends on [FreeType](https://www.freetype.org/)
//! WebRender currently depends on [FreeType](https://www.freetype.org/)
//!
//! # Api Structure
//! The main entry point to webrender is the `webrender::renderer::Renderer`.
//! The main entry point to WebRender is the `webrender::renderer::Renderer`.
//!
//! By calling `Renderer::new(...)` you get a `Renderer`, as well as a `RenderApiSender`.
//! Your `Renderer` is responsible to render the previously processed frames onto the screen.
Expand Down
2 changes: 1 addition & 1 deletion webrender/src/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ impl Renderer {
*notifier_arc = Some(notifier);
}

/// Sets the new MainThreadDispatcher.
/// Sets the new main thread dispatcher.
///
/// Allows to dispatch functions to the main thread's event loop.
pub fn set_main_thread_dispatcher(&self, dispatcher: Box<RenderDispatcher>) {
Expand Down
16 changes: 9 additions & 7 deletions webrender_traits/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,14 @@ impl RenderApi {
///
/// # Examples
///
/// ```ignore
/// let (mut renderer, sender) = webrender::renderer::Renderer::new(opts);
/// ```
/// # use webrender_traits::{PipelineId, RenderApiSender};
/// # fn example(sender: RenderApiSender) {
/// let api = sender.create_api();
/// ...
/// let pipeline_id = PipelineId(0,0);
/// // ...
/// let pipeline_id = PipelineId(0, 0);
/// api.set_root_pipeline(pipeline_id);
/// # }
/// ```
pub fn set_root_pipeline(&self, pipeline_id: PipelineId) {
let msg = ApiMsg::SetRootPipeline(pipeline_id);
Expand All @@ -289,8 +291,8 @@ impl RenderApi {
///
/// * `background_color`: The background color of this pipeline.
/// * `epoch`: The unique Frame ID, monotonically increasing.
/// * `pipeline_id`: The ID of the pipeline that is supplying this display list.
/// * `viewport_size`: The size of the viewport for this frame.
/// * `pipeline_id`: The ID of the pipeline that is supplying this display list.
/// * `display_list`: The root Display list used in this frame.
/// * `auxiliary_lists`: Various items that the display lists and stacking contexts reference.
/// * `preserve_frame_state`: If a previous frame exists which matches this pipeline
Expand Down Expand Up @@ -325,7 +327,7 @@ impl RenderApi {

/// Scrolls the scrolling layer under the `cursor`
///
/// Webrender looks for the layer closest to the user
/// WebRender looks for the layer closest to the user
/// which has `ScrollPolicy::Scrollable` set.
pub fn scroll(&self, scroll_location: ScrollLocation, cursor: WorldPoint, phase: ScrollEventPhase) {
let msg = ApiMsg::Scroll(scroll_location, cursor, phase);
Expand Down Expand Up @@ -590,7 +592,7 @@ pub trait RenderNotifier: Send {
fn shut_down(&mut self) {}
}

// Trait to allow dispatching functions to a specific thread or event loop.
/// Trait to allow dispatching functions to a specific thread or event loop.
pub trait RenderDispatcher: Send {
fn dispatch(&self, Box<Fn() + Send>);
}

0 comments on commit a2d959b

Please sign in to comment.