| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 The Android Open Source Project | 2 * Copyright 2010 The Android Open Source Project |
| 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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkData.h" | 10 #include "SkData.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 SkAutoDataUnref data(stream.copyToData()); | 51 SkAutoDataUnref data(stream.copyToData()); |
| 52 if (offset + len > data->size()) { | 52 if (offset + len > data->size()) { |
| 53 return false; | 53 return false; |
| 54 } | 54 } |
| 55 return memcmp(data->bytes() + offset, buffer, len) == 0; | 55 return memcmp(data->bytes() + offset, buffer, len) == 0; |
| 56 } | 56 } |
| 57 | 57 |
| 58 static bool stream_contains(const SkDynamicMemoryWStream& stream, | 58 static bool stream_contains(const SkDynamicMemoryWStream& stream, |
| 59 const char* buffer) { | 59 const char* buffer) { |
| 60 SkAutoDataUnref data(stream.copyToData()); | 60 SkAutoDataUnref data(stream.copyToData()); |
| 61 int len = strlen(buffer); // our buffer does not have EOSs. | 61 size_t len = strlen(buffer); // our buffer does not have EOSs. |
| 62 | 62 |
| 63 for (int offset = 0 ; offset < (int)data->size() - len; offset++) { | 63 for (size_t offset = 0 ; offset < data->size() - len; offset++) { |
| 64 if (memcmp(data->bytes() + offset, buffer, len) == 0) { | 64 if (memcmp(data->bytes() + offset, buffer, len) == 0) { |
| 65 return true; | 65 return true; |
| 66 } | 66 } |
| 67 } | 67 } |
| 68 | 68 |
| 69 return false; | 69 return false; |
| 70 } | 70 } |
| 71 | 71 |
| 72 static void CheckObjectOutput(skiatest::Reporter* reporter, SkPDFObject* obj, | 72 static void CheckObjectOutput(skiatest::Reporter* reporter, SkPDFObject* obj, |
| 73 const char* expectedData, size_t expectedSize, | 73 const char* expectedData, size_t expectedSize, |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 | 468 |
| 469 // Filter just created; should be unvisited. | 469 // Filter just created; should be unvisited. |
| 470 REPORTER_ASSERT(reporter, !filter->visited()); | 470 REPORTER_ASSERT(reporter, !filter->visited()); |
| 471 SkPaint paint; | 471 SkPaint paint; |
| 472 paint.setImageFilter(filter.get()); | 472 paint.setImageFilter(filter.get()); |
| 473 canvas.drawRect(SkRect::MakeWH(100, 100), paint); | 473 canvas.drawRect(SkRect::MakeWH(100, 100), paint); |
| 474 | 474 |
| 475 // Filter was used in rendering; should be visited. | 475 // Filter was used in rendering; should be visited. |
| 476 REPORTER_ASSERT(reporter, filter->visited()); | 476 REPORTER_ASSERT(reporter, filter->visited()); |
| 477 } | 477 } |
| OLD | NEW |