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

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

Issue 868333002: experimental/skp_to_pdf_md5 optionally also outputs pdf files (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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/tools/SkDmuxWStream.h ('k') | experimental/tools/skp_to_pdf_md5.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "SkDmuxWStream.h"
9
10 SkDmuxWStream::SkDmuxWStream(SkWStream* const streamArray[], size_t count)
11 : fWStreams(streamArray, static_cast<int>(count)), fBytesWritten(0) {}
12
13 SkDmuxWStream::~SkDmuxWStream() {
14 for (int i = 0; i < fWStreams.count(); ++i) {
15 fWStreams[i]->flush();
16 }
17 }
18
19 bool SkDmuxWStream::write(const void* buffer, size_t size) {
20 for (int i = 0; i < fWStreams.count(); ++i) {
21 if (!fWStreams[i]->write(buffer, size)) {
22 return false;
23 }
24 }
25 fBytesWritten += size;
26 return true;
27 }
28
29 void SkDmuxWStream::newline() {
30 for (int i = 0; i < fWStreams.count(); ++i) {
31 fWStreams[i]->newline();
32 }
33 fBytesWritten += 1; // This may be a lie.
34 }
35
36 void SkDmuxWStream::flush() {
37 for (int i = 0; i < fWStreams.count(); ++i) {
38 fWStreams[i]->flush();
39 }
40 }
41
42 size_t SkDmuxWStream::bytesWritten() const { return fBytesWritten; }
OLDNEW
« no previous file with comments | « experimental/tools/SkDmuxWStream.h ('k') | experimental/tools/skp_to_pdf_md5.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698