Changeset 216576 in webkit


Ignore:
Timestamp:
May 10, 2017 1:16:15 AM (7 years ago)
Author:
commit-queue@webkit.org
Message:

ImageDiff: Add CG implementation for new ImageDiff
https://bugs.webkit.org/show_bug.cgi?id=170608

Reviewed Alex Christensen.

Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2017-05-10

  • DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
  • DumpRenderTree/win/ImageDiffCairo.cpp: Removed.
  • DumpRenderTree/win/ImageDiffWin.cpp: Removed.
  • ImageDiff/CMakeLists.txt:
  • ImageDiff/Cairo.cmake:
  • ImageDiff/ImageDiff.cpp:

(main):

  • ImageDiff/ImageDiff.xcodeproj/project.pbxproj:
  • ImageDiff/PlatformImage.cpp:
  • ImageDiff/PlatformImage.h:
  • ImageDiff/cairo/PlatformImageCairo.cpp:
  • ImageDiff/cg/ImageDiff.cpp: Removed.
  • ImageDiff/cg/PlatformImageCG.cpp: Added.

(ImageDiff::PlatformImage::createFromStdin):
(ImageDiff::PlatformImage::createFromDiffData):
(ImageDiff::PlatformImage::PlatformImage):
(ImageDiff::PlatformImage::~PlatformImage):
(ImageDiff::PlatformImage::width):
(ImageDiff::PlatformImage::height):
(ImageDiff::PlatformImage::rowBytes):
(ImageDiff::PlatformImage::hasAlpha):
(ImageDiff::PlatformImage::pixels):
(ImageDiff::PlatformImage::writeAsPNGToStdout):

