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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 /** A default checkerboard. */ | 55 /** A default checkerboard. */ |
56 inline void draw_checkerboard(SkCanvas* canvas) { | 56 inline void draw_checkerboard(SkCanvas* canvas) { |
57 sk_tool_utils::draw_checkerboard(canvas, 0xFF999999, 0xFF666666, 8); | 57 sk_tool_utils::draw_checkerboard(canvas, 0xFF999999, 0xFF666666, 8); |
58 } | 58 } |
59 | 59 |
60 // Encodes to PNG, unless there is already encoded data, in which case that
gets | 60 // Encodes to PNG, unless there is already encoded data, in which case that
gets |
61 // used. | 61 // used. |
62 class PngPixelSerializer : public SkPixelSerializer { | 62 class PngPixelSerializer : public SkPixelSerializer { |
63 public: | 63 public: |
64 bool onUseEncodedData(const void*, size_t) SK_OVERRIDE { return true; } | 64 bool onUseEncodedData(const void*, size_t) override { return true; } |
65 SkData* onEncodePixels(const SkImageInfo& info, const void* pixels, | 65 SkData* onEncodePixels(const SkImageInfo& info, const void* pixels, |
66 size_t rowBytes) SK_OVERRIDE { | 66 size_t rowBytes) override { |
67 return SkImageEncoder::EncodeData(info, pixels, rowBytes, | 67 return SkImageEncoder::EncodeData(info, pixels, rowBytes, |
68 SkImageEncoder::kPNG_Type, 100); | 68 SkImageEncoder::kPNG_Type, 100); |
69 } | 69 } |
70 }; | 70 }; |
71 | 71 |
72 } // namespace sk_tool_utils | 72 } // namespace sk_tool_utils |
73 | 73 |
74 #endif // sk_tool_utils_DEFINED | 74 #endif // sk_tool_utils_DEFINED |
OLD | NEW |