servo: Update rust-stb-image
authorBrian Anderson <banderson@mozilla.com>
Sat, 03 Nov 2012 23:17:49 -0700
changeset 333202 633062529a343a347ed88121647782c239125155
parent 333201 056bc68c7200de6b9a6d29da6ab3db5b03d4a150
child 333203 79833e9e7d04fff9d13bbba84f040dbeebc61304
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
servo: Update rust-stb-image Source-Repo: https://github.com/servo/servo Source-Revision: 0866359a100c34861e8306c2a1903ce43f9d3e6d
servo/src/servo/image/base.rs
--- a/servo/src/servo/image/base.rs
+++ b/servo/src/servo/image/base.rs
@@ -17,17 +17,21 @@ pub fn Image(width: uint, height: uint, 
 
 const TEST_IMAGE: [u8 * 4962] = #include_bin("test.jpeg");
 
 fn test_image_bin() -> ~[u8] {
     return vec::from_fn(4962, |i| TEST_IMAGE[i]);
 }
 
 pub fn load_from_memory(buffer: &[u8]) -> Option<Image> {
-    do stb_image::load_from_memory(buffer).map |image| {
+
+    // Can't remember why we do this. Maybe it's what cairo wants
+    const FORCE_DEPTH: uint = 4;
+
+    do stb_image::load_from_memory_with_depth(buffer, FORCE_DEPTH).map |image| {
 
         assert image.depth == 4;
         // Do color space conversion :(
         let data = do vec::from_fn(image.width * image.height * 4) |i| {
             let color = i % 4;
             let pixel = i / 4;
             match color {
               0 => image.data[pixel * 4 + 2],