summaryrefslogtreecommitdiffstats
path: root/tools/imagediff
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-25 20:40:13 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-25 20:40:13 +0000
commit331d169064b50f0085b42ef7bf695a279cbab622 (patch)
treebd1505e0ed5b79c409d891af0dbb71937ef457f5 /tools/imagediff
parenta3080ea92d3d22b9e4f613004b04d46444c4cd96 (diff)
downloadchromium_src-331d169064b50f0085b42ef7bf695a279cbab622.zip
chromium_src-331d169064b50f0085b42ef7bf695a279cbab622.tar.gz
chromium_src-331d169064b50f0085b42ef7bf695a279cbab622.tar.bz2
Update tools/imagediff/image_diff target to for layout tests
This updates the tools/imagediff/image_diff target to build everywhere we may want to run layout tests. The only tricky bit here is that on android we build the image diff tool on the host toolchain (to avoid doing costly image comparisons on phones, etc). webkit_support_gfx is set up to build in this configuration, but ui isn't. This ports temporarily to webkit_support_gfx. After this patch lands and we switch the bots over to using this version instead of the ImageDiff from third_party/WebKit/Tools/DumpRenderTree/chromium/ImageDiff.cpp, we can migrate the webkit_support_gfx code to a more logical location. R=darin,dpranke Review URL: https://chromiumcodereview.appspot.com/18872002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213686 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/imagediff')
-rw-r--r--tools/imagediff/DEPS2
-rw-r--r--tools/imagediff/image_diff.cc19
-rw-r--r--tools/imagediff/image_diff.gyp12
3 files changed, 20 insertions, 13 deletions
diff --git a/tools/imagediff/DEPS b/tools/imagediff/DEPS
index b273ae3..fc92e01 100644
--- a/tools/imagediff/DEPS
+++ b/tools/imagediff/DEPS
@@ -1,3 +1,3 @@
include_rules = [
- "+ui/gfx",
+ "+webkit/support/webkit_support_gfx.h",
]
diff --git a/tools/imagediff/image_diff.cc b/tools/imagediff/image_diff.cc
index cb1937f..5aa4eef 100644
--- a/tools/imagediff/image_diff.cc
+++ b/tools/imagediff/image_diff.cc
@@ -23,8 +23,7 @@
#include "base/safe_numerics.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
-#include "ui/gfx/codec/png_codec.h"
-#include "ui/gfx/size.h"
+#include "webkit/support/webkit_support_gfx.h"
#if defined(OS_WIN)
#include "windows.h"
@@ -81,9 +80,8 @@ class Image {
if (fread(source.get(), 1, byte_length, stdin) != byte_length)
return false;
- if (!gfx::PNGCodec::Decode(source.get(), byte_length,
- gfx::PNGCodec::FORMAT_RGBA,
- &data_, &w_, &h_)) {
+ if (!webkit_support::DecodePNG(source.get(), byte_length,
+ &data_, &w_, &h_)) {
Clear();
return false;
}
@@ -107,8 +105,8 @@ class Image {
file_util::CloseFile(f);
- if (!gfx::PNGCodec::Decode(&compressed[0], compressed.size(),
- gfx::PNGCodec::FORMAT_RGBA, &data_, &w_, &h_)) {
+ if (!webkit_support::DecodePNG(&compressed[0], compressed.size(),
+ &data_, &w_, &h_)) {
Clear();
return false;
}
@@ -317,10 +315,9 @@ int DiffImages(const base::FilePath& file1, const base::FilePath& file2,
return kStatusSame;
std::vector<unsigned char> png_encoding;
- gfx::PNGCodec::Encode(diff_image.data(), gfx::PNGCodec::FORMAT_RGBA,
- gfx::Size(diff_image.w(), diff_image.h()),
- diff_image.w() * 4, false,
- std::vector<gfx::PNGCodec::Comment>(), &png_encoding);
+ webkit_support::EncodeRGBAPNG(
+ diff_image.data(), diff_image.w(), diff_image.h(),
+ diff_image.w() * 4, &png_encoding);
if (file_util::WriteFile(out_file,
reinterpret_cast<char*>(&png_encoding.front()),
base::checked_numeric_cast<int>(png_encoding.size())) < 0)
diff --git a/tools/imagediff/image_diff.gyp b/tools/imagediff/image_diff.gyp
index 6d4a620..b1f9ccf 100644
--- a/tools/imagediff/image_diff.gyp
+++ b/tools/imagediff/image_diff.gyp
@@ -12,11 +12,21 @@
'type': 'executable',
'dependencies': [
'../../base/base.gyp:base',
- '../../ui/ui.gyp:ui',
+ '../../webkit/support/webkit_support.gyp:webkit_support_gfx',
],
'sources': [
'image_diff.cc',
],
+ 'conditions': [
+ ['OS=="android" and android_webview_build==0', {
+ # The Chromium Android port will compare images on host rather
+ # than target (a device or emulator) for performance reasons.
+ 'toolsets': ['host'],
+ }],
+ ['OS=="android" and android_webview_build==1', {
+ 'type': 'none',
+ }],
+ ],
},
],
}