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

Side by Side Diff: bench/FontCacheBench.cpp

Issue 27343002: Second wave of Win64 warning cleanup (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: switched count_glyphs back to int Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/core/SkPictureRecord.h » ('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 2013 Google Inc. 2 * Copyright 2013 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 "SkBenchmark.h" 8 #include "SkBenchmark.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkFontHost.h" 10 #include "SkFontHost.h"
11 #include "SkPaint.h" 11 #include "SkPaint.h"
12 #include "SkString.h" 12 #include "SkString.h"
13 #include "SkTemplates.h" 13 #include "SkTemplates.h"
14 14
15 #include "gUniqueGlyphIDs.h" 15 #include "gUniqueGlyphIDs.h"
16 #define gUniqueGlyphIDs_Sentinel 0xFFFF 16 #define gUniqueGlyphIDs_Sentinel 0xFFFF
17 17
18 static int count_glyphs(const uint16_t start[]) { 18 static int count_glyphs(const uint16_t start[]) {
19 const uint16_t* curr = start; 19 const uint16_t* curr = start;
20 while (*curr != gUniqueGlyphIDs_Sentinel) { 20 while (*curr != gUniqueGlyphIDs_Sentinel) {
21 curr += 1; 21 curr += 1;
22 } 22 }
23 return curr - start; 23 return static_cast<int>(curr - start);
24 } 24 }
25 25
26 class FontCacheBench : public SkBenchmark { 26 class FontCacheBench : public SkBenchmark {
27 public: 27 public:
28 FontCacheBench() {} 28 FontCacheBench() {}
29 29
30 protected: 30 protected:
31 virtual const char* onGetName() SK_OVERRIDE { 31 virtual const char* onGetName() SK_OVERRIDE {
32 return "fontcache"; 32 return "fontcache";
33 } 33 }
34 34
35 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 35 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
36 SkPaint paint; 36 SkPaint paint;
37 this->setupPaint(&paint); 37 this->setupPaint(&paint);
38 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); 38 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
39 39
40 const uint16_t* array = gUniqueGlyphIDs; 40 const uint16_t* array = gUniqueGlyphIDs;
41 while (*array != gUniqueGlyphIDs_Sentinel) { 41 while (*array != gUniqueGlyphIDs_Sentinel) {
42 size_t count = count_glyphs(array); 42 int count = count_glyphs(array);
43 for (int i = 0; i < this->getLoops(); ++i) { 43 for (int i = 0; i < this->getLoops(); ++i) {
44 paint.measureText(array, count * sizeof(uint16_t)); 44 paint.measureText(array, count * sizeof(uint16_t));
45 } 45 }
46 array += count + 1; // skip the sentinel 46 array += count + 1; // skip the sentinel
47 } 47 }
48 } 48 }
49 49
50 private: 50 private:
51 typedef SkBenchmark INHERITED; 51 typedef SkBenchmark INHERITED;
52 }; 52 };
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 private: 149 private:
150 typedef SkBenchmark INHERITED; 150 typedef SkBenchmark INHERITED;
151 }; 151 };
152 152
153 /////////////////////////////////////////////////////////////////////////////// 153 ///////////////////////////////////////////////////////////////////////////////
154 154
155 DEF_BENCH( return new FontCacheBench(); ) 155 DEF_BENCH( return new FontCacheBench(); )
156 156
157 // undefine this to run the efficiency test 157 // undefine this to run the efficiency test
158 //DEF_BENCH( return new FontCacheEfficiency(); ) 158 //DEF_BENCH( return new FontCacheEfficiency(); )
OLDNEW
« no previous file with comments | « no previous file | src/core/SkPictureRecord.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698