aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode/SampleFontCache.cpp
diff options
context:
space:
mode:
authorGravatar rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-23 18:19:56 +0000
committerGravatar rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-23 18:19:56 +0000
commitae933ce0ea5fd9d21cb6ef2cee7e729d32690aac (patch)
tree62d80e33b16679d01454cf814977a7030d3a5462 /samplecode/SampleFontCache.cpp
parentd6176b0dcacb124539e0cfd051e6d93a9782f020 (diff)
Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/)
This CL is part III of IV (I broke down the 1280 files into 4 CLs). Review URL: https://codereview.appspot.com/6475053 git-svn-id: http://skia.googlecode.com/svn/trunk@5264 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'samplecode/SampleFontCache.cpp')
-rw-r--r--samplecode/SampleFontCache.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/samplecode/SampleFontCache.cpp b/samplecode/SampleFontCache.cpp
index 2546890543..d5c2add4d4 100644
--- a/samplecode/SampleFontCache.cpp
+++ b/samplecode/SampleFontCache.cpp
@@ -17,15 +17,15 @@ static void call_measure() {
SkPaint paint;
uint16_t text[32];
SkRandom rand;
-
+
paint.setAntiAlias(true);
paint.setTextEncoding(SkPaint::kUTF16_TextEncoding);
for (int j = 0; j < SK_ARRAY_COUNT(text); j++)
text[j] = (uint16_t)((rand.nextU() & 0xFF) + 32);
-
+
for (int i = 9; i < 36; i++) {
SkPaint::FontMetrics m;
-
+
paint.setTextSize(SkIntToScalar(i));
paint.getFontMetrics(&m);
paint.measureText(text, sizeof(text));
@@ -36,20 +36,20 @@ static void call_draw(SkCanvas* canvas) {
SkPaint paint;
uint16_t text[32];
SkRandom rand;
-
+
paint.setAntiAlias(true);
paint.setTextEncoding(SkPaint::kUTF16_TextEncoding);
for (int j = 0; j < SK_ARRAY_COUNT(text); j++)
text[j] = (uint16_t)((rand.nextU() & 0xFF) + 32);
-
+
SkScalar x = SkIntToScalar(10);
SkScalar y = SkIntToScalar(20);
-
+
canvas->drawColor(SK_ColorWHITE);
for (int i = 9; i < 36; i++)
{
SkPaint::FontMetrics m;
-
+
paint.setTextSize(SkIntToScalar(i));
paint.getFontMetrics(&m);
canvas->drawText(text, sizeof(text), x, y, paint);
@@ -79,16 +79,16 @@ static void* draw_proc(void* context) {
class FontCacheView : public SampleView {
public:
enum { N = 4 };
-
+
pthread_t fMThreads[N];
pthread_t fDThreads[N];
SkBitmap fBitmaps[N];
- FontCacheView() {
+ FontCacheView() {
gDone = false;
for (int i = 0; i < N; i++) {
int status;
-
+
status = pthread_create(&fMThreads[i], NULL, measure_proc, NULL);
SkASSERT(0 == status);
@@ -99,7 +99,7 @@ public:
}
this->setBGColor(0xFFDDDDDD);
}
-
+
virtual ~FontCacheView() {
gDone = true;
for (int i = 0; i < N; i++) {
@@ -110,7 +110,7 @@ public:
SkASSERT(0 == status);
}
}
-
+
protected:
// overrides from SkEventSink
virtual bool onQuery(SkEvent* evt) {
@@ -120,7 +120,7 @@ protected:
}
return this->INHERITED::onQuery(evt);
}
-
+
virtual void onDrawContent(SkCanvas* canvas) {
SkScalar x = 0;
SkScalar y = 0;
@@ -130,7 +130,7 @@ protected:
}
this->inval(NULL);
}
-
+
private:
typedef SampleView INHERITED;
};