Bug 153251 - remove s_nPixelTwips
Summary: remove s_nPixelTwips
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.6.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: easyHack, difficultyBeginner, skillCp...
Keywords:
Depends on:
Blocks: Dev-related
  Show dependency treegraph
 
Reported: 2023-01-27 19:47 UTC by Michael Meeks
Modified: 2023-04-12 04:41 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Meeks 2023-01-27 19:47:08 UTC
SwViewOptions has a rather grim and unhelpful global variable:

sw/inc/viewopt.hxx:    static sal_uInt16   s_nPixelTwips;// 1 Pixel == ? Twips

Which is only used in one place:

sw/source/uibase/config/viewopt.cxx-void SwViewOption::PaintPostIts( OutputDevice *pOut, const SwRect &rRect, bool bIsScript )

Where (it seems to me) - we could more profitably work out how many twips to the pixel there are for the screen the view is rendered to there with:

sw/source/uibase/config/viewopt.cxx:        s_nPixelTwips = o3tl::narrowing<sal_uInt16>(pWin->PixelToLogic( Size(1,1) ).Height());

And also kill the SwViewOption::Init at the same time.

This global static seems to have come from the initial checkin:

commit 7b0b5cdfeed656b279bc32cd929630d5fc25878b
Author: Jens-Heiner Rechtien <hr@openoffice.org>
Date:   Mon Sep 18 16:15:01 2000 +0000

+USHORT SwViewOption::nPixelTwips = 0;   //ein Pixel auf dem Bildschirm

Thanks !
Comment 1 Michael Meeks 2023-01-27 19:48:03 UTC
Any thoughts Miklos =) looked weird to me.
Comment 2 Miklos Vajna 2023-01-30 09:55:31 UTC
Yes, sounds like a good idea to eliminate that static. It's broken if different views have different DPI / zoom level, I guess.