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

Side by Side Diff: tools/sk_tool_utils.h

Issue 1020103005: Preserve texture compression when saving a revised skp from debugger (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: clean up Created 5 years, 9 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 | « tools/PictureRenderer.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
11 #include "SkColor.h" 11 #include "SkColor.h"
12 #include "SkImageEncoder.h"
12 #include "SkImageInfo.h" 13 #include "SkImageInfo.h"
14 #include "SkPixelSerializer.h"
13 #include "SkTypeface.h" 15 #include "SkTypeface.h"
14 16
15 class SkBitmap; 17 class SkBitmap;
16 class SkCanvas; 18 class SkCanvas;
17 class SkPaint; 19 class SkPaint;
18 class SkShader; 20 class SkShader;
19 class SkTestFont; 21 class SkTestFont;
20 22
21 namespace sk_tool_utils { 23 namespace sk_tool_utils {
22 24
(...skipping 25 matching lines...) Expand all
48 void draw_checkerboard(SkCanvas* canvas, 50 void draw_checkerboard(SkCanvas* canvas,
49 SkColor color1, 51 SkColor color1,
50 SkColor color2, 52 SkColor color2,
51 int size); 53 int size);
52 54
53 /** A default checkerboard. */ 55 /** A default checkerboard. */
54 inline void draw_checkerboard(SkCanvas* canvas) { 56 inline void draw_checkerboard(SkCanvas* canvas) {
55 sk_tool_utils::draw_checkerboard(canvas, 0xFF999999, 0xFF666666, 8); 57 sk_tool_utils::draw_checkerboard(canvas, 0xFF999999, 0xFF666666, 8);
56 } 58 }
57 59
60 // Encodes to PNG, unless there is already encoded data, in which case that gets
61 // used.
62 class PngPixelSerializer : public SkPixelSerializer {
63 public:
64 bool onUseEncodedData(const void*, size_t) SK_OVERRIDE { return true; }
65 SkData* onEncodePixels(const SkImageInfo& info, const void* pixels,
66 size_t rowBytes) SK_OVERRIDE {
67 return SkImageEncoder::EncodeData(info, pixels, rowBytes,
68 SkImageEncoder::kPNG_Type, 100);
69 }
70 };
71
58 } // namespace sk_tool_utils 72 } // namespace sk_tool_utils
59 73
60 #endif // sk_tool_utils_DEFINED 74 #endif // sk_tool_utils_DEFINED
OLDNEW
« no previous file with comments | « tools/PictureRenderer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698