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

Side by Side Diff: tools/picture_utils.h

Issue 1901113002: Move DM png code to picture_utils, for use by other tools. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Move to picture_utils. Better fit, fewer dependencies when adding to skiaserve Created 4 years, 8 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/picture_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 picture_utils_DEFINED 8 #ifndef picture_utils_DEFINED
9 #define picture_utils_DEFINED 9 #define picture_utils_DEFINED
10 10
11 class SkBitmap; 11 #include "SkBitmap.h"
12
13 class SkData;
12 class SkString; 14 class SkString;
13 15
14 namespace sk_tools { 16 namespace sk_tools {
15 // since PNG insists on unpremultiplying our alpha, we take no precision 17 // 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 18 // chances and force all pixels to be 100% opaque, otherwise on compare we
17 // may not get a perfect match. 19 // may not get a perfect match.
18 // 20 //
19 // This expects a bitmap with a config type of 8888 and for the pixels to 21 // This expects a bitmap with a config type of 8888 and for the pixels to
20 // not be on the GPU. 22 // not be on the GPU.
21 void force_all_opaque(const SkBitmap& bitmap); 23 void force_all_opaque(const SkBitmap& bitmap);
(...skipping 18 matching lines...) Expand all
40 * @param bm the bitmap to record 42 * @param bm the bitmap to record
41 * @param dirPath directory within which to write the image file 43 * @param dirPath directory within which to write the image file
42 * @param subdirOrNull subdirectory within dirPath, or nullptr to just write into dirPath 44 * @param subdirOrNull subdirectory within dirPath, or nullptr to just write into dirPath
43 * @param baseName last part of the filename 45 * @param baseName last part of the filename
44 * 46 *
45 * @return true if written out successfully 47 * @return true if written out successfully
46 */ 48 */
47 bool write_bitmap_to_disk(const SkBitmap& bm, const SkString& dirPath, 49 bool write_bitmap_to_disk(const SkBitmap& bm, const SkString& dirPath,
48 const char *subdirOrNull, const SkString& baseName ); 50 const char *subdirOrNull, const SkString& baseName );
49 51
52 // Return raw unpremultiplied RGBA bytes, suitable for storing in a PNG. The output
53 // colors are assumed to be sRGB values. This is only guaranteed to work for the
54 // cases that are currently emitted by tools:
55 // Linear premul 8888, sRGB premul 8888, Linear premul F16
56 sk_sp<SkData> encode_bitmap_for_png(SkBitmap bitmap);
57
50 } // namespace sk_tools 58 } // namespace sk_tools
51 59
52 #endif // picture_utils_DEFINED 60 #endif // picture_utils_DEFINED
OLDNEW
« no previous file with comments | « gyp/tools.gyp ('k') | tools/picture_utils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698