aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-03-02 14:34:11 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-03-02 14:34:11 +0000
commitd6f5a81955d0edb5bec9198bcadeab9563340927 (patch)
tree0fc1f270d0f1b099854f95f9d802562fd32d8540
parent22a0221968bbc7498110f098d7975989d0fbcf6d (diff)
#ifdef protect win specific code (e.g. LOGFONT)
git-svn-id: http://skia.googlecode.com/svn/trunk@874 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--samplecode/SampleTextBox.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/samplecode/SampleTextBox.cpp b/samplecode/SampleTextBox.cpp
index 9511914ab6..f2b5e2c33b 100644
--- a/samplecode/SampleTextBox.cpp
+++ b/samplecode/SampleTextBox.cpp
@@ -20,9 +20,11 @@
#include "SkStream.h"
#include "SkKey.h"
+#ifdef SK_BUILD_FOR_WIN
extern SkTypeface* SkCreateTypefaceFromLOGFONT(const LOGFONT&);
+#endif
-static const char gText[] =
+static const char gText[] =
"When in the Course of human events it becomes necessary for one people "
"to dissolve the political bands which have connected them with another "
"and to assume among the powers of the earth, the separate and equal "
@@ -31,8 +33,9 @@ static const char gText[] =
"declare the causes which impel them to the separation.";
class TextBoxView : public SkView {
-public:
+public:
TextBoxView() {
+#ifdef SK_BUILD_FOR_WIN
LOGFONT lf;
sk_bzero(&lf, sizeof(lf));
lf.lfHeight = 9;
@@ -43,8 +46,9 @@ public:
SkASSERT(tf0 == tf1);
tf0->unref();
tf1->unref();
+#endif
}
-
+
protected:
// overrides from SkEventSink
virtual bool onQuery(SkEvent* evt) {
@@ -55,11 +59,11 @@ protected:
}
return this->INHERITED::onQuery(evt);
}
-
+
void drawBG(SkCanvas* canvas) {
canvas->drawColor(SK_ColorWHITE);
}
-
+
virtual void onDraw(SkCanvas* canvas) {
this->drawBG(canvas);
@@ -80,7 +84,7 @@ protected:
canvas->translate(0, tbox.getTextHeight() + paint.getFontSpacing());
}
}
-
+
private:
typedef SkView INHERITED;
};