Title: [216207] trunk/Tools
Revision
216207
Author
jbed...@apple.com
Date
2017-05-04 14:06:37 -0700 (Thu, 04 May 2017)

Log Message

Make ImageDiff stand-alone
https://bugs.webkit.org/show_bug.cgi?id=168939

Reviewed by David Kilzer.

Create ImageDiff without dependencies on bmalloc and WTF so that it exists as a
stand-alone project. Note that this change does not eliminate the ImageDiff inside
the DumpRenderTree project.

* ImageDiff/ImageDiff.xcodeproj: Added.
* ImageDiff/ImageDiff.xcodeproj/project.pbxproj: Added.
* ImageDiff/Makefile: Use ImageDiff project.
* ImageDiff/PlatformMac.cmake: Added.
* ImageDiff/PlatformWin.cmake: Added.
* ImageDiff/cg: Added.
* ImageDiff/cg/Configurations: Added.
* ImageDiff/cg/Configurations/Base.xcconfig: Copied from Tools/DumpRenderTree/mac/Configurations/Base.xcconfig.
* ImageDiff/cg/Configurations/DebugRelease.xcconfig: Copied from Tools/DumpRenderTree/mac/Configurations/DebugRelease.xcconfig.
* ImageDiff/cg/Configurations/ImageDiff.xcconfig: Copied from Tools/DumpRenderTree/mac/Configurations/ImageDiff.xcconfig.
* ImageDiff/cg/ImageDiff.cpp: Copied from Tools/DumpRenderTree/cg/ImageDiffCG.cpp.
(createImageFromStdin): Stop using RetainPtr.
(createDifferenceImage): Ditto.
(main): Ditto.
* Scripts/build-imagediff: Stop building WTF and bmalloc.

Modified Paths

Added Paths

Diff

Modified: trunk/Tools/ChangeLog (216206 => 216207)


--- trunk/Tools/ChangeLog	2017-05-04 20:56:00 UTC (rev 216206)
+++ trunk/Tools/ChangeLog	2017-05-04 21:06:37 UTC (rev 216207)
@@ -1,3 +1,30 @@
+2017-05-03  Jonathan Bedard  <jbed...@apple.com>
+
+        Make ImageDiff stand-alone
+        https://bugs.webkit.org/show_bug.cgi?id=168939
+
+        Reviewed by David Kilzer.
+
+        Create ImageDiff without dependencies on bmalloc and WTF so that it exists as a
+        stand-alone project. Note that this change does not eliminate the ImageDiff inside
+        the DumpRenderTree project.
+
+        * ImageDiff/ImageDiff.xcodeproj: Added.
+        * ImageDiff/ImageDiff.xcodeproj/project.pbxproj: Added.
+        * ImageDiff/Makefile: Use ImageDiff project.
+        * ImageDiff/PlatformMac.cmake: Added.
+        * ImageDiff/PlatformWin.cmake: Added.
+        * ImageDiff/cg: Added.
+        * ImageDiff/cg/Configurations: Added.
+        * ImageDiff/cg/Configurations/Base.xcconfig: Copied from Tools/DumpRenderTree/mac/Configurations/Base.xcconfig.
+        * ImageDiff/cg/Configurations/DebugRelease.xcconfig: Copied from Tools/DumpRenderTree/mac/Configurations/DebugRelease.xcconfig.
+        * ImageDiff/cg/Configurations/ImageDiff.xcconfig: Copied from Tools/DumpRenderTree/mac/Configurations/ImageDiff.xcconfig.
+        * ImageDiff/cg/ImageDiff.cpp: Copied from Tools/DumpRenderTree/cg/ImageDiffCG.cpp.
+        (createImageFromStdin): Stop using RetainPtr.
+        (createDifferenceImage): Ditto.
+        (main): Ditto.
+        * Scripts/build-imagediff: Stop building WTF and bmalloc.
+
 2017-05-04  Sam Weinig  <s...@webkit.org>
 
         Remove support for legacy Notifications
Index: trunk/Tools/ImageDiff/ImageDiff.xcodeproj
===================================================================
--- trunk/Tools/ImageDiff/ImageDiff.xcodeproj	2017-05-04 20:56:00 UTC (rev 216206)
+++ trunk/Tools/ImageDiff/ImageDiff.xcodeproj	2017-05-04 21:06:37 UTC (rev 216207)

