OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkView.h" | 9 #include "SkView.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 SkBitmap fBitmaps[N]; | 85 SkBitmap fBitmaps[N]; |
86 | 86 |
87 FontCacheView() { | 87 FontCacheView() { |
88 gDone = false; | 88 gDone = false; |
89 for (int i = 0; i < N; i++) { | 89 for (int i = 0; i < N; i++) { |
90 int status; | 90 int status; |
91 | 91 |
92 status = pthread_create(&fMThreads[i], NULL, measure_proc, NULL); | 92 status = pthread_create(&fMThreads[i], NULL, measure_proc, NULL); |
93 SkASSERT(0 == status); | 93 SkASSERT(0 == status); |
94 | 94 |
95 fBitmaps[i].setConfig(SkBitmap::kRGB_565_Config, 320, 240); | 95 fBitmaps[i].allocPixels(SkImageInfo::Make(320, 240, |
96 fBitmaps[i].allocPixels(); | 96 kRGB_565_SkColorType, |
| 97 kOpaque_SkAlphaType)); |
97 status = pthread_create(&fDThreads[i], NULL, draw_proc, &fBitmaps[i
]); | 98 status = pthread_create(&fDThreads[i], NULL, draw_proc, &fBitmaps[i
]); |
98 SkASSERT(0 == status); | 99 SkASSERT(0 == status); |
99 } | 100 } |
100 this->setBGColor(0xFFDDDDDD); | 101 this->setBGColor(0xFFDDDDDD); |
101 } | 102 } |
102 | 103 |
103 virtual ~FontCacheView() { | 104 virtual ~FontCacheView() { |
104 gDone = true; | 105 gDone = true; |
105 for (int i = 0; i < N; i++) { | 106 for (int i = 0; i < N; i++) { |
106 void* ret; | 107 void* ret; |
(...skipping 25 matching lines...) Expand all Loading... |
132 } | 133 } |
133 | 134 |
134 private: | 135 private: |
135 typedef SampleView INHERITED; | 136 typedef SampleView INHERITED; |
136 }; | 137 }; |
137 | 138 |
138 ////////////////////////////////////////////////////////////////////////////// | 139 ////////////////////////////////////////////////////////////////////////////// |
139 | 140 |
140 static SkView* MyFactory() { return new FontCacheView; } | 141 static SkView* MyFactory() { return new FontCacheView; } |
141 static SkViewRegister reg(MyFactory); | 142 static SkViewRegister reg(MyFactory); |
OLD | NEW |