Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(323)

Unified Diff: webkit/tools/test_shell/test_shell.cc

Issue 17211: Make Mac bitmaps use BGRA to match the MD5 hash Apple uses in its WebKit expe... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/tools/test_shell/resources/missingImage.png ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/tools/test_shell/test_shell.cc
===================================================================
--- webkit/tools/test_shell/test_shell.cc (revision 7611)
+++ webkit/tools/test_shell/test_shell.cc (working copy)
@@ -197,14 +197,14 @@
// Encode image.
std::vector<unsigned char> png;
SkAutoLockPixels src_bmp_lock(src_bmp);
+ PNGEncoder::ColorFormat color_format = PNGEncoder::FORMAT_BGRA;
#if defined(OS_WIN) || defined(OS_LINUX)
bool discard_transparency = true;
- PNGEncoder::ColorFormat color_format = PNGEncoder::FORMAT_BGRA;
#elif defined(OS_MACOSX)
- // the expected PNGs in webkit have an alpha channel. We must not discard
- // the transparency else the checksums won't match.
+ // the expected PNGs in webkit have an alpha channel. We shouldn't discard
+ // the transparency for reference purposes, though the hashes will still
+ // match.
bool discard_transparency = false;
- PNGEncoder::ColorFormat color_format = PNGEncoder::FORMAT_RGBA;
#endif
PNGEncoder::Encode(
reinterpret_cast<const unsigned char*>(src_bmp.getPixels()),
@@ -497,7 +497,14 @@
static std::string broken_image_data;
if (broken_image_data.empty()) {
FilePath path = GetResourcesFilePath();
+#if defined(OS_WIN) || defined(OS_LINUX)
path = path.Append(FILE_PATH_LITERAL("missingImage.gif"));
+#elif defined(OS_MACOSX)
+ // In order to match WebKit's colors for the missing image, we have to
+ // use a PNG. The GIF doesn't have the color range needed to correctly
+ // match the TIFF they use in Safari.
+ path = path.Append(FILE_PATH_LITERAL("missingImage.png"));
+#endif
bool success = file_util::ReadFileToString(path.ToWStringHack(),
&broken_image_data);
if (!success) {
« no previous file with comments | « webkit/tools/test_shell/resources/missingImage.png ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698