office-gobmx/external/skia/swap-buffers-rect.patch.1
Noel Grandin f8c15850db update skia to m116
(from m111)

SK_SUPPORT_GPU is now SK_GANESH

GR_OP_ALLOCATE_USE_NEW was removed in skia m111
    commit dd8f8ed3848cbe2032edc7ec08ef648a23e28ad9
    Author: Mike Klein <mtklein@google.com>
    Date:   Thu Apr 22 12:17:33 2021 -0500
    clean up defines that do nothing

the fast-png-write patch was removed. The underlying helper
function we need was removed in
    commit 0ec4c84abd0b578a5c792b04b56653cbc325530e
    Author: Kevin Lubick <kjlubick@google.com>
    Date:   Thu Apr 20 14:46:28 2023 -0400
    Remove SkImageEncoder and SkImage::encodeToData
So I updated our dump() function in SkiaHelper.cxx to
use the new Skia API.

The constexpr-template patch seems to be superceded by skia
changes.

SkOpts: :hash_fn has been replaced with SkChecksum::Hash32
    commit 657ed9cf2379a950b925cb2aba7c85d6e1dd36ed
    Author: Brian Osman <brianosman@google.com>
    Date:   Tue May 23 12:40:12 2023 +0000
    Reland "Replace SkOpts::hash/hash_fn with SkChecksum::Hash32"

The SkDebugf function needs to be exported from the library since
it leaks out to calling code via some of the headers.

Change-Id: I80ace8f25e660fa7889d22ef90676f47264d866c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154223
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-07-10 12:44:38 +02:00

155 lines
6.3 KiB
Groff

