Bump to Ultralight 1.1

This commit is contained in:
ImVexed 2019-10-07 14:04:16 -05:00
parent eb6e92adf1
commit c0297f9539
No known key found for this signature in database
GPG Key ID: F16360BA6A2715B8
22 changed files with 793 additions and 313 deletions

BIN
examples/create-react-app/cra-go Executable file

Binary file not shown.

View File

@ -15,6 +15,7 @@
#include "Defines.h" #include "Defines.h"
#include <Ultralight/RefPtr.h> #include <Ultralight/RefPtr.h>
#include <Ultralight/Renderer.h> #include <Ultralight/Renderer.h>
#include <Ultralight/platform/Config.h>
namespace ultralight { namespace ultralight {
@ -37,6 +38,36 @@ public:
virtual void OnUpdate() {} virtual void OnUpdate() {}
}; };
///
/// App-specific settings.
///
struct AExport Settings {
///
/// The root file path for our file system. You should set this to the
/// relative path where all of your app data is.
///
/// This will be used to resolve all file URLs, eg file:///page.html
///
/// @note By default, on macOS we use the app bundle's @resource_path,
/// on all other platforms we use the "./assets/" directory relative
/// to the executable's directory.
///
#ifdef __APPLE__
String file_system_path = "@resource_path";
#else
String file_system_path = "./assets/";
#endif
///
/// Whether or not we should load and compile shaders from the file system
/// (eg, from the /shaders/ path, relative to file_system_path).
///
/// If this is false (the default), we will instead load pre-compiled shaders
/// from memory which speeds up application startup time.
///
bool load_shaders_from_file_system = false;
};
/// ///
/// Main application class. /// Main application class.
/// ///
@ -45,18 +76,29 @@ public:
/// ///
/// Create the App singleton. /// Create the App singleton.
/// ///
/// @param settings Settings to customize App runtime behavior.
///
/// @param config Config options for the Ultralight renderer.
///
/// @return Returns a ref-pointer to the created App instance.
///
/// @note You should only create one of these per application lifetime. /// @note You should only create one of these per application lifetime.
/// ///
/// App maintains its own Renderer instance, make sure to set your /// @note Certain Config options may be overridden during App creation,
/// Config before creating App. (@see Platform::set_config) /// most commonly Config::face_winding and Config::device_scale_hint.
/// ///
static Ref<App> Create(); static Ref<App> Create(Settings settings = Settings(), Config config = Config());
/// ///
/// Get the App singleton. /// Get the App singleton.
/// ///
static App* instance(); static App* instance();
///
/// Get the settings this App was created with.
///
virtual const Settings& settings() const = 0;
/// ///
/// Set the main window. You must set this before calling Run. /// Set the main window. You must set this before calling Run.
/// ///

View File

