Home | History | Annotate | Download | only in core
      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 
      8 #ifndef SkStreamPriv_DEFINED
      9 #define SkStreamPriv_DEFINED
     10 
     11 #include "SkRefCnt.h"
     12 
     13 class SkData;
     14 class SkStream;
     15 class SkWStream;
     16 
     17 /**
     18  *  Copy the provided stream to an SkData variable.
     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  *
     23  *  @param stream SkStream to be copied into data.
     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
     26  *      caller. Returns nullptr on failure.
     27  */
     28 sk_sp<SkData> SkCopyStreamToData(SkStream* stream);
     29 
     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 
     36 #endif  // SkStreamPriv_DEFINED
     37