Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <cmath>
#include <map>
#include <string>
#include <vector>
#include "core/fxcrt/fx_memory.h"
#include "testing/image_diff/image_diff_png.h"
#include "testing/utils/path_service.h"
#include "third_party/base/numerics/safe_conversions.h"
Go to the source code of this file.
Classes | |
class | Image |
struct | UnpackedPixel |
Functions | |
float | CalculateDifferencePercentage (const Image &actual, int pixels_different) |
void | CountImageSizeMismatchAsPixelDifference (const Image &baseline, const Image &actual, int *pixels_different) |
uint8_t | ChannelDelta (uint8_t baseline_channel, uint8_t actual_channel) |
uint8_t | MaxPixelPerChannelDelta (const UnpackedPixel &baseline_pixel, const UnpackedPixel &actual_pixel) |
float | PercentageDifferent (const Image &baseline, const Image &actual, uint8_t max_pixel_per_channel_delta) |
float | HistogramPercentageDifferent (const Image &baseline, const Image &actual) |
void | PrintHelp (const std::string &binary_name) |
int | CompareImages (const std::string &binary_name, const std::string &file1, const std::string &file2, bool compare_histograms, bool reverse_byte_order, uint8_t max_pixel_per_channel_delta) |
bool | CreateImageDiff (const Image &image1, const Image &image2, Image *out) |
bool | SubtractImages (const Image &image1, const Image &image2, Image *out) |
int | DiffImages (const std::string &binary_name, const std::string &file1, const std::string &file2, const std::string &out_file, bool do_subtraction, bool reverse_byte_order) |
int | main (int argc, const char *argv[]) |
Variables | |
constexpr int | kStatusSame = 0 |
constexpr int | kStatusDifferent = 1 |
constexpr int | kStatusError = 2 |
constexpr uint32_t | RGBA_RED = 0x000000ff |
constexpr uint32_t | RGBA_ALPHA = 0xff000000 |
float CalculateDifferencePercentage | ( | const Image & | actual, |
int | pixels_different ) |
Definition at line 119 of file image_diff.cpp.
References Image::h(), and Image::w().
Referenced by HistogramPercentageDifferent(), and PercentageDifferent().
uint8_t ChannelDelta | ( | uint8_t | baseline_channel, |
uint8_t | actual_channel ) |
Definition at line 159 of file image_diff.cpp.
Referenced by MaxPixelPerChannelDelta().
int CompareImages | ( | const std::string & | binary_name, |
const std::string & | file1, | ||
const std::string & | file2, | ||
bool | compare_histograms, | ||
bool | reverse_byte_order, | ||
uint8_t | max_pixel_per_channel_delta ) |
Definition at line 258 of file image_diff.cpp.
References Image::CreateFromFilename(), Image::CreateFromFilenameWithReverseByteOrder(), HistogramPercentageDifferent(), kStatusDifferent, kStatusError, kStatusSame, and PercentageDifferent().
Referenced by main().
void CountImageSizeMismatchAsPixelDifference | ( | const Image & | baseline, |
const Image & | actual, | ||
int * | pixels_different ) |
Definition at line 131 of file image_diff.cpp.
References Image::h(), and Image::w().
Referenced by HistogramPercentageDifferent(), and PercentageDifferent().
Definition at line 303 of file image_diff.cpp.
References Image::Image(), Image::h(), Image::operator=(), Image::pixel_at(), RGBA_ALPHA, RGBA_RED, Image::set_pixel_at(), and Image::w().
Referenced by DiffImages().
int DiffImages | ( | const std::string & | binary_name, |
const std::string & | file1, | ||
const std::string & | file2, | ||
const std::string & | out_file, | ||
bool | do_subtraction, | ||
bool | reverse_byte_order ) |
Definition at line 367 of file image_diff.cpp.
References Image::CreateFromFilename(), Image::CreateFromFilenameWithReverseByteOrder(), CreateImageDiff(), kStatusDifferent, kStatusError, kStatusSame, and SubtractImages().
Referenced by main().
Definition at line 201 of file image_diff.cpp.
References CalculateDifferencePercentage(), CountImageSizeMismatchAsPixelDifference(), Image::h(), Image::pixel_at(), and Image::w().
Referenced by CompareImages().
int main | ( | int | argc, |
const char * | argv[] ) |
Definition at line 416 of file image_diff.cpp.
References CompareImages(), DiffImages(), FX_InitializeMemoryAllocators(), kStatusError, and PrintHelp().
uint8_t MaxPixelPerChannelDelta | ( | const UnpackedPixel & | baseline_pixel, |
const UnpackedPixel & | actual_pixel ) |
Definition at line 165 of file image_diff.cpp.
References UnpackedPixel::alpha, UnpackedPixel::blue, ChannelDelta(), UnpackedPixel::green, and UnpackedPixel::red.
Referenced by PercentageDifferent().
float PercentageDifferent | ( | const Image & | baseline, |
const Image & | actual, | ||
uint8_t | max_pixel_per_channel_delta ) |
Definition at line 173 of file image_diff.cpp.
References UnpackedPixel::UnpackedPixel(), CalculateDifferencePercentage(), CountImageSizeMismatchAsPixelDifference(), Image::h(), MaxPixelPerChannelDelta(), Image::pixel_at(), and Image::w().
Referenced by CompareImages().
void PrintHelp | ( | const std::string & | binary_name | ) |
Definition at line 235 of file image_diff.cpp.
Referenced by main().
Definition at line 330 of file image_diff.cpp.
References Image::Image(), Image::h(), Image::pixel_at(), RGBA_ALPHA, Image::set_pixel_at(), and Image::w().
Referenced by DiffImages().
|
constexpr |
Definition at line 32 of file image_diff.cpp.
Referenced by CompareImages(), and DiffImages().
|
constexpr |
Definition at line 33 of file image_diff.cpp.
Referenced by CompareImages(), DiffImages(), and main().
|
constexpr |
Definition at line 31 of file image_diff.cpp.
Referenced by CompareImages(), and DiffImages().
|
constexpr |
Definition at line 37 of file image_diff.cpp.
Referenced by CreateImageDiff(), and SubtractImages().
|
constexpr |
Definition at line 36 of file image_diff.cpp.
Referenced by CreateImageDiff().