| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "../src/image/SkImagePriv.h" | 8 #include "../src/image/SkImagePriv.h" |
| 9 #include "../src/image/SkSurface_Base.h" | 9 #include "../src/image/SkSurface_Base.h" |
| 10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 REPORTER_ASSERT(reporter, 1 == notificationCounter.fPrepareForDrawCount); | 540 REPORTER_ASSERT(reporter, 1 == notificationCounter.fPrepareForDrawCount); |
| 541 REPORTER_ASSERT(reporter, canvas->storageAllocatedForRecording() >= bitmapSi
ze); | 541 REPORTER_ASSERT(reporter, canvas->storageAllocatedForRecording() >= bitmapSi
ze); |
| 542 | 542 |
| 543 // verify that after a flush, cached image can be freed | 543 // verify that after a flush, cached image can be freed |
| 544 REPORTER_ASSERT(reporter, canvas->freeMemoryIfPossible(~0U) >= bitmapSize); | 544 REPORTER_ASSERT(reporter, canvas->freeMemoryIfPossible(~0U) >= bitmapSize); |
| 545 | 545 |
| 546 // Verify that caching works for avoiding multiple copies of the same bitmap | 546 // Verify that caching works for avoiding multiple copies of the same bitmap |
| 547 canvas->drawBitmap(sourceImages[0], 0, 0, NULL); | 547 canvas->drawBitmap(sourceImages[0], 0, 0, NULL); |
| 548 REPORTER_ASSERT(reporter, 2 == notificationCounter.fStorageAllocatedChangedC
ount); | 548 REPORTER_ASSERT(reporter, 2 == notificationCounter.fStorageAllocatedChangedC
ount); |
| 549 canvas->drawBitmap(sourceImages[0], 0, 0, NULL); | 549 canvas->drawBitmap(sourceImages[0], 0, 0, NULL); |
| 550 REPORTER_ASSERT(reporter, 2 == notificationCounter.fStorageAllocatedChangedC
ount); | 550 REPORTER_ASSERT(reporter, 3 == notificationCounter.fStorageAllocatedChangedC
ount); |
| 551 REPORTER_ASSERT(reporter, 1 == notificationCounter.fFlushedDrawCommandsCount
); | 551 REPORTER_ASSERT(reporter, 1 == notificationCounter.fFlushedDrawCommandsCount
); |
| 552 REPORTER_ASSERT(reporter, canvas->storageAllocatedForRecording() < 2 * bitma
pSize); | 552 REPORTER_ASSERT(reporter, canvas->storageAllocatedForRecording() < 2 * bitma
pSize); |
| 553 | 553 |
| 554 // Verify partial eviction based on bytesToFree | 554 // Verify partial eviction based on bytesToFree |
| 555 canvas->drawBitmap(sourceImages[1], 0, 0, NULL); | 555 canvas->drawBitmap(sourceImages[1], 0, 0, NULL); |
| 556 REPORTER_ASSERT(reporter, 1 == notificationCounter.fFlushedDrawCommandsCount
); | 556 REPORTER_ASSERT(reporter, 1 == notificationCounter.fFlushedDrawCommandsCount
); |
| 557 canvas->flush(); | 557 canvas->flush(); |
| 558 REPORTER_ASSERT(reporter, 2 == notificationCounter.fFlushedDrawCommandsCount
); | 558 REPORTER_ASSERT(reporter, 2 == notificationCounter.fFlushedDrawCommandsCount
); |
| 559 REPORTER_ASSERT(reporter, canvas->storageAllocatedForRecording() > 2 * bitma
pSize); | 559 REPORTER_ASSERT(reporter, canvas->storageAllocatedForRecording() > 2 * bitma
pSize); |
| 560 size_t bytesFreed = canvas->freeMemoryIfPossible(1); | 560 size_t bytesFreed = canvas->freeMemoryIfPossible(1); |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 TestDeferredCanvasSurface(reporter, NULL); | 831 TestDeferredCanvasSurface(reporter, NULL); |
| 832 TestDeferredCanvasSetSurface(reporter, NULL); | 832 TestDeferredCanvasSetSurface(reporter, NULL); |
| 833 } | 833 } |
| 834 | 834 |
| 835 DEF_GPUTEST(DeferredCanvas_GPU, reporter, factory) { | 835 DEF_GPUTEST(DeferredCanvas_GPU, reporter, factory) { |
| 836 if (factory != NULL) { | 836 if (factory != NULL) { |
| 837 TestDeferredCanvasSurface(reporter, factory); | 837 TestDeferredCanvasSurface(reporter, factory); |
| 838 TestDeferredCanvasSetSurface(reporter, factory); | 838 TestDeferredCanvasSetSurface(reporter, factory); |
| 839 } | 839 } |
| 840 } | 840 } |
| OLD | NEW |