Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(903)

Side by Side Diff: tools/skdiff_utils.h

Issue 2333713002: change SkStreams to work with sk_sp<SkData> instead of SkData* (Closed)
Patch Set: fix xpsdevice Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/skdiff_main.cpp ('k') | tools/skdiff_utils.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 12
13 class SkBitmap; 13 class SkBitmap;
14 class SkData; 14 class SkData;
15 class SkString; 15 class SkString;
16 16
17 /** Returns true if the two buffers passed in are both non-nullptr, 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. 18 * have the same length, and contain exactly the same byte values.
19 */ 19 */
20 bool are_buffers_equal(SkData* skdata1, SkData* skdata2); 20 bool are_buffers_equal(SkData* skdata1, SkData* skdata2);
21 21
22 /** Reads the file at the given path and returns its complete contents as an 22 /** Reads the file at the given path and returns its complete contents as an
23 * SkData object (or returns nullptr on error). 23 * SkData object (or returns nullptr on error).
24 */ 24 */
25 sk_sp<SkData> read_file(const char* file_path); 25 sk_sp<SkData> read_file(const char* file_path);
26 26
27 /** Decodes the fileBits into the resource.fBitmap. Returns false on failure. */ 27 /** Decodes the fileBits into the resource.fBitmap. Returns false on failure. */
28 bool get_bitmap(SkData* fileBits, DiffResource& resource, bool sizeOnly); 28 bool get_bitmap(sk_sp<SkData> fileBits, DiffResource& resource, bool sizeOnly);
29 29
30 /** Writes the bitmap as a PNG to the path specified. */ 30 /** Writes the bitmap as a PNG to the path specified. */
31 bool write_bitmap(const SkString& path, const SkBitmap& bitmap); 31 bool write_bitmap(const SkString& path, const SkBitmap& bitmap);
32 32
33 /** Given an image filename, returns the name of the file containing 33 /** Given an image filename, returns the name of the file containing
34 * the associated difference image. 34 * the associated difference image.
35 */ 35 */
36 SkString filename_to_diff_filename(const SkString& filename); 36 SkString filename_to_diff_filename(const SkString& filename);
37 37
38 /** Given an image filename, returns the name of the file containing 38 /** Given an image filename, returns the name of the file containing
39 * the "white" difference image. 39 * the "white" difference image.
40 */ 40 */
41 SkString filename_to_white_filename(const SkString& filename); 41 SkString filename_to_white_filename(const SkString& filename);
42 42
43 /** Calls compute_diff and handles the difference and white diff resources. 43 /** Calls compute_diff and handles the difference and white diff resources.
44 * If !outputDir.isEmpty(), writes out difference and white images. 44 * If !outputDir.isEmpty(), writes out difference and white images.
45 */ 45 */
46 void create_and_write_diff_image(DiffRecord* drp, 46 void create_and_write_diff_image(DiffRecord* drp,
47 DiffMetricProc dmp, 47 DiffMetricProc dmp,
48 const int colorThreshold, 48 const int colorThreshold,
49 const SkString& outputDir, 49 const SkString& outputDir,
50 const SkString& filename); 50 const SkString& filename);
51 51
52 #endif 52 #endif
OLDNEW
« no previous file with comments | « tools/skdiff_main.cpp ('k') | tools/skdiff_utils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698