diff options
Diffstat (limited to 'Tools/DumpRenderTree/win')
14 files changed, 366 insertions, 13 deletions
diff --git a/Tools/DumpRenderTree/win/DumpRenderTree.cpp b/Tools/DumpRenderTree/win/DumpRenderTree.cpp index 66e7311..2db43da 100644 --- a/Tools/DumpRenderTree/win/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/win/DumpRenderTree.cpp @@ -168,12 +168,15 @@ wstring urlSuitableForTestResult(const wstring& urlString) return cfStringRefToWString(substringFromIndex(path.get(), CFStringGetLength(basePath.get())).get()); } -wstring lastPathComponent(const wstring& url) +wstring lastPathComponent(const wstring& urlString) { - if (url.empty()) - return url; + if (urlString.empty()) + return urlString; + + RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateWithBytes(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(urlString.c_str()), urlString.length() * sizeof(wstring::value_type), kCFStringEncodingUTF16, 0)); + RetainPtr<CFStringRef> lastPathComponent(CFURLCopyLastPathComponent(url.get())); - return PathFindFileNameW(url.c_str()); + return cfStringRefToWString(lastPathComponent.get()); } static string toUTF8(const wchar_t* wideString, size_t length) @@ -873,6 +876,7 @@ static void resetDefaultsToConsistentValues(IWebPreferences* preferences) prefsPrivate->setXSSAuditorEnabled(FALSE); prefsPrivate->setFrameFlatteningEnabled(FALSE); prefsPrivate->setOfflineWebApplicationCacheEnabled(TRUE); + prefsPrivate->setLoadsSiteIconsIgnoringImageLoadingPreference(FALSE); } setAlwaysAcceptCookies(false); diff --git a/Tools/DumpRenderTree/win/DumpRenderTree.vcproj b/Tools/DumpRenderTree/win/DumpRenderTree.vcproj index 39d2df2..803917a 100644 --- a/Tools/DumpRenderTree/win/DumpRenderTree.vcproj +++ b/Tools/DumpRenderTree/win/DumpRenderTree.vcproj @@ -515,6 +515,14 @@ > </File> <File + RelativePath="..\CyclicRedundancyCheck.cpp" + > + </File> + <File + RelativePath="..\CyclicRedundancyCheck.h" + > + </File> + <File RelativePath=".\DraggingInfo.h" > </File> diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeProduction.vsprops b/Tools/DumpRenderTree/win/DumpRenderTreeProduction.vsprops index 818bff2..df20c64 100644 --- a/Tools/DumpRenderTree/win/DumpRenderTreeProduction.vsprops +++ b/Tools/DumpRenderTree/win/DumpRenderTreeProduction.vsprops @@ -6,7 +6,7 @@ InheritedPropertySheets=" $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; - $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\production.vsprops; .\DumpRenderTreeCommon.vsprops; .\DumpRenderTreeApple.vsprops" diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeRelease.vsprops b/Tools/DumpRenderTree/win/DumpRenderTreeRelease.vsprops index c39a9cd..5f12a6b 100644 --- a/Tools/DumpRenderTree/win/DumpRenderTreeRelease.vsprops +++ b/Tools/DumpRenderTree/win/DumpRenderTreeRelease.vsprops @@ -6,6 +6,7 @@ InheritedPropertySheets=" $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; .\DumpRenderTreeCommon.vsprops; .\DumpRenderTreeApple.vsprops" diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeReleaseCairoCFLite.vsprops b/Tools/DumpRenderTree/win/DumpRenderTreeReleaseCairoCFLite.vsprops index 508e8c5..27fefbb 100644 --- a/Tools/DumpRenderTree/win/DumpRenderTreeReleaseCairoCFLite.vsprops +++ b/Tools/DumpRenderTree/win/DumpRenderTreeReleaseCairoCFLite.vsprops @@ -6,6 +6,7 @@ InheritedPropertySheets=" $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefinesCairo.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\cURL.vsprops; diff --git a/Tools/DumpRenderTree/win/ImageDiff.vcproj b/Tools/DumpRenderTree/win/ImageDiff.vcproj index 7094fec..66d4b65 100644 --- a/Tools/DumpRenderTree/win/ImageDiff.vcproj +++ b/Tools/DumpRenderTree/win/ImageDiff.vcproj @@ -199,6 +199,7 @@ </Configuration> <Configuration Name="Debug_Cairo_CFLite|Win32" + IntermediateDirectory="$(ConfigurationName)" ConfigurationType="1" InheritedPropertySheets=".\ImageDiffDebugCairoCFLite.vsprops" CharacterSet="2" @@ -386,8 +387,60 @@ </References> <Files> <File + RelativePath="..\win\ImageDiffCairo.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Production|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File RelativePath="..\cg\ImageDiffCG.cpp" > + <FileConfiguration + Name="Debug_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> </Files> <Globals> diff --git a/Tools/DumpRenderTree/win/ImageDiffCairo.cpp b/Tools/DumpRenderTree/win/ImageDiffCairo.cpp new file mode 100644 index 0000000..d10cc14 --- /dev/null +++ b/Tools/DumpRenderTree/win/ImageDiffCairo.cpp @@ -0,0 +1,260 @@ +/* + * Copyright (C) 2005, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2005 Ben La Monica <ben.lamonica@gmail.com>. All rights reserved. + * Copyright (C) 2011 Brent Fulgham. 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 +#define WTF_EXPORT_PRIVATE + +#include <cairo.h> +#include <stdio.h> +#include <wtf/Platform.h> +#include <wtf/RefPtr.h> +#include <wtf/RetainPtr.h> + +#if PLATFORM(WIN) +#include <fcntl.h> +#include <io.h> +#include <windows.h> +#include <wtf/MathExtras.h> +#endif + +using namespace std; + +static const int s_bufferSize = 2048; +static const int s_bytesPerPixel = 4; +static cairo_user_data_key_t s_imageDataKey; + + +#if PLATFORM(WIN) +#undef min +#undef max + +static inline float strtof(const char* inputString, char** endptr) +{ + return strtod(inputString, endptr); +} +#endif + +static cairo_status_t readFromData(void* closure, unsigned char* data, unsigned int length) +{ + CFMutableDataRef dataSource = reinterpret_cast<CFMutableDataRef>(closure); + + CFRange range = CFRangeMake(0, length); + CFDataGetBytes(dataSource, range, data); + CFDataDeleteBytes(dataSource, range); + + return CAIRO_STATUS_SUCCESS; +} + +static cairo_surface_t* createImageFromStdin(int bytesRemaining) +{ + unsigned char buffer[s_bufferSize]; + RetainPtr<CFMutableDataRef> data(AdoptCF, CFDataCreateMutable(0, bytesRemaining)); + + while (bytesRemaining > 0) { + size_t bytesToRead = min(bytesRemaining, s_bufferSize); + size_t bytesRead = fread(buffer, 1, bytesToRead, stdin); + CFDataAppendBytes(data.get(), buffer, static_cast<CFIndex>(bytesRead)); + bytesRemaining -= static_cast<int>(bytesRead); + } + + return cairo_image_surface_create_from_png_stream (static_cast<cairo_read_func_t>(readFromData), data.get()); +} + +static void releaseMallocBuffer(void* data) +{ + free(data); +} + +static inline float pixelDifference(float expected, float actual) +{ + return (actual - expected) / max<float>(255 - expected, expected); +} + +static inline void normalizeBuffer(float maxDistance, unsigned char* buffer, size_t length) +{ + if (maxDistance >= 1) + return; + + for (size_t p = 0; p < length; ++p) + buffer[p] /= maxDistance; +} + +static cairo_surface_t* createDifferenceImage(cairo_surface_t* baselineImage, cairo_surface_t* actualImage, float& difference) +{ + size_t width = cairo_image_surface_get_width(baselineImage); + size_t height = cairo_image_surface_get_height(baselineImage); + + unsigned char* baselinePixel = cairo_image_surface_get_data(baselineImage); + unsigned char* actualPixel = cairo_image_surface_get_data(actualImage); + + // Compare the content of the 2 bitmaps + void* diffBuffer = malloc(width * height); + unsigned char* diffPixel = reinterpret_cast<unsigned char*>(diffBuffer); + + float count = 0; + float sum = 0; + float maxDistance = 0; + for (size_t y = 0; y < height; ++y) { + for (size_t x = 0; x < width; ++x) { + float red = pixelDifference(baselinePixel[0], actualPixel[0]); + float green = pixelDifference(baselinePixel[1], actualPixel[1]); + float blue = pixelDifference(baselinePixel[2], actualPixel[2]); + float alpha = pixelDifference(baselinePixel[3], actualPixel[3]); + + float distance = sqrtf(red * red + green * green + blue * blue + alpha * alpha) / 2.0; + + *diffPixel++ = static_cast<unsigned char>(distance * 255); + + if (distance >= 1.0 / 255.0) { + ++count; + sum += distance; + if (distance > maxDistance) + maxDistance = distance; + } + + baselinePixel += s_bytesPerPixel; + actualPixel += s_bytesPerPixel; + } + } + + // 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) + difference = 100.0f * sum / (height * width); + else + difference = 0; + + if (!difference) { + free(diffBuffer); + return 0; + } + + // Generate a normalized diff image + normalizeBuffer(maxDistance, reinterpret_cast<unsigned char*>(diffBuffer), height * width); + + cairo_surface_t* diffImage = cairo_image_surface_create_for_data(diffPixel, CAIRO_FORMAT_ARGB32, width, height, width * s_bytesPerPixel); + cairo_surface_set_user_data(diffImage, &s_imageDataKey, diffBuffer, releaseMallocBuffer); + + return diffImage; +} + +static inline bool imageHasAlpha(cairo_surface_t* image) +{ + return (cairo_image_surface_get_format(image) == CAIRO_FORMAT_ARGB32); +} + +static cairo_status_t writeToData(void* closure, unsigned char* data, unsigned int length) +{ + CFMutableDataRef dataTarget = reinterpret_cast<CFMutableDataRef>(closure); + + CFDataAppendBytes(dataTarget, data, length); + + return CAIRO_STATUS_SUCCESS; +} + +int main(int argc, const char* argv[]) +{ +#if PLATFORM(WIN) + _setmode(0, _O_BINARY); + _setmode(1, _O_BINARY); +#endif + + float tolerance = 0; + + 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[s_bufferSize]; + cairo_surface_t* actualImage = 0; + cairo_surface_t* baselineImage = 0; + + while (fgets(buffer, sizeof(buffer), stdin)) { + char* newLineCharacter = strchr(buffer, '\n'); + if (newLineCharacter) + *newLineCharacter = '\0'; + + if (!strncmp("Content-Length: ", buffer, 16)) { + strtok(buffer, " "); + int 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", stdout); + } + + if (actualImage && baselineImage) { + cairo_surface_t* diffImage = 0; + float difference = 100.0; + + if ((cairo_image_surface_get_width(actualImage) == cairo_image_surface_get_width(baselineImage)) + && (cairo_image_surface_get_height(actualImage) == cairo_image_surface_get_height(baselineImage)) + && (imageHasAlpha(actualImage) == imageHasAlpha(baselineImage))) { + diffImage = createDifferenceImage(actualImage, baselineImage, difference); // difference is passed by reference + if (difference <= tolerance) + difference = 0; + else { + difference = roundf(difference * 100.0) / 100.0; + difference = max<float>(difference, 0.01); // round to 2 decimal places + } + } else + fputs("error, test and reference image have different properties.\n", stderr); + + if (difference > 0.0) { + if (diffImage) { + RetainPtr<CFMutableDataRef> imageData(AdoptCF, CFDataCreateMutable(0, 0)); + cairo_surface_write_to_png_stream(diffImage, (cairo_write_func_t)writeToData, imageData.get()); + printf("Content-Length: %lu\n", CFDataGetLength(imageData.get())); + fwrite(CFDataGetBytePtr(imageData.get()), 1, CFDataGetLength(imageData.get()), stdout); + cairo_surface_destroy(diffImage); + diffImage = 0; + } + + fprintf(stdout, "diff: %01.2f%% failed\n", difference); + } else + fprintf(stdout, "diff: %01.2f%% passed\n", difference); + + cairo_surface_destroy(actualImage); + cairo_surface_destroy(baselineImage); + actualImage = 0; + baselineImage = 0; + } + + fflush(stdout); + } + + return 0; +} diff --git a/Tools/DumpRenderTree/win/ImageDiffDebugCairoCFLite.vsprops b/Tools/DumpRenderTree/win/ImageDiffDebugCairoCFLite.vsprops index bd6bc8a..0205f9a 100644 --- a/Tools/DumpRenderTree/win/ImageDiffDebugCairoCFLite.vsprops +++ b/Tools/DumpRenderTree/win/ImageDiffDebugCairoCFLite.vsprops @@ -7,6 +7,6 @@ $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug_wincairo.vsprops; - .\ImageDiffCommon.vsprops" + .\ImageDiffWinCairoCommon.vsprops" > </VisualStudioPropertySheet> diff --git a/Tools/DumpRenderTree/win/ImageDiffProduction.vsprops b/Tools/DumpRenderTree/win/ImageDiffProduction.vsprops index 37ff9de..bd14a38 100644 --- a/Tools/DumpRenderTree/win/ImageDiffProduction.vsprops +++ b/Tools/DumpRenderTree/win/ImageDiffProduction.vsprops @@ -5,7 +5,7 @@ Name="ImageDiffProduction" InheritedPropertySheets=" $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; - $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\production.vsprops; .\ImageDiffCommon.vsprops" > diff --git a/Tools/DumpRenderTree/win/ImageDiffRelease.vsprops b/Tools/DumpRenderTree/win/ImageDiffRelease.vsprops index 79e9749..16ba125 100644 --- a/Tools/DumpRenderTree/win/ImageDiffRelease.vsprops +++ b/Tools/DumpRenderTree/win/ImageDiffRelease.vsprops @@ -5,6 +5,7 @@ Name="ImageDiffRelease" InheritedPropertySheets=" $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; .\ImageDiffCommon.vsprops" > diff --git a/Tools/DumpRenderTree/win/ImageDiffReleaseCairoCFLite.vsprops b/Tools/DumpRenderTree/win/ImageDiffReleaseCairoCFLite.vsprops index 1cb062b..7ca4b32 100644 --- a/Tools/DumpRenderTree/win/ImageDiffReleaseCairoCFLite.vsprops +++ b/Tools/DumpRenderTree/win/ImageDiffReleaseCairoCFLite.vsprops @@ -5,8 +5,9 @@ Name="ImageDiffReleaseCairoCFLite" InheritedPropertySheets=" $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops; - .\ImageDiffCommon.vsprops" + .\ImageDiffWinCairoCommon.vsprops" > </VisualStudioPropertySheet> diff --git a/Tools/DumpRenderTree/win/ImageDiffWinCairoCommon.vsprops b/Tools/DumpRenderTree/win/ImageDiffWinCairoCommon.vsprops new file mode 100644 index 0000000..eb1b922 --- /dev/null +++ b/Tools/DumpRenderTree/win/ImageDiffWinCairoCommon.vsprops @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="ImageDiffCommon" + > + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories=""$(ConfigurationBuildDir)\include";"$(ConfigurationBuildDir)\include\private";"$(ConfigurationBuildDir)\include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\private"" + PreprocessorDefinitions="NOMINMAX" + /> + <Tool + Name="VCLinkerTool" + AdditionalOptions="/NXCOMPAT" + AdditionalDependencies="JavaScriptCore$(WebKitDLLConfigSuffix).lib cairo$(LibraryConfigSuffix).lib libjpeg.lib libpng$(LibraryConfigSuffix).lib zlib.lib Msimg32.lib CFLite$(LibraryConfigSuffix).lib" + SubSystem="1" + /> +</VisualStudioPropertySheet> diff --git a/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp index 1d2f3d8..2086ae7 100644 --- a/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp +++ b/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp @@ -1441,6 +1441,12 @@ void LayoutTestController::setEditingBehavior(const char* editingBehavior) preferences->setEditingBehavior(WebKitEditingUnixBehavior); } +JSValueRef LayoutTestController::shadowRoot(JSContextRef context, JSValueRef jsElement) +{ + // FIXME: Implement this. + return JSValueMakeUndefined(context); +} + void LayoutTestController::abortModal() { } diff --git a/Tools/DumpRenderTree/win/PixelDumpSupportWin.cpp b/Tools/DumpRenderTree/win/PixelDumpSupportWin.cpp index 752cc39..f7a95d3 100644 --- a/Tools/DumpRenderTree/win/PixelDumpSupportWin.cpp +++ b/Tools/DumpRenderTree/win/PixelDumpSupportWin.cpp @@ -28,15 +28,15 @@ #include "config.h" -#if PLATFORM(CG) +#if USE(CG) #include "PixelDumpSupportCG.h" -#elif PLATFORM(CAIRO) +#elif USE(CAIRO) #include "PixelDumpSupportCairo.h" #endif #include "DumpRenderTree.h" -#if PLATFORM(CG) +#if USE(CG) // Note: Must be included *after* DumpRenderTree.h to avoid compile error. #include <CoreGraphics/CGBitmapContext.h> #endif @@ -70,11 +70,11 @@ PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool inc GetObject(bitmap, sizeof(info), &info); ASSERT(info.bmBitsPixel == 32); -#if PLATFORM(CG) +#if USE(CG) RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB()); CGContextRef context = CGBitmapContextCreate(info.bmBits, info.bmWidth, info.bmHeight, 8, info.bmWidthBytes, colorSpace.get(), kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst); -#elif PLATFORM(CAIRO) +#elif USE(CAIRO) cairo_surface_t* image = cairo_image_surface_create_for_data((unsigned char*)info.bmBits, CAIRO_FORMAT_ARGB32, info.bmWidth, info.bmHeight, info.bmWidthBytes); cairo_t* context = cairo_create(image); |