aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGlenn Watson <gw@intuitionlibrary.com>2014-09-02 15:58:36 +1000
committerGlenn Watson <gw@intuitionlibrary.com>2014-09-02 15:58:38 +1000
commit78ef16bfaeb23e35e0e0adf1ddf8e756a444815d (patch)
tree3c3a0ea6d280a97576dab0bda55ea0fadf41018c /src
parenta5965442b5c886bdf1553d65aded1a379f812dc8 (diff)
downloadservo-78ef16bfaeb23e35e0e0adf1ddf8e756a444815d.tar.gz
servo-78ef16bfaeb23e35e0e0adf1ddf8e756a444815d.zip
Fix task failure when loading wikipedia.
There is still an issue with alpha display, so there is likely a problem elsewhere, but this at least allows the page to load for now (ref #2554).
Diffstat (limited to 'src')
-rw-r--r--src/components/gfx/render_context.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/components/gfx/render_context.rs b/src/components/gfx/render_context.rs
index 31c68e7c34d..68449cdff19 100644
--- a/src/components/gfx/render_context.rs
+++ b/src/components/gfx/render_context.rs
@@ -5,7 +5,7 @@
use font_context::FontContext;
use style::computed_values::border_style;
-use azure::azure_hl::{B8G8R8A8, Color, ColorPattern, DrawOptions, DrawSurfaceOptions, DrawTarget};
+use azure::azure_hl::{B8G8R8A8, A8, Color, ColorPattern, DrawOptions, DrawSurfaceOptions, DrawTarget};
use azure::azure_hl::{Linear, SourceOp, StrokeOptions};
use azure::AZ_CAP_BUTT;
use azure::AzFloat;
@@ -100,9 +100,11 @@ impl<'a> RenderContext<'a> {
pub fn draw_image(&self, bounds: Rect<Au>, image: Arc<Box<Image>>) {
let size = Size2D(image.width as i32, image.height as i32);
- let (pixel_width, pixels) = match image.pixels {
- RGBA8(ref pixels) => (4, pixels.as_slice()),
- RGB8(_) | K8(_) | KA8(_) => fail!("color type not supported"),
+ let (pixel_width, pixels, source_format) = match image.pixels {
+ RGBA8(ref pixels) => (4, pixels.as_slice(), B8G8R8A8),
+ K8(ref pixels) => (1, pixels.as_slice(), A8),
+ RGB8(_) => fail!("RGB8 color type not supported"),
+ KA8(_) => fail!("KA8 color type not supported"),
};
let stride = image.width * pixel_width;
@@ -111,7 +113,7 @@ impl<'a> RenderContext<'a> {
let azure_surface = draw_target_ref.create_source_surface_from_data(pixels,
size,
stride as i32,
- B8G8R8A8);
+ source_format);
let source_rect = Rect(Point2D(0u as AzFloat, 0u as AzFloat),
Size2D(image.width as AzFloat, image.height as AzFloat));
let dest_rect = bounds.to_azure_rect();