Skip to content

Commit

Permalink
Fix all CI failures. (#573)
Browse files Browse the repository at this point in the history
* Update Rust stable to 1.82.
* Satisfy Clippy 1.82.
* Update snapshots to reflect the CI macOS 14.7.0 behavior.
([piet-snapshots#35](linebender/piet-snapshots#35))
* Disable Firefox testing on macOS as the new macOS 14 runners don't
have Firefox installed.
  • Loading branch information
xStrom authored Oct 18, 2024
1 parent 3ba6970 commit 059ed69
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 17 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ env:
# version like 1.70. Note that we only specify MAJOR.MINOR and not PATCH so that bugfixes still
# come automatically. If the version specified here is no longer the latest stable version,
# then please feel free to submit a PR that adjusts it along with the potential clippy fixes.
RUST_STABLE_VER: "1.76" # In quotes because otherwise 1.70 would be interpreted as 1.7
RUST_STABLE_VER: "1.82" # In quotes because otherwise 1.70 would be interpreted as 1.7

name: CI

Expand Down Expand Up @@ -157,6 +157,8 @@ jobs:

- name: test firefox
run: wasm-pack test --headless --firefox piet-common
# macOS 14 CI runners don't have Firefox installed
if: contains(matrix.os, 'macos') == false

docs:
name: cargo doc
Expand Down
2 changes: 1 addition & 1 deletion piet-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ png = { version = "0.17.7", optional = true }

[target.'cfg(any(target_os="linux", target_os="openbsd", target_os="freebsd", target_os="netbsd"))'.dependencies]
piet-cairo = { version = "=0.6.2", path = "../piet-cairo" }
cairo-rs = { version = "0.19.0", default_features = false }
cairo-rs = { version = "0.19.0", default-features = false }
cairo-sys-rs = { version = "0.19.0" }

[target.'cfg(any(target_os="macos", target_os="ios"))'.dependencies]
Expand Down
4 changes: 0 additions & 4 deletions piet-common/src/direct2d_back.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ pub struct BitmapTarget<'a> {
context: D2DDeviceContext,
}

trait WrapError<T> {
fn wrap(self) -> Result<T, piet::Error>;
}

impl Device {
/// Create a new device.
///
Expand Down
2 changes: 1 addition & 1 deletion piet-direct2d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ associative-cache = "1.0.1"

wio = "0.2.2"
winapi = { version = "0.3.9", features = ["d2d1", "d2d1_1", "d2d1effects", "d2dbasetypes", "dcommon", "d3d11", "dxgi", "winnls"] }
dwrote = { version = "0.11.0", default_features = false }
dwrote = { version = "0.11.0", default-features = false }

[dev-dependencies]
piet = { version = "=0.6.2", path = "../piet", features = ["samples"] }
Expand Down
8 changes: 4 additions & 4 deletions piet-direct2d/src/d2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -648,10 +648,10 @@ impl DeviceContext {
unsafe {
let params = D2D1_LAYER_PARAMETERS {
contentBounds: D2D1_RECT_F {
left: std::f32::NEG_INFINITY,
top: std::f32::NEG_INFINITY,
right: std::f32::INFINITY,
bottom: std::f32::INFINITY,
left: f32::NEG_INFINITY,
top: f32::NEG_INFINITY,
right: f32::INFINITY,
bottom: f32::INFINITY,
},
geometricMask: mask.0.as_raw(),
maskAntialiasMode: D2D1_ANTIALIAS_MODE_PER_PRIMITIVE,
Expand Down
2 changes: 1 addition & 1 deletion piet-direct2d/src/dwrite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ impl DwriteFactory {
impl FontCollection {
pub(crate) fn font_family(&self, name: &str) -> Option<PietFontFamily> {
let wname = name.to_wide_null();
let mut idx = u32::max_value();
let mut idx = u32::MAX;
let mut exists = 0_i32;

let family = unsafe {
Expand Down
2 changes: 1 addition & 1 deletion piet-direct2d/src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ fn resolve_family_name(family: &FontFamily) -> &str {
impl LoadedFontsInner {
fn add(&mut self, font_data: &[u8]) -> Result<FontFamily, Error> {
let font_data: Arc<Vec<u8>> = Arc::new(font_data.to_owned());
let font_file = FontFile::new_from_data(font_data).ok_or(Error::FontLoadingFailed)?;
let font_file = FontFile::new_from_buffer(font_data).ok_or(Error::FontLoadingFailed)?;
let collection_loader = CustomFontCollectionLoaderImpl::new(&[font_file.clone()]);
let collection = FontCollection::from_loader(collection_loader);
let mut families = collection.families_iter();
Expand Down
2 changes: 2 additions & 0 deletions piet-web/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,10 @@ impl WebRenderContext<'_> {
fn set_brush(&mut self, brush: &Brush, is_fill: bool) {
let value = self.brush_value(brush);
if is_fill {
#[allow(deprecated)]
self.ctx.set_fill_style(&value);
} else {
#[allow(deprecated)]
self.ctx.set_stroke_style(&value);
}
}
Expand Down
4 changes: 2 additions & 2 deletions piet-web/src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ impl WebTextLayout {
// various functions like `text_width` are stateful, and require
// the context to be configured correcttly.
self.ctx.set_font(&self.font.get_font_string());
let new_width = new_width.into().unwrap_or(std::f64::INFINITY);
let new_width = new_width.into().unwrap_or(f64::INFINITY);
let mut line_metrics =
lines::calculate_line_metrics(&self.text, &self.ctx, new_width, self.font.size);

Expand Down Expand Up @@ -630,7 +630,7 @@ pub(crate) mod test {

//let mut text_layout = D2DText::new();
//let font = text_layout.new_font_by_name("sans-serif", 12.0).build().unwrap();
//let layout = text_layout.new_text_layout(&font, input, std::f64::INFINITY).build().unwrap();
//let layout = text_layout.new_text_layout(&font, input, f64::INFINITY).build().unwrap();

//assert_eq!(input.graphemes(true).count(), 1);
//assert_eq!(layout.hit_test_text_position(0, true).map(|p| p.point_x as f64), Some(layout.size().width));
Expand Down
2 changes: 1 addition & 1 deletion piet/snapshots
Submodule snapshots updated 35 files
+1 −1 coregraphics/GENERATED_BY
+ coregraphics/coregraphics-test-00-1.00.png
+ coregraphics/coregraphics-test-00-2.00.png
+ coregraphics/coregraphics-test-01-1.00.png
+ coregraphics/coregraphics-test-01-2.00.png
+ coregraphics/coregraphics-test-02-1.00.png
+ coregraphics/coregraphics-test-02-2.00.png
+ coregraphics/coregraphics-test-03-1.00.png
+ coregraphics/coregraphics-test-03-2.00.png
+ coregraphics/coregraphics-test-04-1.00.png
+ coregraphics/coregraphics-test-04-2.00.png
+ coregraphics/coregraphics-test-05-1.00.png
+ coregraphics/coregraphics-test-05-2.00.png
+ coregraphics/coregraphics-test-06-1.00.png
+ coregraphics/coregraphics-test-06-2.00.png
+ coregraphics/coregraphics-test-07-1.00.png
+ coregraphics/coregraphics-test-07-2.00.png
+ coregraphics/coregraphics-test-08-1.00.png
+ coregraphics/coregraphics-test-08-2.00.png
+ coregraphics/coregraphics-test-09-1.00.png
+ coregraphics/coregraphics-test-09-2.00.png
+ coregraphics/coregraphics-test-10-1.00.png
+ coregraphics/coregraphics-test-10-2.00.png
+ coregraphics/coregraphics-test-11-1.00.png
+ coregraphics/coregraphics-test-11-2.00.png
+ coregraphics/coregraphics-test-12-1.00.png
+ coregraphics/coregraphics-test-12-2.00.png
+ coregraphics/coregraphics-test-13-1.00.png
+ coregraphics/coregraphics-test-13-2.00.png
+ coregraphics/coregraphics-test-14-1.00.png
+ coregraphics/coregraphics-test-14-2.00.png
+ coregraphics/coregraphics-test-15-1.00.png
+ coregraphics/coregraphics-test-15-2.00.png
+ coregraphics/coregraphics-test-16-1.00.png
+ coregraphics/coregraphics-test-16-2.00.png
2 changes: 1 addition & 1 deletion piet/src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ pub enum TextAlignment {
/// - The beginning of a line has text position `0`.
/// - The end of a line is a valid text position. e.g. `text.len()` is a valid text position.
/// - If the text position is not at a code point or grapheme boundary, undesirable behavior may
/// occur.
/// occur.
pub trait TextLayout: Clone {
/// The total size of this `TextLayout`.
///
Expand Down

0 comments on commit 059ed69

Please sign in to comment.