Archives
 
 
 
  Special
 
 
 
  About Us
 
 
 

Newsletter
Free E-mail Newsletter from BYTE.com

 
    
           
Visit the home page Browse the four-year online archive Download platform-neutral CPU/FPU benchmarks Find information for advertisers, authors, vendors, subscribers Request free information on products written about or advertised in BYTE Submit a press release, or scan recent announcements Talk with BYTE's staff and readers about products and technologies

ArticlesPorting Adobe Photoshop: A Case Study


February 1994 / State Of The Art / Porting Adobe Photoshop: A Case Study

In the course of developing and porting Adobe Photoshop, a package for editing images, Adobe engineers have learned a number of lessons.

When Photoshop was conceived in 1988, the Mac was the only affordable desktop system with the needed horsepower. Adobe developed the application in MacApp, an object-oriented framework using Object Pascal. At that time, Windows was not a significant factor for graphics applications, and the Mac was clearly the platform of choice for graphics and desktop publishing.

By late 1990, it was clear that the Windows platform would become a major market, and Adobe began planning its first Windows port. The company faced a difficult task. Understandably, it had not taken enough of the precautionary and preparatory steps that are routine today. Adobe ha d created a base of source code for which there were very few tools. Windows compilers existed for C, C++, and Pascal, but not for Object Pascal, which was little known outside of Apple.

MacApp itself presented a serious porting challenge. To port Photoshop, not only the application code would have to move but also the entire MacApp framework.

While planning this first Windows port, Adobe was also mapping out new features for the next major upgrade. Clearly, if Adobe engineers opted to take a "snapshot" of the existing Photoshop code and then embark on a complex port to Windows while simultaneously bringing major new features to the Mac side, the two versions would be hopelessly out of sync.

Still, market conditions favored the snapshot approach. No one was certain that Windows would become a popular, viable platform for graphics and desktop publishing software. And it seemed unwise to tie up the highly successful Mac version of Photoshop while engineers reworked the application to sustai n future cross-platform development efforts.

Emulating MacApp

In the end, Adobe opted for a sustained approach, hoping to avoid an endless pattern of releasing different platform versions with leapfrogging feature sets. Adobe decided to do a bulk translation of Photoshop from Object Pascal to C++ and to restructure the application into separate core and edge code. It would also create its own framework for Windows that emulated MacApp.

The first step was to form separate Mac and Windows development teams. Engineers on the Mac side would restructure the product to separate core code and API-related code. They would use MacApp 3.0, written in C++. Their goal was not to port code but to structure it properly. At the same time, the Mac team was working on new features for the next major revision.

Meanwhile, the Windows team began building an emulation of MacApp. They looked at the existing Photoshop and emulated only the required portions of MacApp--those relating to the user interface. Th eir goal was to bring MacApp functionality to Windows and thus ensure that Mac code would compile under Windows.

At that time, it was unclear whether the Windows team would be licensed to use MacApp source code, so they worked without it, using headers that described the MacApp API and building their own analogs. As a result of their efforts, it is possible, using emulated portions of MacApp, to translate the Mac GUI into a Windows GUI. Adobe developed its own tool that converts Mac view resources--which describe interface elements such as dialog boxes and buttons--for use by the emulated MacApp.

This effort was so successful that, to this day, as Adobe's developers continue to improve Photoshop, their code for new features usually compiles without modification under either platform. Aside from the usual compiler independence issues, little hampers this process. Now, when developers complete new Photoshop features for either platform, the same features can be running on the other platform in sho rt order. Mac and Windows versions of Photoshop ship within weeks of each other.

New Platforms--Unix, PowerPC, and NT

Encouraged by the successful Windows port and market forces, Adobe decided to develop Unix versions of Photoshop, including Sun Microsystems and Silicon Graphics. By leveraging fast I/O bandwidth and RISC processors, Photoshop will get a big performance boost.

To bring Photoshop to Unix platforms, Adobe is using Latitude, an emulated API system from Quorum Software Systems. Because the Quorum system emulates the Macintosh API, MacApp ported directly. A high percentage of Photoshop's Mac source code, running against Latitude's Unix libraries, has compiled without change.

Adobe is currently porting Photoshop to the PowerPC Mac and Windows NT. While it is too early to discuss either port in much detail, the basic approaches are clear.

In porting Photoshop to the PowerPC, the quirks of MacApp proved to be the major obstacle. Apple's compilers for the PowerPC, which w ere written by IBM, were not geared to certain peculiarities of Object Pascal. For example, one involves the use of objects based on handles rather than pointers--a distinctive aspect of Macintosh memory management. Supporting such Object Pascal-based objects and calling sequences was too much for the PowerPC compiler. To get around this, Adobe and Apple jointly developed a new version of MacApp that compiles under PowerPC.

PowerPC and NT bring important changes to APIs and raise the usual issues of compiler independence. With NT, for example, the target machine may be using any of a number of different processors from Intel, Mips, and DEC.

NT brings important benefits to applications like Photoshop. For example, image-processing applications need large data structures. To run under Windows, these had to be broken into 64-KB units--a requirement that NT eliminates because it relies on a 32-bit flat-memory model, just like the Mac. Thus, NT removes the performance constraints that compromise the performance of Photoshop under Windows.

It turns out that, with the MacApp emulation well established on the Windows side, the Photoshop Windows source code contains no attributes that do not easily compile. Therefore, the Adobe team was able to move Photoshop easily to NT.


Photograph: Doug Olson (lower left) with Adobe Photoshop team members.
Screens: Windows menu Mac menu The screens show how well the Windows and Mac versions of Photoshop correspond.

Up to the State Of The Art section contentsGo to previous article: Developing For Multiple PlatformsGo to next article: Compilers For Parallel CPUsSearchSend a comment on this articleSubscribe to BYTE or BYTE on CD-ROM  
Flexible C++
Matthew Wilson
My approach to software engineering is far more pragmatic than it is theoretical--and no language better exemplifies this than C++.

more...

BYTE Digest

BYTE Digest editors every month analyze and evaluate the best articles from Information Week, EE Times, Dr. Dobb's Journal, Network Computing, Sys Admin, and dozens of other CMP publications—bringing you critical news and information about wireless communication, computer security, software development, embedded systems, and more!

Find out more

BYTE.com Store

BYTE CD-ROM
NOW, on one CD-ROM, you can instantly access more than 8 years of BYTE.
 
The Best of BYTE Volume 1: Programming Languages
The Best of BYTE
Volume 1: Programming Languages
In this issue of Best of BYTE, we bring together some of the leading programming language designers and implementors...

Copyright © 2005 CMP Media LLC, Privacy Policy, Your California Privacy rights, Terms of Service
Site comments: webmaster@byte.com
SDMG Web Sites: BYTE.com, C/C++ Users Journal, Dr. Dobb's Journal, MSDN Magazine, New Architect, SD Expo, SD Magazine, Sys Admin, The Perl Journal, UnixReview.com, Windows Developer Network