Renaming KisPainter::bitBltFixedSelection to bitBltWithFixedMask
pentalis at gmail.com
Thu Sep 9 10:10:13 CEST 2010
This is an e-mail to let everyone know of the name change so they can
express their concerns or opposition, and to let them prepare for what
comes after a name change (a large search and replace of all uses, and
deleting an unit test that no longer goes with what the new
Here is an explanation/rationale for the change:
The former bitBltFixedSelection used to override the user selection
(d->selection) with a fixed selection provided as a parameter. But
nobody used it intending to override the user's selection with that
new KisFixedPaintDevice selection, instead it was used as a mask to
give a brush its characteristic shape (that was the case with the
SmudgeOp and DuplicateOp, and later my own HatchingOp).
There is a function in the test kis_painter_test.cpp,
KisPainterTest::testSelectionBitBltFixedSelection(), that tests
whether an arbitrarily bounded source QRect turns into the expected
destination QRect when blitting. However this test makes no sense
anymore, since when using the fixed selection as a mask for a brush
dab, the most sensible way to use it is to have a mask of the same
size than the QRect to be extracted from the dab, anything else leads
to either unpredictable or unclear behavior, and it goes against code
readability. So I gladly followed Dmitry's suggestion of putting an
ASSERT to check whether someone tries to use bitBltFixedSelection in
this unwieldy way (a source QRect of different size than the mask).
This very ASSERT immediately broke the now clearly obsolete unit test.
Therefore, the changes I propose are:
1.- rename bitBltFixedSelection to bitBltWithFixedMask to reflect what
the function does now (which was in fact what people were using it
2.- eliminate the obsolete unit test (
3.- update the doxygen documentation.
I'll wait a couple days for comments. If nobody opposes I'll commit the changes.
More information about the kimageshop