summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/content_shell.gypi11
-rw-r--r--tools/imagediff/DEPS2
-rw-r--r--tools/imagediff/image_diff.cc19
-rw-r--r--tools/imagediff/image_diff.gyp12
4 files changed, 31 insertions, 13 deletions
diff --git a/content/content_shell.gypi b/content/content_shell.gypi
index 129c2a2..4d120af 100644
--- a/content/content_shell.gypi
+++ b/content/content_shell.gypi
@@ -356,6 +356,7 @@
'content_shell_lib',
'content_shell_pak',
'../third_party/mesa/mesa.gyp:osmesa',
+ '../tools/imagediff/image_diff.gyp:image_diff',
],
'include_dirs': [
'..',
@@ -484,6 +485,16 @@
},
],
}], # OS=="mac"
+ ['OS=="android"', {
+ 'dependencies!': [
+ '../tools/imagediff/image_diff.gyp:image_diff',
+ ],
+ }], # OS=="android"
+ ['OS=="android" and android_webview_build==0', {
+ 'dependencies': [
+ '../tools/imagediff/image_diff.gyp:image_diff#host',
+ ],
+ }], # OS=="android" and android_webview_build==0
],
},
{
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',
+ }],
+ ],
},
],
}