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

Side by Side Diff: tools/picture_utils.h

Issue 646213002: Eliminate one copy of replace_char() function. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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 | « gyp/tools.gyp ('k') | tools/skimage_main.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 picture_utils_DEFINED 8 #ifndef picture_utils_DEFINED
9 #define picture_utils_DEFINED 9 #define picture_utils_DEFINED
10 10
11 class SkBitmap; 11 class SkBitmap;
12 class SkString; 12 class SkString;
13 13
14 namespace sk_tools { 14 namespace sk_tools {
15 // since PNG insists on unpremultiplying our alpha, we take no precision 15 // since PNG insists on unpremultiplying our alpha, we take no precision
16 // chances and force all pixels to be 100% opaque, otherwise on compare we 16 // chances and force all pixels to be 100% opaque, otherwise on compare we
17 // may not get a perfect match. 17 // may not get a perfect match.
18 // 18 //
19 // This expects a bitmap with a config type of 8888 and for the pixels to 19 // This expects a bitmap with a config type of 8888 and for the pixels to
20 // not be on the GPU. 20 // not be on the GPU.
21 void force_all_opaque(const SkBitmap& bitmap); 21 void force_all_opaque(const SkBitmap& bitmap);
22 22
23 /** 23 /**
24 * Replaces all instances of oldChar with newChar in str. 24 * Replaces all instances of oldChar with newChar in str.
25 * 25 *
26 * TODO: This function appears here and in skimage_main.cpp ; 26 * TODO: We should add the implementation to src/core/SkString.cpp, write
27 * we should add the implementation to src/core/SkString.cpp, write tests fo r it, 27 * tests for it.
28 * and remove it from elsewhere.
29 */ 28 */
30 void replace_char(SkString* str, const char oldChar, const char newChar); 29 void replace_char(SkString* str, const char oldChar, const char newChar);
reed1 2014/10/15 14:13:07 Hey, this looks semantically dangerous. SkString i
31 30
32 // Returns true if the string ends with % 31 // Returns true if the string ends with %
33 bool is_percentage(const char* const string); 32 bool is_percentage(const char* const string);
34 33
35 // Prepares the bitmap so that it can be written. 34 // Prepares the bitmap so that it can be written.
36 // 35 //
37 // Specifically, it configures the bitmap, allocates pixels and then 36 // Specifically, it configures the bitmap, allocates pixels and then
38 // erases the pixels to transparent black. 37 // erases the pixels to transparent black.
39 void setup_bitmap(SkBitmap* bitmap, int width, int height); 38 void setup_bitmap(SkBitmap* bitmap, int width, int height);
40 39
41 /** 40 /**
42 * Write a bitmap file to disk. 41 * Write a bitmap file to disk.
43 * 42 *
44 * @param bm the bitmap to record 43 * @param bm the bitmap to record
45 * @param dirPath directory within which to write the image file 44 * @param dirPath directory within which to write the image file
46 * @param subdirOrNull subdirectory within dirPath, or NULL to just write in to dirPath 45 * @param subdirOrNull subdirectory within dirPath, or NULL to just write in to dirPath
47 * @param baseName last part of the filename 46 * @param baseName last part of the filename
48 * 47 *
49 * @return true if written out successfully 48 * @return true if written out successfully
50 */ 49 */
51 bool write_bitmap_to_disk(const SkBitmap& bm, const SkString& dirPath, 50 bool write_bitmap_to_disk(const SkBitmap& bm, const SkString& dirPath,
52 const char *subdirOrNull, const SkString& baseName ); 51 const char *subdirOrNull, const SkString& baseName );
53 52
54 } // namespace sk_tools 53 } // namespace sk_tools
55 54
56 #endif // picture_utils_DEFINED 55 #endif // picture_utils_DEFINED
OLDNEW
« no previous file with comments | « gyp/tools.gyp ('k') | tools/skimage_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698