Closed Bug 328820 Opened 18 years ago Closed 18 years ago

Fast path ASCII text measuring/drawing

Categories

(Core :: Graphics, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: pavlov, Assigned: pavlov)

References

Details

Attachments

(1 file, 1 obsolete file)

Since the DOM can provide us with ASCII strings, we should fast path them on the various platforms where we can.
Attached patch windows fast pathing (obsolete) — Splinter Review
With a few changes, we could probably use this function to also support non-complex scripts which would probably give us a win as well.

I also need to see if I need to support RTL here...
Assignee: nobody → pavlov
Status: NEW → ASSIGNED
Comment on attachment 213436 [details] [diff] [review]
windows fast pathing


>+        int dxbuf[1024];
>+        results.nGlyphs = 1020;
>+        results.lpDx = dxbuf;

...

>+        for (PRInt32 k = 0; k < numGlyphs; k++) {

What happens if I have more than 1024 glyphs?  Why is nGlyphs 1020 instead of 1024?
Attached patch updated patchSplinter Review
this should be good enough.  I'm told it isn't possible to do RTL with ascii text, but I'm skeptical so I added a warning.
This should all be good now.
Attachment #213436 - Attachment is obsolete: true
Attachment #213500 - Flags: review?(vladimir)
Comment on attachment 213500 [details] [diff] [review]
updated patch


>@@ -354,16 +365,47 @@
> void
> gfxWindowsTextRun::DrawString(gfxContext *aContext, gfxPoint pt)
> {
>+    if (mIsASCII && (MeasureOrDrawAscii(aContext, PR_TRUE, pt.x, pt.y, nsnull) != -1))
>+        return;
>+
>     MeasureOrDrawUniscribe(aContext, PR_TRUE, pt.x, pt.y, nsnull);
> }


> gfxFloat
> gfxWindowsTextRun::MeasureString(gfxContext *aContext)
> {

>+#else
>+    if (mIsASCII) {
>+        PRInt32 ret = MeasureOrDrawAscii(aContext, PR_FALSE, 0, 0, nsnull);
>+        if (ret != -1) {
>+            return ret;
>+        }
>+    }

Use the same construct as above (or change the one above to match this one, just make 'em consistent)

r=me
Attachment #213500 - Flags: review?(vladimir) → review+
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
This patch seems to have caused the following error in my Win32/cygwin/MinGW build

e:/mozilla/source/mozilla/gfx/thebes/src/gfxWindowsFonts.cpp:557: error: invalid
 static_cast from type `NS_ConvertASCIItoUTF16' to type `nsAString_internal&'
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
so file a new bug. this one is fixed.
Status: REOPENED → RESOLVED
Closed: 18 years ago18 years ago
Resolution: --- → FIXED
Blocks: 329032
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: