aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode/SamplePath.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/SamplePath.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/SamplePath.cpp')
-rw-r--r--samplecode/SamplePath.cpp52
1 files changed, 26 insertions, 26 deletions
diff --git a/samplecode/SamplePath.cpp b/samplecode/SamplePath.cpp
index 69b48fad58..b07307a9b3 100644
--- a/samplecode/SamplePath.cpp
+++ b/samplecode/SamplePath.cpp
@@ -50,7 +50,7 @@ static void test_cubic2() {
const char* str = "M2242 -590088L-377758 9.94099e+07L-377758 9.94099e+07L2242 -590088Z";
SkPath path;
SkParsePath::FromSVGString(str, &path);
-
+
{
#ifdef SK_BUILD_FOR_WIN
// windows doesn't have strtof
@@ -62,7 +62,7 @@ static void test_cubic2() {
int fx = (int)(x * 65536);
int ffx = SkScalarToFixed(x);
printf("%g %x %x %x\n", x, ix, fx, ffx);
-
+
SkRect r = path.getBounds();
SkIRect ir;
r.round(&ir);
@@ -71,7 +71,7 @@ static void test_cubic2() {
SkScalarToDouble(r.fRight), SkScalarToDouble(r.fBottom),
ir.fLeft, ir.fTop, ir.fRight, ir.fBottom);
}
-
+
SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config, 300, 200);
bitmap.allocPixels();
@@ -88,11 +88,11 @@ public:
SkPath fPath[6];
bool fShowHairline;
bool fOnce;
-
- PathView() {
+
+ PathView() {
fOnce = false;
}
-
+
void init() {
if (fOnce) {
return;
@@ -103,47 +103,47 @@ public:
test_cubic2();
fShowHairline = false;
-
+
fDStroke = 1;
fStroke = 10;
fMinStroke = 10;
fMaxStroke = 180;
const int V = 85;
-
+
fPath[0].moveTo(SkIntToScalar(40), SkIntToScalar(70));
fPath[0].lineTo(SkIntToScalar(70), SkIntToScalar(70) + SK_Scalar1/1);
fPath[0].lineTo(SkIntToScalar(110), SkIntToScalar(70));
-
+
fPath[1].moveTo(SkIntToScalar(40), SkIntToScalar(70));
fPath[1].lineTo(SkIntToScalar(70), SkIntToScalar(70) - SK_Scalar1/1);
fPath[1].lineTo(SkIntToScalar(110), SkIntToScalar(70));
-
+
fPath[2].moveTo(SkIntToScalar(V), SkIntToScalar(V));
fPath[2].lineTo(SkIntToScalar(50), SkIntToScalar(V));
fPath[2].lineTo(SkIntToScalar(50), SkIntToScalar(50));
-
+
fPath[3].moveTo(SkIntToScalar(50), SkIntToScalar(50));
fPath[3].lineTo(SkIntToScalar(50), SkIntToScalar(V));
fPath[3].lineTo(SkIntToScalar(V), SkIntToScalar(V));
-
+
fPath[4].moveTo(SkIntToScalar(50), SkIntToScalar(50));
fPath[4].lineTo(SkIntToScalar(50), SkIntToScalar(V));
fPath[4].lineTo(SkIntToScalar(52), SkIntToScalar(50));
-
+
fPath[5].moveTo(SkIntToScalar(52), SkIntToScalar(50));
fPath[5].lineTo(SkIntToScalar(50), SkIntToScalar(V));
fPath[5].lineTo(SkIntToScalar(50), SkIntToScalar(50));
-
+
this->setBGColor(0xFFDDDDDD);
}
-
+
void nextStroke() {
fStroke += fDStroke;
if (fStroke > fMaxStroke || fStroke < fMinStroke)
fDStroke = -fDStroke;
}
-
+
protected:
// overrides from SkEventSink
virtual bool onQuery(SkEvent* evt) {
@@ -153,10 +153,10 @@ protected:
}
return this->INHERITED::onQuery(evt);
}
-
+
void drawPath(SkCanvas* canvas, const SkPath& path, SkPaint::Join j) {
SkPaint paint;
-
+
paint.setAntiAlias(true);
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeJoin(j);
@@ -164,19 +164,19 @@ protected:
if (fShowHairline) {
SkPath fill;
-
- paint.getFillPath(path, &fill);
+
+ paint.getFillPath(path, &fill);
paint.setStrokeWidth(0);
canvas->drawPath(fill, paint);
} else {
canvas->drawPath(path, paint);
}
-
+
paint.setColor(SK_ColorRED);
paint.setStrokeWidth(0);
canvas->drawPath(path, paint);
}
-
+
virtual void onDrawContent(SkCanvas* canvas) {
this->init();
canvas->translate(SkIntToScalar(50), SkIntToScalar(50));
@@ -194,20 +194,20 @@ protected:
canvas->translate(SkIntToScalar(200), 0);
}
canvas->restore();
-
+
canvas->translate(0, SkIntToScalar(200));
}
-
+
this->nextStroke();
this->inval(NULL);
}
-
+
virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y) {
fShowHairline = !fShowHairline;
this->inval(NULL);
return this->INHERITED::onFindClickHandler(x, y);
}
-
+
private:
typedef SampleView INHERITED;
};