diff options
author | 2014-05-08 16:23:56 +0000 | |
---|---|---|
committer | 2014-05-08 16:23:56 +0000 | |
commit | de3ad9e2209e4c0a682246cf732c8bf3bc0f0286 (patch) | |
tree | cae4a777a6d78bfbbc8585aa67ddeb32b8b2b294 /src | |
parent | 0ecbfffa82593024a7de354c94068e543c560c54 (diff) |
Revert of extract some common code from PictureRenderer (https://codereview.chromium.org/273703006/)
Reason for revert:
breaking the android debug builds. It seems to be the result of android using shared libs and not lumping everything into one big static lib or executable. So we have more than one copy of SkString which is the root of the issue.
Original issue's description:
> extract some common code from PictureRenderer
>
> Committed: http://code.google.com/p/skia/source/detail?r=14638
R=borenet@google.com, epoger@google.com
TBR=borenet@google.com, epoger@google.com
NOTREECHECKS=true
NOTRY=true
Author: djsollen@google.com
Review URL: https://codereview.chromium.org/274463004
git-svn-id: http://skia.googlecode.com/svn/trunk@14649 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/utils/SkDataUtils.cpp | 28 | ||||
-rw-r--r-- | src/utils/SkDataUtils.h | 63 |
2 files changed, 0 insertions, 91 deletions
diff --git a/src/utils/SkDataUtils.cpp b/src/utils/SkDataUtils.cpp deleted file mode 100644 index c5544f71ba..0000000000 --- a/src/utils/SkDataUtils.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2014 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "SkData.h" -#include "SkDataUtils.h" -#include "SkStream.h" - -/*static*/ SkData* SkDataUtils::ReadIntoSkData(SkStream &stream, size_t maxBytes) { - if (0 == maxBytes) { - return SkData::NewEmpty(); - } - char* bufStart = reinterpret_cast<char *>(sk_malloc_throw(maxBytes)); - char* bufPtr = bufStart; - size_t bytesRemaining = maxBytes; - while (bytesRemaining > 0) { - size_t bytesReadThisTime = stream.read(bufPtr, bytesRemaining); - if (0 == bytesReadThisTime) { - break; - } - bytesRemaining -= bytesReadThisTime; - bufPtr += bytesReadThisTime; - } - return SkData::NewFromMalloc(bufStart, maxBytes - bytesRemaining); -} diff --git a/src/utils/SkDataUtils.h b/src/utils/SkDataUtils.h deleted file mode 100644 index fc237f7b1a..0000000000 --- a/src/utils/SkDataUtils.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2014 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkDataUtils_DEFINED -#define SkDataUtils_DEFINED - -#include "SkData.h" -#include "SkStream.h" - -/** - * Static class that performs various operations on SkData objects. - * - * EPOGER: Before committing, add unittests for these methods. - * - * TODO(epoger): Move these methods into SkStream.[cpp|h], as attempted in - * https://codereview.appspot.com/7300071 ? - */ -class SkDataUtils { -public: - /** - * Read as many bytes as possible (up to maxBytes) from the stream into - * an SkData object. - * - * If the returned SkData contains fewer than maxBytes, then EOF has been - * reached and no more data would be available from subsequent calls. - * (If EOF has already been reached, then this call will return an empty - * SkData object immediately.) - * - * If there are fewer than maxBytes bytes available to read from the - * stream, but the stream has not been closed yet, this call will block - * until there are enough bytes to read or the stream has been closed. - * - * It is up to the caller to call unref() on the returned SkData object - * once the data is no longer needed, so that the underlying buffer will - * be freed. For example: - * - * { - * size_t maxBytes = 256; - * SkAutoDataUnref dataRef(readIntoSkData(stream, maxBytes)); - * if (NULL != dataRef.get()) { - * size_t bytesActuallyRead = dataRef.get()->size(); - * // use the data... - * } - * } - * // underlying buffer has been freed, thanks to auto unref - */ - static SkData* ReadIntoSkData(SkStream &stream, size_t maxBytes); - - /** - * Wrapper around ReadIntoSkData for files: reads the entire file into - * an SkData object. - */ - static SkData* ReadFileIntoSkData(SkFILEStream &stream) { - return ReadIntoSkData(stream, stream.getLength()); - } - -}; - -#endif |