From 701639315e2aa1870b7db793deb54e5f6f194777 Mon Sep 17 00:00:00 2001 From: Olivier 'reivilibre Date: Sat, 26 Jun 2021 19:15:32 +0100 Subject: [PATCH] Format code --- src/lib.rs | 4 ++-- src/pipeline.rs | 21 ++++++--------------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index b57fbb9..083ff6c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,7 +9,7 @@ mod region; pub use region::Region; -use pipeline::{Vertex, Pipeline}; +use pipeline::{Pipeline, Vertex}; pub use builder::GlyphBrushBuilder; pub use glyph_brush::ab_glyph; @@ -24,9 +24,9 @@ use ab_glyph::{Font, FontArc, Rect}; use core::hash::BuildHasher; use std::borrow::Cow; +use crate::pipeline::VertexGroup; use glyph_brush::{BrushAction, BrushError, DefaultSectionHasher}; use log::{log_enabled, warn}; -use crate::pipeline::VertexGroup; /// Object allowing glyph drawing, containing cache state. Manages glyph positioning cacheing, /// glyph draw caching & efficient GPU texture cache updating and re-sizing on demand. diff --git a/src/pipeline.rs b/src/pipeline.rs index 66dbe81..caa76d1 100644 --- a/src/pipeline.rs +++ b/src/pipeline.rs @@ -125,9 +125,7 @@ impl Pipeline { let num = self.current_instances as i32; for i in 0..num { - gl.draw_arrays(glow::TRIANGLE_STRIP, - i * 4, - 4); + gl.draw_arrays(glow::TRIANGLE_STRIP, i * 4, 4); } gl.bind_vertex_array(None); @@ -278,22 +276,22 @@ impl Vertex { let vert0 = Vertex { tex_pos: [tex_coords.min.x, tex_coords.max.y], pos: [left, top, extra.z], - color: extra.color + color: extra.color, }; let vert1 = Vertex { tex_pos: [tex_coords.max.x, tex_coords.max.y], pos: [right, top, extra.z], - color: extra.color + color: extra.color, }; let vert2 = Vertex { tex_pos: [tex_coords.min.x, tex_coords.min.y], pos: [left, bottom, extra.z], - color: extra.color + color: extra.color, }; let vert3 = Vertex { tex_pos: [tex_coords.max.x, tex_coords.min.y], pos: [right, bottom, extra.z], - color: extra.color + color: extra.color, }; VertexGroup(vert0, vert1, vert2, vert3) @@ -365,14 +363,7 @@ unsafe fn create_instance_buffer( gl.vertex_attrib_pointer_f32(1, 3, glow::FLOAT, false, stride, 4 * 2); gl.enable_vertex_attrib_array(2); - gl.vertex_attrib_pointer_f32( - 2, - 4, - glow::FLOAT, - false, - stride, - 4 * (2 + 3), - ); + gl.vertex_attrib_pointer_f32(2, 4, glow::FLOAT, false, stride, 4 * (2 + 3)); gl.bind_vertex_array(None); gl.bind_buffer(glow::ARRAY_BUFFER, None);