Skip to content

Commit ca80ecb

Browse files
author
bors-servo
authored
Auto merge of #1785 - kvark:logging, r=glennw
Logging for examples This enables logging, also makes the text drawing path of the basic example to actually work again. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/1785) <!-- Reviewable:end -->
2 parents bbc60b9 + 694516e commit ca80ecb

File tree

5 files changed

+9
-4
lines changed

5 files changed

+9
-4
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webrender/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ serde_derive = { optional = true, version = "1.0" }
3535

3636
[dev-dependencies]
3737
angle = {git = "https://github.com/servo/angle", branch = "servo"}
38+
env_logger = "0.4"
3839
rand = "0.3" # for the benchmarks
3940
servo-glutin = "0.12" # for the example apps
4041

webrender/examples/basic.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,18 +247,18 @@ impl Example for App {
247247

248248
let info = LayoutPrimitiveInfo::new((100, 100).to(200, 200));
249249
builder.push_border(&info, border_widths, border_details);
250-
250+
builder.pop_clip_id();
251251

252252
if false {
253253
// draw text?
254254
let font_key = api.generate_font_key();
255-
let font_bytes = load_file("res/FreeSans.ttf");
255+
let font_bytes = load_file("../wrench/reftest/text/FreeSans.ttf");
256256
resources.add_raw_font(font_key, font_bytes, 0);
257257

258258
let font_instance_key = api.generate_font_instance_key();
259259
resources.add_font_instance(font_instance_key, font_key, Au::from_px(32), None, None, Vec::new());
260260

261-
let text_bounds = (100, 200).by(700, 300);
261+
let text_bounds = (100, 50).by(700, 200);
262262
let glyphs = vec![
263263
GlyphInstance {
264264
index: 48,
@@ -344,7 +344,6 @@ impl Example for App {
344344
);
345345
}
346346

347-
builder.pop_clip_id();
348347
builder.pop_stacking_context();
349348
}
350349

webrender/examples/common/boilerplate.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

5+
extern crate env_logger;
6+
57
use gleam::gl;
68
use glutin;
79
use std::env;
@@ -77,6 +79,8 @@ pub trait Example {
7779
}
7880

7981
pub fn main_wrapper(example: &mut Example, options: Option<webrender::RendererOptions>) {
82+
env_logger::init().unwrap();
83+
8084
let args: Vec<String> = env::args().collect();
8185
let res_path = if args.len() > 1 {
8286
Some(PathBuf::from(&args[1]))

wrench/reftests/text/FreeSans.ttf

698 KB
Binary file not shown.

0 commit comments

Comments
 (0)