apps/kiv: loading icons from shared memory, libs/libimg: crop function #573
Dismiss Review
Are you sure you want to dismiss this review?
Labels
Clear labels
Influence/Text/TYPO
AI
Eolite
FS
GSoC
Good First PR
HLL
HardwareTested
IRCC
Influence/Settings
Lang/C
Lang/FASM
Pay for the code
Subsystem/API
Subsystem/Audio
Subsystem/Graphics
Subsystem/IPC and events
Subsystem/Memory
Subsystem/Network
Subsystem/Services(daemon)
Subsystem/Taskmanager
Subsystem/VFS
Subsystem/Window
This issue or PR in the Google Source of Code program
The issue is suitable to beginners
Paid task
infinity service, audio drivers, midi, speacker, audio programs
vesa, vga, framebuffer, cursors, blitter, and video drivers
pipes, signals, events, shared memory
virt and phys memory allocators, malloc and other
userspace and kernel(for example: serial) services
process, threads, run apps, scheduler
drivers from filesystem, fs api, blkdev, programs that work with the file system
windows, skins, buttons, mouse and keyboard code for windows (not the base code)
Category
Applications
Category
Drivers
Category
General
Category
Kernel
Category
Libraries
Kind
Breaking
Breaking change that won't be backward compatible
Kind
Bug
Something is not working
Kind
Build
Kind
Documentation
Documentation changes
Kind
Enhancement
Improve existing functionality
Kind
Feature
New functionality
Kind
Security
This is security issue
Kind
Testing
Issue or pull request related to testing
PR
Ready to merge
Pull request is ready for merge
PR
Conflicts
PR conflicts with main
PR
Dependent
This PR is dependent on another PR
PR
Request changes
Changes requested in pull request
PR
Review required
Priority
Critical
1
The priority is critical
Priority
High
2
The priority is high
Priority
Medium
3
The priority is medium
Priority
Low
4
The priority is low
Reviewed
Confirmed
Issue has been confirmed
Reviewed
Duplicate
This issue or pull request already exists
Reviewed
Invalid
Invalid issue
Reviewed
Won't Fix
This issue won't be fixed
Status
Abandoned
Somebody has started to work on this but abandoned work
Status
Blocked
Something is blocking this issue or pull request
Status
Need More Info
Feedback is required to reproduce issue or to continue work
Milestone
No items
No Milestone
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: KolibriOS/kolibrios#573
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
add 3 icons: save as, edit in other app, crop
libimg: add new function 'img_crop'
@@ -1033,0 +1033,4 @@;;============================================================================;;proc img.crop _img, _left, _top, _width, _height;;----------------------------------------------------------------------------;;;? Сrops the image according to the specified coordinates ;;First letter is Cyrillic С, must be Latin C.
🔴
img.crop, bpp24 path:rep movsbwith an undefinedecxWhen
b_lost == 0(_width == Image.Width, vertical-only crop) the fast path runsrep movsbwithout loadingecx. The intended count (_width*_height*3) was inecxbeforeinvoke mem.alloc, which may clobber it. The bpp8i sibling reloadsecx(line 1092); bpp24 doesn't.🟡
img.cropsilently no-ops on bpp32 and bpp8gOnly bpp8i and bpp24 are handled; other types fall to
.failand return 0.image_croptreats 0 as "do nothing", so cropping a 32-bit (alpha) image does nothing. Consider implementing crop for them or adding some notification for users.🟡
image_save_ascallsfree_directorySaving a file frees
directory_ptr, the cached folder listing used for next/prev navigation.Do we really need to clean cache directory on saving file?
Kiv: loading icons from shared memory,to apps/kiv: loading icons from shared memory,apps/kiv: loading icons from shared memory,to apps/kiv: loading icons from shared memory, libs/libimg: crop functionIf I open a file from a folder and then save it to a different one, the program crashes when I click the buttons to open the next or previous image. However, the program does not crash after adding a call to the
directory_ptrfunction. I left the question marks there because, when clicking the next or previous image buttons, the program opens images from the original folder. Ideally, the current folder should be updated after saving, but I don't know which functions to use for that.image_save_as:get_libimg_formatreturns 0 forraw, so the raw branch is entered, but it then doescmp [Image.Type], Image.bpp24; jnz @f. For a non-24-bit image (e.g. a 32-bit PNG with alpha) it falls through tocmp eax, 1; jl .end_fwitheax = 0and returns - nothing is written and no error is shown.Other formats (png/bmp/…) go through
img.encodeand handle 32-bit fine; only raw is affected. Consider either converting to 24-bit before the raw dump or reject the save with a message.Asterisk is in more usual position now
I like that selection goes througt all canvas. This is handy.
Unfortunatelly, aftifacts appear from time to time.Fixed.
@@ -1296,2 +2027,3 @@add edx, ((5+25*1) SHL 16)+0; mcall , buttons+scalebtn *20mcall , buttons+bgrbtn *ICON_SIZEadd edx, ((0+25*1) SHL 16)+0Could you please replace "25" by a constant that is easy to change? I would prefere a little more horisontal space around icons. We can afford it as the minimal window width is less than 400px now.
Probably +1 px around each icon and +2 px around section separator.
c2a20ccdbctoc78f0155081. Saving as
.rawpermanently converts the open image to 24-bitNothing restores the original, so a 32-bit image loses its alpha for the rest of the session and a later "save as PNG" writes 24-bit data.
2. The scaled image is leaked on that path
In
LIBIMG_SCALE_FIT_MINmodecur_imageis a separate object fromimg.scale. Overwriting[cur_image]above without destroying it strands that buffer: the nextdraw_viewseescur_image == orig_image, skips itsimg.destroy, and allocates a new one.I believe, using a temporary image for the conversion fixes both of these problems.
f52100781ato8dfd179568