@ -18,18 +18,19 @@
#if defined(__WIN32__) || defined(_WIN32) #if defined(__WIN32__) || defined(_WIN32)
# if defined(APPCORE_IMPLEMENTATION) # if defined(APPCORE_IMPLEMENTATION)
# define AExport __declspec(dllexport) # define ACExport __declspec(dllexport)
# else # else
# define AExport __declspec(dllimport) # define ACExport __declspec(dllimport)
# endif # endif
#else #else
# define AExport __attribute__((visibility("default"))) # define ACExport __attribute__((visibility("default")))
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
typedef struct C_Settings* ULSettings;
typedef struct C_App* ULApp; typedef struct C_App* ULApp;
typedef struct C_Window* ULWindow; typedef struct C_Window* ULWindow;
typedef struct C_Monitor* ULMonitor; typedef struct C_Monitor* ULMonitor;
@ -45,37 +46,73 @@ typedef enum {
kWindowFlags_Maximizable = 1 << 3, kWindowFlags_Maximizable = 1 << 3,
} ULWindowFlags; } ULWindowFlags;
///
/// Create settings with default values (see <AppCore/App.h>).
///
ACExport ULSettings ulCreateSettings();
///
/// Destroy settings.
///
ACExport void ulDestroySettings(ULSettings settings);
///
/// Set the root file path for our file system, you should set this to the
/// relative path where all of your app data is.
///
/// This will be used to resolve all file URLs, eg file:///page.html
///
/// @note By default, on macOS we use the app bundle's @resource_path,
/// on all other platforms we use the "./assets/" directory relative
/// to the executable's directory.
///
ACExport void ulSettingsSetFileSystemPath(ULSettings settings, ULString path);
///
/// Set whether or not we should load and compile shaders from the file system
/// (eg, from the /shaders/ path, relative to file_system_path).
///
/// If this is false (the default), we will instead load pre-compiled shaders
/// from memory which speeds up application startup time.
///
ACExport void ulSettingsSetLoadShadersFromFileSystem(ULSettings settings,
bool enabled);
/// ///
/// Create the App singleton. /// Create the App singleton.
/// ///
/// @param config Configuration settings to use. /// @param settings Settings to customize App runtime behavior. You can pass
/// NULL for this parameter to use default settings.
///
/// @param config Config options for the Ultralight renderer. You can pass
/// NULL for this parameter to use default config.
/// ///
/// @note You should only create one of these per application lifetime. /// @note You should only create one of these per application lifetime.
/// ///
/// App maintains its own Renderer instance, make sure to set your /// @note Certain Config options may be overridden during App creation,
/// Config before creating App. (@see Platform::set_config) /// most commonly Config::face_winding and Config::device_scale_hint.
/// ///
AExport ULApp ulCreateApp(ULConfig config); ACExport ULApp ulCreateApp(ULSettings settings, ULConfig config);
/// ///
/// Destroy the App instance. /// Destroy the App instance.
/// ///
AExport void ulDestroyApp(ULApp app); ACExport void ulDestroyApp(ULApp app);
/// ///
/// Set the main window. You must set this before calling ulAppRun. /// Set the main window, you must set this before calling ulAppRun.
/// ///
/// @param window The window to use for all rendering. /// @param window The window to use for all rendering.
/// ///
/// @note We currently only support one Window per App, this will change /// @note We currently only support one Window per App, this will change
/// later once we add support for multiple driver instances. /// later once we add support for multiple driver instances.
/// ///
AExport void ulAppSetWindow(ULApp app, ULWindow window); ACExport void ulAppSetWindow(ULApp app, ULWindow window);
/// ///
/// Get the main window. /// Get the main window.
/// ///
AExport ULWindow ulAppGetWindow(ULApp app); ACExport ULWindow ulAppGetWindow(ULApp app);
typedef void typedef void
(*ULUpdateCallback) (void* user_data); (*ULUpdateCallback) (void* user_data);
@ -87,52 +124,50 @@ typedef void
/// @note This event is fired right before the run loop calls /// @note This event is fired right before the run loop calls
/// Renderer::Update and Renderer::Render. /// Renderer::Update and Renderer::Render.
/// ///
AExport void ulAppSetUpdateCallback(ULApp app, ULUpdateCallback callback, ACExport void ulAppSetUpdateCallback(ULApp app, ULUpdateCallback callback,
void* user_data); void* user_data);
/// ///
/// Whether or not the App is running. /// Whether or not the App is running.
/// ///
AExport bool ulAppIsRunning(ULApp app); ACExport bool ulAppIsRunning(ULApp app);
/// ///
/// Get the main monitor (this is never NULL). /// Get the main monitor (this is never NULL).
/// ///
/// @note We'll add monitor enumeration later. /// @note We'll add monitor enumeration later.
/// ///
AExport ULMonitor ulAppGetMainMonitor(ULApp app); ACExport ULMonitor ulAppGetMainMonitor(ULApp app);
/// ///
/// Get the underlying Renderer instance. /// Get the underlying Renderer instance.
/// ///
AExport ULRenderer ulAppGetRenderer(ULApp app); ACExport ULRenderer ulAppGetRenderer(ULApp app);
/// ///
/// Run the main loop. /// Run the main loop, make sure to call ulAppSetWindow before calling this.
/// ///
/// @note Make sure to call ulAppSetWindow before calling this. ACExport void ulAppRun(ULApp app);
///
AExport void ulAppRun(ULApp app);
/// ///
/// Quit the application. /// Quit the application.
/// ///
AExport void ulAppQuit(ULApp app); ACExport void ulAppQuit(ULApp app);
/// ///
/// Get the monitor's DPI scale (1.0 = 100%). /// Get the monitor's DPI scale (1.0 = 100%).
/// ///
AExport double ulMonitorGetScale(ULMonitor monitor); ACExport double ulMonitorGetScale(ULMonitor monitor);
/// ///
/// Get the width of the monitor (in device coordinates) /// Get the width of the monitor (in device coordinates).
/// ///
AExport unsigned int ulMonitorGetWidth(ULMonitor monitor); ACExport unsigned int ulMonitorGetWidth(ULMonitor monitor);
/// ///
/// Get the height of the monitor (in device coordinates) /// Get the height of the monitor (in device coordinates).
/// ///
AExport unsigned int ulMonitorGetHeight(ULMonitor monitor); ACExport unsigned int ulMonitorGetHeight(ULMonitor monitor);
/// ///
/// Create a new Window. /// Create a new Window.
@ -147,14 +182,14 @@ AExport unsigned int ulMonitorGetHeight(ULMonitor monitor);
/// ///
/// @param window_flags Various window flags. /// @param window_flags Various window flags.
/// ///
AExport ULWindow ulCreateWindow(ULMonitor monitor, unsigned int width, ACExport ULWindow ulCreateWindow(ULMonitor monitor, unsigned int width,
unsigned int height, bool fullscreen, unsigned int height, bool fullscreen,
unsigned int window_flags); unsigned int window_flags);
/// ///
/// Destroy a Window. /// Destroy a Window.
/// ///
AExport void ulDestroyWindow(ULWindow window); ACExport void ulDestroyWindow(ULWindow window);
typedef void typedef void
(*ULCloseCallback) (void* user_data); (*ULCloseCallback) (void* user_data);
@ -162,7 +197,7 @@ typedef void
/// ///
/// Set a callback to be notified when a window closes. /// Set a callback to be notified when a window closes.
/// ///
AExport void ulWindowSetCloseCallback(ULWindow window, ACExport void ulWindowSetCloseCallback(ULWindow window,
ULCloseCallback callback, ULCloseCallback callback,
void* user_data); void* user_data);
@ -173,54 +208,54 @@ typedef void
/// Set a callback to be notified when a window resizes /// Set a callback to be notified when a window resizes
/// (parameters are passed back in device coordinates). /// (parameters are passed back in device coordinates).
/// ///
AExport void ulWindowSetResizeCallback(ULWindow window, ACExport void ulWindowSetResizeCallback(ULWindow window,
ULResizeCallback callback, ULResizeCallback callback,
void* user_data); void* user_data);
/// ///
/// Get window width (in device coordinates). /// Get window width (in device coordinates).
/// ///
AExport unsigned int ulWindowGetWidth(ULWindow window); ACExport unsigned int ulWindowGetWidth(ULWindow window);
/// ///
/// Get window height (in device coordinates). /// Get window height (in device coordinates).
/// ///
AExport unsigned int ulWindowGetHeight(ULWindow window); ACExport unsigned int ulWindowGetHeight(ULWindow window);
/// ///
/// Get whether or not a window is fullscreen. /// Get whether or not a window is fullscreen.
/// ///
AExport bool ulWindowIsFullscreen(ULWindow window); ACExport bool ulWindowIsFullscreen(ULWindow window);
/// ///
/// Get the DPI scale of a window. /// Get the DPI scale of a window.
/// ///
AExport double ulWindowGetScale(ULWindow window); ACExport double ulWindowGetScale(ULWindow window);
/// ///
/// Set the window title. /// Set the window title.
/// ///
AExport void ulWindowSetTitle(ULWindow window, const char* title); ACExport void ulWindowSetTitle(ULWindow window, const char* title);
/// ///
/// Set the cursor for a window. /// Set the cursor for a window.
/// ///
AExport void ulWindowSetCursor(ULWindow window, ULCursor cursor); ACExport void ulWindowSetCursor(ULWindow window, ULCursor cursor);
/// ///
/// Close a window. /// Close a window.
/// ///
AExport void ulWindowClose(ULWindow window); ACExport void ulWindowClose(ULWindow window);
/// ///
/// Convert device coordinates to pixels using the current DPI scale. /// Convert device coordinates to pixels using the current DPI scale.
/// ///
AExport int ulWindowDeviceToPixel(ULWindow window, int val); ACExport int ulWindowDeviceToPixel(ULWindow window, int val);
/// ///
/// Convert pixels to device coordinates using the current DPI scale. /// Convert pixels to device coordinates using the current DPI scale.
/// ///
AExport int ulWindowPixelsToDevice(ULWindow window, int val); ACExport int ulWindowPixelsToDevice(ULWindow window, int val);
/// ///
/// Create a new Overlay. /// Create a new Overlay.
@ -241,82 +276,82 @@ AExport int ulWindowPixelsToDevice(ULWindow window, int val);
/// @note Each Overlay is essentially a View and an on-screen quad. You should /// @note Each Overlay is essentially a View and an on-screen quad. You should
/// create the Overlay then load content into the underlying View. /// create the Overlay then load content into the underlying View.
/// ///
AExport ULOverlay ulCreateOverlay(ULWindow window, unsigned int width, ACExport ULOverlay ulCreateOverlay(ULWindow window, unsigned int width,
unsigned int height, int x, int y); unsigned int height, int x, int y);
/// ///
/// Destroy an overlay. /// Destroy an overlay.
/// ///
AExport void ulDestroyOverlay(ULOverlay overlay); ACExport void ulDestroyOverlay(ULOverlay overlay);
/// ///
/// Get the underlying View. /// Get the underlying View.
/// ///
AExport ULView ulOverlayGetView(ULOverlay overlay); ACExport ULView ulOverlayGetView(ULOverlay overlay);
/// ///
/// Get the width (in device coordinates). /// Get the width (in device coordinates).
/// ///
AExport unsigned int ulOverlayGetWidth(ULOverlay overlay); ACExport unsigned int ulOverlayGetWidth(ULOverlay overlay);
/// ///
/// Get the height (in device coordinates). /// Get the height (in device coordinates).
/// ///
AExport unsigned int ulOverlayGetHeight(ULOverlay overlay); ACExport unsigned int ulOverlayGetHeight(ULOverlay overlay);
/// ///
/// Get the x-position (offset from the left of the Window), in device /// Get the x-position (offset from the left of the Window), in device
/// coordinates. /// coordinates.
/// ///
AExport int ulOverlayGetX(ULOverlay overlay); ACExport int ulOverlayGetX(ULOverlay overlay);
/// ///
/// Get the y-position (offset from the top of the Window), in device /// Get the y-position (offset from the top of the Window), in device
/// coordinates. /// coordinates.
/// ///
AExport int ulOverlayGetY(ULOverlay overlay); ACExport int ulOverlayGetY(ULOverlay overlay);
/// ///
/// Move the overlay to a new position (in device coordinates). /// Move the overlay to a new position (in device coordinates).
/// ///
AExport void ulOverlayMoveTo(ULOverlay overlay, int x, int y); ACExport void ulOverlayMoveTo(ULOverlay overlay, int x, int y);
/// ///
/// Resize the overlay (and underlying View), dimensions should be /// Resize the overlay (and underlying View), dimensions should be
/// specified in device coordinates. /// specified in device coordinates.
/// ///
AExport void ulOverlayResize(ULOverlay overlay, unsigned int width, ACExport void ulOverlayResize(ULOverlay overlay, unsigned int width,
unsigned int height); unsigned int height);
/// ///
/// Whether or not the overlay is hidden (not drawn). /// Whether or not the overlay is hidden (not drawn).
/// ///
AExport bool ulOverlayIsHidden(ULOverlay overlay); ACExport bool ulOverlayIsHidden(ULOverlay overlay);
/// ///
/// Hide the overlay (will no longer be drawn) /// Hide the overlay (will no longer be drawn).
/// ///
AExport void ulOverlayHide(ULOverlay overlay); ACExport void ulOverlayHide(ULOverlay overlay);
/// ///
/// Show the overlay. /// Show the overlay.
/// ///
AExport void ulOverlayShow(ULOverlay overlay); ACExport void ulOverlayShow(ULOverlay overlay);
/// ///
/// Whether or not an overlay has keyboard focus. /// Whether or not an overlay has keyboard focus.
/// ///
AExport bool ulOverlayHasFocus(ULOverlay overlay); ACExport bool ulOverlayHasFocus(ULOverlay overlay);
/// ///
/// Grant this overlay exclusive keyboard focus. /// Grant this overlay exclusive keyboard focus.
/// ///
AExport void ulOverlayFocus(ULOverlay overlay); ACExport void ulOverlayFocus(ULOverlay overlay);
/// ///
/// Remove keyboard focus. /// Remove keyboard focus.
/// ///
AExport void ulOverlayUnfocus(ULOverlay overlay); ACExport void ulOverlayUnfocus(ULOverlay overlay);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -24,17 +24,33 @@ namespace ultralight {
/// The various Bitmap formats. /// The various Bitmap formats.
/// ///
enum UExport BitmapFormat { enum UExport BitmapFormat {
/// Alpha-channel only, 8-bits per channel (8-bits in total per pixel) /**
kBitmapFormat_A8, * Alpha channel only, 8-bits per pixel.
*
* Encoding: 8-bits per channel, unsigned normalized.
*
* Color-space: Linear (no gamma), alpha-coverage only.
*/
kBitmapFormat_A8_UNORM,
/// Red Green Blue Alpha, 8-bits per channel (32-bits in total per pixel) /**
kBitmapFormat_RGBA8 * Blue Green Red Alpha channels, 32-bits per pixel.
*
* Encoding: 8-bits per channel, unsigned normalized.
*
* Color-space: sRGB gamma with premultiplied linear alpha channel.
*
* NOTE: Alpha is premultiplied with BGR channels _before_ sRGB gamma is
* applied so we can use sRGB conversion hardware and perform all
* blending in linear space on GPU.
*/
kBitmapFormat_BGRA8_UNORM_SRGB,
}; };
/// ///
/// Macro to get the bytes per pixel from a BitmapFormat /// Macro to get the bytes per pixel from a BitmapFormat
/// ///
#define GetBytesPerPixel(x) (x == kBitmapFormat_A8? 1 : 4) #define GetBytesPerPixel(x) (x == kBitmapFormat_A8_UNORM? 1 : 4)
/// ///
/// @brief Bitmap container with basic blitting and conversion routines. /// @brief Bitmap container with basic blitting and conversion routines.
@ -58,7 +74,8 @@ class UExport Bitmap : public RefCounted {
/// ///
/// @return A ref-pointer to a new Bitmap instance. /// @return A ref-pointer to a new Bitmap instance.
/// ///
static Ref<Bitmap> Create(uint32_t width, uint32_t height, BitmapFormat format); static Ref<Bitmap> Create(uint32_t width, uint32_t height,
BitmapFormat format);
/// ///
/// Create a Bitmap with existing pixels and configuration. /// Create a Bitmap with existing pixels and configuration.
@ -81,10 +98,20 @@ class UExport Bitmap : public RefCounted {
/// raw pixels passed in as its own, but you are still /// raw pixels passed in as its own, but you are still
/// responsible for destroying your buffer afterwards. /// responsible for destroying your buffer afterwards.
/// ///
/// @param fixup_gamma Whether or not we should reinterpret the source
/// as an sRGB bitmap with premultiplied alpha applied
/// after the gamma function (typical of PNGs). We
/// expect all premultiplication to be applied before
/// the gamma function so we can blend properly in
/// linear space. Only valid for
/// kBitmapFormat_BGRA8_UNORM_SRGB.
///
/// @return A ref-pointer to a new Bitmap instance. /// @return A ref-pointer to a new Bitmap instance.
/// ///
static Ref<Bitmap> Create(uint32_t width, uint32_t height, BitmapFormat format, static Ref<Bitmap> Create(uint32_t width, uint32_t height,
uint32_t row_bytes, const void* pixels, size_t size, bool should_copy = true); BitmapFormat format, uint32_t row_bytes,
const void* pixels, size_t size,
bool should_copy = true, bool fixup_gamma = false);
/// ///
/// Create a bitmap from a deep copy of another Bitmap. /// Create a bitmap from a deep copy of another Bitmap.
@ -185,7 +212,7 @@ class UExport Bitmap : public RefCounted {
/// ///
/// @note Formats do not need to match. Bitmap formats will be converted /// @note Formats do not need to match. Bitmap formats will be converted
/// to one another automatically. Note that when converting from /// to one another automatically. Note that when converting from
/// RGBA8 to A8, only the Red channel will be used. /// BGRA8 to A8, only the Blue channel will be used.
/// ///
/// @param src_rect The source rectangle, relative to src bitmap. /// @param src_rect The source rectangle, relative to src bitmap.
/// ///
@ -212,6 +239,24 @@ class UExport Bitmap : public RefCounted {
/// ///
virtual bool WritePNG(const char* path) = 0; virtual bool WritePNG(const char* path) = 0;
///
/// Make a resized copy of this bitmap by writing to a pre-allocated
/// destination bitmap.
///
/// @param destination The bitmap to store the result in, the width and
/// height of the destination will be used.
///
/// @param high_quality Whether or not a high quality resampling will be
/// used during the resize. (Otherwise, just uses fast
/// nearest-neighbor sampling)
///
/// @return Whether or not the operation succeeded. This operation is only
/// valid if both formats are kBitmapFormat_BGRA8_UNORM_SRGB and
/// both the source and destination are non-empty.
///
virtual bool Resample(Ref<Bitmap> destination, bool high_quality) = 0;
protected: protected:
Bitmap(); Bitmap();
virtual ~Bitmap(); virtual ~Bitmap();

View File

@ -179,62 +179,86 @@ ULExport ULConfig ulCreateConfig();
ULExport void ulDestroyConfig(ULConfig config); ULExport void ulDestroyConfig(ULConfig config);
/// ///
/// Set whether images should be enabled (Default = True) /// Set whether images should be enabled (Default = True).
/// ///
ULExport void ulConfigSetEnableImages(ULConfig config, bool enabled); ULExport void ulConfigSetEnableImages(ULConfig config, bool enabled);
/// ///
/// Set whether JavaScript should be eanbled (Default = True) /// Set whether JavaScript should be eanbled (Default = True).
/// ///
ULExport void ulConfigSetEnableJavaScript(ULConfig config, bool enabled); ULExport void ulConfigSetEnableJavaScript(ULConfig config, bool enabled);
/// ///
/// Set whether we should use BGRA byte order (instead of RGBA) for View /// Set whether we should use BGRA byte order (instead of RGBA) for View
/// bitmaps. (Default = False) /// bitmaps (Default = False).
/// ///
ULExport void ulConfigSetUseBGRAForOffscreenRendering(ULConfig config, ULExport void ulConfigSetUseBGRAForOffscreenRendering(ULConfig config,
bool enabled); bool enabled);
/// ///
/// Set the amount that the application DPI has been scaled, used for /// Set the amount that the application DPI has been scaled, used for
/// scaling device coordinates to pixels and oversampling raster shapes. /// scaling device coordinates to pixels and oversampling raster shapes
/// (Default = 1.0) /// (Default = 1.0).
/// ///
ULExport void ulConfigSetDeviceScaleHint(ULConfig config, double value); ULExport void ulConfigSetDeviceScaleHint(ULConfig config, double value);
/// ///
/// Set default font-family to use (Default = Times New Roman) /// Set default font-family to use (Default = Times New Roman).
/// ///
ULExport void ulConfigSetFontFamilyStandard(ULConfig config, ULExport void ulConfigSetFontFamilyStandard(ULConfig config,
ULString font_name); ULString font_name);
/// ///
/// Set default font-family to use for fixed fonts, eg <pre> and <code>. /// Set default font-family to use for fixed fonts, eg <pre> and <code>
/// (Default = Courier New) /// (Default = Courier New).
/// ///
ULExport void ulConfigSetFontFamilyFixed(ULConfig config, ULString font_name); ULExport void ulConfigSetFontFamilyFixed(ULConfig config, ULString font_name);
/// ///
/// Set default font-family to use for serif fonts. (Default = Times New Roman) /// Set default font-family to use for serif fonts (Default = Times New Roman).
/// ///
ULExport void ulConfigSetFontFamilySerif(ULConfig config, ULString font_name); ULExport void ulConfigSetFontFamilySerif(ULConfig config, ULString font_name);
/// ///
/// Set default font-family to use for sans-serif fonts. (Default = Arial) /// Set default font-family to use for sans-serif fonts (Default = Arial).
/// ///
ULExport void ulConfigSetFontFamilySansSerif(ULConfig config, ULExport void ulConfigSetFontFamilySansSerif(ULConfig config,
ULString font_name); ULString font_name);
/// ///
/// Set user agent string. (See <Ultralight/platform/Config.h> for the default) /// Set user agent string (See <Ultralight/platform/Config.h> for the default).
/// ///
ULExport void ulConfigSetUserAgent(ULConfig config, ULString agent_string); ULExport void ulConfigSetUserAgent(ULConfig config, ULString agent_string);
/// ///
/// Set user stylesheet (CSS). (Default = Empty) /// Set user stylesheet (CSS) (Default = Empty).
/// ///
ULExport void ulConfigSetUserStylesheet(ULConfig config, ULString css_string); ULExport void ulConfigSetUserStylesheet(ULConfig config, ULString css_string);
///
/// Set whether or not we should continuously repaint any Views or compositor
/// layers, regardless if they are dirty or not. This is mainly used to
/// diagnose painting/shader issues. (Default = False)
///
ULExport void ulConfigSetForceRepaint(ULConfig config, bool enabled);
///
/// Set the amount of time to wait before triggering another repaint when a
/// CSS animation is active. (Default = 1.0 / 60.0)
///
ULExport void ulConfigSetAnimationTimerDelay(ULConfig config, double delay);
///
/// Set the size of WebCore's memory cache for decoded images, scripts, and
/// other assets in bytes. (Default = 64 * 1024 * 1024)
///
ULExport void ulConfigSetMemoryCacheSize(ULConfig config, unsigned int size);
///
/// Set the number of pages to keep in the cache. (Default = 0)
///
ULExport void ulConfigSetPageCacheSize(ULConfig config, unsigned int size);
/****************************************************************************** /******************************************************************************
* Renderer * Renderer
*****************************************************************************/ *****************************************************************************/
@ -250,7 +274,7 @@ ULExport ULRenderer ulCreateRenderer(ULConfig config);
ULExport void ulDestroyRenderer(ULRenderer renderer); ULExport void ulDestroyRenderer(ULRenderer renderer);
/// ///
/// Update timers and dispatch internal callbacks (JavaScript and network) /// Update timers and dispatch internal callbacks (JavaScript and network).
/// ///
ULExport void ulUpdate(ULRenderer renderer); ULExport void ulUpdate(ULRenderer renderer);
@ -294,7 +318,7 @@ ULExport ULString ulViewGetTitle(ULView view);
ULExport bool ulViewIsLoading(ULView view); ULExport bool ulViewIsLoading(ULView view);
/// ///
/// Check if bitmap is dirty (has changed since last call to ulViewGetBitmap) /// Check if bitmap is dirty (has changed since last call to ulViewGetBitmap).
/// ///
ULExport bool ulViewIsBitmapDirty(ULView view); ULExport bool ulViewIsBitmapDirty(ULView view);
@ -306,78 +330,78 @@ ULExport bool ulViewIsBitmapDirty(ULView view);
ULExport ULBitmap ulViewGetBitmap(ULView view); ULExport ULBitmap ulViewGetBitmap(ULView view);
/// ///
/// Load a raw string of html /// Load a raw string of HTML.
/// ///
ULExport void ulViewLoadHTML(ULView view, ULString html_string); ULExport void ulViewLoadHTML(ULView view, ULString html_string);
/// ///
/// Load a URL into main frame /// Load a URL into main frame.
/// ///
ULExport void ulViewLoadURL(ULView view, ULString url_string); ULExport void ulViewLoadURL(ULView view, ULString url_string);
/// ///
/// Resize view to a certain width and height (in device coordinates) /// Resize view to a certain width and height (in device coordinates).
/// ///
ULExport void ulViewResize(ULView view, unsigned int width, ULExport void ulViewResize(ULView view, unsigned int width,
unsigned int height); unsigned int height);
/// ///
/// Get the page's JSContext for use with JavaScriptCore API /// Get the page's JSContext for use with JavaScriptCore API.
/// ///
ULExport JSContextRef ulViewGetJSContext(ULView view); ULExport JSContextRef ulViewGetJSContext(ULView view);
/// ///
/// Evaluate a raw string of JavaScript and return result /// Evaluate a raw string of JavaScript and return result.
/// ///
ULExport JSValueRef ulViewEvaluateScript(ULView view, ULString js_string); ULExport JSValueRef ulViewEvaluateScript(ULView view, ULString js_string);
/// ///
/// Check if can navigate backwards in history /// Check if can navigate backwards in history.
/// ///
ULExport bool ulViewCanGoBack(ULView view); ULExport bool ulViewCanGoBack(ULView view);
/// ///
/// Check if can navigate forwards in history /// Check if can navigate forwards in history.
/// ///
ULExport bool ulViewCanGoForward(ULView view); ULExport bool ulViewCanGoForward(ULView view);
/// ///
/// Navigate backwards in history /// Navigate backwards in history.
/// ///
ULExport void ulViewGoBack(ULView view); ULExport void ulViewGoBack(ULView view);
/// ///
/// Navigate forwards in history /// Navigate forwards in history.
/// ///
ULExport void ulViewGoForward(ULView view); ULExport void ulViewGoForward(ULView view);
/// ///
/// Navigate to arbitrary offset in history /// Navigate to arbitrary offset in history.
/// ///
ULExport void ulViewGoToHistoryOffset(ULView view, int offset); ULExport void ulViewGoToHistoryOffset(ULView view, int offset);
/// ///
/// Reload current page /// Reload current page.
/// ///
ULExport void ulViewReload(ULView view); ULExport void ulViewReload(ULView view);
/// ///
/// Stop all page loads /// Stop all page loads.
/// ///
ULExport void ulViewStop(ULView view); ULExport void ulViewStop(ULView view);
/// ///
/// Fire a keyboard event /// Fire a keyboard event.
/// ///
ULExport void ulViewFireKeyEvent(ULView view, ULKeyEvent key_event); ULExport void ulViewFireKeyEvent(ULView view, ULKeyEvent key_event);
/// ///
/// Fire a mouse event /// Fire a mouse event.
/// ///
ULExport void ulViewFireMouseEvent(ULView view, ULMouseEvent mouse_event); ULExport void ulViewFireMouseEvent(ULView view, ULMouseEvent mouse_event);
/// ///
/// Fire a scroll event /// Fire a scroll event.
/// ///
ULExport void ulViewFireScrollEvent(ULView view, ULScrollEvent scroll_event); ULExport void ulViewFireScrollEvent(ULView view, ULScrollEvent scroll_event);
@ -385,7 +409,7 @@ typedef void
(*ULChangeTitleCallback) (void* user_data, ULView caller, ULString title); (*ULChangeTitleCallback) (void* user_data, ULView caller, ULString title);
/// ///
/// Set callback for when the page title changes /// Set callback for when the page title changes.
/// ///
ULExport void ulViewSetChangeTitleCallback(ULView view, ULExport void ulViewSetChangeTitleCallback(ULView view,
ULChangeTitleCallback callback, ULChangeTitleCallback callback,
@ -395,7 +419,7 @@ typedef void
(*ULChangeURLCallback) (void* user_data, ULView caller, ULString url); (*ULChangeURLCallback) (void* user_data, ULView caller, ULString url);
/// ///
/// Set callback for when the page URL changes /// Set callback for when the page URL changes.
/// ///
ULExport void ulViewSetChangeURLCallback(ULView view, ULExport void ulViewSetChangeURLCallback(ULView view,
ULChangeURLCallback callback, ULChangeURLCallback callback,
@ -405,7 +429,7 @@ typedef void
(*ULChangeTooltipCallback) (void* user_data, ULView caller, ULString tooltip); (*ULChangeTooltipCallback) (void* user_data, ULView caller, ULString tooltip);
/// ///
/// Set callback for when the tooltip changes (usually result of a mouse hover) /// Set callback for when the tooltip changes (usually result of a mouse hover).
/// ///
ULExport void ulViewSetChangeTooltipCallback(ULView view, ULExport void ulViewSetChangeTooltipCallback(ULView view,
ULChangeTooltipCallback callback, ULChangeTooltipCallback callback,
@ -415,7 +439,7 @@ typedef void
(*ULChangeCursorCallback) (void* user_data, ULView caller, ULCursor cursor); (*ULChangeCursorCallback) (void* user_data, ULView caller, ULCursor cursor);
/// ///
/// Set callback for when the mouse cursor changes /// Set callback for when the mouse cursor changes.
/// ///
ULExport void ulViewSetChangeCursorCallback(ULView view, ULExport void ulViewSetChangeCursorCallback(ULView view,
ULChangeCursorCallback callback, ULChangeCursorCallback callback,
@ -430,7 +454,7 @@ typedef void
/// ///
/// Set callback for when a message is added to the console (useful for /// Set callback for when a message is added to the console (useful for
/// JavaScript / network errors and debugging) /// JavaScript / network errors and debugging).
/// ///
ULExport void ulViewSetAddConsoleMessageCallback(ULView view, ULExport void ulViewSetAddConsoleMessageCallback(ULView view,
ULAddConsoleMessageCallback callback, ULAddConsoleMessageCallback callback,
@ -440,7 +464,7 @@ typedef void
(*ULBeginLoadingCallback) (void* user_data, ULView caller); (*ULBeginLoadingCallback) (void* user_data, ULView caller);
/// ///
/// Set callback for when the page begins loading new URL into main frame /// Set callback for when the page begins loading new URL into main frame.
/// ///
ULExport void ulViewSetBeginLoadingCallback(ULView view, ULExport void ulViewSetBeginLoadingCallback(ULView view,
ULBeginLoadingCallback callback, ULBeginLoadingCallback callback,
@ -450,7 +474,7 @@ typedef void
(*ULFinishLoadingCallback) (void* user_data, ULView caller); (*ULFinishLoadingCallback) (void* user_data, ULView caller);
/// ///
/// Set callback for when the page finishes loading URL into main frame /// Set callback for when the page finishes loading URL into main frame.
/// ///
ULExport void ulViewSetFinishLoadingCallback(ULView view, ULExport void ulViewSetFinishLoadingCallback(ULView view,
ULFinishLoadingCallback callback, ULFinishLoadingCallback callback,
@ -460,7 +484,7 @@ typedef void
(*ULUpdateHistoryCallback) (void* user_data, ULView caller); (*ULUpdateHistoryCallback) (void* user_data, ULView caller);
/// ///
/// Set callback for when the history (back/forward state) is modified /// Set callback for when the history (back/forward state) is modified.
/// ///
ULExport void ulViewSetUpdateHistoryCallback(ULView view, ULExport void ulViewSetUpdateHistoryCallback(ULView view,
ULUpdateHistoryCallback callback, ULUpdateHistoryCallback callback,
@ -491,22 +515,37 @@ ULExport void ulViewSetNeedsPaint(ULView view, bool needs_paint);
/// ///
ULExport bool ulViewGetNeedsPaint(ULView view); ULExport bool ulViewGetNeedsPaint(ULView view);
///
/// Create an inspector for this View, this is useful for debugging and
/// inspecting pages locally. This will only succeed if you have the
/// inspector assets in your filesystem-- the inspector will look for
/// file:///inspector/Main.html when it loads.
///
/// @note The initial dimensions of the returned View are 10x10, you should
/// call ulViewResize on the returned View to resize it to your desired
/// dimensions.
///
/// @note You will need to call ulDestroyView on the returned instance
/// when you're done using it.
///
ULExport ULView ulViewCreateInspectorView(ULView view);
/****************************************************************************** /******************************************************************************
* String * String
*****************************************************************************/ *****************************************************************************/
/// ///
/// Create string from null-terminated ASCII C-string /// Create string from null-terminated ASCII C-string.
/// ///
ULExport ULString ulCreateString(const char* str); ULExport ULString ulCreateString(const char* str);
/// ///
/// Create string from UTF-8 buffer /// Create string from UTF-8 buffer.
/// ///
ULExport ULString ulCreateStringUTF8(const char* str, size_t len); ULExport ULString ulCreateStringUTF8(const char* str, size_t len);
/// ///
/// Create string from UTF-16 buffer /// Create string from UTF-16 buffer.
/// ///
ULExport ULString ulCreateStringUTF16(ULChar16* str, size_t len); ULExport ULString ulCreateStringUTF16(ULChar16* str, size_t len);
@ -521,7 +560,7 @@ ULExport void ulDestroyString(ULString str);
ULExport ULChar16* ulStringGetData(ULString str); ULExport ULChar16* ulStringGetData(ULString str);
/// ///
/// Get length in UTF-16 characters /// Get length in UTF-16 characters.
/// ///
ULExport size_t ulStringGetLength(ULString str); ULExport size_t ulStringGetLength(ULString str);

View File

@ -19,64 +19,135 @@
namespace ultralight { namespace ultralight {
/// ///
/// Affine Matrix helper /// 4x4 Matrix Helper
/// ///
struct UExport Matrix { struct UExport Matrix4x4 {
/// ///
/// Raw affine matrix as an array /// Raw 4x4 matrix as an array
/// ///
float data[6]; float data[16];
/// ///
/// Set to identity matrix /// Set to identity matrix.
///
void SetIdentity();
};
///
/// Transformation Matrix helper
///
struct UExport Matrix {
#if defined(__x86_64__) || defined(_M_X64)
#if defined(_MSC_VER)
__declspec(align(16)) typedef double Aligned4x4[4][4];
#else
typedef double Aligned4x4[4][4] __attribute__((aligned(16)));
#endif
#else
typedef double Aligned4x4[4][4];
#endif
Aligned4x4 data;
///
/// Set to identity matrix.
/// ///
void SetIdentity(); void SetIdentity();
/// ///
/// Set to another matrix /// Set to an orthographic projection matrix suitable for use with our
/// vertex shaders. Optionally flip the y-coordinate space (eg, for OpenGL).
///
void SetOrthographicProjection(double screen_width, double screen_height,
bool flip_y);
///
/// Set to another matrix.
/// ///
void Set(const Matrix& other); void Set(const Matrix& other);
/// ///
/// Set from raw affine members /// Set to another matrix.
/// ///
void Set(float a, float b, float c, float d, float e, float f); void Set(const Matrix4x4& other);
/// ///
/// Whether or not this is an identity matrix /// Set from raw affine members.
///
void Set(double a, double b, double c, double d, double e, double f);
///
/// Set from raw 4x4 components.
///
void Set(double m11, double m12, double m13, double m14,
double m21, double m22, double m23, double m24,
double m31, double m32, double m33, double m34,
double m41, double m42, double m43, double m44);
inline double m11() const { return data[0][0]; }
inline double m12() const { return data[0][1]; }
inline double m13() const { return data[0][2]; }
inline double m14() const { return data[0][3]; }
inline double m21() const { return data[1][0]; }
inline double m22() const { return data[1][1]; }
inline double m23() const { return data[1][2]; }
inline double m24() const { return data[1][3]; }
inline double m31() const { return data[2][0]; }
inline double m32() const { return data[2][1]; }
inline double m33() const { return data[2][2]; }
inline double m34() const { return data[2][3]; }
inline double m41() const { return data[3][0]; }
inline double m42() const { return data[3][1]; }
inline double m43() const { return data[3][2]; }
inline double m44() const { return data[3][3]; }
inline double a() const { return data[0][0]; }
inline double b() const { return data[0][1]; }
inline double c() const { return data[1][0]; }
inline double d() const { return data[1][1]; }
inline double e() const { return data[3][0]; }
inline double f() const { return data[3][1]; }
///
/// Whether or not this is an identity matrix.
/// ///
bool IsIdentity() const; bool IsIdentity() const;
/// ///
/// Whether or not this is an identity matrix or translation /// Whether or not this is an identity matrix or translation.
/// ///
bool IsIdentityOrTranslation() const; bool IsIdentityOrTranslation() const;
///
/// Whether or not this matrix uses only affine transformations.
///
bool IsAffine() const;
/// ///
/// Whether or not this is an identity, translation, or non-negative /// Whether or not this is an identity, translation, or non-negative
/// uniform scale /// uniform scale.
/// ///
bool IsSimple() const; bool IsSimple() const;
/// ///
/// Translate by x and y /// Translate by x and y.
/// ///
void Translate(float x, float y); void Translate(double x, double y);
/// ///
/// Scale by x and y /// Scale by x and y.
/// ///
void Scale(float x, float y); void Scale(double x, double y);
/// ///
/// Rotate matrix by theta (in degrees) /// Rotate matrix by theta (in degrees)
/// ///
void Rotate(float theta); void Rotate(double theta);
/// ///
/// Rotate matrix by x and y /// Rotate matrix by x and y
/// ///
void Rotate(float x, float y); void Rotate(double x, double y);
/// ///
/// Transform (multiply) by another Matrix /// Transform (multiply) by another Matrix
@ -102,28 +173,14 @@ struct UExport Matrix {
/// Get an integer hash of this matrix's members. /// Get an integer hash of this matrix's members.
/// ///
uint32_t Hash() const; uint32_t Hash() const;
///
/// Get this matrix as unaligned 4x4 float components (for use passing to
/// GPU driver APIs).
///
Matrix4x4 GetMatrix4x4() const;
}; };
///
/// 4x4 Matrix Helper
///
struct UExport Matrix4x4 {
///
/// Raw 4x4 matrix as an array
///
float data[16];
///
/// Set to identity matrix.
///
void SetIdentity();
};
///
/// Convert affine matrix to a 4x4 matrix.
///
Matrix4x4 UExport ConvertAffineTo4x4(const Matrix& mat);
bool UExport operator==(const Matrix& a, const Matrix& b); bool UExport operator==(const Matrix& a, const Matrix& b);
bool UExport operator!=(const Matrix& a, const Matrix& b); bool UExport operator!=(const Matrix& a, const Matrix& b);

View File

@ -224,6 +224,17 @@ public:
/// ///
virtual bool needs_paint() const = 0; virtual bool needs_paint() const = 0;
///
/// Get the inspector for this View, this is useful for debugging and
/// inspecting pages locally. This will only succeed if you have the
/// inspector assets in your filesystem-- the inspector will look for
/// file:///inspector/Main.html when it first loads.
///
/// @note The inspector View is owned by the View and lazily-created on
/// first call. The initial dimensions are 10x10, you should call
/// View::Resize() on the returned View to resize it to your desired
/// dimensions.
///
virtual RefPtr<View> inspector() = 0; virtual RefPtr<View> inspector() = 0;
protected: protected:

View File

@ -57,7 +57,7 @@ struct UExport Config {
bool enable_images = true; bool enable_images = true;
/// ///
/// Whether or not JavaScript should be enabled /// Whether or not JavaScript should be enabled.
/// ///
bool enable_javascript = true; bool enable_javascript = true;
@ -107,6 +107,36 @@ struct UExport Config {
/// and platform input widgets. /// and platform input widgets.
/// ///
String16 user_stylesheet; String16 user_stylesheet;
///
/// Whether or not we should continuously repaint any Views or compositor
/// layers, regardless if they are dirty or not. This is mainly used to
/// diagnose painting/shader issues.
///
bool force_repaint = false;
///
/// When a CSS animation is active, the amount of time to wait before
/// triggering another repaint.
///
double animation_timer_delay = 1.0 / 60.0;
///
/// Size of WebCore's memory cache in bytes.
///
/// @note You should increase this if you anticipate handling pages with
/// large resources, Safari typically uses 128+ MiB for its cache.
///
uint32_t memory_cache_size = 64 * 1024 * 1024;
///
/// Number of pages to keep in the cache. Defaults to 0 (none).
///
/// @note Safari typically caches about 5 pages and maintains an on-disk
/// cache to support typical web-browsing activities. If you increase
/// this, you should probably increase the memory cache size as well.
///
uint32_t page_cache_size = 0;
}; };
} // namespace ultralight } // namespace ultralight

View File

@ -121,6 +121,8 @@ struct UExport GPUState {
vec4 uniform_vector[8]; vec4 uniform_vector[8];
uint8_t clip_size; uint8_t clip_size;
Matrix4x4 clip[8]; Matrix4x4 clip[8];
bool enable_scissor;
Rect scissor_rect;
}; };
/// ///
@ -222,7 +224,7 @@ public:
virtual void BindRenderBuffer(uint32_t render_buffer_id) = 0; virtual void BindRenderBuffer(uint32_t render_buffer_id) = 0;
/// ///
/// Clear a render buffer (flush pixels) /// Clear a render buffer (flush pixels to 0).
/// ///
virtual void ClearRenderBuffer(uint32_t render_buffer_id) = 0; virtual void ClearRenderBuffer(uint32_t render_buffer_id) = 0;

View File

@ -44,7 +44,8 @@ func New(cfg *Config, handler http.Handler) *Window {
} }
ufg := UlCreateConfig() ufg := UlCreateConfig()
w.app = UlCreateApp(ufg) std := UlCreateSettings()
w.app = UlCreateApp(std, ufg)
mm := UlAppGetMainMonitor(w.app) mm := UlAppGetMainMonitor(w.app)
w.wnd = UlCreateWindow(mm, w.cfg.Height, w.cfg.Width, false, w.cfg.Hint) w.wnd = UlCreateWindow(mm, w.cfg.Height, w.cfg.Width, false, w.cfg.Hint)

View File

@ -4,7 +4,7 @@ GENERATOR:
PackageLicense: "THE AUTOGENERATED LICENSE. ALL THE RIGHTS ARE RESERVED BY ROBOTS." PackageLicense: "THE AUTOGENERATED LICENSE. ALL THE RIGHTS ARE RESERVED BY ROBOTS."
FlagGroups: FlagGroups:
- {name: CFLAGS, flags: [-I../include]} - {name: CFLAGS, flags: [-I../include]}
- {name: LDFLAGS, flags: [-L -lUltralightCore -lWebCore -lUltralight -lAppCore]} - {name: LDFLAGS, flags: ["-L${SRCDIR}/libs -lUltralightCore -lWebCore -lUltralight -lAppCore"]}
Includes: ["AppCore/CAPI.h"] Includes: ["AppCore/CAPI.h"]
Options: Options:
SafeStrings: true SafeStrings: true
@ -37,18 +37,18 @@ TRANSLATOR:
- {transform: export} - {transform: export}
function: function:
- {action: ignore, from: __GO__} - {action: ignore, from: __GO__}
- {action: ignore, from: JSObjectGetArrayBufferByteLength} # - {action: ignore, from: JSObjectGetArrayBufferByteLength}
- {action: ignore, from: JSObjectGetArrayBufferBytesPtr} # - {action: ignore, from: JSObjectGetArrayBufferBytesPtr}
- {action: ignore, from: JSObjectGetTypedArrayBuffer} # - {action: ignore, from: JSObjectGetTypedArrayBuffer}
- {action: ignore, from: JSObjectGetTypedArrayByteLength} # - {action: ignore, from: JSObjectGetTypedArrayByteLength}
- {action: ignore, from: JSObjectGetTypedArrayByteOffset} # - {action: ignore, from: JSObjectGetTypedArrayByteOffset}
- {action: ignore, from: JSObjectGetTypedArrayBytesPtr} # - {action: ignore, from: JSObjectGetTypedArrayBytesPtr}
- {action: ignore, from: JSObjectGetTypedArrayLength} # - {action: ignore, from: JSObjectGetTypedArrayLength}
- {action: ignore, from: JSObjectMakeArrayBufferWithBytesNoCopy} # - {action: ignore, from: JSObjectMakeArrayBufferWithBytesNoCopy}
- {action: ignore, from: JSObjectMakeTypedArray} # - {action: ignore, from: JSObjectMakeTypedArray}
- {action: ignore, from: JSObjectMakeTypedArrayWithArrayBuffer} # - {action: ignore, from: JSObjectMakeTypedArrayWithArrayBuffer}
- {action: ignore, from: JSObjectMakeTypedArrayWithArrayBufferAndOffset} # - {action: ignore, from: JSObjectMakeTypedArrayWithArrayBufferAndOffset}
- {action: ignore, from: JSObjectMakeTypedArrayWithBytesNoCopy} # - {action: ignore, from: JSObjectMakeTypedArrayWithBytesNoCopy}
- {action: ignore, from: JSValueGetTypedArrayType} # - {action: ignore, from: JSValueGetTypedArrayType}
private: private:
- {transform: unexport} - {transform: unexport}

View File

@ -1,6 +1,6 @@
// THE AUTOGENERATED LICENSE. ALL THE RIGHTS ARE RESERVED BY ROBOTS. // THE AUTOGENERATED LICENSE. ALL THE RIGHTS ARE RESERVED BY ROBOTS.
// WARNING: This file has automatically been generated on Fri, 27 Sep 2019 21:28:43 CDT. // WARNING: This file has automatically been generated on Mon, 07 Oct 2019 13:59:36 CDT.
// Code generated by https://git.io/c-for-go. DO NOT EDIT. // Code generated by https://git.io/c-for-go. DO NOT EDIT.
#include "_cgo_export.h" #include "_cgo_export.h"

View File

@ -1,6 +1,6 @@
// THE AUTOGENERATED LICENSE. ALL THE RIGHTS ARE RESERVED BY ROBOTS. // THE AUTOGENERATED LICENSE. ALL THE RIGHTS ARE RESERVED BY ROBOTS.
// WARNING: This file has automatically been generated on Fri, 27 Sep 2019 21:28:43 CDT. // WARNING: This file has automatically been generated on Mon, 07 Oct 2019 13:59:36 CDT.
// Code generated by https://git.io/c-for-go. DO NOT EDIT. // Code generated by https://git.io/c-for-go. DO NOT EDIT.
package ultralight package ultralight
@ -886,7 +886,7 @@ func jSObjectCallAsFunctionCallback89F9469B(cctx C.JSContextRef, cfunction C.JSO
hxff73280 := (*sliceHeader)(unsafe.Pointer(&arguments89f9469b)) hxff73280 := (*sliceHeader)(unsafe.Pointer(&arguments89f9469b))
hxff73280.Data = unsafe.Pointer(carguments) hxff73280.Data = unsafe.Pointer(carguments)
hxff73280.Cap = 0x7fffffff hxff73280.Cap = 0x7fffffff
hxff73280.Len = int(argumentCount89f9469b) // <-- Was commented out hxff73280.Len = int(argumentCount89f9469b)
var exception89f9469b []JSValueRef var exception89f9469b []JSValueRef
hxfa9955c := (*sliceHeader)(unsafe.Pointer(&exception89f9469b)) hxfa9955c := (*sliceHeader)(unsafe.Pointer(&exception89f9469b))

View File

@ -1,6 +1,6 @@
// THE AUTOGENERATED LICENSE. ALL THE RIGHTS ARE RESERVED BY ROBOTS. // THE AUTOGENERATED LICENSE. ALL THE RIGHTS ARE RESERVED BY ROBOTS.
// WARNING: This file has automatically been generated on Fri, 27 Sep 2019 21:28:43 CDT. // WARNING: This file has automatically been generated on Mon, 07 Oct 2019 13:59:36 CDT.
// Code generated by https://git.io/c-for-go. DO NOT EDIT. // Code generated by https://git.io/c-for-go. DO NOT EDIT.
#include "AppCore/CAPI.h" #include "AppCore/CAPI.h"

View File

@ -1,6 +1,6 @@
// THE AUTOGENERATED LICENSE. ALL THE RIGHTS ARE RESERVED BY ROBOTS. // THE AUTOGENERATED LICENSE. ALL THE RIGHTS ARE RESERVED BY ROBOTS.
// WARNING: This file has automatically been generated on Fri, 27 Sep 2019 21:28:43 CDT. // WARNING: This file has automatically been generated on Mon, 07 Oct 2019 13:59:36 CDT.
// Code generated by https://git.io/c-for-go. DO NOT EDIT. // Code generated by https://git.io/c-for-go. DO NOT EDIT.
package ultralight package ultralight
@ -19,10 +19,10 @@ const (
JSC_OBJC_API_ENABLED = 0 JSC_OBJC_API_ENABLED = 0
) )
// ULWindowFlags as declared in AppCore/CAPI.h:46 // ULWindowFlags as declared in AppCore/CAPI.h:47
type ULWindowFlags int32 type ULWindowFlags int32
// ULWindowFlags enumeration from AppCore/CAPI.h:46 // ULWindowFlags enumeration from AppCore/CAPI.h:47
const ( const (
KWindowFlags_Borderless ULWindowFlags = 1 KWindowFlags_Borderless ULWindowFlags = 1
KWindowFlags_Titled ULWindowFlags = 2 KWindowFlags_Titled ULWindowFlags = 2

9
ultralight/doc.go Normal file
View File

@ -0,0 +1,9 @@
// THE AUTOGENERATED LICENSE. ALL THE RIGHTS ARE RESERVED BY ROBOTS.
// WARNING: This file has automatically been generated on Mon, 07 Oct 2019 13:59:36 CDT.
// Code generated by https://git.io/c-for-go. DO NOT EDIT.
/*
Ultralight bindings for golang
*/
package ultralight

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,6 +1,6 @@
// THE AUTOGENERATED LICENSE. ALL THE RIGHTS ARE RESERVED BY ROBOTS. // THE AUTOGENERATED LICENSE. ALL THE RIGHTS ARE RESERVED BY ROBOTS.
// WARNING: This file has automatically been generated on Fri, 27 Sep 2019 21:28:43 CDT. // WARNING: This file has automatically been generated on Mon, 07 Oct 2019 13:59:36 CDT.
// Code generated by https://git.io/c-for-go. DO NOT EDIT. // Code generated by https://git.io/c-for-go. DO NOT EDIT.
package ultralight package ultralight
@ -15,25 +15,28 @@ package ultralight
import "C" import "C"
import "unsafe" import "unsafe"
// ULApp as declared in AppCore/CAPI.h:33 // ULSettings as declared in AppCore/CAPI.h:33
type ULSettings C.ULSettings
// ULApp as declared in AppCore/CAPI.h:34
type ULApp C.ULApp type ULApp C.ULApp
// ULWindow as declared in AppCore/CAPI.h:34 // ULWindow as declared in AppCore/CAPI.h:35
type ULWindow C.ULWindow type ULWindow C.ULWindow
// ULMonitor as declared in AppCore/CAPI.h:35 // ULMonitor as declared in AppCore/CAPI.h:36
type ULMonitor C.ULMonitor type ULMonitor C.ULMonitor
// ULOverlay as declared in AppCore/CAPI.h:36 // ULOverlay as declared in AppCore/CAPI.h:37
type ULOverlay C.ULOverlay type ULOverlay C.ULOverlay
// ULUpdateCallback type as declared in AppCore/CAPI.h:81 // ULUpdateCallback type as declared in AppCore/CAPI.h:118
type ULUpdateCallback func(user_data unsafe.Pointer) type ULUpdateCallback func(user_data unsafe.Pointer)
// ULCloseCallback type as declared in AppCore/CAPI.h:160 // ULCloseCallback type as declared in AppCore/CAPI.h:195
type ULCloseCallback func(user_data unsafe.Pointer) type ULCloseCallback func(user_data unsafe.Pointer)
// ULResizeCallback type as declared in AppCore/CAPI.h:170 // ULResizeCallback type as declared in AppCore/CAPI.h:205
type ULResizeCallback func(user_data unsafe.Pointer, width uint32, height uint32) type ULResizeCallback func(user_data unsafe.Pointer, width uint32, height uint32)
// ULChar16 type as declared in Ultralight/CAPI.h:43 // ULChar16 type as declared in Ultralight/CAPI.h:43
@ -69,31 +72,31 @@ type ULMouseEvent C.ULMouseEvent
// ULScrollEvent as declared in Ultralight/CAPI.h:59 // ULScrollEvent as declared in Ultralight/CAPI.h:59
type ULScrollEvent C.ULScrollEvent type ULScrollEvent C.ULScrollEvent
// ULChangeTitleCallback type as declared in Ultralight/CAPI.h:385 // ULChangeTitleCallback type as declared in Ultralight/CAPI.h:409
type ULChangeTitleCallback func(user_data unsafe.Pointer, caller ULView, title ULString) type ULChangeTitleCallback func(user_data unsafe.Pointer, caller ULView, title ULString)
// ULChangeURLCallback type as declared in Ultralight/CAPI.h:395 // ULChangeURLCallback type as declared in Ultralight/CAPI.h:419
type ULChangeURLCallback func(user_data unsafe.Pointer, caller ULView, url ULString) type ULChangeURLCallback func(user_data unsafe.Pointer, caller ULView, url ULString)
// ULChangeTooltipCallback type as declared in Ultralight/CAPI.h:405 // ULChangeTooltipCallback type as declared in Ultralight/CAPI.h:429
type ULChangeTooltipCallback func(user_data unsafe.Pointer, caller ULView, tooltip ULString) type ULChangeTooltipCallback func(user_data unsafe.Pointer, caller ULView, tooltip ULString)
// ULChangeCursorCallback type as declared in Ultralight/CAPI.h:415 // ULChangeCursorCallback type as declared in Ultralight/CAPI.h:439
type ULChangeCursorCallback func(user_data unsafe.Pointer, caller ULView, cursor ULCursor) type ULChangeCursorCallback func(user_data unsafe.Pointer, caller ULView, cursor ULCursor)
// ULAddConsoleMessageCallback type as declared in Ultralight/CAPI.h:425 // ULAddConsoleMessageCallback type as declared in Ultralight/CAPI.h:449
type ULAddConsoleMessageCallback func(user_data unsafe.Pointer, caller ULView, source ULMessageSource, level ULMessageLevel, message ULString, line_number uint32, column_number uint32, source_id ULString) type ULAddConsoleMessageCallback func(user_data unsafe.Pointer, caller ULView, source ULMessageSource, level ULMessageLevel, message ULString, line_number uint32, column_number uint32, source_id ULString)
// ULBeginLoadingCallback type as declared in Ultralight/CAPI.h:440 // ULBeginLoadingCallback type as declared in Ultralight/CAPI.h:464
type ULBeginLoadingCallback func(user_data unsafe.Pointer, caller ULView) type ULBeginLoadingCallback func(user_data unsafe.Pointer, caller ULView)
// ULFinishLoadingCallback type as declared in Ultralight/CAPI.h:450 // ULFinishLoadingCallback type as declared in Ultralight/CAPI.h:474
type ULFinishLoadingCallback func(user_data unsafe.Pointer, caller ULView) type ULFinishLoadingCallback func(user_data unsafe.Pointer, caller ULView)
// ULUpdateHistoryCallback type as declared in Ultralight/CAPI.h:460 // ULUpdateHistoryCallback type as declared in Ultralight/CAPI.h:484
type ULUpdateHistoryCallback func(user_data unsafe.Pointer, caller ULView) type ULUpdateHistoryCallback func(user_data unsafe.Pointer, caller ULView)
// ULDOMReadyCallback type as declared in Ultralight/CAPI.h:470 // ULDOMReadyCallback type as declared in Ultralight/CAPI.h:494
type ULDOMReadyCallback func(user_data unsafe.Pointer, caller ULView) type ULDOMReadyCallback func(user_data unsafe.Pointer, caller ULView)
// JSContextGroupRef as declared in JavaScriptCore/JSBase.h:40 // JSContextGroupRef as declared in JavaScriptCore/JSBase.h:40

File diff suppressed because it is too large Load Diff