blob: ac822c1110ac78b0e03bf5a9d843b35f2205bdd3 [file] [log] [blame]
scroggo@google.comdbf9f882013-08-21 15:01:48 +00001/*
2 * Copyright 2013 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
halcanary67ec1f82014-06-27 11:36:20 -07008#ifndef SkStreamPriv_DEFINED
9#define SkStreamPriv_DEFINED
scroggo@google.comdbf9f882013-08-21 15:01:48 +000010
reedfde05112016-03-11 13:02:28 -080011#include "SkRefCnt.h"
12
krajcevski99ffe242014-06-03 13:04:35 -070013class SkData;
scroggoa9132752016-01-19 07:53:39 -080014class SkStream;
15class SkWStream;
scroggo@google.comdbf9f882013-08-21 15:01:48 +000016
krajcevski99ffe242014-06-03 13:04:35 -070017/**
halcanary67ec1f82014-06-27 11:36:20 -070018 * Copy the provided stream to an SkData variable.
scroggoa9132752016-01-19 07:53:39 -080019 *
20 * Note: Assumes the stream is at the beginning. If it has a length,
21 * but is not at the beginning, this call will fail (return NULL).
22 *
krajcevski99ffe242014-06-03 13:04:35 -070023 * @param stream SkStream to be copied into data.
halcanary67ec1f82014-06-27 11:36:20 -070024 * @return SkData* The resulting SkData after the copy. This data
25 * will have a ref count of one upon return and belongs to the
halcanary96fcdcc2015-08-27 07:41:13 -070026 * caller. Returns nullptr on failure.
krajcevski99ffe242014-06-03 13:04:35 -070027 */
reedfde05112016-03-11 13:02:28 -080028sk_sp<SkData> SkCopyStreamToData(SkStream* stream);
halcanarye3224822014-07-14 09:12:12 -070029
halcanary48305e82015-08-18 13:30:25 -070030/**
31 * Copies the input stream from the current position to the end.
32 * Does not rewind the input stream.
33 */
34bool SkStreamCopy(SkWStream* out, SkStream* input);
35
halcanary67ec1f82014-06-27 11:36:20 -070036#endif // SkStreamPriv_DEFINED