Refactor SelectorTool to not draw directly to ImageView#687
Merged
Conversation
960194a to
8dea339
Compare
Refactor ImageView drawing to remove checker background from render - Set default for "bg" parameter in Image::Render to false so it doesn't draw the checker bg - Remove code to render the checker bg in Image::DoRenderPreview - In ImageView add checker bg bitmap. it is the size of two checker squares and is drawn as a tiled bitmap first thing in the ImageView::Draw function. the bitmap is drawn in the ImageView::MakeBackground() function and this is also called when the settings change to redraw the background bitmap - in ImageView::Draw the background is drawn first and the brush drawing was also moved here. this is because in Haiku drawing should happen only in the Draw() function so other Draw commands were removed unless in functions called by Draw(). - ImageView::BlitImage() uses alpha drawing mode to draw the changed bitmap parts - ImageView::UpdateImage() uses Invalidate() to force redraw but doesn't use BlitImage() anymore - ImageView::MouseDown() invalidates window region when scrolling view to force redraw - ImageView::MouseUp() code is not needed because DrawBrush happens in Draw() - ImageView::MouseMoved() invalidates area where brush is drawn but doesn't draw brush because it happens in Draw() function. Also the Draw() when the mouse leaves the view is changed to Invalidate() - ImageView::DrawBrush() clear code is not needed because Draw erases the bg before calling DrawBrush. Also calls to Draw are replaced by Invalidate() - A few tools (FreeLineTool, EraserTool, HairyBrushTool) make sure updated_rect is within the image bounds to prevent crashes Refactor Color Selector tool to stop drawing directly to ImageView - Removed drawing / erasing code from ColorSelectorTool::UseTool - in ImageView::DrawBrush draw rect for color selection Refactor SelectorTool to not draw directly to ImageView - add SelectorTool to ImageView::DrawBrush so selection draws during Draw() function - in SelectorTool store the points for a selection in progress. "selectionPoints" is for drawing selections like rectangle or ellipse. "activePoints" is needed for intelligent scissors because there is the part currenyly being drawn and then "selectionPoints" is for the part that the user drew before clicking the mouse. - add SelectorTool::DrawSelection function to draw in progress selections based on points stored in SelectorTool::UseTool - removed drawing code from SelectorTool::UseTool. store points for selections. use ImageUpdater like other drawing tools to update the image instead of drawing directly to the view
8dea339 to
fd8a636
Compare
Contributor
Author
|
added a quick fix so the cursors work again |
fd8a636 to
38c7880
Compare
Member
|
Thanks very much! |
This was referenced Jan 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
drawing selections like rectangle or ellipse. "activePoints" is needed for intelligent scissors
because there is the part currenyly being drawn and then "selectionPoints" is for the part that the user
drew before clicking the mouse.
in SelectorTool::UseTool
like other drawing tools to update the image instead of drawing directly to the view
NEEDS commit 1f79d69
aka MUST TEST with #685 applied first