Property changes: trunk/Tools/ImageDiff/ImageDiff.xcodeproj


Added: svn:ignore

+project.xcworkspace +xcuserdata

Added: trunk/Tools/ImageDiff/ImageDiff.xcodeproj/project.pbxproj (0 => 216207)


--- trunk/Tools/ImageDiff/ImageDiff.xcodeproj/project.pbxproj	                        (rev 0)
+++ trunk/Tools/ImageDiff/ImageDiff.xcodeproj/project.pbxproj	2017-05-04 21:06:37 UTC (rev 216207)
@@ -0,0 +1,213 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 48;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		31DF42D51EBBBC220096ED44 /* ImageDiff.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31DF42C21EBBBB550096ED44 /* ImageDiff.cpp */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+		31DF42CA1EBBBBFE0096ED44 /* CopyFiles */ = {
+			isa = PBXCopyFilesBuildPhase;
+			buildActionMask = 2147483647;
+			dstPath = /usr/share/man/man1/;
+			dstSubfolderSpec = 0;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 1;
+		};
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+		31DF42C21EBBBB550096ED44 /* ImageDiff.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = ImageDiff.cpp; path = cg/ImageDiff.cpp; sourceTree = SOURCE_ROOT; };
+		31DF42C41EBBBBB90096ED44 /* Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = "<group>"; };
+		31DF42C51EBBBBB90096ED44 /* DebugRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = DebugRelease.xcconfig; sourceTree = "<group>"; };
+		31DF42C61EBBBBB90096ED44 /* ImageDiff.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ImageDiff.xcconfig; sourceTree = "<group>"; };
+		31DF42CC1EBBBBFE0096ED44 /* ImageDiff */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ImageDiff; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		31DF42C91EBBBBFE0096ED44 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		31A5D0391EBBBB0400D3F11B = {
+			isa = PBXGroup;
+			children = (
+				31DF42C31EBBBB5E0096ED44 /* Configurations */,
+				31DF42C01EBBBB210096ED44 /* cg */,
+				31DF42CD1EBBBBFE0096ED44 /* Products */,
+			);
+			sourceTree = "<group>";
+		};
+		31DF42C01EBBBB210096ED44 /* cg */ = {
+			isa = PBXGroup;
+			children = (
+				31DF42C21EBBBB550096ED44 /* ImageDiff.cpp */,
+			);
+			path = cg;
+			sourceTree = "<group>";
+		};
+		31DF42C31EBBBB5E0096ED44 /* Configurations */ = {
+			isa = PBXGroup;
+			children = (
+				31DF42C41EBBBBB90096ED44 /* Base.xcconfig */,
+				31DF42C51EBBBBB90096ED44 /* DebugRelease.xcconfig */,
+				31DF42C61EBBBBB90096ED44 /* ImageDiff.xcconfig */,
+			);
+			name = Configurations;
+			path = cg/Configurations;
+			sourceTree = "<group>";
+		};
+		31DF42CD1EBBBBFE0096ED44 /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				31DF42CC1EBBBBFE0096ED44 /* ImageDiff */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+		31DF42CB1EBBBBFE0096ED44 /* ImageDiff */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 31DF42D11EBBBBFE0096ED44 /* Build configuration list for PBXNativeTarget "ImageDiff" */;
+			buildPhases = (
+				31DF42C81EBBBBFE0096ED44 /* Sources */,
+				31DF42C91EBBBBFE0096ED44 /* Frameworks */,
+				31DF42CA1EBBBBFE0096ED44 /* CopyFiles */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = ImageDiff;
+			productName = ImageDiff;
+			productReference = 31DF42CC1EBBBBFE0096ED44 /* ImageDiff */;
+			productType = "com.apple.product-type.tool";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		31A5D03A1EBBBB0400D3F11B /* Project object */ = {
+			isa = PBXProject;
+			attributes = {
+				LastUpgradeCheck = 0900;
+				TargetAttributes = {
+					31DF42CB1EBBBBFE0096ED44 = {
+						CreatedOnToolsVersion = 9.0;
+						ProvisioningStyle = Automatic;
+					};
+				};
+			};
+			buildConfigurationList = 31A5D03D1EBBBB0400D3F11B /* Build configuration list for PBXProject "ImageDiff" */;
+			compatibilityVersion = "Xcode 8.0";
+			developmentRegion = English;
+			hasScannedForEncodings = 0;
+			knownRegions = (
+				en,
+			);
+			mainGroup = 31A5D0391EBBBB0400D3F11B;
+			productRefGroup = 31DF42CD1EBBBBFE0096ED44 /* Products */;
+			projectDirPath = "";
+			projectRoot = "";
+			targets = (
+				31DF42CB1EBBBBFE0096ED44 /* ImageDiff */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXSourcesBuildPhase section */
+		31DF42C81EBBBBFE0096ED44 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				31DF42D51EBBBC220096ED44 /* ImageDiff.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+		31A5D03E1EBBBB0400D3F11B /* Debug */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 31DF42C51EBBBBB90096ED44 /* DebugRelease.xcconfig */;
+			buildSettings = {
+			};
+			name = Debug;
+		};
+		31A5D03F1EBBBB0400D3F11B /* Release */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 31DF42C51EBBBBB90096ED44 /* DebugRelease.xcconfig */;
+			buildSettings = {
+			};
+			name = Release;
+		};
+		31DF42C71EBBBBD80096ED44 /* Production */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 31DF42C41EBBBBB90096ED44 /* Base.xcconfig */;
+			buildSettings = {
+			};
+			name = Production;
+		};
+		31DF42D21EBBBBFE0096ED44 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 31DF42C61EBBBBB90096ED44 /* ImageDiff.xcconfig */;
+			buildSettings = {
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Debug;
+		};
+		31DF42D31EBBBBFE0096ED44 /* Release */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 31DF42C61EBBBBB90096ED44 /* ImageDiff.xcconfig */;
+			buildSettings = {
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Release;
+		};
+		31DF42D41EBBBBFE0096ED44 /* Production */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 31DF42C61EBBBBB90096ED44 /* ImageDiff.xcconfig */;
+			buildSettings = {
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Production;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		31A5D03D1EBBBB0400D3F11B /* Build configuration list for PBXProject "ImageDiff" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				31A5D03E1EBBBB0400D3F11B /* Debug */,
+				31A5D03F1EBBBB0400D3F11B /* Release */,
+				31DF42C71EBBBBD80096ED44 /* Production */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		31DF42D11EBBBBFE0096ED44 /* Build configuration list for PBXNativeTarget "ImageDiff" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				31DF42D21EBBBBFE0096ED44 /* Debug */,
+				31DF42D31EBBBBFE0096ED44 /* Release */,
+				31DF42D41EBBBBFE0096ED44 /* Production */,
+			);
+			defaultConfigurationIsVisible = 0;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = 31A5D03A1EBBBB0400D3F11B /* Project object */;
+}

