aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/images/SkStreamHelpers.h
blob: 7e766b7eccc45e15e89fe830ec6cc71f142a8961 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
 * Copyright 2013 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkStreamHelpers_DEFINED
#define SkStreamHelpers_DEFINED

class SkAutoMalloc;
class SkStream;

/**
 *  Copy the provided stream to memory allocated by storage.
 *  Used by SkImageDecoder_libbmp and SkImageDecoder_libico.
 *  @param storage Allocator to hold the memory. Will be reset to be large
 *      enough to hold the entire stream. Upon successful return,
 *      storage->get() will point to data holding the SkStream's entire
 *      contents.
 *  @param stream SkStream to be copied into storage.
 *  @return size_t Total number of bytes in the SkStream, which is also the
 *      number of bytes pointed to by storage->get(). Returns 0 on failure.
 */
size_t CopyStreamToStorage(SkAutoMalloc* storage, SkStream* stream);

#endif // SkStreamHelpers_DEFINED