Closed Bug 88282 Opened 24 years ago Closed 24 years ago

Xlib-toolkit uses XCreateGC()/XDrawString16()/XFreeGC() instead of using the GC-cache

Categories

(Core :: XUL, enhancement)

All
Linux
enhancement
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla0.9.3

People

(Reporter: roland.mainz, Assigned: roland.mainz)

Details

(Keywords: perf)

Attachments

(1 file)

Xlib-toolkit uses a very inefficient way to draw some fonts: (from mozilla/gfx/src/xlib/nsFontMetricsXlib.cpp) -- snip -- { /* XXX is this the right way to do it? Can I get GCCache to give me a * new GC? */ GC copyGC; XGCValues values; memset(&values, 0, sizeof(XGCValues)); XGetGCValues(aSurface->GetDisplay(), *gc, GCForeground | GCBackground, &values); values.font = mFont->fid; copyGC = XCreateGC(aSurface->GetDisplay(), aSurface->GetDrawable(), GCForeground | GCBackground | GCFont, &values); /* note the length must be divided by 2 for X*16 functions */ XDrawString16(aSurface->GetDisplay(), aSurface->GetDrawable(), copyGC, aX, aY + mBaselineAdjust, (XChar2b *)p, len / 2); XFreeGC(aSurface->GetDisplay(), copyGC); gc->Release(); textWidth = XTextWidth16(mFont, (XChar2b *)p, len / 2); } -- snip -- It would be far more efficient if we could use the GC-cache instead of fireing a XCreateGC()/XFreeGC() sequence for drawing each single string... Suggested fix: - Create the following API or make it accessible to nsFontMetricsXlib class: - nsRenderingContextXlib::UpdateGC() - nsRenderingContextXlib::GetCurrentFont() - nsRenderingContextXlib::SetCurrentFont() - Use this new API to get rid of this BAD code...
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9.3
Accepting. Looks easy... :-)
Filed patch for both Xlib-toolkit and Xprint. Requesting r= from pocemit ...
The patch looks great, and works great. r=pocemit Looking for sr= This patch makes a nice performance improvement on a page with lots of mixed doublebyte/normal fonts.
Keywords: patch, perf
sr=tor
CC:'ing mkaply@us.ibm.com for checkin, please...
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
massive speed improvement noted, verifying.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: