This is an archive of the discontinued LLVM Phabricator instance.

[llvm-rc] Serialize CURSOR and ICON resources to .res files (serialization, pt 6).
ClosedPublic

Authored by mnbvmar on Sep 14 2017, 5:17 PM.

Details

Summary

This adds ability to output cursors and icons as resources.

Unfortunately, we can't just copy .cur or .ico files to output - as each file might contain multiple images, each of them needs to be unpacked and stored as a separate resource. This forces us to parse cursor and icon contents. (Fortunately, these formats are pretty similar and can be processed by mostly common code).

As test files are binary, here is a short explanation of .cur and .ico files stored:

  • cursor.cur, cursor-8.cur, cursor-32.cur are sample correct cursor files, differing in their bit depth.
  • icon-old.ico, icon-new.ico are sample correct icon files;
  • icon-png.ico is a sample correct icon file in PNG format (instead of usual BMP);
  • cursor-eof.cur is an incorrect cursor file - this is cursor.cur with some of its final bytes removed.
  • cursor-bad-offset.cur is an incorrect cursor file - image header states that image data begins at offset 0xFFFFFFFF.

Sample correct cursors and icons were created by Nico Weber.

Diff Detail

Repository
rL LLVM

Event Timeline

mnbvmar updated this revision to Diff 117164.Sep 29 2017, 9:32 AM

Refactored into FileWriter; updated tests.

mnbvmar updated this revision to Diff 117165.Sep 29 2017, 9:33 AM

Remove unnecessary .res file.

rnk accepted this revision.Sep 29 2017, 10:23 AM

lgtm

This revision is now accepted and ready to land.Sep 29 2017, 10:23 AM
This revision was automatically updated to reflect the committed changes.