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

Side by Side Diff: tests/DeferredCanvasTest.cpp

Issue 806653007: Fix up all the easy virtual ... SK_OVERRIDE cases. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 11 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 | « tests/CanvasTest.cpp ('k') | tests/DrawBitmapRectTest.cpp » ('j') | 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 return pixel; 49 return pixel;
50 } 50 }
51 51
52 class MockSurface : public SkSurface_Base { 52 class MockSurface : public SkSurface_Base {
53 public: 53 public:
54 MockSurface(int width, int height) : SkSurface_Base(width, height, NULL) { 54 MockSurface(int width, int height) : SkSurface_Base(width, height, NULL) {
55 clearCounts(); 55 clearCounts();
56 fBitmap.allocN32Pixels(width, height); 56 fBitmap.allocN32Pixels(width, height);
57 } 57 }
58 58
59 virtual SkCanvas* onNewCanvas() SK_OVERRIDE { 59 SkCanvas* onNewCanvas() SK_OVERRIDE {
60 return SkNEW_ARGS(SkCanvas, (fBitmap)); 60 return SkNEW_ARGS(SkCanvas, (fBitmap));
61 } 61 }
62 62
63 virtual SkSurface* onNewSurface(const SkImageInfo&) SK_OVERRIDE { 63 SkSurface* onNewSurface(const SkImageInfo&) SK_OVERRIDE {
64 return NULL; 64 return NULL;
65 } 65 }
66 66
67 virtual SkImage* onNewImageSnapshot() SK_OVERRIDE { 67 SkImage* onNewImageSnapshot() SK_OVERRIDE {
68 return SkNewImageFromBitmap(fBitmap, true, &this->props()); 68 return SkNewImageFromBitmap(fBitmap, true, &this->props());
69 } 69 }
70 70
71 virtual void onCopyOnWrite(ContentChangeMode mode) SK_OVERRIDE { 71 void onCopyOnWrite(ContentChangeMode mode) SK_OVERRIDE {
72 if (mode == SkSurface::kDiscard_ContentChangeMode) { 72 if (mode == SkSurface::kDiscard_ContentChangeMode) {
73 fDiscardCount++; 73 fDiscardCount++;
74 } else { 74 } else {
75 fRetainCount++; 75 fRetainCount++;
76 } 76 }
77 } 77 }
78 78
79 void clearCounts() { 79 void clearCounts() {
80 fDiscardCount = 0; 80 fDiscardCount = 0;
81 fRetainCount = 0; 81 fRetainCount = 0;
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 int fDrawBitmapCallCount; 419 int fDrawBitmapCallCount;
420 }; 420 };
421 421
422 class NotificationCounter : public SkDeferredCanvas::NotificationClient { 422 class NotificationCounter : public SkDeferredCanvas::NotificationClient {
423 public: 423 public:
424 NotificationCounter() { 424 NotificationCounter() {
425 fPrepareForDrawCount = fStorageAllocatedChangedCount = 425 fPrepareForDrawCount = fStorageAllocatedChangedCount =
426 fFlushedDrawCommandsCount = fSkippedPendingDrawCommandsCount = 0; 426 fFlushedDrawCommandsCount = fSkippedPendingDrawCommandsCount = 0;
427 } 427 }
428 428
429 virtual void prepareForDraw() SK_OVERRIDE { 429 void prepareForDraw() SK_OVERRIDE {
430 fPrepareForDrawCount++; 430 fPrepareForDrawCount++;
431 } 431 }
432 virtual void storageAllocatedForRecordingChanged(size_t) SK_OVERRIDE { 432 void storageAllocatedForRecordingChanged(size_t) SK_OVERRIDE {
433 fStorageAllocatedChangedCount++; 433 fStorageAllocatedChangedCount++;
434 } 434 }
435 virtual void flushedDrawCommands() SK_OVERRIDE { 435 void flushedDrawCommands() SK_OVERRIDE {
436 fFlushedDrawCommandsCount++; 436 fFlushedDrawCommandsCount++;
437 } 437 }
438 virtual void skippedPendingDrawCommands() SK_OVERRIDE { 438 void skippedPendingDrawCommands() SK_OVERRIDE {
439 fSkippedPendingDrawCommandsCount++; 439 fSkippedPendingDrawCommandsCount++;
440 } 440 }
441 441
442 int fPrepareForDrawCount; 442 int fPrepareForDrawCount;
443 int fStorageAllocatedChangedCount; 443 int fStorageAllocatedChangedCount;
444 int fFlushedDrawCommandsCount; 444 int fFlushedDrawCommandsCount;
445 int fSkippedPendingDrawCommandsCount; 445 int fSkippedPendingDrawCommandsCount;
446 446
447 private: 447 private:
448 typedef SkDeferredCanvas::NotificationClient INHERITED; 448 typedef SkDeferredCanvas::NotificationClient INHERITED;
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 TestDeferredCanvasSurface(reporter, NULL); 899 TestDeferredCanvasSurface(reporter, NULL);
900 TestDeferredCanvasSetSurface(reporter, NULL); 900 TestDeferredCanvasSetSurface(reporter, NULL);
901 } 901 }
902 902
903 DEF_GPUTEST(DeferredCanvas_GPU, reporter, factory) { 903 DEF_GPUTEST(DeferredCanvas_GPU, reporter, factory) {
904 if (factory != NULL) { 904 if (factory != NULL) {
905 TestDeferredCanvasSurface(reporter, factory); 905 TestDeferredCanvasSurface(reporter, factory);
906 TestDeferredCanvasSetSurface(reporter, factory); 906 TestDeferredCanvasSetSurface(reporter, factory);
907 } 907 }
908 } 908 }
OLDNEW
« no previous file with comments | « tests/CanvasTest.cpp ('k') | tests/DrawBitmapRectTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698