Go to the source code of this file.
◆ are_buffers_equal()
bool are_buffers_equal |
( |
SkData * |
skdata1, |
|
|
SkData * |
skdata2 |
|
) |
| |
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.
19 {
20 if ((nullptr == skdata1) || (nullptr == skdata2)) {
21 return false;
22 }
23 if (skdata1->
size() != skdata2->
size()) {
24 return false;
25 }
26 return (0 == memcmp(skdata1->
data(), skdata2->
data(), skdata1->
size()));
27}
const void * data() const
◆ create_and_write_diff_image()
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.
161 {
164
167 } else {
169
171
175 }
176
180
181 } else {
186
191
195 } else {
197 }
200 } else {
202 }
203 }
204 }
205}
void allocN32Pixels(int width, int height, bool isOpaque=false)
void append(const char text[])
void compute_diff(DiffRecord *dr, DiffMetricProc diffFunction, const int colorThreshold)
SkString filename_to_white_filename(const SkString &filename)
SkString filename_to_diff_filename(const SkString &filename)
bool write_bitmap(const SkString &path, const SkBitmap &bitmap)
Result fResult
Which category of diff result.
@ kDifferentPixels_Result
◆ filename_to_diff_filename()
Given an image filename, returns the name of the file containing the associated difference image.
Definition at line 149 of file skdiff_utils.cpp.
149 {
151}
static SkString filename_to_derived_filename(const SkString &filename, const char *suffix)
◆ filename_to_white_filename()
Given an image filename, returns the name of the file containing the "white" difference image.
Definition at line 153 of file skdiff_utils.cpp.
◆ get_bitmap()
Decodes the fileBits into the resource.fBitmap. Returns false on failure.
Definition at line 37 of file skdiff_utils.cpp.
38 {
39 static constexpr const SkCodecs::Decoder decoders[] = {
41 };
42
44 if (!codec) {
47 return false;
48 }
49
50
51
52
53
54
55
57 if (!ignoreColorSpace) {
59 }
60
64 return false;
65 }
66
67 if (sizeOnly) {
68 return true;
69 }
70
74 return false;
75 }
76
81 return false;
82 }
83
85 return true;
86}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
const SkImageInfo & info() const
bool setInfo(const SkImageInfo &imageInfo, size_t rowBytes=0)
bool tryAllocPixels(const SkImageInfo &info, size_t rowBytes)
static std::unique_ptr< SkCodec > MakeFromData(sk_sp< SkData >, SkSpan< const SkCodecs::Decoder > decoders, SkPngChunkReader *=nullptr)
static sk_sp< SkColorSpace > MakeSRGB()
const char * c_str() const
constexpr SkCodecs::Decoder Decoder()
SkImageInfo makeColorSpace(sk_sp< SkColorSpace > cs) const
SkImageInfo makeColorType(SkColorType newColorType) const
◆ read_file()
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.
29 {
31 if (!data) {
32 SkDebugf(
"WARNING: could not open file <%s> for reading\n", file_path);
33 }
35}
static sk_sp< SkData > MakeFromFileName(const char path[])
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
◆ write_bitmap()
Writes the bitmap as a PNG to the path specified.
Definition at line 97 of file skdiff_utils.cpp.
97 {
99 if (!
copy.tryAllocPixels(
bitmap.info().makeColorType(kN32_SkColorType))) {
100 return false;
101 }
103 return false;
104 }
106
108 if (!
file.isValid()) {
109 return false;
110 }
111
113}
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
static void force_all_opaque(const SkBitmap &bitmap)