| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 | 10 |
| 11 #include "Test.h" | |
| 12 #include "SkData.h" | 11 #include "SkData.h" |
| 13 #include "SkFlate.h" | 12 #include "SkFlate.h" |
| 14 #include "SkStream.h" | 13 #include "SkStream.h" |
| 14 #include "Test.h" |
| 15 | 15 |
| 16 // A memory stream that reports zero size with the standard call, like | 16 // A memory stream that reports zero size with the standard call, like |
| 17 // an unseekable file stream would. | 17 // an unseekable file stream would. |
| 18 class SkZeroSizeMemStream : public SkMemoryStream { | 18 class SkZeroSizeMemStream : public SkMemoryStream { |
| 19 public: | 19 public: |
| 20 virtual size_t read(void* buffer, size_t size) { | 20 virtual size_t read(void* buffer, size_t size) { |
| 21 if (buffer == NULL && size == 0) | 21 if (buffer == NULL && size == 0) |
| 22 return 0; | 22 return 0; |
| 23 if (buffer == NULL && size == kGetSizeKey) | 23 if (buffer == NULL && size == kGetSizeKey) |
| 24 size = 0; | 24 size = 0; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 SkMemoryStream memStream; | 91 SkMemoryStream memStream; |
| 92 TestFlate(reporter, &memStream, 512); | 92 TestFlate(reporter, &memStream, 512); |
| 93 TestFlate(reporter, &memStream, 10240); | 93 TestFlate(reporter, &memStream, 10240); |
| 94 | 94 |
| 95 SkZeroSizeMemStream fileStream; | 95 SkZeroSizeMemStream fileStream; |
| 96 TestFlate(reporter, &fileStream, 512); | 96 TestFlate(reporter, &fileStream, 512); |
| 97 TestFlate(reporter, &fileStream, 10240); | 97 TestFlate(reporter, &fileStream, 10240); |
| 98 #endif | 98 #endif |
| 99 } | 99 } |
| OLD | NEW |