include/tools/gen.hxx    |    5 +++--
 vcl/skia/gdiimpl.cxx     |    4 ++--
 vcl/skia/osx/gdiimpl.cxx |   14 +++++++-------
 3 files changed, 12 insertions(+), 11 deletions(-)

New commits:
commit 2ca522fa2d3d1f80a9f12826f76028264be1dfa1
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Thu Aug 26 11:12:15 2021 +0200
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Thu Aug 26 17:24:43 2021 +0200

    change some left,top,width,height usage in Skia to x,y,w,h
    
    Change-Id: I26e0f1f1c9aef795b040a191ffa9b725280eb63e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121080
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 882816514362..cb8708fd5d60 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -571,7 +571,7 @@ void SkiaSalGraphicsImpl::setCanvasClipRegion(SkCanvas* 
canvas, const vcl::Regio
     region.GetRegionRectangles(rectangles);
     path.incReserve(rectangles.size() + 1);
     for (const tools::Rectangle& rectangle : rectangles)
-        path.addRect(SkRect::MakeXYWH(rectangle.Left(), rectangle.Top(), 
rectangle.GetWidth(),
+        path.addRect(SkRect::MakeXYWH(rectangle.getX(), rectangle.getY(), 
rectangle.GetWidth(),
                                       rectangle.GetHeight()));
     path.setFillType(SkPathFillType::kEvenOdd);
     canvas->clipPath(path);
@@ -1971,7 +1971,7 @@ bool SkiaSalGraphicsImpl::drawGradient(const 
tools::PolyPolygon& rPolyPolygon,
     if (rPolyPolygon.IsRect())
     {
         // Rect->Polygon conversion loses the right and bottom edge, fix that.
-        path.addRect(SkRect::MakeXYWH(boundRect.Left(), boundRect.Top(), 
boundRect.GetWidth(),
+        path.addRect(SkRect::MakeXYWH(boundRect.getX(), boundRect.getY(), 
boundRect.GetWidth(),
                                       boundRect.GetHeight()));
         boundRect.AdjustRight(1);
         boundRect.AdjustBottom(1);
diff --git a/vcl/skia/osx/gdiimpl.cxx b/vcl/skia/osx/gdiimpl.cxx
index 34f343097c1c..13a5dd32aa82 100644
--- a/vcl/skia/osx/gdiimpl.cxx
+++ b/vcl/skia/osx/gdiimpl.cxx
@@ -135,7 +135,7 @@ void AquaSkiaSalGraphicsImpl::flushSurfaceToScreenCG(const 
SkIRect& rect)
     // the first pixel of rect.topLeft(), and using pixmap.rowBytes() ensures 
the following
     // pixel lines will be read from correct positions.
     CGContextRef context
-        = CGBitmapContextCreate(pixmap.writable_addr32(rect.left(), 
rect.top()), rect.width(),
+        = CGBitmapContextCreate(pixmap.writable_addr32(rect.x(), rect.y()), 
rect.width(),
                                 rect.height(), 8, pixmap.rowBytes(), 
GetSalData()->mxRGBSpace,
                                 toCGBitmapType(image->colorType(), 
image->alphaType()));
     assert(context); // TODO
@@ -143,7 +143,7 @@ void AquaSkiaSalGraphicsImpl::flushSurfaceToScreenCG(const 
SkIRect& rect)
     assert(screenImage); // TODO
     if (mrShared.isFlipped())
     {
-        const CGRect screenRect = CGRectMake(rect.left(), GetHeight() - 
rect.top() - rect.height(),
+        const CGRect screenRect = CGRectMake(rect.x(), GetHeight() - rect.y() 
- rect.height(),
                                              rect.width(), rect.height());
         mrShared.maContextHolder.saveState();
         CGContextTranslateCTM(mrShared.maContextHolder.get(), 0, 
pixmap.height());
@@ -153,13 +153,13 @@ void 
AquaSkiaSalGraphicsImpl::flushSurfaceToScreenCG(const SkIRect& rect)
     }
     else
     {
-        const CGRect screenRect = CGRectMake(rect.left(), rect.top(), 
rect.width(), rect.height());
+        const CGRect screenRect = CGRectMake(rect.x(), rect.y(), rect.width(), 
rect.height());
         CGContextDrawImage(mrShared.maContextHolder.get(), screenRect, 
screenImage);
     }
 
     CGImageRelease(screenImage);
     CGContextRelease(context);
-    mrShared.refreshRect(rect.left(), rect.top(), rect.width(), rect.height());
+    mrShared.refreshRect(rect.x(), rect.y(), rect.width(), rect.height());
 }
 
 bool AquaSkiaSalGraphicsImpl::drawNativeControl(ControlType nType, ControlPart 
nPart,
@@ -201,9 +201,9 @@ bool AquaSkiaSalGraphicsImpl::drawNativeControl(ControlType 
nType, ControlPart n
         // as in AquaGraphicsBackend::drawNativeControl().
         if (nType == ControlType::WindowBackground)
             updateRect.Intersection(mClipRegion.GetBoundRect());
-        addUpdateRegion(SkRect::MakeXYWH(updateRect.Left(), updateRect.Top(), 
updateRect.GetWidth(),
-                                         updateRect.GetHeight()));
-        getDrawCanvas()->drawImage(bitmap.asImage(), rControlRegion.Left(), 
rControlRegion.Top());
+        addUpdateRegion(SkRect::MakeXYWH(updateRect.getX(), updateRect.getY(),
+                                         updateRect.GetWidth(), 
updateRect.GetHeight()));
+        getDrawCanvas()->drawImage(bitmap.asImage(), rControlRegion.getX(), 
rControlRegion.getY());
         ++mPendingOperationsToFlush; // tdf#136369
         postDraw();
     }
commit 55accad663d13dff73a0aa57c08ebd0297a8c0fb
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Thu Aug 26 11:08:20 2021 +0200
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Thu Aug 26 17:24:26 2021 +0200

    add back getX()/getY() to tools::Rectangle
    
    581b2cf7960c48e cleaned up some usage of the class and removed
    getX()/getY(). But that means that the (probably most) common case
    of treating rectangles as x,y,w,h now doesn't work, and one has
    to use either left,top,right,bottom (which doesn't always mentally
    fit), or the IMO weird left,top,width,height.
    
    Change-Id: Ie9516f69af48490635346c76821be9a9eedd686c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121079
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins

diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
index 63d03b9f788e..f255168b3709 100644
--- a/include/tools/gen.hxx
+++ b/include/tools/gen.hxx
@@ -571,7 +571,8 @@ public:
     friend inline tools::Rectangle operator + ( const tools::Rectangle& rRect, 
const Point& rPt );
     friend inline tools::Rectangle operator - ( const tools::Rectangle& rRect, 
const Point& rPt );
 
-    // ONE
+    tools::Long         getX() const { return nLeft; }
+    tools::Long         getY() const { return nTop; }
     /// Returns the difference between right and left, assuming the range 
includes one end, but not the other.
     tools::Long getWidth() const { return Right() - Left(); }
     /// Returns the difference between bottom and top, assuming the range 
includes one end, but not the other.
@@ -745,7 +746,7 @@ inline std::basic_ostream<charT, traits> & operator <<(
         return stream << "EMPTY";
     else
         return stream << rectangle.GetWidth() << 'x' << rectangle.GetHeight()
-                      << "@(" << rectangle.Left() << ',' << rectangle.Top() << 
")";
+                      << "@(" << rectangle.getX() << ',' << rectangle.getY() 
<< ")";
 }
 }
 

Reply via email to