Skip to content

Commit 81178c7

Browse files
Update README.md
1 parent 691b072 commit 81178c7

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ A simple and lightweight tool for extracting text from a screenshot/image (on th
44

55
## Optimization
66

7-
- **Screen capture uses the fastest available hardware path per platform**: DXGI Desktop Duplication on Windows acquires frames directly from the GPU's front buffer via a staging texture mapped for CPU read, avoiding any GDI software rasterization; XGetImage on X11 takes a direct 32bpp packed-pixel fast path (a single `memcpy`-equivalent row scan), falling back to the `XGetPixel` generic path only when the pixel format does not match the expected mask layout. The screen is then kept as a single RGBA buffer in memory for the entire session; all cropping, annotation rendering, and encoding operate on that buffer without re-capturing.
7+
- **Screen capture uses the fastest available hardware path (X11, Windows)**: DXGI Desktop Duplication on Windows acquires frames directly from the GPU's front buffer via a staging texture mapped for CPU read, avoiding any GDI software rasterization; XGetImage on X11 takes a direct 32bpp packed-pixel fast path (a single `memcpy`-equivalent row scan), falling back to the `XGetPixel` generic path only when the pixel format does not match the expected mask layout. The screen is then kept as a single RGBA buffer in memory for the entire session; all cropping, annotation rendering, and encoding operate on that buffer without re-capturing.
88

99
- The fullscreen overlay is a **borderless windowed surface** rather than exclusive fullscreen, avoiding implicit GPU mode switches and the display state corruption they can leave behind on abnormal exit. Can also be changed via configuration file.
1010

1111
- **OCR, barcode scanning, and font loading are all on-demand**: none are initialized at startup; Tesseract and ZBar are only configured when the user triggers an extraction, and the Tesseract engine instance is reused across extractions within a session, re-initializing only when the model or data path changes. Tesseract page segmentation mode is additionally dispatched in **O(1)** via area and aspect ratio heuristics before OCR runs, avoiding full-page layout analysis on small single-word or single-line regions.
1212

13-
- **Annotation geometry is rendered entirely through ImGui draw lists on the GPU**, with CPU-side pixel rasterization only used when baking annotations into the saved image. The rasterizer uses **Bresenham's line algorithm**, O(max(Δx, Δy)), and a **midpoint circle algorithm**, O(radius), rather than naive scanline fills.
13+
- **Annotation geometry is rendered entirely through ImGui draw lists on the GPU**, with CPU-side pixel rasterization only used when baking annotations into the saved image. The rasterizer uses **Bresenham's line algorithm** `O(max(Δx, Δy))` and a **midpoint circle algorithm** `O(radius)` rather than naive scanline fills.
1414

1515
- **Pencil stroke point reduction uses a squared-distance threshold**, comparing `dx²+dy² > 4.0` rather than computing `sqrt`, keeping the per-mouse-move check O(1) with no transcendental function call and keeping the point array small regardless of how long the user draws.
1616

1717
- **Grayscale conversion for barcode scanning uses integer-only ITU-R BT.601 weights** `(77r + 150g + 29b) >> 8` rather than floating-point luminance coefficients, keeping the O(w×h) pixel walk entirely in the integer pipeline.
1818

19-
- **Monitor detection under XRandR is O(monitors)**, querying only the list of attached outputs and comparing cursor coordinates against their bounding rectangles, never touching pixel data.
19+
- **Monitor detection is O(monitors)**, querying only the list of attached outputs and comparing cursor coordinates against their bounding rectangles, never touching pixel data.
2020

2121
- **The font cache is an O(log n) lookup** keyed on `(path, size)`, ensuring repeated renders of the same annotated text at the same size never trigger atlas rebuilds or filesystem access.
2222

0 commit comments

Comments
 (0)