Chromium Code Reviews| Index: gm/gm_expectations.cpp |
| diff --git a/gm/gm_expectations.cpp b/gm/gm_expectations.cpp |
| index f46a572458f4439a950c5e0d7af6cf6df87b1708..40bb2b4f906f286968a24135735357158b7aef56 100644 |
| --- a/gm/gm_expectations.cpp |
| +++ b/gm/gm_expectations.cpp |
| @@ -3,10 +3,14 @@ |
| * |
| * Use of this source code is governed by a BSD-style license that can be |
| * found in the LICENSE file. |
| + * |
| + * TODO(epoger): Combine this with tools/image_expectations.cpp, or eliminate one of the two. |
| */ |
| #include "gm_expectations.h" |
| #include "SkBitmapHasher.h" |
| +#include "SkData.h" |
| +#include "SkDataUtils.h" |
| #include "SkImageDecoder.h" |
| #define DEBUGFAIL_SEE_STDERR SkDEBUGFAIL("see stderr for message") |
| @@ -219,24 +223,6 @@ namespace skiagm { |
| return Expectations(fJsonExpectedResults[testName]); |
| } |
| - /*static*/ SkData* JsonExpectationsSource::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); |
| - } |
| - |
| /*static*/ bool JsonExpectationsSource::Parse(const char *jsonPath, Json::Value *jsonRoot) { |
| SkFILEStream inFile(jsonPath); |
| if (!inFile.isValid()) { |
| @@ -245,7 +231,7 @@ namespace skiagm { |
| return false; |
| } |
| - SkAutoDataUnref dataRef(ReadFileIntoSkData(inFile)); |
| + SkAutoDataUnref dataRef(SkDataUtils::ReadFileIntoSkData(inFile)); |
|
bungeman-skia
2014/05/08 16:29:51
Why isn't this just SkData::NewFromFileName(jsonPa
|
| if (NULL == dataRef.get()) { |
| SkDebugf("error reading JSON file %s\n", jsonPath); |
| DEBUGFAIL_SEE_STDERR; |