diff -ur skia.org/tools/sk_app/MetalWindowContext.h skia/tools/sk_app/MetalWindowContext.h
--- skia.org/tools/sk_app/MetalWindowContext.h 2023-07-08 21:49:27.179700423 +0200
+++ skia/tools/sk_app/MetalWindowContext.h 2023-07-08 21:51:53.416328675 +0200
@@ -51,7 +51,7 @@
static void checkDestroyShared();
- void onSwapBuffers() override;
+ void onSwapBuffers(const SkIRect* rect = nullptr) override;
bool fValid;
diff -ur skia.org/tools/sk_app/MetalWindowContext.mm skia/tools/sk_app/MetalWindowContext.mm
--- skia.org/tools/sk_app/MetalWindowContext.mm 2023-07-08 21:49:27.179700423 +0200
+++ skia/tools/sk_app/MetalWindowContext.mm 2023-07-08 21:52:10.064396318 +0200
@@ -191,7 +191,7 @@
return surface;
}
-void MetalWindowContext::onSwapBuffers() {
+void MetalWindowContext::onSwapBuffers(const SkIRect*) {
id<CAMetalDrawable> currentDrawable = (id<CAMetalDrawable>)fDrawableHandle;
id<MTLCommandBuffer> commandBuffer([*fShared->fQueue commandBuffer]);
diff -ur skia.org/tools/sk_app/unix/RasterWindowContext_unix.cpp skia/tools/sk_app/unix/RasterWindowContext_unix.cpp
--- skia.org/tools/sk_app/unix/RasterWindowContext_unix.cpp 2023-07-08 21:49:27.183700444 +0200
+++ skia/tools/sk_app/unix/RasterWindowContext_unix.cpp 2023-07-08 21:54:06.840852252 +0200
@@ -24,7 +24,7 @@
void setDisplayParams(const DisplayParams& params) override;
protected:
- void onSwapBuffers() override;
+ void onSwapBuffers(const SkIRect* rect = nullptr) override;
sk_sp<SkSurface> fBackbufferSurface;
Display* fDisplay;
@@ -58,7 +58,7 @@
sk_sp<SkSurface> RasterWindowContext_xlib::getBackbufferSurface() { return fBackbufferSurface; }
-void RasterWindowContext_xlib::onSwapBuffers() {
+void RasterWindowContext_xlib::onSwapBuffers(const SkIRect* rect) {
SkPixmap pm;
if (!fBackbufferSurface->peekPixels(&pm)) {
return;
@@ -80,7 +80,9 @@
if (!XInitImage(&image)) {
return;
}
- XPutImage(fDisplay, fWindow, fGC, &image, 0, 0, 0, 0, pm.width(), pm.height());
+ SkIRect update = rect ? *rect : SkIRect::MakeWH( pm.width(), pm.height());
+ XPutImage(fDisplay, fWindow, fGC, &image, update.x(), update.y(),
+ update.x(), update.y(), update.width(), update.height());
}
} // anonymous namespace
diff -ur skia.org/tools/sk_app/VulkanWindowContext.cpp skia/tools/sk_app/VulkanWindowContext.cpp
--- skia.org/tools/sk_app/VulkanWindowContext.cpp 2023-07-08 21:49:27.179700423 +0200
+++ skia/tools/sk_app/VulkanWindowContext.cpp 2023-07-08 21:52:53.676570245 +0200
@@ -572,7 +572,7 @@
return sk_ref_sp(surface);
}
-void VulkanWindowContext::onSwapBuffers() {
+void VulkanWindowContext::onSwapBuffers(const SkIRect*) {
BackbufferInfo* backbuffer = fBackbuffers + fCurrentBackbufferIndex;
sk_sp<SkSurface> surface = fSurfaces[backbuffer->fImageIndex];
diff -ur skia.org/tools/sk_app/VulkanWindowContext.h skia/tools/sk_app/VulkanWindowContext.h
--- skia.org/tools/sk_app/VulkanWindowContext.h 2023-07-08 21:49:27.179700423 +0200
+++ skia/tools/sk_app/VulkanWindowContext.h 2023-07-08 21:52:34.580494658 +0200
@@ -71,7 +71,7 @@
bool createSwapchain(int width, int height, const DisplayParams& params);
bool createBuffers(VkFormat format, VkImageUsageFlags, SkColorType colorType, VkSharingMode);
void destroyBuffers();
- void onSwapBuffers() override;
+ void onSwapBuffers(const SkIRect* rect = nullptr) override;
// Create functions
CreateVkSurfaceFn fCreateVkSurfaceFn;
diff -ur skia.org/tools/sk_app/win/RasterWindowContext_win.cpp skia/tools/sk_app/win/RasterWindowContext_win.cpp
--- skia.org/tools/sk_app/win/RasterWindowContext_win.cpp 2023-07-08 21:49:27.183700444 +0200
+++ skia/tools/sk_app/win/RasterWindowContext_win.cpp 2023-07-08 21:55:26.169145828 +0200
@@ -27,7 +27,7 @@
void setDisplayParams(const DisplayParams& params) override;
protected:
- void onSwapBuffers() override;
+ void onSwapBuffers(const SkIRect* rect=nullptr) override;
SkAutoMalloc fSurfaceMemory;
sk_sp<SkSurface> fBackbufferSurface;
@@ -73,13 +73,17 @@
sk_sp<SkSurface> RasterWindowContext_win::getBackbufferSurface() { return fBackbufferSurface; }
-void RasterWindowContext_win::onSwapBuffers() {
+void RasterWindowContext_win::onSwapBuffers(const SkIRect* rect) {
BITMAPINFO* bmpInfo = reinterpret_cast<BITMAPINFO*>(fSurfaceMemory.get());
HDC dc = GetDC(fWnd);
SkPixmap pixmap;
fBackbufferSurface->peekPixels(&pixmap);
- StretchDIBits(dc, 0, 0, fWidth, fHeight, 0, 0, fWidth, fHeight, pixmap.addr(), bmpInfo,
- DIB_RGB_COLORS, SRCCOPY);
+ SkIRect update = rect ? *rect : SkIRect::MakeWH( fWidth, fHeight );
+ // It appears that y-axis handling is broken if it doesn't match the window size.
+ update = SkIRect::MakeXYWH( update.x(), 0, update.width(), fHeight );
+ StretchDIBits(dc, update.x(), update.y(), update.width(), update.height(),
+ update.x(), update.y(), update.width(), update.height(),
+ pixmap.addr(), bmpInfo, DIB_RGB_COLORS, SRCCOPY);
ReleaseDC(fWnd, dc);
}
diff -ur skia.org/tools/sk_app/WindowContext.cpp skia/tools/sk_app/WindowContext.cpp
--- skia.org/tools/sk_app/WindowContext.cpp 2023-07-08 21:49:27.179700423 +0200
+++ skia/tools/sk_app/WindowContext.cpp 2023-07-08 21:56:23.373350669 +0200
@@ -20,7 +20,7 @@
WindowContext::~WindowContext() {}
-void WindowContext::swapBuffers() {
+void WindowContext::swapBuffers(const SkIRect* rect) {
#if defined(SK_GRAPHITE)
if (fGraphiteContext) {
SkASSERT(fGraphiteRecorder);
@@ -33,7 +33,7 @@
}
}
#endif
- this->onSwapBuffers();
+ this->onSwapBuffers(rect);
}
} //namespace sk_app
diff -ur skia.org/tools/sk_app/WindowContext.h skia/tools/sk_app/WindowContext.h
--- skia.org/tools/sk_app/WindowContext.h 2023-07-08 21:49:27.179700423 +0200
+++ skia/tools/sk_app/WindowContext.h 2023-07-08 21:51:08.804143750 +0200
@@ -31,7 +31,7 @@
virtual sk_sp<SkSurface> getBackbufferSurface() = 0;
- void swapBuffers();
+ void swapBuffers(const SkIRect* rect = nullptr);
virtual bool isValid() = 0;
@@ -57,7 +57,7 @@
protected:
virtual bool isGpuContext() { return true; }
- virtual void onSwapBuffers() = 0;
+ virtual void onSwapBuffers(const SkIRect* rect = nullptr) = 0;
sk_sp<GrDirectContext> fContext;
#if defined(SK_GRAPHITE)