Closed Bug 310845 Opened 19 years ago Closed 19 years ago

[BeOS]Cleanup StringWidth methods in nsRenderingContextBeOS

Categories

(Core Graveyard :: GFX: BeOS, defect)

x86
BeOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: sergei_d, Assigned: sergei_d)

References

Details

(Keywords: fixed1.8.1)

Attachments

(2 files)

Attached patch patchSplinter Review
simple and obvious patch. Uses regular GetWidh() method everywhere around
nsRenderingContext.
review request
Assignee: beos → sergei_d
Status: NEW → ASSIGNED
Attachment #198347 - Flags: review?(thesuckiestemail)
Attached patch additional patchSplinter Review
Depends on first, and then enables even more fast string width measurment -
allowing summarize cached glyph widths to whole string width.
If first patch gets reviewed 
review request
Attachment #198386 - Flags: review?(thesuckiestemail)
Comment on attachment 198347 [details] [diff] [review]
patch

r=thesuckiestemail@yahoo.se
Attachment #198347 - Flags: review?(thesuckiestemail) → review+
Comment on attachment 198386 [details] [diff] [review]
additional patch

r=thesuckiestemail@yahoo.se

The charlen = line looks a bit magic, with magic numbers. Maybe it should be
documented.
Attachment #198386 - Flags: review?(thesuckiestemail) → review+
Landed in trunk:
nsFontMetricsBeOS.cpp
new revision: 1.44; previous revision: 1.43
nsRenderingContextBeOS.cpp
new revision: 1.56; previous revision: 1.55 

P.S. About charlen magic. Even in Be Newsletter where i found this, they wrote
something alike as comment: "Ohh, don't ask us how - but it works!":)
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
as for bigger fix - this is for future, when Bug 297074 will be completed and
fix landed. I can easily implement method for getting glyphs width array, but it
has no sense at moment.
+		charlen = ((0xE5000000 >> ((*utf8str >> 3) & 0x1E)) & 3) + 1;

how about putting that into a "PRUint8 utf8_char_len(const char* uf8str)" function?
Heh, biesi, there is such function 15 lines or so above. Even inlined.
But as at moment we use this trick in only place, i decided to avoid this time
such little overhead and put code directly in GetStringWidth
inline functions cause no overhead, and I think using that function would make
this more readable... but ok, it's your module.
Blocks: 311032
Comment on attachment 198347 [details] [diff] [review]
patch

Requesting permission to land on the BUGZILLA_1_8_BRANCH.

This is a BeOS-only change and does not affect other platforms.

Note: sergei, apply this one after bug 310708.
Attachment #198347 - Flags: approval1.8.1?
Attachment #198386 - Flags: approval1.8.1?
Comment on attachment 198347 [details] [diff] [review]
patch

a=schrep for drivers for BeOS only change.
Attachment #198347 - Flags: approval1.8.1? → approval1.8.1+
Comment on attachment 198386 [details] [diff] [review]
additional patch

a=schrep for drivers for BeOS only change.
Attachment #198386 - Flags: approval1.8.1? → approval1.8.1+
applied two patches at once:
Checking in mozilla/gfx/src/beos/nsRenderingContextBeOS.cpp;
/cvsroot/mozilla/gfx/src/beos/nsRenderingContextBeOS.cpp,v  <--  nsRenderingContextBeOS.cpp
new revision: 1.51.12.5; previous revision: 1.51.12.4
done
Keywords: fixed1.8.1
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: