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