From 53ca05457a1d7306defd98ee4a21eb18e6a9be8d Mon Sep 17 00:00:00 2001 From: Neil Date: Wed, 2 Feb 2022 14:01:29 +1100 Subject: Add Supports::ThreadSafeMeasureWidths for platforms to indicate if they support concurrent calls to MeasureWidths. --- cocoa/PlatCocoa.mm | 1 + doc/ScintillaDoc.html | 17 ++++++++++++++--- gtk/PlatGTK.cxx | 4 ++++ include/Scintilla.h | 1 + include/Scintilla.iface | 1 + include/ScintillaTypes.h | 1 + win32/PlatWin.cxx | 1 + 7 files changed, 23 insertions(+), 3 deletions(-) diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm index 239884341..bec420a66 100644 --- a/cocoa/PlatCocoa.mm +++ b/cocoa/PlatCocoa.mm @@ -348,6 +348,7 @@ const Supports SupportsCocoa[] = { Supports::FractionalStrokeWidth, Supports::TranslucentStroke, Supports::PixelModification, + Supports::ThreadSafeMeasureWidths, }; } diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index e54059624..58e8da944 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -50,6 +50,7 @@ table.standard tr:nth-child(even) {background: #F0F0F0} table.standard td { padding: 1px 5px 1px 5px; + vertical-align:top; } tr.section { border-top:1px solid #808080; @@ -128,7 +129,7 @@

Scintilla Documentation

-

Last edited 12 November 2021 NH

+

Last edited 2 February 2021 NH

Scintilla 5 has moved the lexers from Scintilla into a new Lexilla project.
@@ -4691,13 +4692,15 @@ struct Sci_TextToFind { SC_SUPPORTS_LINE_DRAWS_FINAL 0 - Whether drawing a line draws its final position. Only false on Win32 GDI. + Whether drawing a line draws its final position.
+ Only false on Win32 GDI. SC_SUPPORTS_PIXEL_DIVISIONS 1 - Are logical pixels larger than physical pixels? Currently only true for macOS Cocoa with 'retina' displays. + Are logical pixels larger than physical pixels?
+ Currently only true for macOS Cocoa with 'retina' displays.
When true, creating pixmaps at twice the resolution can produce clearer output with less blur. @@ -4719,6 +4722,14 @@ struct Sci_TextToFind { Can individual pixels be modified? This is false for character cell platforms like curses. + + SC_SUPPORTS_THREAD_SAFE_MEASURE_WIDTHS + 5 + Can text measurement be safely performed concurrently on multiple threads?
+ Currently only true for macOS Cocoa, DirectWrite on Win32, and GTK on X or Wayland. + + + diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index 53ee57300..859589bec 100755 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -215,6 +215,10 @@ const Supports SupportsGTK[] = { Supports::FractionalStrokeWidth, Supports::TranslucentStroke, Supports::PixelModification, +#if !defined(PLAT_GTK_WIN32) && !defined(PLAT_GTK_MACOSX) + // Pango is not thread-safe on Win32 or macOS + Supports::ThreadSafeMeasureWidths, +#endif }; } diff --git a/include/Scintilla.h b/include/Scintilla.h index b46e886b6..7ab0e3560 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -1101,6 +1101,7 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP #define SC_SUPPORTS_FRACTIONAL_STROKE_WIDTH 2 #define SC_SUPPORTS_TRANSLUCENT_STROKE 3 #define SC_SUPPORTS_PIXEL_MODIFICATION 4 +#define SC_SUPPORTS_THREAD_SAFE_MEASURE_WIDTHS 5 #define SCI_SUPPORTSFEATURE 2750 #define SC_LINECHARACTERINDEX_NONE 0 #define SC_LINECHARACTERINDEX_UTF32 1 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index f2ef2d33e..a98a310ab 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -3040,6 +3040,7 @@ val SC_SUPPORTS_PIXEL_DIVISIONS=1 val SC_SUPPORTS_FRACTIONAL_STROKE_WIDTH=2 val SC_SUPPORTS_TRANSLUCENT_STROKE=3 val SC_SUPPORTS_PIXEL_MODIFICATION=4 +val SC_SUPPORTS_THREAD_SAFE_MEASURE_WIDTHS=5 # Get whether a feature is supported get bool SupportsFeature=2750(Supports feature,) diff --git a/include/ScintillaTypes.h b/include/ScintillaTypes.h index 917878474..fe4b06032 100644 --- a/include/ScintillaTypes.h +++ b/include/ScintillaTypes.h @@ -507,6 +507,7 @@ enum class Supports { FractionalStrokeWidth = 2, TranslucentStroke = 3, PixelModification = 4, + ThreadSafeMeasureWidths = 5, }; enum class LineCharacterIndexType { diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 645decb35..9a41614cd 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -1282,6 +1282,7 @@ constexpr Supports SupportsD2D[] = { Supports::FractionalStrokeWidth, Supports::TranslucentStroke, Supports::PixelModification, + Supports::ThreadSafeMeasureWidths, }; constexpr D2D_COLOR_F ColorFromColourAlpha(ColourRGBA colour) noexcept { -- cgit v1.2.3