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

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

Issue 1944403002: experimental/tools/coreGraphicsPdf2png: fix (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | gyp/experimental.gyp » ('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"
11 #include "SkCGUtils.h" 11 #include "SkCGUtils.h"
12 #include "SkForceLinking.h"
12 #include "SkImageEncoder.h" 13 #include "SkImageEncoder.h"
13 #include "SkStream.h" 14 #include "SkStream.h"
14 15
16 __SK_FORCE_IMAGE_DECODER_LINKING;
17
15 class StdOutWStream : public SkWStream { 18 class StdOutWStream : public SkWStream {
16 public: 19 public:
17 StdOutWStream() : fBytesWritten(0) {} 20 StdOutWStream() : fBytesWritten(0) {}
18 bool write(const void* buffer, size_t size) final { 21 bool write(const void* buffer, size_t size) final {
19 fBytesWritten += size; 22 fBytesWritten += size;
20 return size == fwrite(buffer, 1, size, stdout); 23 return size == fwrite(buffer, 1, size, stdout);
21 } 24 }
22 size_t bytesWritten() const final { return fBytesWritten; } 25 size_t bytesWritten() const final { return fBytesWritten; }
23 26
24 private: 27 private:
(...skipping 23 matching lines...) Expand all
48 int main(int argc, char** argv) { 51 int main(int argc, char** argv) {
49 SkBitmap bm; 52 SkBitmap bm;
50 SkAutoTDelete<SkStream> in(open_for_reading(argc > 1 ? argv[1] : NULL)); 53 SkAutoTDelete<SkStream> in(open_for_reading(argc > 1 ? argv[1] : NULL));
51 SkAutoTDelete<SkWStream> out(open_for_writing(argc > 2 ? argv[2] : NULL)); 54 SkAutoTDelete<SkWStream> out(open_for_writing(argc > 2 ? argv[2] : NULL));
52 if (SkPDFDocumentToBitmap(in.release(), &bm) && to_png(out, bm)) { 55 if (SkPDFDocumentToBitmap(in.release(), &bm) && to_png(out, bm)) {
53 return 0; 56 return 0;
54 } else { 57 } else {
55 return 1; 58 return 1;
56 } 59 }
57 } 60 }
OLDNEW
« no previous file with comments | « no previous file | gyp/experimental.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698