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

Unified Diff: samplecode/SamplePatch.cpp

Issue 446913002: parameterize tesselation params (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SamplePatch.cpp
diff --git a/samplecode/SamplePatch.cpp b/samplecode/SamplePatch.cpp
index d3ae71ac80b737260b3cd8ba487cdccdfa820239..83849a091e3ec535000d70e5e645e07eb9a498de 100644
--- a/samplecode/SamplePatch.cpp
+++ b/samplecode/SamplePatch.cpp
@@ -206,16 +206,15 @@ void Patch::draw(SkCanvas* canvas, const SkPaint& paint, int nu, int nv,
static void drawpatches(SkCanvas* canvas, const SkPaint& paint, int nu, int nv,
Patch* patch) {
-
SkAutoCanvasRestore ar(canvas, true);
- patch->draw(canvas, paint, 10, 10, false, false);
+ patch->draw(canvas, paint, nu, nv, false, false);
canvas->translate(SkIntToScalar(180), 0);
- patch->draw(canvas, paint, 10, 10, true, false);
+ patch->draw(canvas, paint, nu, nv, true, false);
canvas->translate(SkIntToScalar(180), 0);
- patch->draw(canvas, paint, 10, 10, false, true);
+ patch->draw(canvas, paint, nu, nv, false, true);
canvas->translate(SkIntToScalar(180), 0);
- patch->draw(canvas, paint, 10, 10, true, true);
+ patch->draw(canvas, paint, nu, nv, true, true);
}
const SkScalar DX = 20;
@@ -270,6 +269,9 @@ protected:
}
virtual void onDrawContent(SkCanvas* canvas) {
+ const int nu = 10;
+ const int nv = 10;
+
SkPaint paint;
paint.setDither(true);
paint.setFilterLevel(SkPaint::kLow_FilterLevel);
@@ -288,7 +290,7 @@ protected:
patch.setBounds(fSize0.fX, fSize0.fY);
patch.setPatch(fPts);
- drawpatches(canvas, paint, 10, 10, &patch);
+ drawpatches(canvas, paint, nu, nv, &patch);
paint.setShader(NULL);
paint.setAntiAlias(true);
@@ -299,13 +301,13 @@ protected:
paint.setAntiAlias(false);
paint.setShader(fShader1);
- {
+ if (true) {
SkMatrix m;
m.setSkew(1, 0);
SkShader* s = SkShader::CreateLocalMatrixShader(paint.getShader(), m);
paint.setShader(s)->unref();
}
- {
+ if (true) {
static int gAngle;
SkMatrix m;
m.setRotate(SkIntToScalar(gAngle++));
@@ -313,7 +315,7 @@ protected:
paint.setShader(s)->unref();
}
patch.setBounds(fSize1.fX, fSize1.fY);
- drawpatches(canvas, paint, 10, 10, &patch);
+ drawpatches(canvas, paint, nu, nv, &patch);
this->inval(NULL);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698