]> granicus.if.org Git - llvm/commit
[llvm-rc] Serialize CURSOR and ICON resources to .res
authorZachary Turner <zturner@google.com>
Fri, 6 Oct 2017 21:25:44 +0000 (21:25 +0000)
committerZachary Turner <zturner@google.com>
Fri, 6 Oct 2017 21:25:44 +0000 (21:25 +0000)
commit4c72b95c52efc04bfb3cd498054704e8032abd54
treea534529eff4b4f68eae770f28538c0b6b8c287e6
parent57c865bc5dbc005ba9f03156e1bfb643371544fe
[llvm-rc] Serialize CURSOR and ICON resources to .res

This is part 6 of llvm-rc serialization.

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.

Patch by Marek Sokolowski
Differential Revision: https://reviews.llvm.org/D37878

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315109 91177308-0d34-0410-b5e6-96231b3b80d8
test/tools/llvm-rc/Inputs/tag-icon-cursor-bad-offset.rc [new file with mode: 0644]
test/tools/llvm-rc/Inputs/tag-icon-cursor-bad-type.rc [new file with mode: 0644]
test/tools/llvm-rc/Inputs/tag-icon-cursor-eof.rc [new file with mode: 0644]
test/tools/llvm-rc/Inputs/tag-icon-cursor-nonexistent.rc [new file with mode: 0644]
test/tools/llvm-rc/Inputs/tag-icon-cursor-nonsense.rc [new file with mode: 0644]
test/tools/llvm-rc/Inputs/tag-icon-cursor.rc [new file with mode: 0644]
test/tools/llvm-rc/tag-icon-cursor.test [new file with mode: 0644]
tools/llvm-rc/ResourceFileWriter.cpp
tools/llvm-rc/ResourceFileWriter.h
tools/llvm-rc/ResourceScriptStmt.h
tools/llvm-rc/ResourceVisitor.h