scroggo@google.com | dbf9f88 | 2013-08-21 15:01:48 +0000 | [diff] [blame] | 1 | /* |
| 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 | |
halcanary | 67ec1f8 | 2014-06-27 11:36:20 -0700 | [diff] [blame] | 8 | #ifndef SkStreamPriv_DEFINED |
| 9 | #define SkStreamPriv_DEFINED |
scroggo@google.com | dbf9f88 | 2013-08-21 15:01:48 +0000 | [diff] [blame] | 10 | |
reed | fde0511 | 2016-03-11 13:02:28 -0800 | [diff] [blame] | 11 | #include "SkRefCnt.h" |
| 12 | |
krajcevski | 99ffe24 | 2014-06-03 13:04:35 -0700 | [diff] [blame] | 13 | class SkData; |
scroggo | a913275 | 2016-01-19 07:53:39 -0800 | [diff] [blame] | 14 | class SkStream; |
| 15 | class SkWStream; |
scroggo@google.com | dbf9f88 | 2013-08-21 15:01:48 +0000 | [diff] [blame] | 16 | |
krajcevski | 99ffe24 | 2014-06-03 13:04:35 -0700 | [diff] [blame] | 17 | /** |
halcanary | 67ec1f8 | 2014-06-27 11:36:20 -0700 | [diff] [blame] | 18 | * Copy the provided stream to an SkData variable. |
scroggo | a913275 | 2016-01-19 07:53:39 -0800 | [diff] [blame] | 19 | * |
| 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 | * |
krajcevski | 99ffe24 | 2014-06-03 13:04:35 -0700 | [diff] [blame] | 23 | * @param stream SkStream to be copied into data. |
halcanary | 67ec1f8 | 2014-06-27 11:36:20 -0700 | [diff] [blame] | 24 | * @return SkData* The resulting SkData after the copy. This data |
| 25 | * will have a ref count of one upon return and belongs to the |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 26 | * caller. Returns nullptr on failure. |
krajcevski | 99ffe24 | 2014-06-03 13:04:35 -0700 | [diff] [blame] | 27 | */ |
reed | fde0511 | 2016-03-11 13:02:28 -0800 | [diff] [blame] | 28 | sk_sp<SkData> SkCopyStreamToData(SkStream* stream); |
halcanary | e322482 | 2014-07-14 09:12:12 -0700 | [diff] [blame] | 29 | |
halcanary | 48305e8 | 2015-08-18 13:30:25 -0700 | [diff] [blame] | 30 | /** |
| 31 | * Copies the input stream from the current position to the end. |
| 32 | * Does not rewind the input stream. |
| 33 | */ |
| 34 | bool SkStreamCopy(SkWStream* out, SkStream* input); |
| 35 | |
halcanary | 67ec1f8 | 2014-06-27 11:36:20 -0700 | [diff] [blame] | 36 | #endif // SkStreamPriv_DEFINED |