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

Side by Side Diff: tests/PictureTest.cpp

Issue 1037793002: C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: git cl web Created 5 years, 9 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/PictureBBHTest.cpp ('k') | tests/PixelRefTest.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 "SkBBoxHierarchy.h" 8 #include "SkBBoxHierarchy.h"
9 #include "SkBlurImageFilter.h" 9 #include "SkBlurImageFilter.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 class SaveCountingCanvas : public SkCanvas { 541 class SaveCountingCanvas : public SkCanvas {
542 public: 542 public:
543 SaveCountingCanvas(int width, int height) 543 SaveCountingCanvas(int width, int height)
544 : INHERITED(width, height) 544 : INHERITED(width, height)
545 , fSaveCount(0) 545 , fSaveCount(0)
546 , fSaveLayerCount(0) 546 , fSaveLayerCount(0)
547 , fRestoreCount(0){ 547 , fRestoreCount(0){
548 } 548 }
549 549
550 virtual SaveLayerStrategy willSaveLayer(const SkRect* bounds, const SkPaint* paint, 550 virtual SaveLayerStrategy willSaveLayer(const SkRect* bounds, const SkPaint* paint,
551 SaveFlags flags) SK_OVERRIDE { 551 SaveFlags flags) override {
552 ++fSaveLayerCount; 552 ++fSaveLayerCount;
553 return this->INHERITED::willSaveLayer(bounds, paint, flags); 553 return this->INHERITED::willSaveLayer(bounds, paint, flags);
554 } 554 }
555 555
556 void willSave() SK_OVERRIDE { 556 void willSave() override {
557 ++fSaveCount; 557 ++fSaveCount;
558 this->INHERITED::willSave(); 558 this->INHERITED::willSave();
559 } 559 }
560 560
561 void willRestore() SK_OVERRIDE { 561 void willRestore() override {
562 ++fRestoreCount; 562 ++fRestoreCount;
563 this->INHERITED::willRestore(); 563 this->INHERITED::willRestore();
564 } 564 }
565 565
566 unsigned int getSaveCount() const { return fSaveCount; } 566 unsigned int getSaveCount() const { return fSaveCount; }
567 unsigned int getSaveLayerCount() const { return fSaveLayerCount; } 567 unsigned int getSaveLayerCount() const { return fSaveLayerCount; }
568 unsigned int getRestoreCount() const { return fRestoreCount; } 568 unsigned int getRestoreCount() const { return fRestoreCount; }
569 569
570 private: 570 private:
571 unsigned int fSaveCount; 571 unsigned int fSaveCount;
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 */ 987 */
988 class ClipCountingCanvas : public SkCanvas { 988 class ClipCountingCanvas : public SkCanvas {
989 public: 989 public:
990 ClipCountingCanvas(int width, int height) 990 ClipCountingCanvas(int width, int height)
991 : INHERITED(width, height) 991 : INHERITED(width, height)
992 , fClipCount(0){ 992 , fClipCount(0){
993 } 993 }
994 994
995 virtual void onClipRect(const SkRect& r, 995 virtual void onClipRect(const SkRect& r,
996 SkRegion::Op op, 996 SkRegion::Op op,
997 ClipEdgeStyle edgeStyle) SK_OVERRIDE { 997 ClipEdgeStyle edgeStyle) override {
998 fClipCount += 1; 998 fClipCount += 1;
999 this->INHERITED::onClipRect(r, op, edgeStyle); 999 this->INHERITED::onClipRect(r, op, edgeStyle);
1000 } 1000 }
1001 1001
1002 virtual void onClipRRect(const SkRRect& rrect, 1002 virtual void onClipRRect(const SkRRect& rrect,
1003 SkRegion::Op op, 1003 SkRegion::Op op,
1004 ClipEdgeStyle edgeStyle)SK_OVERRIDE { 1004 ClipEdgeStyle edgeStyle)override {
1005 fClipCount += 1; 1005 fClipCount += 1;
1006 this->INHERITED::onClipRRect(rrect, op, edgeStyle); 1006 this->INHERITED::onClipRRect(rrect, op, edgeStyle);
1007 } 1007 }
1008 1008
1009 virtual void onClipPath(const SkPath& path, 1009 virtual void onClipPath(const SkPath& path,
1010 SkRegion::Op op, 1010 SkRegion::Op op,
1011 ClipEdgeStyle edgeStyle) SK_OVERRIDE { 1011 ClipEdgeStyle edgeStyle) override {
1012 fClipCount += 1; 1012 fClipCount += 1;
1013 this->INHERITED::onClipPath(path, op, edgeStyle); 1013 this->INHERITED::onClipPath(path, op, edgeStyle);
1014 } 1014 }
1015 1015
1016 void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) SK_OVERRIDE { 1016 void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) override {
1017 fClipCount += 1; 1017 fClipCount += 1;
1018 this->INHERITED::onClipRegion(deviceRgn, op); 1018 this->INHERITED::onClipRegion(deviceRgn, op);
1019 } 1019 }
1020 1020
1021 unsigned getClipCount() const { return fClipCount; } 1021 unsigned getClipCount() const { return fClipCount; }
1022 1022
1023 private: 1023 private:
1024 unsigned fClipCount; 1024 unsigned fClipCount;
1025 1025
1026 typedef SkCanvas INHERITED; 1026 typedef SkCanvas INHERITED;
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 REPORTER_ASSERT(reporter, replayBM.getColor(30, 30) == 0xff000080); 1234 REPORTER_ASSERT(reporter, replayBM.getColor(30, 30) == 0xff000080);
1235 REPORTER_ASSERT(reporter, replayBM.getColor(55, 55) == 0xff800000); 1235 REPORTER_ASSERT(reporter, replayBM.getColor(55, 55) == 0xff800000);
1236 } 1236 }
1237 1237
1238 struct CountingBBH : public SkBBoxHierarchy { 1238 struct CountingBBH : public SkBBoxHierarchy {
1239 mutable int searchCalls; 1239 mutable int searchCalls;
1240 SkRect rootBound; 1240 SkRect rootBound;
1241 1241
1242 CountingBBH(const SkRect& bound) : searchCalls(0), rootBound(bound) {} 1242 CountingBBH(const SkRect& bound) : searchCalls(0), rootBound(bound) {}
1243 1243
1244 void search(const SkRect& query, SkTDArray<unsigned>* results) const SK_OVER RIDE { 1244 void search(const SkRect& query, SkTDArray<unsigned>* results) const overrid e {
1245 this->searchCalls++; 1245 this->searchCalls++;
1246 } 1246 }
1247 1247
1248 void insert(const SkRect[], int) SK_OVERRIDE {} 1248 void insert(const SkRect[], int) override {}
1249 virtual size_t bytesUsed() const SK_OVERRIDE { return 0; } 1249 virtual size_t bytesUsed() const override { return 0; }
1250 SkRect getRootBound() const SK_OVERRIDE { return rootBound; } 1250 SkRect getRootBound() const override { return rootBound; }
1251 }; 1251 };
1252 1252
1253 class SpoonFedBBHFactory : public SkBBHFactory { 1253 class SpoonFedBBHFactory : public SkBBHFactory {
1254 public: 1254 public:
1255 explicit SpoonFedBBHFactory(SkBBoxHierarchy* bbh) : fBBH(bbh) {} 1255 explicit SpoonFedBBHFactory(SkBBoxHierarchy* bbh) : fBBH(bbh) {}
1256 SkBBoxHierarchy* operator()(const SkRect&) const SK_OVERRIDE { 1256 SkBBoxHierarchy* operator()(const SkRect&) const override {
1257 return SkRef(fBBH); 1257 return SkRef(fBBH);
1258 } 1258 }
1259 private: 1259 private:
1260 SkBBoxHierarchy* fBBH; 1260 SkBBoxHierarchy* fBBH;
1261 }; 1261 };
1262 1262
1263 // When the canvas clip covers the full picture, we don't need to call the BBH. 1263 // When the canvas clip covers the full picture, we don't need to call the BBH.
1264 DEF_TEST(Picture_SkipBBH, r) { 1264 DEF_TEST(Picture_SkipBBH, r) {
1265 SkRect bound = SkRect::MakeWH(320, 240); 1265 SkRect bound = SkRect::MakeWH(320, 240);
1266 CountingBBH bbh(bound); 1266 CountingBBH bbh(bound);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 1304
1305 // The picture shares the immutable pixels but copies the mutable ones. 1305 // The picture shares the immutable pixels but copies the mutable ones.
1306 REPORTER_ASSERT(r, mut.pixelRef()->unique()); 1306 REPORTER_ASSERT(r, mut.pixelRef()->unique());
1307 REPORTER_ASSERT(r, !immut.pixelRef()->unique()); 1307 REPORTER_ASSERT(r, !immut.pixelRef()->unique());
1308 1308
1309 // When the picture goes away, it's just our bitmaps holding the refs. 1309 // When the picture goes away, it's just our bitmaps holding the refs.
1310 pic.reset(NULL); 1310 pic.reset(NULL);
1311 REPORTER_ASSERT(r, mut.pixelRef()->unique()); 1311 REPORTER_ASSERT(r, mut.pixelRef()->unique());
1312 REPORTER_ASSERT(r, immut.pixelRef()->unique()); 1312 REPORTER_ASSERT(r, immut.pixelRef()->unique());
1313 } 1313 }
OLDNEW
« no previous file with comments | « tests/PictureBBHTest.cpp ('k') | tests/PixelRefTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698