Firefox hopes to one-up IE with fast graphics

Windows 7 features called Direct2D and DirectWrite will speed up Internet Explorer 9 performance. But Firefox hopes it might retool for the same benefit first.

Last week, Microsoft showed off some browser technology that could help Internet Explorer leapfrog the competition. But if Mozilla succeeds in its hope, Microsoft could be playing catch-up instead.

The technology in question is hardware-accelerated graphics and text using interfaces called Direct2D and DirectWrite that provide an easy way to use graphics cards' computing power. They're built into Windows 7, and Microsoft is bringing them to Windows Vista but not Windows XP.

The performance boost from Direct2D and DirectWrite was the centerpiece of Microsoft's demonstration of Internet Explorer 9 goodies shown last week. Online maps flashed on the screen quickly and tracked mouse movements responsively; text was clearer and changed sizes more gracefully.

But the day of Microsoft's demo, Mozilla evangelist Chris Blizzard had this to tweet: "Interesting that we're doing Direct2D support in Firefox as well--I'll bet we'll ship it first."

There's work to back up his rhetoric. On Sunday, Bas Schouten, the programmer who's been leading the work for Mozilla, posted a prototype of Firefox using the Direct2D and DirectWrite.

However, any Firefox fans tempted to crow about a victory should be cautious. Mozilla wouldn't commit to including the technology, much less to a release schedule such as Firefox 3.7 due in the first half of 2010. "We are currently investigating Direct2D for Firefox, but do not have a target for shipping it in Firefox at this time," the organization said in a statement..

Several Web pages arrive significantly faster using Direct2D rendering technology in Firefox.
Several Web pages arrive significantly faster using Direct2D rendering technology in Firefox. Bas Schouten

The race is on
Microsoft declined to comment for this story, referring readers just to last week's blog post about coming Internet Explorer 9 features. "While we're still early in the product cycle, we wanted to be clear to developers about our approach and the progress so far," the company said while sharing a Direct2D demonstration video.

There's no doubt the race is on, though, given the potential benefits of the new interface and the commercial success of Window 7 . Microsoft is lighting a fire under its developers, but the company's browser has lagged Firefox and other rivals in many technological areas for years, and many Web developers loathe earlier versions of IE still widely used. IE's market share has steadily eroded, though it remains dominant overall.

The attention is giving Google ideas, too. In a Chrome issue logged Sunday, Chrome programmer Peter Kasting pointed to Schouten's blog post on the subject as "motivation."

"If we can speed up the rendering time, the most noticeable benefit will probably be smoother-feeling scrolling," Kasting said. He also directed attention in October to DirectWrite support in Chrome, though cautioning that it might not work with the browser's present "sandbox" design to isolate elements of the browser for security reasons.

Mozilla has its own results to show off, too. Schouten offered a graph showing improved performance displaying a variety of Web pages. Facebook, Google, and Twitter rendered on the screen in half the time using the Direct2D; Slashdot and a Wikipedia entry were barely changed. One taxing page using the Scalable Vector Graphics format (SVG) to show movable, resizable graphics showed more than twice as fast, dropping from about 11 milliseconds to less than 4 milliseconds.

Microsoft's DirectWrite permits smoother display of many fonts.
Microsoft's DirectWrite permits smoother display of many fonts. Microsoft

What actually changes?
Direct2D replaces an older technology called Graphics Device Interface (GDI) used in Windows XP. Both offer a way for programs to tap into computing hardware without having to worry about the particulars of video card capabilities and settings, but Direct2D taps into hardware acceleration features.

The technology lets programmers control basic elements such as transparent boxes, curved lines, and resizable photos. Out of these, user interface elements are constructed; Direct2D calls upon a computer's graphics processor to speed that up. It's particularly helpful for dynamic situations that change element properties such as color, size, or opacity.

DirectWrite offers a similar graphics chip boost to the task of displaying text. That may not sound computationally intense, but some parts of it are. In particular, DirectWrite offers a more sophisticated mechanism for displaying text to take advantage of something called sub-pixel positioning of letters.

Each pixel on an LCD screen is actually made of three tiny slices--for red, green, and blue components--and sub-pixel technology subtly draws letters using pieces of these pixels to make the overall appearance smoother. The older GDI permitted some sub-pixel positioning, but only smoothed letters in the horizontal direction; DirectWrite smooths curves vertically as well.

Using the graphics chip in Direct2D and DirectWrite operations brings several advantages. Performance is the first: some operations are faster or smoother, and having more power on hand lets programmers tackle more ambitious projects. Second, the general-purpose central processor, relatively inefficient at handling graphics tasks, is unburdened, freeing it up for other tasks and saving battery power.

Firefox already has a graphics system of its own called Cairo. Schouten has been adding a Direct2D and DirectWrite.

Firefox is of course a browser that doesn't just work on Windows. The DirectWrite technology helps that operating system catch up to its rivals, said Mozilla's John Daggett in a blog post Sunday. "Platform APIs [application programming interfaces] on Mac OS X and Linux already do a good job rendering Postscript CFF [Compact Font Format] fonts," he said. "This just brings them up to parity under Windows 7."

Direct2D is used elsewhere in the browser. "We've made significant progress and are now able to present a Firefox browser completely rendered using Direct2D, making intensive usage of the GPU," or graphics processing unit, Schouten said. And because Cairo is used by other open-source software, other projects will benefit from the work, he added.

The Direct2D work is Mozilla's second hardware acceleration effort; the company also is working on one using a different hardware acceleration interface called OpenGL for mobile devices using Nvidia's Tegra chips, according to Mozilla.

This Mozilla demonstration of photos and Scalable Vector Graphics (SVG), with transparency and click-and-drag resizing, works more than twice as fast Direct2D graphics.
This Mozilla demonstration of photos and Scalable Vector Graphics (SVG), with transparency and click-and-drag resizing, works more than twice as fast Direct2D graphics. Screenshot by Stephen Shankland/CNET

The interactive Web
Microsoft went out of its way to emphasize that the Direct2D and DirectWrite work will help existing Web pages without programmers having to change a line of code. Dean Hachamovitch, general manager of Internet Explorer, contrasted that to other hardware acceleration efforts including Native Client and O3D from Google and WebGL from Mozilla and the Khronos Group .

Native Client, O3D, and WebGL are part of a long list of developments designed to transform the Web into a foundation not just for static pages but also for interactive applications. Those technologies, though, require new programming skills and tools.

Mozilla, Google, Apple, and Opera have been pushing this interactive Web agenda, and Microsoft is showing signs of interest, too. However, for now, Microsoft emphasizes that Direct2D support will help the existing Web. But the browser makers have their eyes on interactive technology as well. Direct2D will help with complex sites that use 2D graphics interfaces such as SVG and Canvas, Mozilla said.

Added Schouten, "As Web sites become more graphically intense, dynamic graphics will start playing a larger role, especially in user interfaces."

About the author

Stephen Shankland has been a reporter at CNET since 1998 and covers browsers, Web development, digital photography and new technology. In the past he has been CNET's beat reporter for Google, Yahoo, Linux, open-source software, servers and supercomputers. He has a soft spot in his heart for standards groups and I/O interfaces.

 

Join the discussion

Conversation powered by Livefyre

Don't Miss
Hot Products
Trending on CNET

CNET's Christmas Gift Guide

'Tis the season for a gadget upgrade

Check out these 8 tablets you'll want to bring home for the holidays.