darkfi vor 1 Jahr
Ursprung
Commit
d950dd6e37

+ 23 - 34
bin/app/src/gfx/mod.rs

@@ -177,7 +177,12 @@ impl RenderApi {
         let _ = self.method_req.try_send((epoch, method)).unwrap();
         let _ = self.method_req.try_send((epoch, method)).unwrap();
     }
     }
 
 
-    fn new_unmanaged_texture(&self, width: u16, height: u16, data: Vec<u8>) -> (GfxTextureId, EpochIndex) {
+    fn new_unmanaged_texture(
+        &self,
+        width: u16,
+        height: u16,
+        data: Vec<u8>,
+    ) -> (GfxTextureId, EpochIndex) {
         let gfx_texture_id = NEXT_TEXTURE_ID.fetch_add(1, Ordering::SeqCst);
         let gfx_texture_id = NEXT_TEXTURE_ID.fetch_add(1, Ordering::SeqCst);
 
 
         let method = GraphicsMethod::NewTexture((width, height, data, gfx_texture_id));
         let method = GraphicsMethod::NewTexture((width, height, data, gfx_texture_id));
@@ -194,12 +199,7 @@ impl RenderApi {
         tag: DebugTag,
         tag: DebugTag,
     ) -> ManagedTexturePtr {
     ) -> ManagedTexturePtr {
         let (id, epoch) = self.new_unmanaged_texture(width, height, data);
         let (id, epoch) = self.new_unmanaged_texture(width, height, data);
-        Arc::new(ManagedTexture {
-            id,
-            epoch,
-            render_api: self.clone(),
-            tag,
-        })
+        Arc::new(ManagedTexture { id, epoch, render_api: self.clone(), tag })
     }
     }
 
 
     fn delete_unmanaged_texture(&self, texture: GfxTextureId, epoch: EpochIndex, tag: DebugTag) {
     fn delete_unmanaged_texture(&self, texture: GfxTextureId, epoch: EpochIndex, tag: DebugTag) {
@@ -227,26 +227,20 @@ impl RenderApi {
 
 
     pub fn new_vertex_buffer(&self, verts: Vec<Vertex>, tag: DebugTag) -> ManagedBufferPtr {
     pub fn new_vertex_buffer(&self, verts: Vec<Vertex>, tag: DebugTag) -> ManagedBufferPtr {
         let (id, epoch) = self.new_unmanaged_vertex_buffer(verts);
         let (id, epoch) = self.new_unmanaged_vertex_buffer(verts);
-        Arc::new(ManagedBuffer {
-            id,
-            epoch,
-            render_api: self.clone(),
-            tag,
-            buftype: 0,
-        })
+        Arc::new(ManagedBuffer { id, epoch, render_api: self.clone(), tag, buftype: 0 })
     }
     }
     pub fn new_index_buffer(&self, indices: Vec<u16>, tag: DebugTag) -> ManagedBufferPtr {
     pub fn new_index_buffer(&self, indices: Vec<u16>, tag: DebugTag) -> ManagedBufferPtr {
         let (id, epoch) = self.new_unmanaged_index_buffer(indices);
         let (id, epoch) = self.new_unmanaged_index_buffer(indices);
-        Arc::new(ManagedBuffer {
-            id,
-            epoch,
-            render_api: self.clone(),
-            tag,
-            buftype: 1,
-        })
+        Arc::new(ManagedBuffer { id, epoch, render_api: self.clone(), tag, buftype: 1 })
     }
     }
 
 
-    fn delete_unmanaged_buffer(&self, buffer: GfxBufferId, epoch: EpochIndex, tag: DebugTag, buftype: u8) {
+    fn delete_unmanaged_buffer(
+        &self,
+        buffer: GfxBufferId,
+        epoch: EpochIndex,
+        tag: DebugTag,
+        buftype: u8,
+    ) {
         let method = GraphicsMethod::DeleteBuffer((buffer, tag, buftype));
         let method = GraphicsMethod::DeleteBuffer((buffer, tag, buftype));
         self.send_with_epoch(method, epoch);
         self.send_with_epoch(method, epoch);
     }
     }
@@ -270,7 +264,7 @@ impl GfxDrawMesh {
         self,
         self,
         textures: &HashMap<GfxTextureId, miniquad::TextureId>,
         textures: &HashMap<GfxTextureId, miniquad::TextureId>,
         buffers: &HashMap<GfxBufferId, miniquad::BufferId>,
         buffers: &HashMap<GfxBufferId, miniquad::BufferId>,
-        debug_str: &'static str
+        debug_str: &'static str,
     ) -> Option<DrawMesh> {
     ) -> Option<DrawMesh> {
         let vertex_buffer_id = self.vertex_buffer.id;
         let vertex_buffer_id = self.vertex_buffer.id;
         let index_buffer_id = self.index_buffer.id;
         let index_buffer_id = self.index_buffer.id;
@@ -291,7 +285,7 @@ impl GfxDrawMesh {
     fn try_get_texture(
     fn try_get_texture(
         textures: &HashMap<GfxTextureId, miniquad::TextureId>,
         textures: &HashMap<GfxTextureId, miniquad::TextureId>,
         gfx_texture: ManagedTexturePtr,
         gfx_texture: ManagedTexturePtr,
-        debug_str: &'static str
+        debug_str: &'static str,
     ) -> Option<(ManagedTexturePtr, miniquad::TextureId)> {
     ) -> Option<(ManagedTexturePtr, miniquad::TextureId)> {
         let gfx_texture_id = gfx_texture.id;
         let gfx_texture_id = gfx_texture.id;
 
 
@@ -312,7 +306,7 @@ impl GfxDrawMesh {
     fn try_get_buffer(
     fn try_get_buffer(
         buffers: &HashMap<GfxBufferId, miniquad::BufferId>,
         buffers: &HashMap<GfxBufferId, miniquad::BufferId>,
         gfx_buffer_id: GfxBufferId,
         gfx_buffer_id: GfxBufferId,
-        debug_str: &'static str
+        debug_str: &'static str,
     ) -> Option<miniquad::BufferId> {
     ) -> Option<miniquad::BufferId> {
         let Some(mq_buffer_id) = buffers.get(&gfx_buffer_id) else {
         let Some(mq_buffer_id) = buffers.get(&gfx_buffer_id) else {
             error!(target: "gfx", "Serious error: missing buffer ID={gfx_buffer_id}, debug={debug_str}");
             error!(target: "gfx", "Serious error: missing buffer ID={gfx_buffer_id}, debug={debug_str}");
@@ -343,7 +337,7 @@ impl GfxDrawInstruction {
         self,
         self,
         textures: &HashMap<GfxTextureId, miniquad::TextureId>,
         textures: &HashMap<GfxTextureId, miniquad::TextureId>,
         buffers: &HashMap<GfxBufferId, miniquad::BufferId>,
         buffers: &HashMap<GfxBufferId, miniquad::BufferId>,
-        debug_str: &'static str
+        debug_str: &'static str,
     ) -> Option<DrawInstruction> {
     ) -> Option<DrawInstruction> {
         let instr = match self {
         let instr = match self {
             Self::SetScale(scale) => DrawInstruction::SetScale(scale),
             Self::SetScale(scale) => DrawInstruction::SetScale(scale),
@@ -362,7 +356,7 @@ pub struct GfxDrawCall {
     pub instrs: Vec<GfxDrawInstruction>,
     pub instrs: Vec<GfxDrawInstruction>,
     pub dcs: Vec<u64>,
     pub dcs: Vec<u64>,
     pub z_index: u32,
     pub z_index: u32,
-    pub debug_str: &'static str
+    pub debug_str: &'static str,
 }
 }
 
 
 impl GfxDrawCall {
 impl GfxDrawCall {
@@ -370,14 +364,9 @@ impl GfxDrawCall {
         instrs: Vec<GfxDrawInstruction>,
         instrs: Vec<GfxDrawInstruction>,
         dcs: Vec<u64>,
         dcs: Vec<u64>,
         z_index: u32,
         z_index: u32,
-        debug_str: &'static str
+        debug_str: &'static str,
     ) -> Self {
     ) -> Self {
-        Self {
-            instrs,
-            dcs,
-            z_index,
-            debug_str
-        }
+        Self { instrs, dcs, z_index, debug_str }
     }
     }
 }
 }
 
 

+ 3 - 1
bin/app/src/text2/editor/parley.rs

@@ -75,7 +75,9 @@ impl Editor {
 
 
         self.editor.set_scale(window_scale);
         self.editor.set_scale(window_scale);
         let mut styles = parley::StyleSet::new(font_size);
         let mut styles = parley::StyleSet::new(font_size);
-        styles.insert(parley::StyleProperty::LineHeight(parley::LineHeight::FontSizeRelative(lineheight)));
+        styles.insert(parley::StyleProperty::LineHeight(parley::LineHeight::FontSizeRelative(
+            lineheight,
+        )));
         styles.insert(parley::StyleProperty::FontStack(parley::FontStack::List(FONT_STACK.into())));
         styles.insert(parley::StyleProperty::FontStack(parley::FontStack::List(FONT_STACK.into())));
         styles.insert(parley::StyleProperty::Brush(text_color));
         styles.insert(parley::StyleProperty::Brush(text_color));
         *self.editor.edit_styles() = styles;
         *self.editor.edit_styles() = styles;

+ 5 - 8
bin/app/src/ui/chatedit.rs

@@ -1015,12 +1015,12 @@ impl ChatEdit {
                     content_instrs,
                     content_instrs,
                     vec![self.text_dc_key, self.cursor_dc_key, self.select_dc_key],
                     vec![self.text_dc_key, self.cursor_dc_key, self.select_dc_key],
                     0,
                     0,
-                    "chatedit_content"
+                    "chatedit_content",
                 ),
                 ),
             ),
             ),
             (
             (
                 self.phone_select_handle_dc_key,
                 self.phone_select_handle_dc_key,
-                GfxDrawCall::new(phone_sel_instrs, vec![], 1, "chatedit_phone_sel_scroll")
+                GfxDrawCall::new(phone_sel_instrs, vec![], 1, "chatedit_phone_sel_scroll"),
             ),
             ),
         ];
         ];
         self.render_api.replace_draw_calls(timest, draw_main);
         self.render_api.replace_draw_calls(timest, draw_main);
@@ -1237,7 +1237,7 @@ impl ChatEdit {
                         vec![GfxDrawInstruction::Move(rect.pos())],
                         vec![GfxDrawInstruction::Move(rect.pos())],
                         vec![self.content_dc_key, self.phone_select_handle_dc_key],
                         vec![self.content_dc_key, self.phone_select_handle_dc_key],
                         self.z_index.get(),
                         self.z_index.get(),
-                        "chatedit_root"
+                        "chatedit_root",
                     ),
                     ),
                 ),
                 ),
                 (
                 (
@@ -1246,15 +1246,12 @@ impl ChatEdit {
                         content_instrs,
                         content_instrs,
                         vec![self.text_dc_key, self.cursor_dc_key, self.select_dc_key],
                         vec![self.text_dc_key, self.cursor_dc_key, self.select_dc_key],
                         0,
                         0,
-                        "chatedit_content"
+                        "chatedit_content",
                     ),
                     ),
                 ),
                 ),
                 (self.select_dc_key, GfxDrawCall::new(sel_instrs, vec![], 0, "chatedit_sel")),
                 (self.select_dc_key, GfxDrawCall::new(sel_instrs, vec![], 0, "chatedit_sel")),
                 (self.text_dc_key, GfxDrawCall::new(txt_instrs, vec![], 1, "chatedit_text")),
                 (self.text_dc_key, GfxDrawCall::new(txt_instrs, vec![], 1, "chatedit_text")),
-                (
-                    self.cursor_dc_key,
-                    GfxDrawCall::new(cursor_instrs, vec![], 2, "chatedit_curs"),
-                ),
+                (self.cursor_dc_key, GfxDrawCall::new(cursor_instrs, vec![], 2, "chatedit_curs")),
                 (
                 (
                     self.phone_select_handle_dc_key,
                     self.phone_select_handle_dc_key,
                     GfxDrawCall::new(phone_sel_instrs, vec![], 1, "chatedit_phone_sel"),
                     GfxDrawCall::new(phone_sel_instrs, vec![], 1, "chatedit_phone_sel"),

+ 1 - 1
bin/app/src/ui/chatview/mod.rs

@@ -854,7 +854,7 @@ impl UIObject for ChatView {
             key: self.dc_key,
             key: self.dc_key,
             draw_calls: vec![(
             draw_calls: vec![(
                 self.dc_key,
                 self.dc_key,
-                GfxDrawCall::new(instrs, vec![], self.z_index.get(), "chatview")
+                GfxDrawCall::new(instrs, vec![], self.z_index.get(), "chatview"),
             )],
             )],
         })
         })
     }
     }

+ 3 - 3
bin/app/src/ui/editbox/mod.rs

@@ -1191,7 +1191,7 @@ impl EditBox {
 
 
         let draw_calls = vec![(
         let draw_calls = vec![(
             self.cursor_dc_key,
             self.cursor_dc_key,
-            GfxDrawCall::new(cursor_instrs, vec![], self.z_index.get(), "editbox_curs_redr")
+            GfxDrawCall::new(cursor_instrs, vec![], self.z_index.get(), "editbox_curs_redr"),
         )];
         )];
 
 
         self.render_api.replace_draw_calls(timest, draw_calls);
         self.render_api.replace_draw_calls(timest, draw_calls);
@@ -1247,12 +1247,12 @@ impl EditBox {
                         ],
                         ],
                         vec![self.cursor_dc_key],
                         vec![self.cursor_dc_key],
                         self.z_index.get(),
                         self.z_index.get(),
-                        "editbox_txt"
+                        "editbox_txt",
                     ),
                     ),
                 ),
                 ),
                 (
                 (
                     self.cursor_dc_key,
                     self.cursor_dc_key,
-                    GfxDrawCall::new(cursor_instrs, vec![], self.z_index.get(), "editbox_curs")
+                    GfxDrawCall::new(cursor_instrs, vec![], self.z_index.get(), "editbox_curs"),
                 ),
                 ),
             ],
             ],
         })
         })

