OLD | NEW |
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 117 // Encodes to PNG, unless there is already encoded data, in which case that
gets |
118 // used. | 118 // used. |
119 class PngPixelSerializer : public SkPixelSerializer { | 119 class PngPixelSerializer : public SkPixelSerializer { |
120 public: | 120 public: |
121 bool onUseEncodedData(const void*, size_t) override { return true; } | 121 bool onUseEncodedData(const void*, size_t) override; |
122 SkData* onEncodePixels(const SkImageInfo& info, const void* pixels, | 122 SkData* onEncode(const SkPixmap&) override; |
123 size_t rowBytes) override { | |
124 return SkImageEncoder::EncodeData(info, pixels, rowBytes, | |
125 SkImageEncoder::kPNG_Type, 100); | |
126 } | |
127 }; | 123 }; |
128 | 124 |
129 // A helper for inserting a drawtext call into a SkTextBlobBuilder | 125 // A helper for inserting a drawtext call into a SkTextBlobBuilder |
130 void add_to_text_blob(SkTextBlobBuilder* builder, const char* text, const Sk
Paint& origPaint, | 126 void add_to_text_blob(SkTextBlobBuilder* builder, const char* text, const Sk
Paint& origPaint, |
131 SkScalar x, SkScalar y); | 127 SkScalar x, SkScalar y); |
132 | 128 |
133 void create_hemi_normal_map(SkBitmap* bm, const SkIRect& dst); | 129 void create_hemi_normal_map(SkBitmap* bm, const SkIRect& dst); |
134 | 130 |
135 void create_frustum_normal_map(SkBitmap* bm, const SkIRect& dst); | 131 void create_frustum_normal_map(SkBitmap* bm, const SkIRect& dst); |
136 | 132 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 int fID; | 224 int fID; |
229 int fOutputPos; | 225 int fOutputPos; |
230 bool fTempMark; | 226 bool fTempMark; |
231 | 227 |
232 SkTDArray<TopoTestNode*> fDependencies; | 228 SkTDArray<TopoTestNode*> fDependencies; |
233 }; | 229 }; |
234 | 230 |
235 } // namespace sk_tool_utils | 231 } // namespace sk_tool_utils |
236 | 232 |
237 #endif // sk_tool_utils_DEFINED | 233 #endif // sk_tool_utils_DEFINED |
OLD | NEW |