| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright 2011 Google Inc. | 2  * Copyright 2011 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 #include "SkBenchmark.h" | 7 #include "SkBenchmark.h" | 
| 8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" | 
| 9 #include "SkPaint.h" | 9 #include "SkPaint.h" | 
| 10 #include "SkString.h" | 10 #include "SkString.h" | 
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 461 protected: | 461 protected: | 
| 462 | 462 | 
| 463     virtual const char* onGetName() { return "chrome_scrollGmail"; } | 463     virtual const char* onGetName() { return "chrome_scrollGmail"; } | 
| 464     virtual void onDraw(SkCanvas* canvas) { | 464     virtual void onDraw(SkCanvas* canvas) { | 
| 465         SkDEBUGCODE(this->validateBounds(canvas)); | 465         SkDEBUGCODE(this->validateBounds(canvas)); | 
| 466         SkPaint paint; | 466         SkPaint paint; | 
| 467         this->setupPaint(&paint); | 467         this->setupPaint(&paint); | 
| 468         for (int i = 0; i < N; i++) { | 468         for (int i = 0; i < N; i++) { | 
| 469             SkRect current; | 469             SkRect current; | 
| 470             setRectangle(current, i); | 470             setRectangle(current, i); | 
| 471             for (int j = 0; j < SkBENCHLOOP(gmailScrollingRectSpec[i*3]); j++) { | 471             for (int j = 0; j < this->getLoops() * gmailScrollingRectSpec[i*3]; 
     j++) { | 
| 472                 canvas->drawRect(current, paint); | 472                 canvas->drawRect(current, paint); | 
| 473             } | 473             } | 
| 474         } | 474         } | 
| 475     } | 475     } | 
| 476     virtual SkIPoint onGetSize() { return SkIPoint::Make(W, H); } | 476     virtual SkIPoint onGetSize() { return SkIPoint::Make(W, H); } | 
| 477 | 477 | 
| 478     void setRectangle(SkRect& current, int i) { | 478     void setRectangle(SkRect& current, int i) { | 
| 479         current.set(0, 0, | 479         current.set(0, 0, | 
| 480                     SkIntToScalar(gmailScrollingRectSpec[i*3+1]), SkIntToScalar(
     gmailScrollingRectSpec[i*3+2])); | 480                     SkIntToScalar(gmailScrollingRectSpec[i*3+1]), SkIntToScalar(
     gmailScrollingRectSpec[i*3+2])); | 
| 481     } | 481     } | 
| 482     void validateBounds(SkCanvas* canvas) { | 482     void validateBounds(SkCanvas* canvas) { | 
| 483         SkIRect bounds; | 483         SkIRect bounds; | 
| 484         canvas->getClipDeviceBounds(&bounds); | 484         canvas->getClipDeviceBounds(&bounds); | 
| 485         SkASSERT(bounds.right()-bounds.left() >= W); | 485         SkASSERT(bounds.right()-bounds.left() >= W); | 
| 486         SkASSERT(bounds.bottom()-bounds.top() >= H); | 486         SkASSERT(bounds.bottom()-bounds.top() >= H); | 
| 487     } | 487     } | 
| 488 | 488 | 
| 489 | 489 | 
| 490 private: | 490 private: | 
| 491     typedef SkBenchmark INHERITED; | 491     typedef SkBenchmark INHERITED; | 
| 492 }; | 492 }; | 
| 493 | 493 | 
| 494 static inline SkBenchmark* ScrollGmailFactory(void* p) { | 494 static inline SkBenchmark* ScrollGmailFactory(void* p) { | 
| 495     return SkNEW_ARGS(ScrollGmailBench, (p)); | 495     return SkNEW_ARGS(ScrollGmailBench, (p)); | 
| 496 } | 496 } | 
| 497 | 497 | 
| 498 // Disabled this benchmark: it takes 15x longer than any other benchmark | 498 // Disabled this benchmark: it takes 15x longer than any other benchmark | 
| 499 // and is probably not giving us important information. | 499 // and is probably not giving us important information. | 
| 500 //static BenchRegistry gScrollGmailReg(ScrollGmailFactory); | 500 //static BenchRegistry gScrollGmailReg(ScrollGmailFactory); | 
| OLD | NEW | 
|---|