diff options
author | Tor Lillqvist <tml@collabora.com> | 2018-09-28 14:15:56 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2018-10-02 19:46:31 +0200 |
commit | 51591ae750df644738bba4e1c8a2bb81d183a572 (patch) | |
tree | c6b234439c41f2d2a06b74a38b6eb015cdfae882 /ios | |
parent | 0895c26b7761215e92eef7b3fbf384982ac01eeb (diff) |
More hacking on the tilebench part of the UnitTest app
On iOS, don't attempt to write the tile dump ppm file to /tmp, but use
the app-specific directory so that it can be copied for inspection
using iTunes. (Of course, even better would be to simply paint it to
the app's view. Later)
Change-Id: I8dd60d04adc61de6594099f5c358a9b6220522da
Reviewed-on: https://gerrit.libreoffice.org/61255
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'ios')
-rw-r--r-- | ios/UnitTest/UnitTest/Info.plist | 2 | ||||
-rw-r--r-- | ios/UnitTest/UnitTest/ViewController.mm | 26 |
2 files changed, 28 insertions, 0 deletions
diff --git a/ios/UnitTest/UnitTest/Info.plist b/ios/UnitTest/UnitTest/Info.plist index 16be3b681122..e6a294eba3ab 100644 --- a/ios/UnitTest/UnitTest/Info.plist +++ b/ios/UnitTest/UnitTest/Info.plist @@ -2,6 +2,8 @@ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> + <key>UIFileSharingEnabled</key> + <true/> <key>CFBundleDevelopmentRegion</key> <string>$(DEVELOPMENT_LANGUAGE)</string> <key>CFBundleExecutable</key> diff --git a/ios/UnitTest/UnitTest/ViewController.mm b/ios/UnitTest/UnitTest/ViewController.mm index 0b25baf6ae0a..a955812d6f3c 100644 --- a/ios/UnitTest/UnitTest/ViewController.mm +++ b/ios/UnitTest/UnitTest/ViewController.mm @@ -29,9 +29,35 @@ extern "C" { } #include <premac.h> +#import <CoreGraphics/CoreGraphics.h> #import "ViewController.h" #include <postmac.h> +// This is from online's Mobile app (as it is called at the moment); +// should of course be factored out to some common place. Here in +// core? + +static thread_local CGContextRef cgc = nullptr; + +static unsigned char *lo_ios_app_get_cgcontext_for_buffer(unsigned char *buffer, int width, int height) +{ + assert(cgc == nullptr); + + cgc = CGBitmapContextCreate(buffer, width, height, 8, width*4, CGColorSpaceCreateDeviceRGB(), kCGImageAlphaNoneSkipFirst); + + CGContextTranslateCTM(cgc, 0, height); + CGContextScaleCTM(cgc, 1, -1); + + return (unsigned char*)cgc; +} + +static void lo_ios_app_release_cgcontext_for_buffer() +{ + assert(cgc != nullptr); + CGContextRelease(cgc); + cgc = nullptr; +} + @interface ViewController () @end |