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 "CrashHandler.h" | 8 #include "CrashHandler.h" |
9 #include "DMJsonWriter.h" | 9 #include "DMJsonWriter.h" |
10 #include "DMSrcSink.h" | 10 #include "DMSrcSink.h" |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 } | 486 } |
487 | 487 |
488 // Convert our N32 bitmap into unpremul RGBA for libpng. | 488 // Convert our N32 bitmap into unpremul RGBA for libpng. |
489 SkAutoTMalloc<uint32_t> rgba(w*h); | 489 SkAutoTMalloc<uint32_t> rgba(w*h); |
490 if (!bitmap.readPixels(SkImageInfo::Make(w,h, kRGBA_8888_SkColorType, kUnpre
mul_SkAlphaType), | 490 if (!bitmap.readPixels(SkImageInfo::Make(w,h, kRGBA_8888_SkColorType, kUnpre
mul_SkAlphaType), |
491 rgba, 4*w, 0,0)) { | 491 rgba, 4*w, 0,0)) { |
492 return false; | 492 return false; |
493 } | 493 } |
494 | 494 |
495 // We don't need bitmap anymore. Might as well drop our ref. | 495 // We don't need bitmap anymore. Might as well drop our ref. |
496 bitmap = SkBitmap(); | 496 bitmap.reset(); |
497 | 497 |
498 FILE* f = fopen(path, "w"); | 498 FILE* f = fopen(path, "w"); |
499 if (!f) { return false; } | 499 if (!f) { return false; } |
500 | 500 |
501 png_structp png = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nu
llptr, nullptr); | 501 png_structp png = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nu
llptr, nullptr); |
502 if (!png) { | 502 if (!png) { |
503 fclose(f); | 503 fclose(f); |
504 return false; | 504 return false; |
505 } | 505 } |
506 | 506 |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
908 } | 908 } |
909 return 0; | 909 return 0; |
910 } | 910 } |
911 | 911 |
912 #if !defined(SK_BUILD_FOR_IOS) | 912 #if !defined(SK_BUILD_FOR_IOS) |
913 int main(int argc, char** argv) { | 913 int main(int argc, char** argv) { |
914 SkCommandLineFlags::Parse(argc, argv); | 914 SkCommandLineFlags::Parse(argc, argv); |
915 return dm_main(); | 915 return dm_main(); |
916 } | 916 } |
917 #endif | 917 #endif |
OLD | NEW |