diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2023-12-02 22:27:34 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-12-03 17:39:43 +0100 |
commit | 29fc0ec9930fc1c09c0e79d41c56f93ae853c054 (patch) | |
tree | 6866cf167d9118d9d31c1e8fc95aff72d2c2b324 /include | |
parent | 033f973e22f4d76a8e55a5591ac46249c149901d (diff) |
Split the *Bitmap::CopyPixel functions
into the two entire separate cases they want to handle, there is
no reason to mix the two different cases like this.
Change-Id: I38e99e7ad6168a84e7a744f61407887825158902
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160248
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/vcl/bitmap.hxx | 29 | ||||
-rw-r--r-- | include/vcl/bitmapex.hxx | 29 |
2 files changed, 51 insertions, 7 deletions
diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx index f8123b177932..b7059654e016 100644 --- a/include/vcl/bitmap.hxx +++ b/include/vcl/bitmap.hxx @@ -233,12 +233,37 @@ public: bool CopyPixel( const tools::Rectangle& rRectDst, const tools::Rectangle& rRectSrc, - const Bitmap* pBmpSrc = nullptr ); + const Bitmap& rBmpSrc ); + + /** Copy a rectangular area inside this bitmap. + + @param rRectDst + Destination rectangle in this bitmap. This is clipped to the + bitmap dimensions. + + @param rRectSrc + Source rectangl. This is clipped to the + bitmap dimensions. Note further that no scaling takes place + during this copy operation, i.e. only the minimum of source + and destination rectangle's width and height are used. + + @return true, if the operation completed successfully. false + is not only returned when the operation failed, but also if + nothing had to be done, e.g. because one of the rectangles are + empty. + */ + bool CopyPixel( + const tools::Rectangle& rRectDst, + const tools::Rectangle& rRectSrc ); bool CopyPixel_AlphaOptimized( const tools::Rectangle& rRectDst, const tools::Rectangle& rRectSrc, - const Bitmap* pBmpSrc ); + const Bitmap& rBmpSrc ); + + bool CopyPixel_AlphaOptimized( + const tools::Rectangle& rRectDst, + const tools::Rectangle& rRectSrc ); /** Alpha-blend the given bitmap against a specified uniform background color. diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx index 9d7a104264ef..c159e7d4910c 100644 --- a/include/vcl/bitmapex.hxx +++ b/include/vcl/bitmapex.hxx @@ -139,10 +139,8 @@ public: during this copy operation, i.e. only the minimum of source and destination rectangle's width and height are used. - @param pBmpExSrc - The source bitmap to copy from. If this argument is NULL, or - equal to the object this method is called on, copying takes - place within the same bitmap. + @param rBmpExSrc + The source bitmap to copy from. @return true, if the operation completed successfully. false is not only returned when the operation failed, but also if @@ -152,7 +150,28 @@ public: bool CopyPixel( const tools::Rectangle& rRectDst, const tools::Rectangle& rRectSrc, - const BitmapEx* pBmpExSrc ); + const BitmapEx& rBmpExSrc ); + + /** Copy a rectangular area from one part of the bitmap to another. + + @param rRectDst + Destination rectangle in this bitmap. This is clipped to the + bitmap dimensions. + + @param rRectSrc + Source rectangle in this bitmap. This is clipped to the + bitmap dimensions. Note further that no scaling takes place + during this copy operation, i.e. only the minimum of source + and destination rectangle's width and height are used. + + @return true, if the operation completed successfully. false + is not only returned when the operation failed, but also if + nothing had to be done, e.g. because one of the rectangles are + empty. + */ + bool CopyPixel( + const tools::Rectangle& rRectDst, + const tools::Rectangle& rRectSrc ); /** Fill the entire bitmap with the given color |