Modified: trunk/Tools/ImageDiff/Makefile (216206 => 216207)


--- trunk/Tools/ImageDiff/Makefile	2017-05-04 20:56:00 UTC (rev 216206)
+++ trunk/Tools/ImageDiff/Makefile	2017-05-04 21:06:37 UTC (rev 216207)
@@ -1,15 +1,3 @@
 SCRIPTS_PATH = ../Scripts
 
-# Temporary until https://bugs.webkit.org/show_bug.cgi?id=168939 is completed
-all:
-	$(SCRIPTS_PATH)/build-imagediff $(OTHER_OPTIONS)
-
-debug d development dev develop:
-	$(SCRIPTS_PATH)/set-webkit-configuration --debug
-	$(SCRIPTS_PATH)/build-imagediff $(OTHER_OPTIONS)
-
-release r deployment dep deploy:
-	$(SCRIPTS_PATH)/set-webkit-configuration --release
-	$(SCRIPTS_PATH)/build-imagediff $(OTHER_OPTIONS)
-clean:
-	$(SCRIPTS_PATH)/build-imagediff --clean
+include ../../Makefile.shared

Added: trunk/Tools/ImageDiff/PlatformMac.cmake (0 => 216207)


--- trunk/Tools/ImageDiff/PlatformMac.cmake	                        (rev 0)
+++ trunk/Tools/ImageDiff/PlatformMac.cmake	2017-05-04 21:06:37 UTC (rev 216207)
@@ -0,0 +1,13 @@
+list(APPEND IMAGE_DIFF_LIBRARIES
+    CFNetwork
+    CoreGraphics
+    CoreText
+)
+set(IMAGE_DIFF_SOURCES
+    ${IMAGE_DIFF_DIR}/cg/ImageDiff.cpp
+)
+list(APPEND ImageDiff_LIBRARIES
+    CoreFoundation
+    CoreGraphics
+    CoreText
+)
\ No newline at end of file

Added: trunk/Tools/ImageDiff/PlatformWin.cmake (0 => 216207)


--- trunk/Tools/ImageDiff/PlatformWin.cmake	                        (rev 0)
+++ trunk/Tools/ImageDiff/PlatformWin.cmake	2017-05-04 21:06:37 UTC (rev 216207)
@@ -0,0 +1,5 @@
+if (${WTF_PLATFORM_WIN_CAIRO})
+    include(Cairo.cmake)
+else ()
+    include(PlatformMac.cmake)
+endif ()
\ No newline at end of file

Copied: trunk/Tools/ImageDiff/cg/Configurations/Base.xcconfig (from rev 216144, trunk/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig) (0 => 216207)


--- trunk/Tools/ImageDiff/cg/Configurations/Base.xcconfig	                        (rev 0)
+++ trunk/Tools/ImageDiff/cg/Configurations/Base.xcconfig	2017-05-04 21:06:37 UTC (rev 216207)
@@ -0,0 +1,80 @@
+// Copyright (C) 2009-2017 Apple Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+
+CLANG_CXX_LANGUAGE_STANDARD = gnu++14;
+CLANG_CXX_LIBRARY = libc++;
+CLANG_WARN_CXX0X_EXTENSIONS = NO;
+GCC_NO_COMMON_BLOCKS = YES;
+ENABLE_STRICT_OBJC_MSGSEND=YES;
+GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) $(GCC_PREPROCESSOR_DEFINITIONS_$(PLATFORM_NAME));
+GCC_PREPROCESSOR_DEFINITIONS_macosx = ENABLE_DASHBOARD_SUPPORT;
+DEBUG_INFORMATION_FORMAT = dwarf-with-dsym;
+PREBINDING = NO
+GCC_C_LANGUAGE_STANDARD = gnu99
+GCC_ENABLE_CPP_RTTI = NO;
+GCC_OBJC_CALL_CXX_CDTORS = YES
+GCC_PRECOMPILE_PREFIX_HEADER = YES
+GCC_TREAT_WARNINGS_AS_ERRORS = YES
+CLANG_WARN_BOOL_CONVERSION = YES;
+CLANG_WARN_CONSTANT_CONVERSION = YES;
+CLANG_WARN_EMPTY_BODY = YES;
+CLANG_WARN_ENUM_CONVERSION = YES;
+CLANG_WARN_INFINITE_RECURSION = YES;
+CLANG_WARN_INT_CONVERSION = YES;
+CLANG_WARN_SUSPICIOUS_MOVE = YES;
+CLANG_WARN_UNREACHABLE_CODE = YES;
+GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO
+GCC_WARN_ABOUT_RETURN_TYPE = YES;
+GCC_WARN_UNINITIALIZED_AUTOS = YES;
+GCC_WARN_UNUSED_FUNCTION = YES
+GCC_WARN_UNUSED_VARIABLE = YES
+CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+GCC_WARN_UNDECLARED_SELECTOR = YES;
+GCC_WARN_64_TO_32_BIT_CONVERSION[arch=arm64*] = NO;
+GCC_WARN_64_TO_32_BIT_CONVERSION[arch=x86_64] = NO;
+WARNING_CFLAGS = -Wall -W -Wno-unused-parameter -Wundef
+
+DEBUG_DEFINES_debug = ;
+DEBUG_DEFINES_normal = NDEBUG;
+DEBUG_DEFINES = $(DEBUG_DEFINES_$(CURRENT_VARIANT));
+
+TARGET_MAC_OS_X_VERSION_MAJOR = $(TARGET_MAC_OS_X_VERSION_MAJOR$(MACOSX_DEPLOYMENT_TARGET:suffix:identifier));
+TARGET_MAC_OS_X_VERSION_MAJOR_10 = 101000;
+TARGET_MAC_OS_X_VERSION_MAJOR_11 = 101100;
+TARGET_MAC_OS_X_VERSION_MAJOR_12 = 101200;
+TARGET_MAC_OS_X_VERSION_MAJOR_13 = 101300;
+TARGET_MAC_OS_X_VERSION_MAJOR_14 = 101400;
+
+SDKROOT = macosx.internal;
+
+PRODUCTION_FRAMEWORKS_DIR[sdk=iphone*] = $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks;
+PRODUCTION_FRAMEWORKS_DIR[sdk=macosx*] = $(SDKROOT)$(NEXT_ROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Versions/A/Frameworks;
+
+AD_HOC_CODE_SIGNING_ALLOWED = YES;
+
+SUPPORTED_PLATFORMS = iphoneos iphonesimulator macosx tvos tvsimulator watchos watchsimulator;
+
+OTHER_CFLAGS = $(ASAN_OTHER_CFLAGS);
+OTHER_CPLUSPLUSFLAGS = $(ASAN_OTHER_CPLUSPLUSFLAGS);
+OTHER_LDFLAGS = $(ASAN_OTHER_LDFLAGS);

Copied: trunk/Tools/ImageDiff/cg/Configurations/DebugRelease.xcconfig (from rev 216144, trunk/Tools/DumpRenderTree/mac/Configurations/DebugRelease.xcconfig) (0 => 216207)


--- trunk/Tools/ImageDiff/cg/Configurations/DebugRelease.xcconfig	                        (rev 0)
+++ trunk/Tools/ImageDiff/cg/Configurations/DebugRelease.xcconfig	2017-05-04 21:06:37 UTC (rev 216207)
@@ -0,0 +1,41 @@
+// Copyright (C) 2009, 2013 Apple Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+
+#include "Base.xcconfig"
+
+ARCHS = $(ARCHS_STANDARD_32_64_BIT);
+
+_ONLY_ACTIVE_ARCH_ = YES;
+
+TARGET_MAC_OS_X_VERSION_MAJOR = $(MAC_OS_X_VERSION_MAJOR);
+
+MACOSX_DEPLOYMENT_TARGET[sdk=macosx*] = $(MACOSX_DEPLOYMENT_TARGET_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));
+MACOSX_DEPLOYMENT_TARGET_macosx_101000 = 10.10;
+MACOSX_DEPLOYMENT_TARGET_macosx_101100 = 10.11;
+MACOSX_DEPLOYMENT_TARGET_macosx_101200 = 10.12;
+MACOSX_DEPLOYMENT_TARGET_macosx_101300 = 10.13;
+MACOSX_DEPLOYMENT_TARGET_macosx_101400 = 10.14;
+
+SDKROOT = $(SDKROOT_$(USE_INTERNAL_SDK));
+SDKROOT_ = macosx;
+SDKROOT_YES = macosx.internal;

Copied: trunk/Tools/ImageDiff/cg/Configurations/ImageDiff.xcconfig (from rev 216144, trunk/Tools/DumpRenderTree/mac/Configurations/ImageDiff.xcconfig) (0 => 216207)


--- trunk/Tools/ImageDiff/cg/Configurations/ImageDiff.xcconfig	                        (rev 0)
+++ trunk/Tools/ImageDiff/cg/Configurations/ImageDiff.xcconfig	2017-05-04 21:06:37 UTC (rev 216207)
@@ -0,0 +1,30 @@
+// Copyright (C) 2009 Apple Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+
+OTHER_CFLAGS = $(inherited) -iframework $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks -iframework $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks -iframework $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/CoreServices.framework/Frameworks -iframework $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Frameworks;
+OTHER_CPLUSPLUSFLAGS = $(OTHER_CFLAGS);
+GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+
+PRODUCT_NAME = ImageDiff;
+OTHER_LDFLAGS[sdk=macosx*] = $(inherited) -framework Carbon -framework Cocoa -framework QuartzCore;
+OTHER_LDFLAGS[sdk=iphone*] = $(inherited) -framework CoreFoundation -framework CoreGraphics -framework MobileCoreServices -framework ImageIO;

Copied: trunk/Tools/ImageDiff/cg/ImageDiff.cpp (from rev 216144, trunk/Tools/DumpRenderTree/cg/ImageDiffCG.cpp) (0 => 216207)


--- trunk/Tools/ImageDiff/cg/ImageDiff.cpp	                        (rev 0)
+++ trunk/Tools/ImageDiff/cg/ImageDiff.cpp	2017-05-04 21:06:37 UTC (rev 216207)
@@ -0,0 +1,286 @@
+/*
+ * Copyright (C) 2005, 2007, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2005 Ben La Monica <ben.lamon...@gmail.com>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// FIXME: We need to be able to include these defines from a config.h somewhere.
+#define JS_EXPORT_PRIVATE
+
+#include <algorithm>
+#include <stdio.h>
+
+#ifdef _WIN32
+#include <winsock2.h>
+#include <windows.h>
+#include <fcntl.h>
+#include <io.h>
+#include <wtf/MathExtras.h>
+#endif
+
+#include <CoreGraphics/CGBitmapContext.h>
+#include <CoreGraphics/CGImage.h>
+#include <ImageIO/CGImageDestination.h>
+
+#if __APPLE__
+#include <TargetConditionals.h>
+
+#if TARGET_OS_IPHONE
+#include <MobileCoreServices/UTCoreTypes.h>
+#else
+#include <CoreServices/CoreServices.h>
+#endif
+
+#endif
+
+#ifndef CGFLOAT_DEFINED
+#ifdef __LP64__
+typedef double CGFloat;
+#else
+typedef float CGFloat;
+#endif
+#define CGFLOAT_DEFINED 1
+#endif
+
+using namespace std;
+
+#ifdef _WIN32
+static const CFStringRef kUTTypePNG = CFSTR("public.png");
+#endif
+
+static CGImageRef createImageFromStdin(long bytesRemaining)
+{
+    unsigned char buffer[2048];
+    CFMutableDataRef data = "" bytesRemaining);
+
+    while (bytesRemaining > 0) {
+        size_t bytesToRead = std::min(bytesRemaining, 2048L);
+        size_t bytesRead = fread(buffer, 1, bytesToRead, stdin);
+        CFDataAppendBytes(data, buffer, static_cast<CFIndex>(bytesRead));
+        bytesRemaining -= static_cast<int>(bytesRead);
+    }
+    CGDataProviderRef dataProvider = CGDataProviderCreateWithCFData(data);
+    CFRelease(data);
+    CGImageRef result = CGImageCreateWithPNGDataProvider(dataProvider, 0, false, kCGRenderingIntentDefault);
+    CFRelease(dataProvider);
+    
+    return result;
+}
+
+static void releaseMallocBuffer(void* info, const void* data, size_t size)
+{
+    free((void*)data);
+}
+
+static CGImageRef createDifferenceImage(CGImageRef baseImage, CGImageRef testImage, float& difference)
+{
+    size_t width = CGImageGetWidth(baseImage);
+    size_t height = CGImageGetHeight(baseImage);
+    size_t rowBytes = width * 4;
+
+    // Draw base image in bitmap context
+    void* baseBuffer = calloc(height, rowBytes);
+    CGContextRef baseContext = CGBitmapContextCreate(baseBuffer, width, height, 8, rowBytes, CGImageGetColorSpace(baseImage), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host);
+    CGContextDrawImage(baseContext, CGRectMake(0, 0, width, height), baseImage);
+
+    // Draw test image in bitmap context
+    void* buffer = calloc(height, rowBytes);
+    CGContextRef context = CGBitmapContextCreate(buffer, width, height, 8, rowBytes, CGImageGetColorSpace(testImage), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host);
+    CGContextDrawImage(context, CGRectMake(0, 0, width, height), testImage);
+
+    // Compare the content of the 2 bitmaps
+    void* diffBuffer = malloc(width * height);
+    float count = 0.0f;
+    float sum = 0.0f;
+    float maxDistance = 0.0f;
+    unsigned char* basePixel = reinterpret_cast<unsigned char*>(baseBuffer);
+    unsigned char* pixel = reinterpret_cast<unsigned char*>(buffer);
+    unsigned char* diff = reinterpret_cast<unsigned char*>(diffBuffer);
+    for (size_t y = 0; y < height; ++y) {
+        for (size_t x = 0; x < width; ++x) {
+            float red = (pixel[0] - basePixel[0]) / max<float>(255 - basePixel[0], basePixel[0]);
+            float green = (pixel[1] - basePixel[1]) / max<float>(255 - basePixel[1], basePixel[1]);
+            float blue = (pixel[2] - basePixel[2]) / max<float>(255 - basePixel[2], basePixel[2]);
+            float alpha = (pixel[3] - basePixel[3]) / max<float>(255 - basePixel[3], basePixel[3]);
+            float distance = sqrtf(red * red + green * green + blue * blue + alpha * alpha) / 2.0f;
+            
+            *diff++ = (unsigned char)(distance * 255.0f);
+            
+            if (distance >= 1.0f / 255.0f) {
+                count += 1.0f;
+                sum += distance;
+                if (distance > maxDistance)
+                    maxDistance = distance;
+            }
+            
+            basePixel += 4;
+            pixel += 4;
+        }
+    }
+    
+    // Compute the difference as a percentage combining both the number of different pixels and their difference amount i.e. the average distance over the entire image
+    if (count > 0.0f)
+        difference = 100.0f * sum / (height * width);
+    else
+        difference = 0.0f;
+
+    CGImageRef diffImage = nullptr;
+    // Generate a normalized diff image if there is any difference
+    if (difference > 0.0f) {
+        if (maxDistance < 1.0f) {
+            diff = reinterpret_cast<unsigned char*>(diffBuffer);
+            for (size_t p = 0; p < height * width; ++p)
+                diff[p] = diff[p] / maxDistance;
+        }
+        
+        static CGColorSpaceRef diffColorspace = CGColorSpaceCreateDeviceGray();
+        CGDataProviderRef provider = CGDataProviderCreateWithData(0, diffBuffer, width * height, releaseMallocBuffer);
+        diffImage = CGImageCreate(width, height, 8, 8, width, diffColorspace, 0, provider, 0, false, kCGRenderingIntentDefault);
+        CFRelease(provider);
+    } else
+        free(diffBuffer);
+    
+    CFRelease(baseContext);
+    CFRelease(context);
+    
+    // Destroy drawing buffers
+    if (buffer)
+        free(buffer);
+    if (baseBuffer)
+        free(baseBuffer);
+    
+    return diffImage;
+}
+
+static inline bool imageHasAlpha(CGImageRef image)
+{
+    CGImageAlphaInfo info = CGImageGetAlphaInfo(image);
+    
+    return (info >= kCGImageAlphaPremultipliedLast) && (info <= kCGImageAlphaFirst);
+}
+
+int main(int argc, const char* argv[])
+{
+#ifdef _WIN32
+    _setmode(0, _O_BINARY);
+    _setmode(1, _O_BINARY);
+#endif
+
+    float tolerance = 0.0f;
+
+    for (int i = 1; i < argc; ++i) {
+        if (!strcmp(argv[i], "-t") || !strcmp(argv[i], "--tolerance")) {
+            if (i >= argc - 1)
+                exit(1);
+            tolerance = strtof(argv[i + 1], 0);
+            ++i;
+            continue;
+        }
+    }
+
+    char buffer[2048];
+    CGImageRef actualImage = nullptr;
+    CGImageRef baselineImage = nullptr;
+
+    while (fgets(buffer, sizeof(buffer), stdin)) {
+        // remove the CR
+        char* newLineCharacter = strchr(buffer, '\n');
+        if (newLineCharacter)
+            *newLineCharacter = '\0';
+
+        if (!strncmp("Content-Length: ", buffer, 16)) {
+            strtok(buffer, " ");
+            long imageSize = strtol(strtok(0, " "), 0, 10);
+
+            if (imageSize > 0 && !actualImage)
+                actualImage = createImageFromStdin(imageSize);
+            else if (imageSize > 0 && !baselineImage)
+                baselineImage = createImageFromStdin(imageSize);
+            else
+                fputs("Error: image size must be specified.\n", stderr);
+        }
+
+        if (actualImage && baselineImage) {
+            CGImageRef diffImage = nullptr;
+            float difference = 100.0f;
+
+            if ((CGImageGetWidth(actualImage) == CGImageGetWidth(baselineImage)) && (CGImageGetHeight(actualImage) == CGImageGetHeight(baselineImage)) && (imageHasAlpha(actualImage) == imageHasAlpha(baselineImage))) {
+                diffImage = createDifferenceImage(actualImage, baselineImage, difference); // difference is passed by reference
+                if (difference <= tolerance)
+                    difference = 0.0f;
+                else {
+                    difference = roundf(difference * 100.0f) / 100.0f;
+                    difference = max(difference, 0.01f); // round to 2 decimal places
+                }
+            } else {
+                if (CGImageGetWidth(actualImage) != CGImageGetWidth(baselineImage) || CGImageGetHeight(actualImage) != CGImageGetHeight(baselineImage)) {
+#ifdef _WIN32
+                    fprintf(stderr, "Error: test and reference images have different sizes. Test image is %Iux%Iu, reference image is %Iux%Iu\n",
+#else
+                    fprintf(stderr, "Error: test and reference images have different sizes. Test image is %zux%zu, reference image is %zux%zu\n",
+#endif
+                        CGImageGetWidth(actualImage), CGImageGetHeight(actualImage),
+                        CGImageGetWidth(baselineImage), CGImageGetHeight(baselineImage));
+                } else if (imageHasAlpha(actualImage) != imageHasAlpha(baselineImage))
+                    fprintf(stderr, "Error: test and reference images differ in alpha. Test image %s alpha, reference image %s alpha.\n",
+                    imageHasAlpha(actualImage) ? "has" : "does not have",
+                        imageHasAlpha(baselineImage) ? "has" : "does not have");
+            }
+            
+            if (difference > 0.0f) {
+                if (diffImage) {
+                    CFMutableDataRef imageData = CFDataCreateMutable(0, 0);
+                    CGImageDestinationRef imageDest = CGImageDestinationCreateWithData(imageData, kUTTypePNG, 1, 0);
+                    CGImageDestinationAddImage(imageDest, diffImage, 0);
+                    CGImageDestinationFinalize(imageDest);
+#ifdef _WIN32
+                    printf("Content-Length: %Iu\n", static_cast<size_t>(CFDataGetLength(imageData)));
+#else
+                    printf("Content-Length: %zu\n", static_cast<size_t>(CFDataGetLength(imageData)));
+#endif
+                    fwrite(CFDataGetBytePtr(imageData), 1, CFDataGetLength(imageData), stdout);
+                    
+                    CFRelease(imageData);
+                    CFRelease(imageDest);
+                }
+
+                fprintf(stdout, "diff: %01.2f%% failed\n", difference);
+            } else
+                fprintf(stdout, "diff: %01.2f%% passed\n", difference);
+            
+            if (diffImage)
+                CFRelease(diffImage);
+            if (actualImage)
+                CFRelease(actualImage);
+            if (baselineImage)
+                CFRelease(baselineImage);
+            actualImage = nullptr;
+            baselineImage = nullptr;
+        }
+        
+
+        fflush(stdout);
+    }
+
+    return 0;
+}

Modified: trunk/Tools/Scripts/build-imagediff (216206 => 216207)


--- trunk/Tools/Scripts/build-imagediff	2017-05-04 20:56:00 UTC (rev 216206)
+++ trunk/Tools/Scripts/build-imagediff	2017-05-04 21:06:37 UTC (rev 216207)
@@ -58,26 +58,10 @@
 setConfiguration();
 chdirWebKit();
 
-# Build bmalloc
-chdir "Source/bmalloc" or die;
-$result = buildXCodeProject("bmalloc", $clean, XcodeOptions(), @ARGV);
-if (exitStatus($result)) {
-    exit exitStatus($result);
-}
-chdirWebKit();
- 
-# Build WTF
-chdir "Source/WTF" or die;
-$result = buildXCodeProject("WTF", $clean, XcodeOptions(), @ARGV);
-if (exitStatus($result)) {
-    exit exitStatus($result);
-}
-chdirWebKit();
-
 my @xcodeOptions = ("-target", "ImageDiff");
 push @xcodeOptions, XcodeOptions();
 
 # Build
-chdir "Tools/DumpRenderTree" or die;
-$result = buildXCodeProject("DumpRenderTree", $clean, @xcodeOptions, @ARGV);
+chdir "Tools/ImageDiff" or die;
+$result = buildXCodeProject("ImageDiff", $clean, @xcodeOptions, @ARGV);
 exit exitStatus($result);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to