| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #include "SkBitmap.h" | 8 #include "SkBitmap.h" |
| 9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
| 10 #include "SkCommandLineFlags.h" | 10 #include "SkCommandLineFlags.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 height = y + 1; | 51 height = y + 1; |
| 52 width = width > (x + 1) ? width : x + 1; | 52 width = width > (x + 1) ? width : x + 1; |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 | 56 |
| 57 return SkISize::Make(width, height); | 57 return SkISize::Make(width, height); |
| 58 } | 58 } |
| 59 | 59 |
| 60 static void setup_bitmap(SkBitmap* bitmap, int width, int height) { | 60 static void setup_bitmap(SkBitmap* bitmap, int width, int height) { |
| 61 bitmap->setConfig(SkBitmap::kARGB_8888_Config, width, height); | 61 bitmap->allocN32Pixels(width, height); |
| 62 | |
| 63 bitmap->allocPixels(); | |
| 64 } | 62 } |
| 65 | 63 |
| 66 | 64 |
| 67 static bool write_bitmap(const char outName[], const SkBitmap& bm) { | 65 static bool write_bitmap(const char outName[], const SkBitmap& bm) { |
| 68 SkISize size = opaqueSize(bm); | 66 SkISize size = opaqueSize(bm); |
| 69 SkBitmap dst; | 67 SkBitmap dst; |
| 70 setup_bitmap(&dst, size.width(), size.height()); | 68 setup_bitmap(&dst, size.width(), size.height()); |
| 71 | 69 |
| 72 for (int y = 0 ; y < dst.height(); y++) { | 70 for (int y = 0 ; y < dst.height(); y++) { |
| 73 for (int x = 0 ; x < dst.width(); x++) { | 71 for (int x = 0 ; x < dst.width(); x++) { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 } | 167 } |
| 170 | 168 |
| 171 return 0; | 169 return 0; |
| 172 } | 170 } |
| 173 | 171 |
| 174 #if !defined SK_BUILD_FOR_IOS | 172 #if !defined SK_BUILD_FOR_IOS |
| 175 int main(int argc, char * const argv[]) { | 173 int main(int argc, char * const argv[]) { |
| 176 return tool_main(argc, (char**) argv); | 174 return tool_main(argc, (char**) argv); |
| 177 } | 175 } |
| 178 #endif | 176 #endif |
| OLD | NEW |