+ 1 - 1
bin/app/src/ui/emoji_picker/mod.rs

@@ -268,7 +268,7 @@ impl EmojiPicker {
             key: self.dc_key,
             key: self.dc_key,
             draw_calls: vec![(
             draw_calls: vec![(
                 self.dc_key,
                 self.dc_key,
-                GfxDrawCall::new(instrs, vec![], self.z_index.get(), "emoji")
+                GfxDrawCall::new(instrs, vec![], self.z_index.get(), "emoji"),
             )],
             )],
         })
         })
     }
     }

+ 2 - 5
bin/app/src/ui/image.rs

@@ -173,13 +173,10 @@ impl Image {
             draw_calls: vec![(
             draw_calls: vec![(
                 self.dc_key,
                 self.dc_key,
                 GfxDrawCall::new(
                 GfxDrawCall::new(
-                    vec![
-                        GfxDrawInstruction::Move(rect.pos()),
-                        GfxDrawInstruction::Draw(mesh),
-                    ],
+                    vec![GfxDrawInstruction::Move(rect.pos()), GfxDrawInstruction::Draw(mesh)],
                     vec![],
                     vec![],
                     self.z_index.get(),
                     self.z_index.get(),
-                    "img"
+                    "img",
                 ),
                 ),
             )],
             )],
         })
         })

