[Webkit-unassigned] [Bug 33189] New: scaleEmToUnits in SimpleFontDataMac.mm does an unnecessary division

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jan 4 17:01:14 PST 2010


https://bugs.webkit.org/show_bug.cgi?id=33189

           Summary: scaleEmToUnits in SimpleFontDataMac.mm does an
                    unnecessary division
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: Mac OS X 10.5
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Layout and Rendering
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: ojan at chromium.org


It's not a big deal, but I stumbled upon it and thought I'd clean it up.

const float contextDPI = 72.0f;
static inline float scaleEmToUnits(float x, unsigned unitsPerEm) { return x *
(contextDPI / (contextDPI * unitsPerEm)); }

can just be

static inline float scaleEmToUnits(float x, unsigned unitsPerEm) { return x /
static_cast<float>(unitsPerEm); }

Technically, there could be minor differences here due to float rounding I
think, but in practice I think this is just an accident of history. The code
was added here http://trac.webkit.org/changeset/8104. I assume this was done to
match the previously private function, but we don't use that function anymore.

In either case, the layout tests pass with this change.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list