summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2013-12-09 21:53:23 +0200
committerTor Lillqvist <tml@collabora.com>2013-12-14 01:42:02 +0200
commit6265876ae9f1bb862440182d2d2c9b9b5b322668 (patch)
treecb64f9a87dd4a98556c2708be0ff8dbfd152ce58 /sw
parentf279acd3678d014d9d5dafe41971e0da4dec7b6c (diff)
iOS tiled rendering work
Possibly quite broken intermediate commit. But anyway, now it is possible to render the tile diretly to a CGContext. Can be seen in the MobileLibreOffice app when build in the Debug_tile_tester configuration. See touch_lo_draw_tile() in viewsh.cxx. Unfortunately the old plain LibreOffice test app is now broken, though, and displays nothing at all. This refactoring and hacking in vcl was done in a quite ugly fashion, with ifdefs etc. But trust me, I did try, several times, for many days, to get where I wanted in an elegant and clean fashion. But doing it cleanly meant not being able to actually build it for days while trying to figure ut which bits go where and which class should be split into what base and derived class(es), and it was too much for my limited brain capacity. I just couldn't juggle all the vcl class structure in my head, especially as I don't have any good understanding of the general design of it all. Change-Id: Ia59d6a9cce15a63e63f94e8d8574bef21993fb1f
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/view/viewsh.cxx27
1 files changed, 7 insertions, 20 deletions
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index add342d5b819..01933762695b 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -67,6 +67,7 @@
#include "../../ui/inc/view.hxx"
#include <PostItMgr.hxx>
#include <vcl/dibtools.hxx>
+#include <vcl/sysdata.hxx>
#include <vcl/virdev.hxx>
#include <vcl/svapp.hxx>
#include <svx/sdrpaintwindow.hxx>
@@ -1756,6 +1757,9 @@ void SwViewShell::PaintTile(VirtualDevice &rDevice, int contextWidth, int contex
mbTiledRendering = true;
mpOut = &rDevice;
+ // resizes the virtual device so to contain the entrie context
+ rDevice.SetOutputSizePixel(Size(contextWidth, contextHeight));
+
// setup the output device to draw the tile
MapMode aMapMode(rDevice.GetMapMode());
aMapMode.SetMapUnit(MAP_TWIP);
@@ -1769,9 +1773,6 @@ void SwViewShell::PaintTile(VirtualDevice &rDevice, int contextWidth, int contex
aMapMode.SetScaleY(scaleY);
rDevice.SetMapMode(aMapMode);
- // resizes the virtual device so to contain the entrie context
- rDevice.SetOutputSizePixel(Size(contextWidth, contextHeight));
-
// scroll the requested area into view if necessary
MakeVisible(SwRect(Point(tilePosX, tilePosY), rDevice.PixelToLogic(Size(contextWidth, contextHeight))));
@@ -1813,25 +1814,11 @@ void touch_lo_draw_tile(void *context, int contextWidth, int contextHeight, MLOD
Application::AcquireSolarMutex(1);
if (pViewShell)
{
- // TODO create a VirtualDevice based on SystemGraphicsData instead so
- // that we get direct rendering; something like:
- //
- VirtualDevice aDevice;
-
+ SystemGraphicsData aData;
+ aData.rCGContext = (CGContextRef) context;
+ VirtualDevice aDevice(&aData, (sal_uInt16)0);
// paint to it
pViewShell->PaintTile(aDevice, contextWidth, contextHeight, tilePosX, tilePosY, tileWidth, tileHeight);
-
- // copy the aDevice content to mpImage
- Bitmap aBitmap(aDevice.GetBitmap(aDevice.PixelToLogic(Point(0,0)), aDevice.PixelToLogic(Size(contextWidth, contextHeight))));
- BitmapReadAccess * readAccess = aBitmap.AcquireReadAccess();
- touch_lo_copy_buffer((void *) readAccess->GetBuffer(),
- contextWidth,
- contextHeight,
- readAccess-> GetScanlineSize(),
- context,
- contextWidth,
- contextHeight);
- aBitmap.ReleaseAccess(readAccess);
}
Application::ReleaseSolarMutex();
#else