+ 1 - 1
bin/app/src/ui/layer.rs

@@ -144,7 +144,7 @@ impl Layer {
             vec![GfxDrawInstruction::ApplyView(rect)],
             vec![GfxDrawInstruction::ApplyView(rect)],
             child_calls,
             child_calls,
             self.z_index.get(),
             self.z_index.get(),
-            "layer"
+            "layer",
         );
         );
         draw_calls.push((self.dc_key, dc));
         draw_calls.push((self.dc_key, dc));
         Some(DrawUpdate { key: self.dc_key, draw_calls })
         Some(DrawUpdate { key: self.dc_key, draw_calls })

+ 1 - 1
bin/app/src/ui/text.rs

@@ -166,7 +166,7 @@ impl Text {
             key: self.dc_key,
             key: self.dc_key,
             draw_calls: vec![(
             draw_calls: vec![(
                 self.dc_key,
                 self.dc_key,
-                GfxDrawCall::new(instrs, vec![], self.z_index.get(), "text")
+                GfxDrawCall::new(instrs, vec![], self.z_index.get(), "text"),
             )],
             )],
         })
         })
     }
     }

+ 1 - 1
bin/app/src/ui/vector_art/mod.rs

@@ -151,7 +151,7 @@ impl VectorArt {
             key: self.dc_key,
             key: self.dc_key,
             draw_calls: vec![(
             draw_calls: vec![(
                 self.dc_key,
                 self.dc_key,
-                GfxDrawCall::new(instrs, vec![], self.z_index.get(), "vecart")
+                GfxDrawCall::new(instrs, vec![], self.z_index.get(), "vecart"),
             )],
             )],
         })
         })
     }
     }

+ 1 - 1
bin/app/src/ui/win.rs

@@ -446,7 +446,7 @@ impl Window {
             vec![GfxDrawInstruction::SetScale(self.scale.get())],
             vec![GfxDrawInstruction::SetScale(self.scale.get())],
             child_calls,
             child_calls,
             0,
             0,
-            "win"
+            "win",
         );
         );
         draw_calls.push((0, dc));
         draw_calls.push((0, dc));
         //t!("  => {:?}", draw_calls);
         //t!("  => {:?}", draw_calls);