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); | |
Justin Novosad
2014/05/06 17:08:14
Could we keep this assert and put it inside "#ifde
mtklein
2014/05/06 17:36:43
You bet. Now testing both sides.
| |
551 REPORTER_ASSERT(reporter, 1 == notificationCounter.fFlushedDrawCommandsCount ); | 550 REPORTER_ASSERT(reporter, 1 == notificationCounter.fFlushedDrawCommandsCount ); |
552 REPORTER_ASSERT(reporter, canvas->storageAllocatedForRecording() < 2 * bitma pSize); | 551 REPORTER_ASSERT(reporter, canvas->storageAllocatedForRecording() < 2 * bitma pSize); |
553 | 552 |
554 // Verify partial eviction based on bytesToFree | 553 // Verify partial eviction based on bytesToFree |
555 canvas->drawBitmap(sourceImages[1], 0, 0, NULL); | 554 canvas->drawBitmap(sourceImages[1], 0, 0, NULL); |
556 REPORTER_ASSERT(reporter, 1 == notificationCounter.fFlushedDrawCommandsCount ); | 555 REPORTER_ASSERT(reporter, 1 == notificationCounter.fFlushedDrawCommandsCount ); |
557 canvas->flush(); | 556 canvas->flush(); |
558 REPORTER_ASSERT(reporter, 2 == notificationCounter.fFlushedDrawCommandsCount ); | 557 REPORTER_ASSERT(reporter, 2 == notificationCounter.fFlushedDrawCommandsCount ); |
559 REPORTER_ASSERT(reporter, canvas->storageAllocatedForRecording() > 2 * bitma pSize); | 558 REPORTER_ASSERT(reporter, canvas->storageAllocatedForRecording() > 2 * bitma pSize); |
560 size_t bytesFreed = canvas->freeMemoryIfPossible(1); | 559 size_t bytesFreed = canvas->freeMemoryIfPossible(1); |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
828 TestDeferredCanvasBitmapSizeThreshold(reporter); | 827 TestDeferredCanvasBitmapSizeThreshold(reporter); |
829 TestDeferredCanvasCreateCompatibleDevice(reporter); | 828 TestDeferredCanvasCreateCompatibleDevice(reporter); |
830 TestDeferredCanvasWritePixelsToSurface(reporter); | 829 TestDeferredCanvasWritePixelsToSurface(reporter); |
831 TestDeferredCanvasSurface(reporter, NULL); | 830 TestDeferredCanvasSurface(reporter, NULL); |
832 TestDeferredCanvasSetSurface(reporter, NULL); | 831 TestDeferredCanvasSetSurface(reporter, NULL); |
833 if (NULL != factory) { | 832 if (NULL != factory) { |
834 TestDeferredCanvasSurface(reporter, factory); | 833 TestDeferredCanvasSurface(reporter, factory); |
835 TestDeferredCanvasSetSurface(reporter, factory); | 834 TestDeferredCanvasSetSurface(reporter, factory); |
836 } | 835 } |
837 } | 836 } |
OLD | NEW |