Location:
trunk/Tools
Files:
1 added
3 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r216575 r216576  
     12017-05-10  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        ImageDiff: Add CG implementation for new ImageDiff
     4        https://bugs.webkit.org/show_bug.cgi?id=170608
     5
     6        Reviewed Alex Christensen.
     7
     8        * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
     9        * DumpRenderTree/win/ImageDiffCairo.cpp: Removed.
     10        * DumpRenderTree/win/ImageDiffWin.cpp: Removed.
     11        * ImageDiff/CMakeLists.txt:
     12        * ImageDiff/Cairo.cmake:
     13        * ImageDiff/ImageDiff.cpp:
     14        (main):
     15        * ImageDiff/ImageDiff.xcodeproj/project.pbxproj:
     16        * ImageDiff/PlatformImage.cpp:
     17        * ImageDiff/PlatformImage.h:
     18        * ImageDiff/cairo/PlatformImageCairo.cpp:
     19        * ImageDiff/cg/ImageDiff.cpp: Removed.
     20        * ImageDiff/cg/PlatformImageCG.cpp: Added.
     21        (ImageDiff::PlatformImage::createFromStdin):
     22        (ImageDiff::PlatformImage::createFromDiffData):
     23        (ImageDiff::PlatformImage::PlatformImage):
     24        (ImageDiff::PlatformImage::~PlatformImage):
     25        (ImageDiff::PlatformImage::width):
     26        (ImageDiff::PlatformImage::height):
     27        (ImageDiff::PlatformImage::rowBytes):
     28        (ImageDiff::PlatformImage::hasAlpha):
     29        (ImageDiff::PlatformImage::pixels):
     30        (ImageDiff::PlatformImage::writeAsPNGToStdout):
     31
    1322017-05-10  Zan Dobersek  <zdobersek@igalia.com>
    233
  • trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj

    r216288 r216576  
    399399                BCB2848C0CFA8221007E533E /* PixelDumpSupportMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = PixelDumpSupportMac.mm; path = mac/PixelDumpSupportMac.mm; sourceTree = "<group>"; };
    400400                BCB284B20CFA82CB007E533E /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = "<absolute>"; };
    401                 BCB284F30CFA84F2007E533E /* ImageDiffCG.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = ImageDiffCG.cpp; path = cg/ImageDiffCG.cpp; sourceTree = "<group>"; };
    402401                BCD08A580E10496B00A7D0C1 /* AccessibilityController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityController.h; sourceTree = "<group>"; };
    403402                BCD08B390E1057EF00A7D0C1 /* AccessibilityController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityController.cpp; sourceTree = "<group>"; };
     
    805804                                53CBB830134E42F3001CE6A4 /* CyclicRedundancyCheck.cpp */,
    806805                                53CBB831134E42F3001CE6A4 /* CyclicRedundancyCheck.h */,
    807                                 BCB284F30CFA84F2007E533E /* ImageDiffCG.cpp */,
    808806                                8465E2C60FFA8DF2003B8342 /* PixelDumpSupport.cpp */,
    809807                                BCB2848A0CFA820F007E533E /* PixelDumpSupport.h */,
  • trunk/Tools/ImageDiff/CMakeLists.txt

    r215179 r216576  
    88)
    99
    10 list(APPEND IMAGE_DIFF_INCLUDE_DIRECTORIES
     10set(IMAGE_DIFF_INCLUDE_DIRECTORIES
    1111    ${IMAGE_DIFF_DIR}
    12 )
    13 
    14 set(IMAGE_DIFF_LIBRARIES
    15     WTF
    1612)
    1713
  • trunk/Tools/ImageDiff/Cairo.cmake

    r215179 r216576  
    1010    ${CAIRO_LIBRARIES}
    1111)
     12
     13add_definitions(-DUSE_CAIRO=1)
  • trunk/Tools/ImageDiff/ImageDiff.cpp

    r216504 r216576  
    2626 */
    2727
    28 #include "config.h"
     28// FIXME: We need to be able to include these defines from a config.h somewhere.
     29#define JS_EXPORT_PRIVATE
     30
    2931#include "PlatformImage.h"
    3032#include <algorithm>
     
    3335#include <string.h>
    3436
    35 #if PLATFORM(WIN)
     37#ifdef _WIN32
    3638#include <fcntl.h>
    3739#include <io.h>
     
    4042using namespace ImageDiff;
    4143
    42 #if OS(WINDOWS)
     44#ifdef _WIN32
    4345#define FORMAT_SIZE_T "Iu"
    4446#else
     
    4850int main(int argc, const char* argv[])
    4951{
    50 #if PLATFORM(WIN)
     52#ifdef _WIN32
    5153    _setmode(0, _O_BINARY);
    5254    _setmode(1, _O_BINARY);
  • trunk/Tools/ImageDiff/ImageDiff.xcodeproj/project.pbxproj

    r216207 r216576  
    88
    99/* Begin PBXBuildFile section */
    10                 31DF42D51EBBBC220096ED44 /* ImageDiff.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31DF42C21EBBBB550096ED44 /* ImageDiff.cpp */; };
     10                7A41C8F01EC1F8FF003DBC76 /* PlatformImageCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A41C8EF1EC1F8FF003DBC76 /* PlatformImageCG.cpp */; };
     11                7A41C8F21EC1F919003DBC76 /* ImageDiff.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A41C8F11EC1F919003DBC76 /* ImageDiff.cpp */; };
     12                7A41C8F41EC1F935003DBC76 /* PlatformImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A41C8F31EC1F935003DBC76 /* PlatformImage.cpp */; };
    1113/* End PBXBuildFile section */
    1214
     
    2426
    2527/* Begin PBXFileReference section */
    26                 31DF42C21EBBBB550096ED44 /* ImageDiff.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = ImageDiff.cpp; path = cg/ImageDiff.cpp; sourceTree = SOURCE_ROOT; };
    2728                31DF42C41EBBBBB90096ED44 /* Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = "<group>"; };
    2829                31DF42C51EBBBBB90096ED44 /* DebugRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = DebugRelease.xcconfig; sourceTree = "<group>"; };
    2930                31DF42C61EBBBBB90096ED44 /* ImageDiff.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ImageDiff.xcconfig; sourceTree = "<group>"; };
    3031                31DF42CC1EBBBBFE0096ED44 /* ImageDiff */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ImageDiff; sourceTree = BUILT_PRODUCTS_DIR; };
     32                7A41C8EF1EC1F8FF003DBC76 /* PlatformImageCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformImageCG.cpp; sourceTree = "<group>"; };
     33                7A41C8F11EC1F919003DBC76 /* ImageDiff.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageDiff.cpp; sourceTree = "<group>"; };
     34                7A41C8F31EC1F935003DBC76 /* PlatformImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformImage.cpp; sourceTree = "<group>"; };
     35                7A41C8F51EC1F946003DBC76 /* PlatformImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformImage.h; sourceTree = "<group>"; };
    3136/* End PBXFileReference section */
    3237
     
    4550                        isa = PBXGroup;
    4651                        children = (
     52                                7A41C8F11EC1F919003DBC76 /* ImageDiff.cpp */,
     53                                7A41C8F31EC1F935003DBC76 /* PlatformImage.cpp */,
     54                                7A41C8F51EC1F946003DBC76 /* PlatformImage.h */,
    4755                                31DF42C31EBBBB5E0096ED44 /* Configurations */,
    4856                                31DF42C01EBBBB210096ED44 /* cg */,
     
    5462                        isa = PBXGroup;
    5563                        children = (
    56                                 31DF42C21EBBBB550096ED44 /* ImageDiff.cpp */,
     64                                7A41C8EF1EC1F8FF003DBC76 /* PlatformImageCG.cpp */,
    5765                        );
    5866                        path = cg;
     
    134142                        buildActionMask = 2147483647;
    135143                        files = (
    136                                 31DF42D51EBBBC220096ED44 /* ImageDiff.cpp in Sources */,
     144                                7A41C8F41EC1F935003DBC76 /* PlatformImage.cpp in Sources */,
     145                                7A41C8F21EC1F919003DBC76 /* ImageDiff.cpp in Sources */,
     146                                7A41C8F01EC1F8FF003DBC76 /* PlatformImageCG.cpp in Sources */,
    137147                        );
    138148                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Tools/ImageDiff/PlatformImage.cpp

    r215179 r216576  
    2626 */
    2727
    28 #include "config.h"
    2928#include "PlatformImage.h"
    3029
    3130#include <algorithm>
     31#include <cstdlib>
    3232
    3333namespace ImageDiff {
  • trunk/Tools/ImageDiff/PlatformImage.h

    r215179 r216576  
    2626#include <cmath>
    2727#include <memory>
    28 #include <wtf/Platform.h>
    2928
    30 #if USE(CAIRO)
     29#if defined(USE_CAIRO) && USE_CAIRO
    3130typedef struct _cairo_surface cairo_surface_t;
     31#else
     32typedef struct CGImage *CGImageRef;
    3233#endif
    3334
     
    3940    static std::unique_ptr<PlatformImage> createFromDiffData(void*, size_t width, size_t height);
    4041
    41 #if USE(CAIRO)
     42#if defined(USE_CAIRO) && USE_CAIRO
    4243    PlatformImage(cairo_surface_t*);
     44#else
     45    PlatformImage(CGImageRef);
    4346#endif
    4447    ~PlatformImage();
     
    5457
    5558private:
    56 #if USE(CAIRO)
     59#if defined(USE_CAIRO) && USE_CAIRO
    5760    cairo_surface_t* m_image;
     61#else
     62    CGImageRef m_image;
     63    mutable void* m_buffer { nullptr };
    5864#endif
    5965};
  • trunk/Tools/ImageDiff/PlatformMac.cmake

    r216207 r216576  
     1list(APPEND IMAGE_DIFF_SOURCES
     2    ${IMAGE_DIFF_DIR}/cg/PlatformImageCG.cpp
     3)
    14list(APPEND IMAGE_DIFF_LIBRARIES
    2     CFNetwork
    3     CoreGraphics
    4     CoreText
    5 )
    6 set(IMAGE_DIFF_SOURCES
    7     ${IMAGE_DIFF_DIR}/cg/ImageDiff.cpp
    8 )
    9 list(APPEND ImageDiff_LIBRARIES
    105    CoreFoundation
    116    CoreGraphics
  • trunk/Tools/ImageDiff/PlatformWin.cmake

    r216504 r216576  
    11if (${WTF_PLATFORM_WIN_CAIRO})
    2     add_definitions(-DUSE_CAIRO=1)
    32    include(Cairo.cmake)
    43else ()
  • trunk/Tools/ImageDiff/cairo/PlatformImageCairo.cpp

    r215179 r216576  
    2424 */
    2525
    26 #include "config.h"
    2726#include "PlatformImage.h"
    2827
     
    3029#include <stdio.h>
    3130
    32 #if OS(WINDOWS)
     31#ifdef _WIN32
    3332#define FORMAT_SIZE_T "Iu"
    3433#else
Note: See TracChangeset for help on using the changeset viewer.