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 #ifdef SK_DEBUG | |
551 REPORTER_ASSERT(reporter, 2 == notificationCounter.fStorageAllocatedChangedC
ount); | 550 REPORTER_ASSERT(reporter, 2 == notificationCounter.fStorageAllocatedChangedC
ount); |
552 #else | |
553 REPORTER_ASSERT(reporter, 3 == notificationCounter.fStorageAllocatedChangedC
ount); | |
554 #endif | |
555 REPORTER_ASSERT(reporter, 1 == notificationCounter.fFlushedDrawCommandsCount
); | 551 REPORTER_ASSERT(reporter, 1 == notificationCounter.fFlushedDrawCommandsCount
); |
556 REPORTER_ASSERT(reporter, canvas->storageAllocatedForRecording() < 2 * bitma
pSize); | 552 REPORTER_ASSERT(reporter, canvas->storageAllocatedForRecording() < 2 * bitma
pSize); |
557 | 553 |
558 // Verify partial eviction based on bytesToFree | 554 // Verify partial eviction based on bytesToFree |
559 canvas->drawBitmap(sourceImages[1], 0, 0, NULL); | 555 canvas->drawBitmap(sourceImages[1], 0, 0, NULL); |
560 REPORTER_ASSERT(reporter, 1 == notificationCounter.fFlushedDrawCommandsCount
); | 556 REPORTER_ASSERT(reporter, 1 == notificationCounter.fFlushedDrawCommandsCount
); |
561 canvas->flush(); | 557 canvas->flush(); |
562 REPORTER_ASSERT(reporter, 2 == notificationCounter.fFlushedDrawCommandsCount
); | 558 REPORTER_ASSERT(reporter, 2 == notificationCounter.fFlushedDrawCommandsCount
); |
563 REPORTER_ASSERT(reporter, canvas->storageAllocatedForRecording() > 2 * bitma
pSize); | 559 REPORTER_ASSERT(reporter, canvas->storageAllocatedForRecording() > 2 * bitma
pSize); |
564 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... |
835 TestDeferredCanvasSurface(reporter, NULL); | 831 TestDeferredCanvasSurface(reporter, NULL); |
836 TestDeferredCanvasSetSurface(reporter, NULL); | 832 TestDeferredCanvasSetSurface(reporter, NULL); |
837 } | 833 } |
838 | 834 |
839 DEF_GPUTEST(DeferredCanvas_GPU, reporter, factory) { | 835 DEF_GPUTEST(DeferredCanvas_GPU, reporter, factory) { |
840 if (factory != NULL) { | 836 if (factory != NULL) { |
841 TestDeferredCanvasSurface(reporter, factory); | 837 TestDeferredCanvasSurface(reporter, factory); |
842 TestDeferredCanvasSetSurface(reporter, factory); | 838 TestDeferredCanvasSetSurface(reporter, factory); |
843 } | 839 } |
844 } | 840 } |
OLD | NEW |