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

Side by Side Diff: tools/sk_tool_utils.h

Issue 1511183002: Revert of default SkPixelSerializer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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 | « tests/PictureTest.cpp ('k') | no next file » | 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 2014 Google Inc. 2 * Copyright 2014 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 sk_tool_utils_DEFINED 8 #ifndef sk_tool_utils_DEFINED
9 #define sk_tool_utils_DEFINED 9 #define sk_tool_utils_DEFINED
10 10
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 int checkSize); 107 int checkSize);
108 108
109 /** A default checkerboard. */ 109 /** A default checkerboard. */
110 inline void draw_checkerboard(SkCanvas* canvas) { 110 inline void draw_checkerboard(SkCanvas* canvas) {
111 sk_tool_utils::draw_checkerboard(canvas, 0xFF999999, 0xFF666666, 8); 111 sk_tool_utils::draw_checkerboard(canvas, 0xFF999999, 0xFF666666, 8);
112 } 112 }
113 113
114 SkBitmap create_string_bitmap(int w, int h, SkColor c, int x, int y, 114 SkBitmap create_string_bitmap(int w, int h, SkColor c, int x, int y,
115 int textSize, const char* str); 115 int textSize, const char* str);
116 116
117 // Encodes to PNG, unless there is already encoded data, in which case that gets
118 // used.
119 class PngPixelSerializer : public SkPixelSerializer {
120 public:
121 bool onUseEncodedData(const void*, size_t) override { return true; }
122 SkData* onEncodePixels(const SkImageInfo& info, const void* pixels,
123 size_t rowBytes) override {
124 return SkImageEncoder::EncodeData(info, pixels, rowBytes,
125 SkImageEncoder::kPNG_Type, 100);
126 }
127 };
128
117 // A helper for inserting a drawtext call into a SkTextBlobBuilder 129 // A helper for inserting a drawtext call into a SkTextBlobBuilder
118 void add_to_text_blob(SkTextBlobBuilder* builder, const char* text, const Sk Paint& origPaint, 130 void add_to_text_blob(SkTextBlobBuilder* builder, const char* text, const Sk Paint& origPaint,
119 SkScalar x, SkScalar y); 131 SkScalar x, SkScalar y);
120 132
121 void create_hemi_normal_map(SkBitmap* bm, const SkIRect& dst); 133 void create_hemi_normal_map(SkBitmap* bm, const SkIRect& dst);
122 134
123 void create_frustum_normal_map(SkBitmap* bm, const SkIRect& dst); 135 void create_frustum_normal_map(SkBitmap* bm, const SkIRect& dst);
124 136
125 void create_tetra_normal_map(SkBitmap* bm, const SkIRect& dst); 137 void create_tetra_normal_map(SkBitmap* bm, const SkIRect& dst);
126 138
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 int fID; 228 int fID;
217 int fOutputPos; 229 int fOutputPos;
218 bool fTempMark; 230 bool fTempMark;
219 231
220 SkTDArray<TopoTestNode*> fDependencies; 232 SkTDArray<TopoTestNode*> fDependencies;
221 }; 233 };
222 234
223 } // namespace sk_tool_utils 235 } // namespace sk_tool_utils
224 236
225 #endif // sk_tool_utils_DEFINED 237 #endif // sk_tool_utils_DEFINED
OLDNEW
« no previous file with comments | « tests/PictureTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698