skia2/tools/skdiff/skdiff_utils.h
Mike Klein c0bd9f9fe5 rewrite includes to not need so much -Ifoo
Current strategy: everything from the top

Things to look at first are the manual changes:

   - added tools/rewrite_includes.py
   - removed -Idirectives from BUILD.gn
   - various compile.sh simplifications
   - tweak tools/embed_resources.py
   - update gn/find_headers.py to write paths from the top
   - update gn/gn_to_bp.py SkUserConfig.h layout
     so that #include "include/config/SkUserConfig.h" always
     gets the header we want.

No-Presubmit: true
Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-04-24 16:27:11 +00:00

54 lines
1.7 KiB
C++

/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef skdiff_utils_DEFINED
#define skdiff_utils_DEFINED
#include "tools/skdiff/skdiff.h"
class SkBitmap;
class SkData;
class SkString;
/** Returns true if the two buffers passed in are both non-nullptr,
* have the same length, and contain exactly the same byte values.
*/
bool are_buffers_equal(SkData* skdata1, SkData* skdata2);
/** Reads the file at the given path and returns its complete contents as an
* SkData object (or returns nullptr on error).
*/
sk_sp<SkData> read_file(const char* file_path);
/** Decodes the fileBits into the resource.fBitmap. Returns false on failure. */
bool get_bitmap(sk_sp<SkData> fileBits, DiffResource& resource, bool sizeOnly,
bool ignoreColorSpace);
/** Writes the bitmap as a PNG to the path specified. */
bool write_bitmap(const SkString& path, const SkBitmap& bitmap);
/** Given an image filename, returns the name of the file containing
* the associated difference image.
*/
SkString filename_to_diff_filename(const SkString& filename);
/** Given an image filename, returns the name of the file containing
* the "white" difference image.
*/
SkString filename_to_white_filename(const SkString& filename);
/** Calls compute_diff and handles the difference and white diff resources.
* If !outputDir.isEmpty(), writes out difference and white images.
*/
void create_and_write_diff_image(DiffRecord* drp,
DiffMetricProc dmp,
const int colorThreshold,
const SkString& outputDir,
const SkString& filename);
#endif