[Libreoffice-commits] core.git: Branch 'feature/skia' - 2 commits - external/skia vcl/inc vcl/skia
Luboš Luňák (via logerrit)
logerrit at kemper.freedesktop.org
Mon Oct 21 15:02:25 UTC 2019
Rebased ref, commits from common ancestor:
commit d040d9eaefd42a1b2fe3a9b3e2210f052d568d85
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Mon Oct 21 16:34:34 2019 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Mon Oct 21 17:01:12 2019 +0200
update Skia PCH after the update to m79
Change-Id: I1e18686ac6f501a04d6f56c78c998621d430d721
diff --git a/external/skia/fix-pch.patch b/external/skia/fix-pch.patch
index 9078a8a12e51..1bd09f1bbc30 100644
--- a/external/skia/fix-pch.patch
+++ b/external/skia/fix-pch.patch
@@ -22,6 +22,16 @@
// windows wants to define this as CreateSemaphoreA or CreateSemaphoreW
--- skia/third_party/skcms/skcms.cc.sav 2019-09-26 13:03:33.997652697 +0200
+++ skia/third_party/skcms/skcms.cc 2019-09-26 13:13:19.185647303 +0200
+@@ -124,7 +124,8 @@ static float minus_1_ulp(float x) {
+ // Most transfer functions we work with are sRGBish.
+ // For exotic HDR transfer functions, we encode them using a tf.g that makes no sense,
+ // and repurpose the other fields to hold the parameters of the HDR functions.
+-enum TFKind { Bad, sRGBish, PQish, HLGish, HLGinvish };
++enum TFKind_skcms { Bad, sRGBish, PQish, HLGish, HLGinvish };
++#define TFKind TFKind_skcms
+ struct TF_PQish { float A,B,C,D,E,F; };
+ struct TF_HLGish { float R,G,a,b,c; };
+
@@ -1817,7 +1817,9 @@ typedef enum {
Op_store_hhhh,
Op_store_fff,
diff --git a/external/skia/inc/pch/precompiled_skia.hxx b/external/skia/inc/pch/precompiled_skia.hxx
index 3d87068fcaa9..34adcad39af2 100644
--- a/external/skia/inc/pch/precompiled_skia.hxx
+++ b/external/skia/inc/pch/precompiled_skia.hxx
@@ -13,7 +13,7 @@
manual changes will be rewritten by the next run of update_pch.sh (which presumably
also fixes all possible problems, so it's usually better to use it).
- Generated on 2019-10-17 15:51:12 using:
+ Generated on 2019-10-21 16:31:00 using:
./bin/update_pch external/skia skia --cutoff=1 --exclude:system --include:module --include:local
If after updating build fails, use the following command to locate conflicting headers:
@@ -155,6 +155,7 @@
#include <include/core/SkSurfaceProps.h>
#include <include/core/SkSwizzle.h>
#include <include/core/SkTextBlob.h>
+#include <include/core/SkTileMode.h>
#include <include/core/SkTime.h>
#include <include/core/SkTraceMemoryDump.h>
#include <include/core/SkTypeface.h>
@@ -182,6 +183,7 @@
#include <include/effects/SkDropShadowImageFilter.h>
#include <include/effects/SkGradientShader.h>
#include <include/effects/SkHighContrastFilter.h>
+#include <include/effects/SkImageFilters.h>
#include <include/effects/SkImageSource.h>
#include <include/effects/SkLayerDrawLooper.h>
#include <include/effects/SkLightingImageFilter.h>
@@ -207,15 +209,12 @@
#include <include/gpu/GrBackendDrawableInfo.h>
#include <include/gpu/GrBackendSemaphore.h>
#include <include/gpu/GrBackendSurface.h>
-#include <include/gpu/GrBlend.h>
#include <include/gpu/GrConfig.h>
#include <include/gpu/GrContext.h>
#include <include/gpu/GrContextOptions.h>
#include <include/gpu/GrContextThreadSafeProxy.h>
#include <include/gpu/GrDriverBugWorkarounds.h>
#include <include/gpu/GrGpuResource.h>
-#include <include/gpu/GrRenderTarget.h>
-#include <include/gpu/GrSamplerState.h>
#include <include/gpu/GrSurface.h>
#include <include/gpu/GrTexture.h>
#include <include/gpu/GrTypes.h>
@@ -300,6 +299,7 @@
#include <src/codec/SkJpegUtility.h>
#include <src/codec/SkMaskSwizzler.h>
#include <src/codec/SkMasks.h>
+#include <src/codec/SkParseEncodedOrigin.h>
#include <src/codec/SkPngCodec.h>
#include <src/codec/SkPngPriv.h>
#include <src/codec/SkRawCodec.h>
@@ -325,7 +325,6 @@
#include <src/core/SkBitmapController.h>
#include <src/core/SkBitmapDevice.h>
#include <src/core/SkBitmapProcState.h>
-#include <src/core/SkBitmapProvider.h>
#include <src/core/SkBlendModePriv.h>
#include <src/core/SkBlitRow.h>
#include <src/core/SkBlitter.h>
@@ -358,6 +357,7 @@
#include <src/core/SkEdgeClipper.h>
#include <src/core/SkEffectPriv.h>
#include <src/core/SkEndian.h>
+#include <src/core/SkEnumerate.h>
#include <src/core/SkExchange.h>
#include <src/core/SkFDot6.h>
#include <src/core/SkFontDescriptor.h>
@@ -367,14 +367,17 @@
#include <src/core/SkGaussFilter.h>
#include <src/core/SkGeometry.h>
#include <src/core/SkGlyph.h>
+#include <src/core/SkGlyphBuffer.h>
#include <src/core/SkGlyphRun.h>
#include <src/core/SkGlyphRunPainter.h>
#include <src/core/SkGpuBlurUtils.h>
#include <src/core/SkICCPriv.h>
#include <src/core/SkIPoint16.h>
#include <src/core/SkImageFilterCache.h>
-#include <src/core/SkImageFilterPriv.h>
+#include <src/core/SkImageFilterTypes.h>
+#include <src/core/SkImageFilter_Base.h>
#include <src/core/SkImagePriv.h>
+#include <src/core/SkLRUCache.h>
#include <src/core/SkLatticeIter.h>
#include <src/core/SkLeanWindows.h>
#include <src/core/SkLineClipper.h>
@@ -403,6 +406,7 @@
#include <src/core/SkOpts.h>
#include <src/core/SkPaintDefaults.h>
#include <src/core/SkPaintPriv.h>
+#include <src/core/SkPathMakers.h>
#include <src/core/SkPathMeasurePriv.h>
#include <src/core/SkPathPriv.h>
#include <src/core/SkPictureCommon.h>
@@ -411,6 +415,7 @@
#include <src/core/SkPicturePlayback.h>
#include <src/core/SkPicturePriv.h>
#include <src/core/SkPictureRecord.h>
+#include <src/core/SkPixelRefPriv.h>
#include <src/core/SkPixmapPriv.h>
#include <src/core/SkPointPriv.h>
#include <src/core/SkPtrRecorder.h>
@@ -431,7 +436,6 @@
#include <src/core/SkRectPriv.h>
#include <src/core/SkRegionPriv.h>
#include <src/core/SkRemoteGlyphCache.h>
-#include <src/core/SkRemoteGlyphCacheImpl.h>
#include <src/core/SkResourceCache.h>
#include <src/core/SkSafeMath.h>
#include <src/core/SkSafeRange.h>
@@ -447,7 +451,7 @@
#include <src/core/SkStreamPriv.h>
#include <src/core/SkStrike.h>
#include <src/core/SkStrikeCache.h>
-#include <src/core/SkStrikeInterface.h>
+#include <src/core/SkStrikeForGPU.h>
#include <src/core/SkStrikeSpec.h>
#include <src/core/SkStringUtils.h>
#include <src/core/SkStroke.h>
@@ -495,23 +499,25 @@
#include <src/gpu/GrBackendTextureImageGenerator.h>
#include <src/gpu/GrBaseContextPriv.h>
#include <src/gpu/GrBitmapTextureMaker.h>
+#include <src/gpu/GrBlend.h>
#include <src/gpu/GrBlurUtils.h>
#include <src/gpu/GrBuffer.h>
#include <src/gpu/GrBufferAllocPool.h>
#include <src/gpu/GrCaps.h>
+#include <src/gpu/GrClientMappedBufferManager.h>
#include <src/gpu/GrClip.h>
#include <src/gpu/GrClipStackClip.h>
#include <src/gpu/GrColor.h>
-#include <src/gpu/GrColorSpaceInfo.h>
+#include <src/gpu/GrColorInfo.h>
#include <src/gpu/GrColorSpaceXform.h>
#include <src/gpu/GrContextPriv.h>
#include <src/gpu/GrContextThreadSafeProxyPriv.h>
#include <src/gpu/GrCoordTransform.h>
+#include <src/gpu/GrCopyRenderTask.h>
#include <src/gpu/GrCpuBuffer.h>
#include <src/gpu/GrDataUtils.h>
#include <src/gpu/GrDefaultGeoProcFactory.h>
#include <src/gpu/GrDeferredProxyUploader.h>
-#include <src/gpu/GrDeinstantiateProxyTracker.h>
#include <src/gpu/GrDistanceFieldGenFromVector.h>
#include <src/gpu/GrDrawOpAtlas.h>
#include <src/gpu/GrDrawOpTest.h>
@@ -522,16 +528,18 @@
#include <src/gpu/GrGlyph.h>
#include <src/gpu/GrGpu.h>
#include <src/gpu/GrGpuBuffer.h>
-#include <src/gpu/GrGpuCommandBuffer.h>
#include <src/gpu/GrGpuResourceCacheAccess.h>
#include <src/gpu/GrGpuResourcePriv.h>
#include <src/gpu/GrImageContextPriv.h>
+#include <src/gpu/GrImageInfo.h>
#include <src/gpu/GrImageTextureMaker.h>
#include <src/gpu/GrMemoryPool.h>
#include <src/gpu/GrMesh.h>
+#include <src/gpu/GrNativeRect.h>
#include <src/gpu/GrOnFlushResourceProvider.h>
#include <src/gpu/GrOpFlushState.h>
-#include <src/gpu/GrOpList.h>
+#include <src/gpu/GrOpsRenderPass.h>
+#include <src/gpu/GrOpsTask.h>
#include <src/gpu/GrPaint.h>
#include <src/gpu/GrPath.h>
#include <src/gpu/GrPathProcessor.h>
@@ -546,24 +554,27 @@
#include <src/gpu/GrProcessorSet.h>
#include <src/gpu/GrProcessorUnitTest.h>
#include <src/gpu/GrProgramDesc.h>
+#include <src/gpu/GrProgramInfo.h>
#include <src/gpu/GrProxyProvider.h>
#include <src/gpu/GrRecordingContextPriv.h>
#include <src/gpu/GrRectanizer.h>
#include <src/gpu/GrRectanizer_pow2.h>
#include <src/gpu/GrRectanizer_skyline.h>
#include <src/gpu/GrReducedClip.h>
+#include <src/gpu/GrRenderTarget.h>
#include <src/gpu/GrRenderTargetContext.h>
#include <src/gpu/GrRenderTargetContextPriv.h>
-#include <src/gpu/GrRenderTargetOpList.h>
#include <src/gpu/GrRenderTargetPriv.h>
#include <src/gpu/GrRenderTargetProxy.h>
#include <src/gpu/GrRenderTargetProxyPriv.h>
+#include <src/gpu/GrRenderTask.h>
#include <src/gpu/GrResourceAllocator.h>
#include <src/gpu/GrResourceCache.h>
#include <src/gpu/GrResourceProvider.h>
#include <src/gpu/GrResourceProviderPriv.h>
#include <src/gpu/GrSWMaskHelper.h>
#include <src/gpu/GrSamplePatternDictionary.h>
+#include <src/gpu/GrSamplerState.h>
#include <src/gpu/GrSemaphore.h>
#include <src/gpu/GrShaderCaps.h>
#include <src/gpu/GrShaderUtils.h>
@@ -585,16 +596,18 @@
#include <src/gpu/GrTextureAdjuster.h>
#include <src/gpu/GrTextureContext.h>
#include <src/gpu/GrTextureMaker.h>
-#include <src/gpu/GrTextureOpList.h>
#include <src/gpu/GrTexturePriv.h>
#include <src/gpu/GrTextureProducer.h>
#include <src/gpu/GrTextureProxy.h>
#include <src/gpu/GrTextureProxyCacheAccess.h>
#include <src/gpu/GrTextureProxyPriv.h>
#include <src/gpu/GrTextureRenderTargetProxy.h>
+#include <src/gpu/GrTextureResolveRenderTask.h>
#include <src/gpu/GrTracing.h>
+#include <src/gpu/GrTransferFromRenderTask.h>
#include <src/gpu/GrUserStencilSettings.h>
#include <src/gpu/GrVertexWriter.h>
+#include <src/gpu/GrWaitRenderTask.h>
#include <src/gpu/GrWindowRectangles.h>
#include <src/gpu/GrXferProcessor.h>
#include <src/gpu/GrYUVProvider.h>
@@ -612,7 +625,7 @@
#include <src/gpu/ccpr/GrCCPathCache.h>
#include <src/gpu/ccpr/GrCCPathProcessor.h>
#include <src/gpu/ccpr/GrCCPerFlushResources.h>
-#include <src/gpu/ccpr/GrCCPerOpListPaths.h>
+#include <src/gpu/ccpr/GrCCPerOpsTaskPaths.h>
#include <src/gpu/ccpr/GrCCQuadraticShader.h>
#include <src/gpu/ccpr/GrCCStrokeGeometry.h>
#include <src/gpu/ccpr/GrCCStroker.h>
@@ -660,6 +673,7 @@
#include <src/gpu/effects/generated/GrPremulInputFragmentProcessor.h>
#include <src/gpu/effects/generated/GrRRectBlurEffect.h>
#include <src/gpu/effects/generated/GrRectBlurEffect.h>
+#include <src/gpu/effects/generated/GrSaturateProcessor.h>
#include <src/gpu/effects/generated/GrSimpleTextureEffect.h>
#include <src/gpu/geometry/GrPathUtils.h>
#include <src/gpu/geometry/GrQuad.h>
@@ -673,7 +687,7 @@
#include <src/gpu/gl/GrGLDefines.h>
#include <src/gpu/gl/GrGLGLSL.h>
#include <src/gpu/gl/GrGLGpu.h>
-#include <src/gpu/gl/GrGLGpuCommandBuffer.h>
+#include <src/gpu/gl/GrGLOpsRenderPass.h>
#include <src/gpu/gl/GrGLPath.h>
#include <src/gpu/gl/GrGLPathRendering.h>
#include <src/gpu/gl/GrGLProgram.h>
@@ -719,7 +733,7 @@
#include <src/gpu/mock/GrMockBuffer.h>
#include <src/gpu/mock/GrMockCaps.h>
#include <src/gpu/mock/GrMockGpu.h>
-#include <src/gpu/mock/GrMockGpuCommandBuffer.h>
+#include <src/gpu/mock/GrMockOpsRenderPass.h>
#include <src/gpu/mock/GrMockStencilAttachment.h>
#include <src/gpu/mock/GrMockTexture.h>
#include <src/gpu/ops/GrAAConvexPathRenderer.h>
@@ -729,7 +743,6 @@
#include <src/gpu/ops/GrAtlasTextOp.h>
#include <src/gpu/ops/GrClearOp.h>
#include <src/gpu/ops/GrClearStencilClipOp.h>
-#include <src/gpu/ops/GrCopySurfaceOp.h>
#include <src/gpu/ops/GrDashLinePathRenderer.h>
#include <src/gpu/ops/GrDashOp.h>
#include <src/gpu/ops/GrDebugMarkerOp.h>
@@ -747,7 +760,6 @@
#include <src/gpu/ops/GrOvalOpFactory.h>
#include <src/gpu/ops/GrQuadPerEdgeAA.h>
#include <src/gpu/ops/GrRegionOp.h>
-#include <src/gpu/ops/GrSemaphoreOp.h>
#include <src/gpu/ops/GrShadowRRectOp.h>
#include <src/gpu/ops/GrSimpleMeshDrawOpHelper.h>
#include <src/gpu/ops/GrSmallPathRenderer.h>
@@ -756,7 +768,6 @@
#include <src/gpu/ops/GrStrokeRectOp.h>
#include <src/gpu/ops/GrTessellatingPathRenderer.h>
#include <src/gpu/ops/GrTextureOp.h>
-#include <src/gpu/ops/GrTransferFromOp.h>
#include <src/gpu/text/GrAtlasManager.h>
#include <src/gpu/text/GrDistanceFieldAdjustTable.h>
#include <src/gpu/text/GrSDFMaskFilter.h>
@@ -775,15 +786,14 @@
#include <src/gpu/vk/GrVkDescriptorSetManager.h>
#include <src/gpu/vk/GrVkFramebuffer.h>
#include <src/gpu/vk/GrVkGpu.h>
-#include <src/gpu/vk/GrVkGpuCommandBuffer.h>
#include <src/gpu/vk/GrVkImage.h>
#include <src/gpu/vk/GrVkImageLayout.h>
#include <src/gpu/vk/GrVkImageView.h>
#include <src/gpu/vk/GrVkIndexBuffer.h>
#include <src/gpu/vk/GrVkInterface.h>
#include <src/gpu/vk/GrVkMemory.h>
+#include <src/gpu/vk/GrVkOpsRenderPass.h>
#include <src/gpu/vk/GrVkPipeline.h>
-#include <src/gpu/vk/GrVkPipelineLayout.h>
#include <src/gpu/vk/GrVkPipelineState.h>
#include <src/gpu/vk/GrVkPipelineStateBuilder.h>
#include <src/gpu/vk/GrVkPipelineStateDataManager.h>
@@ -906,10 +916,10 @@
#include <src/sksl/SkSLParser.h>
#include <src/sksl/SkSLPipelineStageCodeGenerator.h>
#include <src/sksl/SkSLSPIRVCodeGenerator.h>
+#include <src/sksl/SkSLSectionAndParameterHelper.h>
#include <src/sksl/SkSLString.h>
#include <src/sksl/SkSLStringStream.h>
#include <src/sksl/SkSLUtil.h>
-#include <src/sksl/ir/SkSLAppendStage.h>
#include <src/sksl/ir/SkSLBinaryExpression.h>
#include <src/sksl/ir/SkSLBoolLiteral.h>
#include <src/sksl/ir/SkSLBreakStatement.h>
commit 2ac2595efa8c8a79a67f86a3c6cdacda4884fd54
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Mon Oct 21 16:12:19 2019 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Mon Oct 21 17:01:06 2019 +0200
resize surface in SkiaSalGraphicsImpl if needed
This is similar to what the OpenGL backend does. Apparently the VCL
code can just silently resize the graphics without telling.
Change-Id: Ie7c2a7798e76ad598e9cdd1435d68ed03793c408
diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx
index c7c59ac9b2d6..463e927c3572 100644
--- a/vcl/inc/skia/gdiimpl.hxx
+++ b/vcl/inc/skia/gdiimpl.hxx
@@ -185,19 +185,19 @@ public:
void drawBitmap(const SalTwoRect& rPosAry, const SkBitmap& bitmap);
- // To be called after any drawing.
- void scheduleFlush();
-
- // Internal, called by SkiaFlushIdle.
- virtual void performFlush() = 0;
-
#ifdef DBG_UTIL
void dump(const char* file) const;
static void dump(const SkBitmap& bitmap, const char* file);
#endif
protected:
+ // To be called before any drawing.
+ void preDraw();
+ // To be called after any drawing.
+ void postDraw();
+
virtual void createSurface();
+ void resetSurface();
void setProvider(SalGeometryProvider* provider) { mProvider = provider; }
@@ -205,7 +205,10 @@ protected:
void invert(basegfx::B2DPolygon const& rPoly, SalInvert eFlags);
-protected:
+ // Called by SkiaFlushIdle.
+ virtual void performFlush() = 0;
+ friend class SkiaFlushIdle;
+
// get the width of the device
int GetWidth() const { return mProvider ? mProvider->GetWidth() : 1; }
// get the height of the device
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index deb35255ddfa..ccf4ea7cef34 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -114,13 +114,16 @@ SkiaSalGraphicsImpl::SkiaSalGraphicsImpl(SalGraphics& rParent, SalGeometryProvid
SkiaSalGraphicsImpl::~SkiaSalGraphicsImpl() {}
-void SkiaSalGraphicsImpl::Init()
+void SkiaSalGraphicsImpl::Init() { resetSurface(); }
+
+void SkiaSalGraphicsImpl::resetSurface()
{
createSurface();
mSurface->getCanvas()->save(); // see SetClipRegion()
mClipRegion = vcl::Region(tools::Rectangle(0, 0, GetWidth(), GetHeight()));
// We don't want to be swapping before we've painted.
+ mFlush->Stop();
mFlush->SetPriority(TaskPriority::POST_PAINT);
}
@@ -132,6 +135,24 @@ void SkiaSalGraphicsImpl::createSurface()
void SkiaSalGraphicsImpl::DeInit() { mSurface.reset(); }
+void SkiaSalGraphicsImpl::preDraw()
+{
+ // VCL can sometimes resize us without telling us, update the surface if needed.
+ if (GetWidth() != mSurface->width() || GetHeight() != mSurface->height())
+ resetSurface();
+}
+
+void SkiaSalGraphicsImpl::postDraw()
+{
+ if (!isOffscreen())
+ {
+ if (!Application::IsInExecute())
+ performFlush(); // otherwise nothing would trigger idle rendering
+ else if (!mFlush->IsActive())
+ mFlush->Start();
+ }
+}
+
static SkIRect toSkIRect(const tools::Rectangle& rectangle)
{
return SkIRect::MakeXYWH(rectangle.Left(), rectangle.Top(), rectangle.GetWidth(),
@@ -207,37 +228,41 @@ void SkiaSalGraphicsImpl::drawPixel(long nX, long nY)
{
if (mLineColor == SALCOLOR_NONE)
return;
+ preDraw();
SkCanvas* canvas = mSurface->getCanvas();
canvas->drawPoint(nX, nY, SkPaint());
- scheduleFlush();
+ postDraw();
}
void SkiaSalGraphicsImpl::drawPixel(long nX, long nY, Color nColor)
{
if (nColor == SALCOLOR_NONE)
return;
+ preDraw();
SkCanvas* canvas = mSurface->getCanvas();
SkPaint paint;
paint.setColor(toSkColor(nColor));
// Apparently drawPixel() is actually expected to set the pixel and not draw it.
paint.setBlendMode(SkBlendMode::kSrc); // set as is, including alpha
canvas->drawPoint(nX, nY, paint);
- scheduleFlush();
+ postDraw();
}
void SkiaSalGraphicsImpl::drawLine(long nX1, long nY1, long nX2, long nY2)
{
if (mLineColor == SALCOLOR_NONE)
return;
+ preDraw();
SkCanvas* canvas = mSurface->getCanvas();
SkPaint paint;
paint.setColor(toSkColor(mLineColor));
canvas->drawLine(nX1, nY1, nX2, nY2, paint);
- scheduleFlush();
+ postDraw();
}
void SkiaSalGraphicsImpl::drawRect(long nX, long nY, long nWidth, long nHeight)
{
+ preDraw();
SkCanvas* canvas = mSurface->getCanvas();
SkPaint paint;
if (mFillColor != SALCOLOR_NONE)
@@ -252,13 +277,14 @@ void SkiaSalGraphicsImpl::drawRect(long nX, long nY, long nWidth, long nHeight)
paint.setStyle(SkPaint::kStroke_Style);
canvas->drawIRect(SkIRect::MakeXYWH(nX, nY, nWidth - 1, nHeight - 1), paint);
}
- scheduleFlush();
+ postDraw();
}
void SkiaSalGraphicsImpl::drawPolyLine(sal_uInt32 nPoints, const SalPoint* pPtAry)
{
if (mLineColor == SALCOLOR_NONE)
return;
+ preDraw();
std::vector<SkPoint> pointVector;
pointVector.reserve(nPoints);
for (sal_uInt32 i = 0; i < nPoints; ++i)
@@ -267,13 +293,14 @@ void SkiaSalGraphicsImpl::drawPolyLine(sal_uInt32 nPoints, const SalPoint* pPtAr
paint.setColor(toSkColor(mLineColor));
mSurface->getCanvas()->drawPoints(SkCanvas::kLines_PointMode, nPoints, pointVector.data(),
paint);
- scheduleFlush();
+ postDraw();
}
void SkiaSalGraphicsImpl::drawPolygon(sal_uInt32 nPoints, const SalPoint* pPtAry)
{
if (mLineColor == SALCOLOR_NONE && mFillColor == SALCOLOR_NONE)
return;
+ preDraw();
std::vector<SkPoint> pointVector;
pointVector.reserve(nPoints);
for (sal_uInt32 i = 0; i < nPoints; ++i)
@@ -293,7 +320,7 @@ void SkiaSalGraphicsImpl::drawPolygon(sal_uInt32 nPoints, const SalPoint* pPtAry
paint.setStyle(SkPaint::kStroke_Style);
mSurface->getCanvas()->drawPath(path, paint);
}
- scheduleFlush();
+ postDraw();
}
void SkiaSalGraphicsImpl::drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pPoints,
@@ -301,6 +328,7 @@ void SkiaSalGraphicsImpl::drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pP
{
if (mLineColor == SALCOLOR_NONE && mFillColor == SALCOLOR_NONE)
return;
+ preDraw();
std::vector<SkPoint> pointVector;
SkPath path;
for (sal_uInt32 poly = 0; poly < nPoly; ++poly)
@@ -328,7 +356,7 @@ void SkiaSalGraphicsImpl::drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pP
paint.setStyle(SkPaint::kStroke_Style);
mSurface->getCanvas()->drawPath(path, paint);
}
- scheduleFlush();
+ postDraw();
}
bool SkiaSalGraphicsImpl::drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectToDevice,
@@ -389,15 +417,17 @@ void SkiaSalGraphicsImpl::copyArea(long nDestX, long nDestY, long nSrcX, long nS
{
if (nDestX == nSrcX && nDestY == nSrcY)
return;
+ preDraw();
sk_sp<SkImage> image
= mSurface->makeImageSnapshot(SkIRect::MakeXYWH(nSrcX, nSrcY, nSrcWidth, nSrcHeight));
// TODO makeNonTextureImage() ?
mSurface->getCanvas()->drawImage(image, nDestX, nDestY);
- scheduleFlush();
+ postDraw();
}
void SkiaSalGraphicsImpl::copyBits(const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics)
{
+ preDraw();
SkiaSalGraphicsImpl* src;
if (pSrcGraphics)
{
@@ -414,7 +444,7 @@ void SkiaSalGraphicsImpl::copyBits(const SalTwoRect& rPosAry, SalGraphics* pSrcG
rPosAry.mnDestWidth,
rPosAry.mnDestHeight),
nullptr);
- scheduleFlush();
+ postDraw();
}
bool SkiaSalGraphicsImpl::blendBitmap(const SalTwoRect&, const SalBitmap& rBitmap)
@@ -438,6 +468,7 @@ void SkiaSalGraphicsImpl::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap&
if (rPosAry.mnSrcWidth <= 0 || rPosAry.mnSrcHeight <= 0 || rPosAry.mnDestWidth <= 0
|| rPosAry.mnDestHeight <= 0)
return;
+ preDraw();
assert(dynamic_cast<const SkiaSalBitmap*>(&rSalBitmap));
mSurface->getCanvas()->drawBitmapRect(
static_cast<const SkiaSalBitmap&>(rSalBitmap).GetSkBitmap(),
@@ -445,7 +476,7 @@ void SkiaSalGraphicsImpl::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap&
SkRect::MakeXYWH(rPosAry.mnDestX, rPosAry.mnDestY, rPosAry.mnDestWidth,
rPosAry.mnDestHeight),
nullptr);
- scheduleFlush();
+ postDraw();
}
void SkiaSalGraphicsImpl::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap,
@@ -467,6 +498,7 @@ void SkiaSalGraphicsImpl::drawMask(const SalTwoRect& rPosAry, const SalBitmap& r
void SkiaSalGraphicsImpl::drawMask(const SalTwoRect& rPosAry, const SkBitmap& rBitmap,
Color nMaskColor)
{
+ preDraw();
SkBitmap tmpBitmap;
if (!tmpBitmap.tryAllocN32Pixels(rBitmap.width(), rBitmap.height()))
abort();
@@ -484,7 +516,7 @@ void SkiaSalGraphicsImpl::drawMask(const SalTwoRect& rPosAry, const SkBitmap& rB
SkRect::MakeXYWH(rPosAry.mnDestX, rPosAry.mnDestY, rPosAry.mnDestWidth,
rPosAry.mnDestHeight),
nullptr);
- scheduleFlush();
+ postDraw();
}
std::shared_ptr<SalBitmap> SkiaSalGraphicsImpl::getBitmap(long nX, long nY, long nWidth,
@@ -509,6 +541,7 @@ Color SkiaSalGraphicsImpl::getPixel(long nX, long nY)
void SkiaSalGraphicsImpl::invert(basegfx::B2DPolygon const& rPoly, SalInvert eFlags)
{
+ preDraw();
// TrackFrame just inverts a dashed path around the polygon
if (eFlags == SalInvert::TrackFrame)
{
@@ -568,7 +601,7 @@ void SkiaSalGraphicsImpl::invert(basegfx::B2DPolygon const& rPoly, SalInvert eFl
mSurface->getCanvas()->drawPath(aPath, aPaint);
}
- scheduleFlush();
+ postDraw();
}
void SkiaSalGraphicsImpl::invert(long nX, long nY, long nWidth, long nHeight, SalInvert eFlags)
@@ -625,13 +658,14 @@ bool SkiaSalGraphicsImpl::drawAlphaBitmap(const SalTwoRect& rPosAry, const SalBi
void SkiaSalGraphicsImpl::drawBitmap(const SalTwoRect& rPosAry, const SkBitmap& bitmap)
{
+ preDraw();
mSurface->getCanvas()->drawBitmapRect(
bitmap,
SkRect::MakeXYWH(rPosAry.mnSrcX, rPosAry.mnSrcY, rPosAry.mnSrcWidth, rPosAry.mnSrcHeight),
SkRect::MakeXYWH(rPosAry.mnDestX, rPosAry.mnDestY, rPosAry.mnDestWidth,
rPosAry.mnDestHeight),
nullptr);
- scheduleFlush();
+ postDraw();
}
bool SkiaSalGraphicsImpl::drawTransformedBitmap(const basegfx::B2DPoint& rNull,
@@ -667,16 +701,6 @@ bool SkiaSalGraphicsImpl::drawGradient(const tools::PolyPolygon& rPolygon,
return false;
}
-void SkiaSalGraphicsImpl::scheduleFlush()
-{
- if (isOffscreen())
- return;
- if (!Application::IsInExecute())
- performFlush(); // otherwise nothing would trigger idle rendering
- else if (!mFlush->IsActive())
- mFlush->Start();
-}
-
#ifdef DBG_UTIL
void SkiaSalGraphicsImpl::dump(const char* file) const
{
diff --git a/vcl/skia/win/gdiimpl.cxx b/vcl/skia/win/gdiimpl.cxx
index c33735f58063..7af4f6790a61 100644
--- a/vcl/skia/win/gdiimpl.cxx
+++ b/vcl/skia/win/gdiimpl.cxx
@@ -99,9 +99,9 @@ bool WinSkiaSalGraphicsImpl::RenderAndCacheNativeControl(CompatibleDC& rWhite, C
return false; // TODO
}
-void WinSkiaSalGraphicsImpl::PreDrawText() {}
+void WinSkiaSalGraphicsImpl::PreDrawText() { preDraw(); }
-void WinSkiaSalGraphicsImpl::PostDrawText() { scheduleFlush(); }
+void WinSkiaSalGraphicsImpl::PostDrawText() { postDraw(); }
void WinSkiaSalGraphicsImpl::DeferredTextDraw(const CompatibleDC::Texture* pTexture,
Color aMaskColor, const SalTwoRect& rPosAry)
More information about the Libreoffice-commits
mailing list