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

Side by Side Diff: experimental/tools/coreGraphicsPdf2png.cpp

Issue 1809733002: detach -> release (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: (C) Created 4 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 | « experimental/iOSSampleApp/SkSampleUIView.mm ('k') | include/core/SkRefCnt.h » ('j') | 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 2015 Google Inc. 2 * Copyright 2015 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 <stdio.h> 8 #include <stdio.h>
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 static bool to_png(SkWStream* o, const SkBitmap& bm) { 42 static bool to_png(SkWStream* o, const SkBitmap& bm) {
43 return SkImageEncoder::EncodeStream(o, bm, SkImageEncoder::kPNG_Type, 100); 43 return SkImageEncoder::EncodeStream(o, bm, SkImageEncoder::kPNG_Type, 100);
44 } 44 }
45 45
46 // Note: I could implement this using only MacOS|CG API calls, but 46 // Note: I could implement this using only MacOS|CG API calls, but
47 // since most of this is already done in Skia, here it is. 47 // since most of this is already done in Skia, here it is.
48 int main(int argc, char** argv) { 48 int main(int argc, char** argv) {
49 SkBitmap bm; 49 SkBitmap bm;
50 SkAutoTDelete<SkStream> in(open_for_reading(argc > 1 ? argv[1] : NULL)); 50 SkAutoTDelete<SkStream> in(open_for_reading(argc > 1 ? argv[1] : NULL));
51 SkAutoTDelete<SkWStream> out(open_for_writing(argc > 2 ? argv[2] : NULL)); 51 SkAutoTDelete<SkWStream> out(open_for_writing(argc > 2 ? argv[2] : NULL));
52 if (SkPDFDocumentToBitmap(in.detach(), &bm) && to_png(out, bm)) { 52 if (SkPDFDocumentToBitmap(in.release(), &bm) && to_png(out, bm)) {
53 return 0; 53 return 0;
54 } else { 54 } else {
55 return 1; 55 return 1;
56 } 56 }
57 } 57 }
OLDNEW
« no previous file with comments | « experimental/iOSSampleApp/SkSampleUIView.mm ('k') | include/core/SkRefCnt.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698