Flutter Engine
The Flutter Engine
skdiff_utils.h
Go to the documentation of this file.
1/*
2 * Copyright 2012 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef skdiff_utils_DEFINED
9#define skdiff_utils_DEFINED
10
11#include "tools/skdiff/skdiff.h"
12
13class SkBitmap;
14class SkData;
15class SkString;
16
17/** Returns true if the two buffers passed in are both non-nullptr,
18 * have the same length, and contain exactly the same byte values.
19 */
20bool are_buffers_equal(SkData* skdata1, SkData* skdata2);
21
22/** Reads the file at the given path and returns its complete contents as an
23 * SkData object (or returns nullptr on error).
24 */
25sk_sp<SkData> read_file(const char* file_path);
26
27/** Decodes the fileBits into the resource.fBitmap. Returns false on failure. */
28bool get_bitmap(sk_sp<SkData> fileBits, DiffResource& resource, bool sizeOnly,
29 bool ignoreColorSpace);
30
31/** Writes the bitmap as a PNG to the path specified. */
32bool write_bitmap(const SkString& path, const SkBitmap& bitmap);
33
34/** Given an image filename, returns the name of the file containing
35 * the associated difference image.
36 */
38
39/** Given an image filename, returns the name of the file containing
40 * the "white" difference image.
41 */
43
44/** Calls compute_diff and handles the difference and white diff resources.
45 * If !outputDir.isEmpty(), writes out difference and white images.
46 */
49 const int colorThreshold,
50 const SkString& outputDir,
51 const SkString& filename);
52
53#endif
static SkString resource(SkPDFResourceType type, int index)
Definition: SkData.h:25
Definition: bitmap.py:1
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
Definition: switches.h:57
SkPMColor(* DiffMetricProc)(SkPMColor, SkPMColor)
Parameterized routine to compute the color of a pixel in a difference image.
Definition: skdiff.h:255
SkString filename_to_white_filename(const SkString &filename)
bool are_buffers_equal(SkData *skdata1, SkData *skdata2)
void create_and_write_diff_image(DiffRecord *drp, DiffMetricProc dmp, const int colorThreshold, const SkString &outputDir, const SkString &filename)
SkString filename_to_diff_filename(const SkString &filename)
sk_sp< SkData > read_file(const char *file_path)
bool write_bitmap(const SkString &path, const SkBitmap &bitmap)
bool get_bitmap(sk_sp< SkData > fileBits, DiffResource &resource, bool sizeOnly, bool ignoreColorSpace)