mirror of
https://github.com/itsjunetime/tdf.git
synced 2026-06-01 23:51:46 -04:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 997631aac9 | |||
| 725c6c6bfd | |||
| fca61d55b5 |
@@ -11,7 +11,6 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
tip_release_path: RELEASE.md
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-build:
|
test-build:
|
||||||
@@ -107,39 +106,3 @@ jobs:
|
|||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
files: release-artifacts/*
|
files: release-artifacts/*
|
||||||
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
|
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
|
||||||
|
|
||||||
tip-release:
|
|
||||||
name: Release tip on push to main
|
|
||||||
runs-on: ubuntu-slim
|
|
||||||
if: github.event_name == 'push' && github.ref_name == 'main'
|
|
||||||
needs: test-build
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v6
|
|
||||||
- name: Download prebuilt artifacts
|
|
||||||
uses: actions/download-artifact@v7
|
|
||||||
with:
|
|
||||||
path: release-artifacts
|
|
||||||
merge-multiple: true
|
|
||||||
|
|
||||||
- name: Generate release notes
|
|
||||||
run: |
|
|
||||||
tree release-artifacts/
|
|
||||||
echo "From commit: $(git rev-parse --short HEAD)" > ${{ env.tip_release_path }}
|
|
||||||
echo "Generated on: $(date -u +"%Y-%m-%d %H:%M") UTC" >> ${{ env.tip_release_path }}
|
|
||||||
cat ${{ env.tip_release_path }}
|
|
||||||
|
|
||||||
- name: Update the tip tag
|
|
||||||
run: |
|
|
||||||
git config user.name "github-actions[bot]"
|
|
||||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
||||||
git tag --force tip && git push --force origin tag tip
|
|
||||||
|
|
||||||
- name: Update the draft tip release
|
|
||||||
uses: softprops/action-gh-release@v2
|
|
||||||
with:
|
|
||||||
prerelease: true
|
|
||||||
files: release-artifacts/*
|
|
||||||
tag_name: tip
|
|
||||||
name: Tip Build
|
|
||||||
body_path: ${{ env.tip_release_path }}
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
# Unreleased
|
# Unreleased
|
||||||
|
|
||||||
|
- Added windows support! (thank you to [@jarjk](https://github.com/jarjk) for helping out!)
|
||||||
- Added keybindings (`0`/`$`) to scroll to left or right side of zoomed-in image ([#131](https://github.com/itsjunetime/tdf/pull/131), thank you [@IshDeshpa](https://github.com/IshDeshpa)!)
|
- Added keybindings (`0`/`$`) to scroll to left or right side of zoomed-in image ([#131](https://github.com/itsjunetime/tdf/pull/131), thank you [@IshDeshpa](https://github.com/IshDeshpa)!)
|
||||||
|
- (Internal) decreased runtime footprint of tokio runtime
|
||||||
|
|
||||||
# v0.5.0
|
# v0.5.0
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,12 @@ fn for_all_combos(
|
|||||||
name: &'static str,
|
name: &'static str,
|
||||||
mut f: impl FnMut(&Runtime, BenchmarkId, &'static str, ProtocolType)
|
mut f: impl FnMut(&Runtime, BenchmarkId, &'static str, ProtocolType)
|
||||||
) {
|
) {
|
||||||
let rt = tokio::runtime::Runtime::new().unwrap();
|
let rt = tokio::runtime::Builder::new_multi_thread()
|
||||||
|
.worker_threads(3)
|
||||||
|
.enable_time()
|
||||||
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
for proto in PROTOS {
|
for proto in PROTOS {
|
||||||
for file in FILES {
|
for file in FILES {
|
||||||
f(
|
f(
|
||||||
|
|||||||
+1
-1
Submodule ratatui-image updated: a276a87cb8...8ad154a219
+23
-16
@@ -1,11 +1,12 @@
|
|||||||
use std::{
|
use std::{
|
||||||
|
io::Cursor,
|
||||||
num::NonZeroUsize,
|
num::NonZeroUsize,
|
||||||
time::{SystemTime, UNIX_EPOCH}
|
time::{SystemTime, UNIX_EPOCH}
|
||||||
};
|
};
|
||||||
|
|
||||||
use flume::{Receiver, SendError, Sender, TryRecvError};
|
use flume::{Receiver, SendError, Sender, TryRecvError};
|
||||||
use futures_util::stream::StreamExt as _;
|
use futures_util::stream::StreamExt as _;
|
||||||
use image::DynamicImage;
|
use image::{DynamicImage, codecs::pnm::PnmDecoder};
|
||||||
use kittage::{NumberOrId, action::NONZERO_ONE};
|
use kittage::{NumberOrId, action::NONZERO_ONE};
|
||||||
use ratatui::layout::Rect;
|
use ratatui::layout::Rect;
|
||||||
use ratatui_image::{
|
use ratatui_image::{
|
||||||
@@ -111,22 +112,26 @@ pub async fn run_conversion_loop(
|
|||||||
return Ok(None);
|
return Ok(None);
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut dyn_img = image::load_from_memory_with_format(
|
let decoder = PnmDecoder::new(Cursor::new(&page_info.img_data.pixels)).map_err(|e| {
|
||||||
&page_info.img_data.pixels,
|
RenderError::Converting(format!(
|
||||||
image::ImageFormat::Pnm
|
"The image data provided from mupdf was not in pnm format ({e}); don't know how to convert"
|
||||||
)
|
))
|
||||||
.map_err(|e| RenderError::Converting(format!("Can't load image: {e}")))?;
|
})?;
|
||||||
|
|
||||||
match dyn_img {
|
// The image we get should always already be `ImageRgb8`, so this `into` shouldn't do any
|
||||||
DynamicImage::ImageRgb8(ref mut img) =>
|
// conversions or anything, but just in case some underlying detail of mupdf or image
|
||||||
for quad in &*page_info.result_rects {
|
// changes, we do the `into` instead of just `match + unreachable!()` to avoid panicking
|
||||||
img.par_enumerate_pixels_mut()
|
let mut dyn_img = DynamicImage::from_decoder(decoder)
|
||||||
.filter(|(x, y, _)| {
|
.map_err(|e| RenderError::Converting(format!("Can't load image: {e}")))?
|
||||||
*x > quad.ul_x && *x < quad.lr_x && *y > quad.ul_y && *y < quad.lr_y
|
.into_rgb8();
|
||||||
})
|
|
||||||
.for_each(|(_, _, px)| px.0[2] = px.0[2].saturating_sub(u8::MAX / 2));
|
for quad in &*page_info.result_rects {
|
||||||
},
|
dyn_img
|
||||||
_ => unreachable!()
|
.par_enumerate_pixels_mut()
|
||||||
|
.filter(|(x, y, _)| {
|
||||||
|
*x > quad.ul_x && *x < quad.lr_x && *y > quad.ul_y && *y < quad.lr_y
|
||||||
|
})
|
||||||
|
.for_each(|(_, _, px)| px.0[2] = px.0[2].saturating_sub(u8::MAX / 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
let img_area = Rect {
|
let img_area = Rect {
|
||||||
@@ -136,6 +141,8 @@ pub async fn run_conversion_loop(
|
|||||||
y: 0
|
y: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let dyn_img = DynamicImage::ImageRgb8(dyn_img);
|
||||||
|
|
||||||
let txt_img = match picker.protocol_type() {
|
let txt_img = match picker.protocol_type() {
|
||||||
ProtocolType::Kitty => {
|
ProtocolType::Kitty => {
|
||||||
let rn = SystemTime::now()
|
let rn = SystemTime::now()
|
||||||
|
|||||||
+12
-5
@@ -70,11 +70,18 @@ fn reset_term() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::main]
|
fn main() -> Result<(), WrappedErr> {
|
||||||
async fn main() -> Result<(), WrappedErr> {
|
let rt = tokio::runtime::Builder::new_multi_thread()
|
||||||
let result = inner_main().await;
|
.worker_threads(3)
|
||||||
reset_term();
|
.enable_time()
|
||||||
result
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
rt.block_on(async move {
|
||||||
|
let result = inner_main().await;
|
||||||
|
reset_term();
|
||||||
|
result
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn inner_main() -> Result<(), WrappedErr> {
|
async fn inner_main() -> Result<(), WrappedErr> {
|
||||||
|
|||||||
Reference in New Issue
Block a user