Flutter Engine
The Flutter Engine
|
#include "include/codec/SkPngDecoder.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkData.h"
#include "include/core/SkPixelRef.h"
#include "include/core/SkStream.h"
#include "include/core/SkTypes.h"
#include "include/encode/SkPngEncoder.h"
#include "tools/skdiff/skdiff.h"
#include "tools/skdiff/skdiff_utils.h"
#include <memory>
Go to the source code of this file.
Functions | |
bool | are_buffers_equal (SkData *skdata1, SkData *skdata2) |
sk_sp< SkData > | read_file (const char *file_path) |
bool | get_bitmap (sk_sp< SkData > fileBits, DiffResource &resource, bool sizeOnly, bool ignoreColorSpace) |
static void | force_all_opaque (const SkBitmap &bitmap) |
bool | write_bitmap (const SkString &path, const SkBitmap &bitmap) |
static SkString | replace_all (const SkString &input, const char oldSubstring[], const char newSubstring[]) |
static SkString | filename_to_derived_filename (const SkString &filename, const char *suffix) |
SkString | filename_to_diff_filename (const SkString &filename) |
SkString | filename_to_white_filename (const SkString &filename) |
void | create_and_write_diff_image (DiffRecord *drp, DiffMetricProc dmp, const int colorThreshold, const SkString &outputDir, const SkString &filename) |
Returns true if the two buffers passed in are both non-nullptr, have the same length, and contain exactly the same byte values.
Definition at line 19 of file skdiff_utils.cpp.
void create_and_write_diff_image | ( | DiffRecord * | drp, |
DiffMetricProc | dmp, | ||
const int | colorThreshold, | ||
const SkString & | outputDir, | ||
const SkString & | filename | ||
) |
Calls compute_diff and handles the difference and white diff resources. If !outputDir.isEmpty(), writes out difference and white images.
Definition at line 157 of file skdiff_utils.cpp.
|
static |
Definition at line 136 of file skdiff_utils.cpp.
Given an image filename, returns the name of the file containing the associated difference image.
Definition at line 149 of file skdiff_utils.cpp.
Given an image filename, returns the name of the file containing the "white" difference image.
Definition at line 153 of file skdiff_utils.cpp.
|
static |
Thanks to PNG, we need to force all pixels 100% opaque.
Definition at line 89 of file skdiff_utils.cpp.
bool get_bitmap | ( | sk_sp< SkData > | fileBits, |
DiffResource & | resource, | ||
bool | sizeOnly, | ||
bool | ignoreColorSpace | ||
) |
Decodes the fileBits into the resource.fBitmap. Returns false on failure.
Definition at line 37 of file skdiff_utils.cpp.
Reads the file at the given path and returns its complete contents as an SkData object (or returns nullptr on error).
Definition at line 29 of file skdiff_utils.cpp.
|
static |
Return a copy of the "input" string, within which we have replaced all instances of oldSubstring with newSubstring.
TODO: If we like this, we should move it into the core SkString implementation, adding more checks and ample test cases, and paying more attention to efficiency.
Definition at line 120 of file skdiff_utils.cpp.
Writes the bitmap as a PNG to the path specified.
Definition at line 97 of file skdiff_utils.cpp.