Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(515)

Side by Side Diff: tests/DeferredCanvasTest.cpp

Issue 267863002: 4x allocation in PipeController is probably overkill. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: keep test Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pipe/utils/SamplePipeControllers.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
550 REPORTER_ASSERT(reporter, 2 == notificationCounter.fStorageAllocatedChangedC ount); 551 REPORTER_ASSERT(reporter, 2 == notificationCounter.fStorageAllocatedChangedC ount);
552 #else
553 REPORTER_ASSERT(reporter, 3 == notificationCounter.fStorageAllocatedChangedC ount);
554 #endif
551 REPORTER_ASSERT(reporter, 1 == notificationCounter.fFlushedDrawCommandsCount ); 555 REPORTER_ASSERT(reporter, 1 == notificationCounter.fFlushedDrawCommandsCount );
552 REPORTER_ASSERT(reporter, canvas->storageAllocatedForRecording() < 2 * bitma pSize); 556 REPORTER_ASSERT(reporter, canvas->storageAllocatedForRecording() < 2 * bitma pSize);
553 557
554 // Verify partial eviction based on bytesToFree 558 // Verify partial eviction based on bytesToFree
555 canvas->drawBitmap(sourceImages[1], 0, 0, NULL); 559 canvas->drawBitmap(sourceImages[1], 0, 0, NULL);
556 REPORTER_ASSERT(reporter, 1 == notificationCounter.fFlushedDrawCommandsCount ); 560 REPORTER_ASSERT(reporter, 1 == notificationCounter.fFlushedDrawCommandsCount );
557 canvas->flush(); 561 canvas->flush();
558 REPORTER_ASSERT(reporter, 2 == notificationCounter.fFlushedDrawCommandsCount ); 562 REPORTER_ASSERT(reporter, 2 == notificationCounter.fFlushedDrawCommandsCount );
559 REPORTER_ASSERT(reporter, canvas->storageAllocatedForRecording() > 2 * bitma pSize); 563 REPORTER_ASSERT(reporter, canvas->storageAllocatedForRecording() > 2 * bitma pSize);
560 size_t bytesFreed = canvas->freeMemoryIfPossible(1); 564 size_t bytesFreed = canvas->freeMemoryIfPossible(1);
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 TestDeferredCanvasBitmapSizeThreshold(reporter); 832 TestDeferredCanvasBitmapSizeThreshold(reporter);
829 TestDeferredCanvasCreateCompatibleDevice(reporter); 833 TestDeferredCanvasCreateCompatibleDevice(reporter);
830 TestDeferredCanvasWritePixelsToSurface(reporter); 834 TestDeferredCanvasWritePixelsToSurface(reporter);
831 TestDeferredCanvasSurface(reporter, NULL); 835 TestDeferredCanvasSurface(reporter, NULL);
832 TestDeferredCanvasSetSurface(reporter, NULL); 836 TestDeferredCanvasSetSurface(reporter, NULL);
833 if (NULL != factory) { 837 if (NULL != factory) {
834 TestDeferredCanvasSurface(reporter, factory); 838 TestDeferredCanvasSurface(reporter, factory);
835 TestDeferredCanvasSetSurface(reporter, factory); 839 TestDeferredCanvasSetSurface(reporter, factory);
836 } 840 }
837 } 841 }
OLDNEW
« no previous file with comments | « src/pipe/utils/SamplePipeControllers.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698