Kaydet (Commit) 81dd0c41 authored tarafından Jan Holesovsky's avatar Jan Holesovsky Kaydeden (comit) Miklos Vajna

sc tiled rendering: Simplify the zoom computation.

In principle, we should avoid messing up with zoom, and instead just work with
the MapMode, but we are not there yet - lots of places are hardcoded to work
in pixels.

Change-Id: I572b0d54fbfc72494c44ef95e7fda5e655f83fde
üst a812c875
...@@ -927,22 +927,18 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, ...@@ -927,22 +927,18 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
// FIXME the painting works using a mixture of drawing with coordinates in // FIXME the painting works using a mixture of drawing with coordinates in
// pixels and in logic coordinates; it should be cleaned up to use logic // pixels and in logic coordinates; it should be cleaned up to use logic
// coords only. // coords only, and avoid all the SetMapMode()'s.
// Similarly to Writer, we should set the mapmode once on the rDevice, and
// not care about any zoom settings.
// TODO : zooming isn't perfect. Find out why. Fraction aFracX(long(nOutputWidth * TWIPS_PER_PIXEL), nTileWidth);
double nOutWTwips = static_cast<double>(nOutputWidth) / PIXEL_PER_TWIPS; Fraction aFracY(long(nOutputHeight * TWIPS_PER_PIXEL), nTileHeight);
double nOutHTwips = static_cast<double>(nOutputHeight) / PIXEL_PER_TWIPS;
nOutWTwips /= nTileWidth;
nOutHTwips /= nTileHeight;
Fraction aFracX(nOutWTwips);
Fraction aFracY(nOutHTwips);
pViewData->SetZoom(aFracX, aFracY, true); pViewData->SetZoom(aFracX, aFracY, true);
pViewData->RefreshZoom(); pViewData->RefreshZoom();
double fTilePosXPixel = static_cast<double>(nTilePosX) * PIXEL_PER_TWIPS * static_cast<double>(aFracX); double fTilePosXPixel = static_cast<double>(nTilePosX) * nOutputWidth / nTileWidth;
double fTilePosYPixel = static_cast<double>(nTilePosY) * PIXEL_PER_TWIPS * static_cast<double>(aFracY); double fTilePosYPixel = static_cast<double>(nTilePosY) * nOutputHeight / nTileHeight;
SCTAB nTab = pViewData->GetTabNo(); SCTAB nTab = pViewData->GetTabNo();
ScDocument* pDoc = pViewData->GetDocument(); ScDocument* pDoc = pViewData->GetDocument();
...@@ -957,7 +953,9 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, ...@@ -957,7 +953,9 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
ScTableInfo aTabInfo; ScTableInfo aTabInfo;
pDoc->FillInfo(aTabInfo, nCol1, nRow1, nCol2, nRow2, nTab, fPPTX, fPPTY, false, false, NULL); pDoc->FillInfo(aTabInfo, nCol1, nRow1, nCol2, nRow2, nTab, fPPTX, fPPTY, false, false, NULL);
ScOutputData aOutputData(&rDevice, OUTTYPE_WINDOW, aTabInfo, pDoc, nTab, -fTilePosXPixel, -fTilePosYPixel, nCol1, nRow1, nCol2, nRow2, fPPTX, fPPTY); ScOutputData aOutputData(&rDevice, OUTTYPE_WINDOW, aTabInfo, pDoc, nTab,
-fTilePosXPixel, -fTilePosYPixel, nCol1, nRow1, nCol2, nRow2,
fPPTX, fPPTY);
DrawContent(rDevice, aTabInfo, aOutputData, true, SC_UPDATE_ALL); DrawContent(rDevice, aTabInfo, aOutputData, true, SC_UPDATE_ALL);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment