mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Qualify Azure enums.
This commit is contained in:
parent
be5e9b4278
commit
9068e62f2a
4 changed files with 32 additions and 29 deletions
|
@ -2,8 +2,8 @@
|
|||
* 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 azure::azure_hl::{DrawTarget, Color, B8G8R8A8, SkiaBackend, StrokeOptions, DrawOptions};
|
||||
use azure::azure_hl::{ColorPattern, ColorPatternRef};
|
||||
use azure::azure_hl::{DrawTarget, Color, SurfaceFormat, BackendType, StrokeOptions, DrawOptions};
|
||||
use azure::azure_hl::{ColorPattern, PatternRef};
|
||||
use geom::rect::Rect;
|
||||
use geom::size::Size2D;
|
||||
use servo_util::task::spawn_named;
|
||||
|
@ -55,7 +55,8 @@ impl CanvasPaintTask {
|
|||
|
||||
fn fill_rect(&self, rect: &Rect<f32>) {
|
||||
let drawopts = DrawOptions::new(1.0, 0);
|
||||
self.drawtarget.fill_rect(rect, ColorPatternRef(&self.fill_color), Some(&drawopts));
|
||||
self.drawtarget.fill_rect(rect, PatternRef::ColorPatternRef(&self.fill_color),
|
||||
Some(&drawopts));
|
||||
}
|
||||
|
||||
fn clear_rect(&self, rect: &Rect<f32>) {
|
||||
|
@ -68,7 +69,7 @@ impl CanvasPaintTask {
|
|||
}
|
||||
|
||||
fn create(size: Size2D<i32>) -> DrawTarget {
|
||||
DrawTarget::new(SkiaBackend, size, B8G8R8A8)
|
||||
DrawTarget::new(BackendType::SkiaBackend, size, SurfaceFormat::B8G8R8A8)
|
||||
}
|
||||
|
||||
fn recreate(&mut self, size: Size2D<i32>) {
|
||||
|
|
|
@ -22,21 +22,22 @@ use std::cell::RefCell;
|
|||
use sync::Arc;
|
||||
|
||||
use azure::AzFloat;
|
||||
use azure::azure_hl::SkiaBackend;
|
||||
use azure::azure_hl::BackendType;
|
||||
use azure::scaled_font::ScaledFont;
|
||||
|
||||
#[cfg(any(target_os="linux", target_os = "android"))]
|
||||
use azure::scaled_font::FontData;
|
||||
use azure::scaled_font::FontInfo;
|
||||
|
||||
#[cfg(any(target_os="linux", target_os = "android"))]
|
||||
fn create_scaled_font(template: &Arc<FontTemplateData>, pt_size: Au) -> ScaledFont {
|
||||
ScaledFont::new(SkiaBackend, FontData(&template.bytes), pt_size.to_subpx() as AzFloat)
|
||||
ScaledFont::new(BackendType::SkiaBackend, FontInfo::FontData(&template.bytes),
|
||||
pt_size.to_subpx() as AzFloat)
|
||||
}
|
||||
|
||||
#[cfg(target_os="macos")]
|
||||
fn create_scaled_font(template: &Arc<FontTemplateData>, pt_size: Au) -> ScaledFont {
|
||||
let cgfont = template.ctfont.as_ref().unwrap().copy_to_CGFont();
|
||||
ScaledFont::new(SkiaBackend, &cgfont, pt_size.to_subpx() as AzFloat)
|
||||
ScaledFont::new(BackendType::SkiaBackend, &cgfont, pt_size.to_subpx() as AzFloat)
|
||||
}
|
||||
|
||||
static SMALL_CAPS_SCALE_FACTOR: f64 = 0.8; // Matches FireFox (see gfxFont.h)
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
//! Painting of display lists using Moz2D/Azure.
|
||||
|
||||
use azure::azure::AzIntSize;
|
||||
use azure::azure_hl::{A8, B8G8R8A8, Color, ColorPattern, ColorPatternRef, DrawOptions};
|
||||
use azure::azure_hl::{DrawSurfaceOptions, DrawTarget, ExtendClamp, GaussianBlurFilterType};
|
||||
use azure::azure_hl::{GaussianBlurInput, GradientStop, Linear, LinearGradientPattern};
|
||||
use azure::azure_hl::{LinearGradientPatternRef, Path, PathBuilder, SourceOp};
|
||||
use azure::azure_hl::{StdDeviationGaussianBlurAttribute, StrokeOptions};
|
||||
use azure::azure_hl::{SurfaceFormat, Color, ColorPattern, DrawOptions};
|
||||
use azure::azure_hl::{DrawSurfaceOptions, DrawTarget, ExtendMode, FilterType};
|
||||
use azure::azure_hl::{GaussianBlurInput, GradientStop, Filter, LinearGradientPattern};
|
||||
use azure::azure_hl::{PatternRef, Path, PathBuilder, CompositionOp};
|
||||
use azure::azure_hl::{GaussianBlurAttribute, StrokeOptions};
|
||||
use azure::scaled_font::ScaledFont;
|
||||
use azure::{AZ_CAP_BUTT, AzFloat, struct__AzDrawOptions, struct__AzGlyph};
|
||||
use azure::{struct__AzGlyphBuffer, struct__AzPoint, AzDrawTargetFillGlyphs};
|
||||
|
@ -72,7 +72,7 @@ impl<'a> PaintContext<'a> {
|
|||
pub fn draw_solid_color(&self, bounds: &Rect<Au>, color: Color) {
|
||||
self.draw_target.make_current();
|
||||
self.draw_target.fill_rect(&bounds.to_azure_rect(),
|
||||
ColorPatternRef(&ColorPattern::new(color)),
|
||||
PatternRef::ColorPatternRef(&ColorPattern::new(color)),
|
||||
None);
|
||||
}
|
||||
|
||||
|
@ -123,8 +123,8 @@ impl<'a> PaintContext<'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, source_format) = match image.pixels {
|
||||
RGBA8(ref pixels) => (4, pixels.as_slice(), B8G8R8A8),
|
||||
K8(ref pixels) => (1, pixels.as_slice(), A8),
|
||||
RGBA8(ref pixels) => (4, pixels.as_slice(), SurfaceFormat::B8G8R8A8),
|
||||
K8(ref pixels) => (1, pixels.as_slice(), SurfaceFormat::A8),
|
||||
RGB8(_) => panic!("RGB8 color type not supported"),
|
||||
KA8(_) => panic!("KA8 color type not supported"),
|
||||
};
|
||||
|
@ -139,7 +139,7 @@ impl<'a> PaintContext<'a> {
|
|||
let source_rect = Rect(Point2D(0.0, 0.0),
|
||||
Size2D(image.width as AzFloat, image.height as AzFloat));
|
||||
let dest_rect = bounds.to_azure_rect();
|
||||
let draw_surface_options = DrawSurfaceOptions::new(Linear, true);
|
||||
let draw_surface_options = DrawSurfaceOptions::new(Filter::Linear, true);
|
||||
let draw_options = DrawOptions::new(1.0, 0);
|
||||
draw_target_ref.draw_surface(azure_surface,
|
||||
dest_rect,
|
||||
|
@ -155,9 +155,10 @@ impl<'a> PaintContext<'a> {
|
|||
Size2D(self.screen_rect.size.width as AzFloat,
|
||||
self.screen_rect.size.height as AzFloat));
|
||||
let mut draw_options = DrawOptions::new(1.0, 0);
|
||||
draw_options.set_composition_op(SourceOp);
|
||||
draw_options.set_composition_op(CompositionOp::SourceOp);
|
||||
self.draw_target.make_current();
|
||||
self.draw_target.fill_rect(&rect, ColorPatternRef(&pattern), Some(&draw_options));
|
||||
self.draw_target.fill_rect(&rect, PatternRef::ColorPatternRef(&pattern),
|
||||
Some(&draw_options));
|
||||
}
|
||||
|
||||
fn draw_border_segment(&self,
|
||||
|
@ -855,14 +856,14 @@ impl<'a> PaintContext<'a> {
|
|||
stops: &[GradientStop]) {
|
||||
self.draw_target.make_current();
|
||||
|
||||
let stops = self.draw_target.create_gradient_stops(stops, ExtendClamp);
|
||||
let stops = self.draw_target.create_gradient_stops(stops, ExtendMode::ExtendClamp);
|
||||
let pattern = LinearGradientPattern::new(&start_point.to_azure_point(),
|
||||
&end_point.to_azure_point(),
|
||||
stops,
|
||||
&Matrix2D::identity());
|
||||
|
||||
self.draw_target.fill_rect(&bounds.to_azure_rect(),
|
||||
LinearGradientPatternRef(&pattern),
|
||||
PatternRef::LinearGradientPatternRef(&pattern),
|
||||
None);
|
||||
}
|
||||
|
||||
|
@ -905,7 +906,7 @@ impl<'a> PaintContext<'a> {
|
|||
temporary_draw_target.set_transform(&Matrix2D::identity());
|
||||
let rect = Rect(Point2D(0.0, 0.0), self.draw_target.get_size().to_azure_size());
|
||||
let source_surface = temporary_draw_target.snapshot();
|
||||
let draw_surface_options = DrawSurfaceOptions::new(Linear, true);
|
||||
let draw_surface_options = DrawSurfaceOptions::new(Filter::Linear, true);
|
||||
let draw_options = DrawOptions::new(opacity, 0);
|
||||
self.draw_target.draw_surface(source_surface,
|
||||
rect,
|
||||
|
@ -970,9 +971,9 @@ impl<'a> PaintContext<'a> {
|
|||
if blur_radius > Au(0) {
|
||||
// Go ahead and create the blur now. Despite the name, Azure's notion of `StdDeviation`
|
||||
// describes the blur radius, not the sigma for the Gaussian blur.
|
||||
let blur_filter = self.draw_target.create_filter(GaussianBlurFilterType);
|
||||
blur_filter.set_attribute(StdDeviationGaussianBlurAttribute(blur_radius.to_subpx() as
|
||||
AzFloat));
|
||||
let blur_filter = self.draw_target.create_filter(FilterType::GaussianBlurFilterType);
|
||||
blur_filter.set_attribute(GaussianBlurAttribute::StdDeviationGaussianBlurAttribute(
|
||||
blur_radius.to_subpx() as AzFloat));
|
||||
blur_filter.set_input(GaussianBlurInput, &temporary_draw_target.snapshot());
|
||||
|
||||
// Blit the blur onto the tile. We undo the transforms here because we want to directly
|
||||
|
|
|
@ -10,7 +10,7 @@ use font_cache_task::FontCacheTask;
|
|||
use font_context::FontContext;
|
||||
use paint_context::PaintContext;
|
||||
|
||||
use azure::azure_hl::{B8G8R8A8, Color, DrawTarget, SkiaBackend, StolenGLResources};
|
||||
use azure::azure_hl::{SurfaceFormat, Color, DrawTarget, BackendType, StolenGLResources};
|
||||
use azure::AzFloat;
|
||||
use geom::matrix2d::Matrix2D;
|
||||
use geom::point::Point2D;
|
||||
|
@ -525,14 +525,14 @@ impl WorkerThread {
|
|||
-> DrawTarget {
|
||||
let size = Size2D(tile.screen_rect.size.width as i32, tile.screen_rect.size.height as i32);
|
||||
let draw_target = if !opts::get().gpu_painting {
|
||||
DrawTarget::new(SkiaBackend, size, B8G8R8A8)
|
||||
DrawTarget::new(BackendType::SkiaBackend, size, SurfaceFormat::B8G8R8A8)
|
||||
} else {
|
||||
// FIXME(pcwalton): Cache the components of draw targets (texture color buffer,
|
||||
// paintbuffers) instead of recreating them.
|
||||
let draw_target = DrawTarget::new_with_fbo(SkiaBackend,
|
||||
let draw_target = DrawTarget::new_with_fbo(BackendType::SkiaBackend,
|
||||
native_graphics_context!(self),
|
||||
size,
|
||||
B8G8R8A8);
|
||||
SurfaceFormat::B8G8R8A8);
|
||||
draw_target.make_current();
|
||||
draw_target
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue