Bugzilla – Attachment 174703 Details for
Bug 144214
enabling skia on macOS results in 75% of window painted in red on macOS
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
LO patch
a.patch (text/plain), 7.09 KB, created by
Luboš Luňák
on 2021-09-01 14:51:30 UTC
(
hide
)
Description:
LO patch
Filename:
MIME Type:
Creator:
Luboš Luňák
Created:
2021-09-01 14:51:30 UTC
Size:
7.09 KB
patch
obsolete
>diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx >index 03a4d5cf0413..b922bb711a50 100644 >--- a/vcl/inc/skia/gdiimpl.hxx >+++ b/vcl/inc/skia/gdiimpl.hxx >@@ -336,6 +336,7 @@ protected: > }; > LastPolyPolygonInfo mLastPolyPolygonInfo; > int mPendingOperationsToFlush; >+ float mScaling = 1; > }; > > #endif >diff --git a/vcl/osx/salmacos.cxx b/vcl/osx/salmacos.cxx >index 700b252cf4f3..9d6ce52b44e8 100644 >--- a/vcl/osx/salmacos.cxx >+++ b/vcl/osx/salmacos.cxx >@@ -248,6 +248,7 @@ void AquaSalGraphics::SetVirDevGraphics(SalVirtualDevice* pVirDev, CGLayerHolder > } > maShared.mnWidth = aSize.width / fScale; > maShared.mnHeight = aSize.height / fScale; >+ SAL_DEBUG("SETVIRDEVGRAPHICS:" << Size(maShared.mnWidth,maShared.mnHeight) << ":" << aSize << ":" << fScale); > > // Set color space for fill and stroke > >diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx >index c580471a9608..2a8cb96c0bf7 100644 >--- a/vcl/skia/gdiimpl.cxx >+++ b/vcl/skia/gdiimpl.cxx >@@ -375,7 +375,7 @@ void SkiaSalGraphicsImpl::destroySurface() > // check setClipRegion() invariant > assert(mSurface->getCanvas()->getSaveCount() == 2); > // if this fails, something forgot to use SkAutoCanvasRestore >- assert(mSurface->getCanvas()->getTotalMatrix().isIdentity()); >+ assert(mSurface->getCanvas()->getTotalMatrix() == SkMatrix::Scale(mScaling,mScaling)); > } > // If we use e.g. Vulkan, we must destroy the surface before the context, > // otherwise destroying the surface will reference the context. This is >@@ -389,6 +389,7 @@ void SkiaSalGraphicsImpl::destroySurface() > mSurface.reset(); > mWindowContext.reset(); > mIsGPU = false; >+ mScaling = 1; > } > > void SkiaSalGraphicsImpl::performFlush() >@@ -496,7 +497,7 @@ void SkiaSalGraphicsImpl::checkSurface() > SAL_INFO("vcl.skia.trace", > "create(" << this << "): " << Size(mSurface->width(), mSurface->height())); > } >- else if (GetWidth() != mSurface->width() || GetHeight() != mSurface->height()) >+ else if (int(GetWidth() * mScaling) != mSurface->width() || int(GetHeight() * mScaling) != mSurface->height()) > { > if (!avoidRecreateByResize()) > { >diff --git a/vcl/skia/osx/gdiimpl.cxx b/vcl/skia/osx/gdiimpl.cxx >index 43fe07d5391a..23fb37fa8926 100644 >--- a/vcl/skia/osx/gdiimpl.cxx >+++ b/vcl/skia/osx/gdiimpl.cxx >@@ -56,13 +56,14 @@ void AquaSkiaSalGraphicsImpl::createWindowSurfaceInternal(bool forceRaster) > displayParams.fColorType = kN32_SkColorType; > sk_app::window_context_factory::MacWindowInfo macWindow; > macWindow.fMainView = mrShared.mpFrame->mpNSView; >+ mScaling = sal::aqua::getWindowScaling(); > RenderMethod renderMethod = forceRaster ? RenderRaster : renderMethodToUse(); > switch (renderMethod) > { > case RenderRaster: > // RasterWindowContext_mac uses OpenGL internally, which we don't want, > // so use our own surface and do blitting to the screen ourselves. >- mSurface = createSkSurface(GetWidth(), GetHeight()); >+ mSurface = createSkSurface(GetWidth() * mScaling, GetHeight() * mScaling); > break; > case RenderMetal: > mWindowContext >@@ -72,12 +73,17 @@ void AquaSkiaSalGraphicsImpl::createWindowSurfaceInternal(bool forceRaster) > // it appears that Metal surfaces cannot be read from, which would break things > // like copyArea(). > if (mWindowContext) >- mSurface = createSkSurface(GetWidth(), GetHeight()); >+ mSurface = createSkSurface(GetWidth() * mScaling, GetHeight() * mScaling); > break; > case RenderVulkan: > abort(); > break; > } >+ if(mSurface) >+ { >+ mSurface->getCanvas()->scale(mScaling,mScaling); >+ SAL_DEBUG("CREATE:" << Size(GetWidth(), GetHeight()) << ":" << Size(mSurface->width(), mSurface->height())); >+ } > } > > void AquaSkiaSalGraphicsImpl::Flush() { performFlush(); } >@@ -123,12 +129,16 @@ void AquaSkiaSalGraphicsImpl::flushSurfaceToScreenCG() > SkPixmap pixmap; > if (!image->peekPixels(&pixmap)) > abort(); >+ float scaling1 = mScaling; >+ float scaling2 = mScaling; >+ float scaling3 = mScaling; >+ float scaling4 = mScaling; > // This creates the bitmap context from the cropped part, writable_addr32() will get > // the first pixel of mDirtyRect.topLeft(), and using pixmap.rowBytes() ensures the following > // pixel lines will be read from correct positions. > CGContextRef context = CGBitmapContextCreate( >- pixmap.writable_addr32(mDirtyRect.x(), mDirtyRect.y()), mDirtyRect.width(), >- mDirtyRect.height(), 8, pixmap.rowBytes(), GetSalData()->mxRGBSpace, >+ pixmap.writable_addr32(mDirtyRect.x() * scaling1, mDirtyRect.y() * scaling1), mDirtyRect.width() * scaling1, >+ mDirtyRect.height() * scaling1, 8, pixmap.rowBytes(), GetSalData()->mxRGBSpace, > toCGBitmapType(image->colorType(), image->alphaType())); > assert(context); // TODO > CGImageRef screenImage = CGBitmapContextCreateImage(context); >@@ -136,10 +146,14 @@ void AquaSkiaSalGraphicsImpl::flushSurfaceToScreenCG() > if (mrShared.isFlipped()) > { > const CGRect screenRect >- = CGRectMake(mDirtyRect.x(), GetHeight() - mDirtyRect.y() - mDirtyRect.height(), >- mDirtyRect.width(), mDirtyRect.height()); >+ = CGRectMake(mDirtyRect.x() * scaling2, GetHeight() * scaling4 - mDirtyRect.y() * scaling2 - mDirtyRect.height() * scaling2, >+ mDirtyRect.width() * scaling2, mDirtyRect.height() * scaling2); > mrShared.maContextHolder.saveState(); >- CGContextTranslateCTM(mrShared.maContextHolder.get(), 0, pixmap.height()); >+ CGAffineTransform at; >+ at = CGContextGetCTM(mrShared.maContextHolder.get()); >+ SAL_DEBUG("FLUSH:" << at.a << ":" << at.b << ":" << at.c << ":" << at.d << ":" << at.tx << ":" << at.ty); >+ CGContextScaleCTM(mrShared.maContextHolder.get(), 1 / scaling3, 1 / scaling3); >+ CGContextTranslateCTM(mrShared.maContextHolder.get(), 0, GetHeight() * scaling4); > CGContextScaleCTM(mrShared.maContextHolder.get(), 1, -1); > CGContextDrawImage(mrShared.maContextHolder.get(), screenRect, screenImage); > mrShared.maContextHolder.restoreState(); >@@ -147,13 +161,13 @@ void AquaSkiaSalGraphicsImpl::flushSurfaceToScreenCG() > else > { > const CGRect screenRect >- = CGRectMake(mDirtyRect.x(), mDirtyRect.y(), mDirtyRect.width(), mDirtyRect.height()); >+ = CGRectMake(mDirtyRect.x() * scaling2, mDirtyRect.y() * scaling2, mDirtyRect.width() * scaling2, mDirtyRect.height() * scaling2); > CGContextDrawImage(mrShared.maContextHolder.get(), screenRect, screenImage); > } > > CGImageRelease(screenImage); > CGContextRelease(context); >- mrShared.refreshRect(mDirtyRect.x(), mDirtyRect.y(), mDirtyRect.width(), mDirtyRect.height()); >+ mrShared.refreshRect(mDirtyRect.x() * scaling2, mDirtyRect.y() * scaling2, mDirtyRect.width() * scaling2, mDirtyRect.height() * scaling2); > } > > bool AquaSkiaSalGraphicsImpl::drawNativeControl(ControlType nType, ControlPart nPart,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 144214
:
174664
|
174665
| 174703 |
176293
|
176294
|
176295
|
176296