这篇教程C++ testSimplify函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中testSimplify函数的典型用法代码示例。如果您正苦于以下问题:C++ testSimplify函数的具体用法?C++ testSimplify怎么用?C++ testSimplify使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了testSimplify函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: testSimplifyQuadralateralsMainstatic void testSimplifyQuadralateralsMain(PathOpsThreadState* data){ SkASSERT(data); PathOpsThreadState& state = *data; char pathStr[1024]; sk_bzero(pathStr, sizeof(pathStr)); int ax = state.fA & 0x03; int ay = state.fA >> 2; int bx = state.fB & 0x03; int by = state.fB >> 2; int cx = state.fC & 0x03; int cy = state.fC >> 2; int dx = state.fD & 0x03; int dy = state.fD >> 2; for (int e = 0 ; e < 16; ++e) { int ex = e & 0x03; int ey = e >> 2; for (int f = e ; f < 16; ++f) { int fx = f & 0x03; int fy = f >> 2; for (int g = f ; g < 16; ++g) { int gx = g & 0x03; int gy = g >> 2; for (int h = g ; h < 16; ++h) { int hx = h & 0x03; int hy = h >> 2; SkPath path, out; path.setFillType(SkPath::kWinding_FillType); path.moveTo(SkIntToScalar(ax), SkIntToScalar(ay)); path.lineTo(SkIntToScalar(bx), SkIntToScalar(by)); path.lineTo(SkIntToScalar(cx), SkIntToScalar(cy)); path.lineTo(SkIntToScalar(dx), SkIntToScalar(dy)); path.close(); path.moveTo(SkIntToScalar(ex), SkIntToScalar(ey)); path.lineTo(SkIntToScalar(fx), SkIntToScalar(fy)); path.lineTo(SkIntToScalar(gx), SkIntToScalar(gy)); path.lineTo(SkIntToScalar(hx), SkIntToScalar(hy)); path.close(); // gdb: set print elements 400 char* str = pathStr; str += sprintf(str, " path.moveTo(%d, %d);/n", ax, ay); str += sprintf(str, " path.lineTo(%d, %d);/n", bx, by); str += sprintf(str, " path.lineTo(%d, %d);/n", cx, cy); str += sprintf(str, " path.lineTo(%d, %d);/n", dx, dy); str += sprintf(str, " path.close();/n"); str += sprintf(str, " path.moveTo(%d, %d);/n", ex, ey); str += sprintf(str, " path.lineTo(%d, %d);/n", fx, fy); str += sprintf(str, " path.lineTo(%d, %d);/n", gx, gy); str += sprintf(str, " path.lineTo(%d, %d);/n", hx, hy); str += sprintf(str, " path.close();/n"); outputProgress(state.fPathStr, pathStr, SkPath::kWinding_FillType); testSimplify(path, false, out, state, pathStr); path.setFillType(SkPath::kEvenOdd_FillType); outputProgress(state.fPathStr, pathStr, SkPath::kEvenOdd_FillType); testSimplify(path, true, out, state, pathStr); } } } }}
开发者ID:SimonSapin,项目名称:skia,代码行数:60,
示例2: testSimplifyDegeneratesMainstatic void testSimplifyDegeneratesMain(PathOpsThreadState* data) { SkASSERT(data); PathOpsThreadState& state = *data; char pathStr[1024]; bool progress = state.fReporter->verbose(); // FIXME: break out into its own parameter? if (progress) { sk_bzero(pathStr, sizeof(pathStr)); } int ax = state.fA & 0x03; int ay = state.fA >> 2; int bx = state.fB & 0x03; int by = state.fB >> 2; int cx = state.fC & 0x03; int cy = state.fC >> 2; for (int d = 0; d < 16; ++d) { int dx = d & 0x03; int dy = d >> 2; for (int e = d ; e < 16; ++e) { int ex = e & 0x03; int ey = e >> 2; for (int f = d ; f < 16; ++f) { int fx = f & 0x03; int fy = f >> 2; if (state.fD && (ex - dx) * (fy - dy) != (ey - dy) * (fx - dx)) { continue; } SkPath path, out; path.setFillType(SkPath::kWinding_FillType); path.moveTo(SkIntToScalar(ax), SkIntToScalar(ay)); path.lineTo(SkIntToScalar(bx), SkIntToScalar(by)); path.lineTo(SkIntToScalar(cx), SkIntToScalar(cy)); path.close(); path.moveTo(SkIntToScalar(dx), SkIntToScalar(dy)); path.lineTo(SkIntToScalar(ex), SkIntToScalar(ey)); path.lineTo(SkIntToScalar(fx), SkIntToScalar(fy)); path.close(); if (progress) { char* str = pathStr; str += sprintf(str, " path.moveTo(%d, %d);/n", ax, ay); str += sprintf(str, " path.lineTo(%d, %d);/n", bx, by); str += sprintf(str, " path.lineTo(%d, %d);/n", cx, cy); str += sprintf(str, " path.close();/n"); str += sprintf(str, " path.moveTo(%d, %d);/n", dx, dy); str += sprintf(str, " path.lineTo(%d, %d);/n", ex, ey); str += sprintf(str, " path.lineTo(%d, %d);/n", fx, fy); str += sprintf(str, " path.close();/n"); outputProgress(state.fPathStr, pathStr, SkPath::kWinding_FillType); } testSimplify(path, false, out, state, pathStr); path.setFillType(SkPath::kEvenOdd_FillType); if (progress) { outputProgress(state.fPathStr, pathStr, SkPath::kEvenOdd_FillType); } testSimplify(path, true, out, state, pathStr); } } }}
开发者ID:brianwoo,项目名称:cm11_grouper,代码行数:59,
示例3: testSimplifyQuadratic3static void testSimplifyQuadratic3() { SkPath path, out; path.moveTo(0, 0); path.quadTo(20, 0, 20, 20); path.close(); path.moveTo(0, 20); path.quadTo(0, 0, 20, 0); path.close(); testSimplify(path, true, out, bitmap);}
开发者ID:Adenilson,项目名称:skia,代码行数:10,
示例4: testSimplifyQuadratic4static void testSimplifyQuadratic4() { SkPath path, out; path.moveTo(0, 20); path.quadTo(20, 0, 40, 20); path.close(); path.moveTo(40, 10); path.quadTo(20, 30, 0, 10); path.close(); testSimplify(path, true, out, bitmap); drawAsciiPaths(path, out, true);}
开发者ID:Adenilson,项目名称:skia,代码行数:11,
示例5: testSimplifyTriangle24static void testSimplifyTriangle24() { SkPath path, out; path.moveTo(0, 0); path.lineTo(0, 0); path.lineTo(0, 1); path.close(); path.moveTo(0, 0); path.lineTo(1, 0); path.lineTo(0, 1); path.close(); testSimplify(path, true, out, bitmap);}
开发者ID:Adenilson,项目名称:skia,代码行数:12,
示例6: testSimplifyDegenerateTriangle2static void testSimplifyDegenerateTriangle2() { SkPath path, out; path.moveTo(0, 0); path.lineTo(1, 1); path.lineTo(2, 2); path.close(); path.moveTo(1, 0); path.lineTo(2, 2); path.lineTo(3, 3); path.close(); testSimplify(path, true, out, bitmap);}
开发者ID:Adenilson,项目名称:skia,代码行数:12,
示例7: testSimplifyTriangle2static void testSimplifyTriangle2() { SkPath path, out; path.setFillType(SkPath::kWinding_FillType); path.moveTo(10,10); // triangle |/ . path.lineTo(10,30); // |_/ . path.lineTo(20,30); path.close(); path.moveTo(10,10); // triangle _ path.lineTo(20,10); // / | path.lineTo(20,30); // /| path.close(); // _ testSimplify(path, true, out, bitmap); // expect | |} // |_|
开发者ID:Adenilson,项目名称:skia,代码行数:13,
示例8: testSimplifyTriangle19static void testSimplifyTriangle19() { SkPath path, out; path.setFillType(SkPath::kEvenOdd_FillType); path.moveTo(0, 0); path.lineTo(0, 1); path.lineTo(3, 2); path.close(); path.moveTo(0, 0); path.lineTo(1, 1); path.lineTo(2, 1); path.close(); testSimplify(path, true, out, bitmap);}
开发者ID:Adenilson,项目名称:skia,代码行数:13,
示例9: testSimplifyQuadratic8static void testSimplifyQuadratic8() { SkPath path, out; path.moveTo(0, 0); path.quadTo(0, 0, 0, 0); path.lineTo(0, 0); path.close(); path.moveTo(0, 0); path.lineTo(0, 0); path.quadTo(1, 0, 0, 2); path.close(); testSimplify(path, true, out, bitmap); drawAsciiPaths(path, out, true);}
开发者ID:Adenilson,项目名称:skia,代码行数:13,
示例10: testSimplifyXorParallelogramstatic void testSimplifyXorParallelogram() { SkPath path, out; path.setFillType(SkPath::kEvenOdd_FillType); path.moveTo(20,10); // parallelogram _ path.lineTo(30,30); // / / . path.lineTo(40,30); // /_/ . path.lineTo(30,10); path.close(); path.moveTo(20,10); // parallelogram _ path.lineTo(10,30); // / / path.lineTo(20,30); // /_/ path.lineTo(30,10); path.close(); testSimplify(path, true, out, bitmap); // expect _} // / /
开发者ID:Adenilson,项目名称:skia,代码行数:15,
示例11: testSimplifyQuadsMainstatic void testSimplifyQuadsMain(PathOpsThreadState* data){ SkASSERT(data); PathOpsThreadState& state = *data; char pathStr[1024]; bool progress = state.fReporter->verbose(); // FIXME: break out into its own parameter? if (progress) { sk_bzero(pathStr, sizeof(pathStr)); } int ax = state.fA & 0x03; int ay = state.fA >> 2; int bx = state.fB & 0x03; int by = state.fB >> 2; int cx = state.fC & 0x03; int cy = state.fC >> 2; int dx = state.fD & 0x03; int dy = state.fD >> 2; for (int e = 0 ; e < 16; ++e) { int ex = e & 0x03; int ey = e >> 2; for (int f = e ; f < 16; ++f) { int fx = f & 0x03; int fy = f >> 2; for (int g = f ; g < 16; ++g) { int gx = g & 0x03; int gy = g >> 2; for (int h = g ; h < 16; ++h) { int hx = h & 0x03; int hy = h >> 2; SkPath path, out; path.setFillType(SkPath::kWinding_FillType); path.moveTo(SkIntToScalar(ax), SkIntToScalar(ay)); path.quadTo(SkIntToScalar(bx), SkIntToScalar(by), SkIntToScalar(cx), SkIntToScalar(cy)); path.lineTo(SkIntToScalar(dx), SkIntToScalar(dy)); path.close(); path.moveTo(SkIntToScalar(ex), SkIntToScalar(ey)); path.lineTo(SkIntToScalar(fx), SkIntToScalar(fy)); path.quadTo(SkIntToScalar(gx), SkIntToScalar(gy), SkIntToScalar(hx), SkIntToScalar(hy)); path.close(); if (progress) { static int quadTest = 66; char* str = pathStr; str += sprintf(str, "static void testQuads%d(skiatest::Reporter* reporter," "const char* filename) {/n", quadTest); str += sprintf(str, " SkPath path;/n"); str += sprintf(str, " path.moveTo(%d, %d);/n", ax, ay); str += sprintf(str, " path.quadTo(%d, %d, %d, %d);/n", bx, by, cx, cy); str += sprintf(str, " path.lineTo(%d, %d);/n", dx, dy); str += sprintf(str, " path.close();/n"); str += sprintf(str, " path.moveTo(%d, %d);/n", ex, ey); str += sprintf(str, " path.lineTo(%d, %d);/n", fx, fy); str += sprintf(str, " path.quadTo(%d, %d, %d, %d);/n", gx, gy, hx, hy); str += sprintf(str, " path.close();/n"); str += sprintf(str, " testSimplify(reporter, path, filename);/n"); str += sprintf(str, "}/n"); outputProgress(state.fPathStr, pathStr, SkPath::kWinding_FillType); } testSimplify(path, false, out, state, pathStr); path.setFillType(SkPath::kEvenOdd_FillType); if (progress) { outputProgress(state.fPathStr, pathStr, SkPath::kEvenOdd_FillType); } testSimplify(path, true, out, state, pathStr); } } } }}
开发者ID:mariospr,项目名称:chromium-browser,代码行数:70,
示例12: testSimplify4x4RectsMainstatic void testSimplify4x4RectsMain(PathOpsThreadState* data){ SkASSERT(data); PathOpsThreadState& state = *data; char pathStr[1024]; // gdb: set print elements 400 bool progress = state.fReporter->verbose(); // FIXME: break out into its own parameter? if (progress) { sk_bzero(pathStr, sizeof(pathStr)); } int aShape = state.fA & 0x03; SkPath::Direction aCW = state.fA >> 2 ? SkPath::kCCW_Direction : SkPath::kCW_Direction; int bShape = state.fB & 0x03; SkPath::Direction bCW = state.fB >> 2 ? SkPath::kCCW_Direction : SkPath::kCW_Direction; int cShape = state.fC & 0x03; SkPath::Direction cCW = state.fC >> 2 ? SkPath::kCCW_Direction : SkPath::kCW_Direction; int dShape = state.fD & 0x03; SkPath::Direction dCW = state.fD >> 2 ? SkPath::kCCW_Direction : SkPath::kCW_Direction; for (int aXAlign = 0; aXAlign < 5; ++aXAlign) { for (int aYAlign = 0; aYAlign < 5; ++aYAlign) { for (int bXAlign = 0; bXAlign < 5; ++bXAlign) { for (int bYAlign = 0; bYAlign < 5; ++bYAlign) { for (int cXAlign = 0; cXAlign < 5; ++cXAlign) { for (int cYAlign = 0; cYAlign < 5; ++cYAlign) { for (int dXAlign = 0; dXAlign < 5; ++dXAlign) { for (int dYAlign = 0; dYAlign < 5; ++dYAlign) { SkPath path, out; char* str = pathStr; path.setFillType(SkPath::kWinding_FillType); int l, t, r, b; if (aShape) { switch (aShape) { case 1: // square l = 0; r = 60; t = 0; b = 60; aXAlign = 5; aYAlign = 5; break; case 2: l = aXAlign * 12; r = l + 30; t = 0; b = 60; aYAlign = 5; break; case 3: l = 0; r = 60; t = aYAlign * 12; b = l + 30; aXAlign = 5; break; } path.addRect(SkIntToScalar(l), SkIntToScalar(t), SkIntToScalar(r), SkIntToScalar(b), aCW); if (progress) { str += sprintf(str, " path.addRect(%d, %d, %d, %d," " SkPath::kC%sW_Direction);/n", l, t, r, b, aCW ? "C" : ""); } } else { aXAlign = 5; aYAlign = 5; } if (bShape) { switch (bShape) { case 1: // square l = bXAlign * 10; r = l + 20; t = bYAlign * 10; b = l + 20; break; case 2: l = bXAlign * 10; r = l + 20; t = 10; b = 40; bYAlign = 5; break; case 3: l = 10; r = 40; t = bYAlign * 10; b = l + 20; bXAlign = 5; break; } path.addRect(SkIntToScalar(l), SkIntToScalar(t), SkIntToScalar(r), SkIntToScalar(b), bCW); if (progress) { str += sprintf(str, " path.addRect(%d, %d, %d, %d," " SkPath::kC%sW_Direction);/n", l, t, r, b, bCW ? "C" : ""); } } else { bXAlign = 5; bYAlign = 5; } if (cShape) { switch (cShape) { case 1: // square l = cXAlign * 6; r = l + 12; t = cYAlign * 6; b = l + 12; break; case 2://.........这里部分代码省略.........
开发者ID:Adenilson,项目名称:skia,代码行数:101,
示例13: testSimplify4x4RectsMainstatic void testSimplify4x4RectsMain(PathOpsThreadState* data){ SkASSERT(data); PathOpsThreadState& state = *data; int aShape = state.fA & 0x03; SkPath::Direction aCW = state.fA >> 2 ? SkPath::kCCW_Direction : SkPath::kCW_Direction; int bShape = state.fB & 0x03; SkPath::Direction bCW = state.fB >> 2 ? SkPath::kCCW_Direction : SkPath::kCW_Direction; int cShape = state.fC & 0x03; SkPath::Direction cCW = state.fC >> 2 ? SkPath::kCCW_Direction : SkPath::kCW_Direction; int dShape = state.fD & 0x03; SkPath::Direction dCW = state.fD >> 2 ? SkPath::kCCW_Direction : SkPath::kCW_Direction; for (int aXAlign = 0; aXAlign < 5; ++aXAlign) { for (int aYAlign = 0; aYAlign < 5; ++aYAlign) { for (int bXAlign = 0; bXAlign < 5; ++bXAlign) { for (int bYAlign = 0; bYAlign < 5; ++bYAlign) { for (int cXAlign = 0; cXAlign < 5; ++cXAlign) { for (int cYAlign = 0; cYAlign < 5; ++cYAlign) { for (int dXAlign = 0; dXAlign < 5; ++dXAlign) { for (int dYAlign = 0; dYAlign < 5; ++dYAlign) { SkString pathStr; SkPath path, out; path.setFillType(SkPath::kWinding_FillType); int l SK_INIT_TO_AVOID_WARNING, t SK_INIT_TO_AVOID_WARNING, r SK_INIT_TO_AVOID_WARNING, b SK_INIT_TO_AVOID_WARNING; if (aShape) { switch (aShape) { case 1: // square l = 0; r = 60; t = 0; b = 60; aXAlign = 5; aYAlign = 5; break; case 2: l = aXAlign * 12; r = l + 30; t = 0; b = 60; aYAlign = 5; break; case 3: l = 0; r = 60; t = aYAlign * 12; b = l + 30; aXAlign = 5; break; } path.addRect(SkIntToScalar(l), SkIntToScalar(t), SkIntToScalar(r), SkIntToScalar(b), aCW); if (state.fReporter->verbose()) { pathStr.appendf(" path.addRect(%d, %d, %d, %d," " SkPath::kC%sW_Direction);/n", l, t, r, b, aCW ? "C" : ""); } } else { aXAlign = 5; aYAlign = 5; } if (bShape) { switch (bShape) { case 1: // square l = bXAlign * 10; r = l + 20; t = bYAlign * 10; b = l + 20; break; case 2: l = bXAlign * 10; r = l + 20; t = 10; b = 40; bYAlign = 5; break; case 3: l = 10; r = 40; t = bYAlign * 10; b = l + 20; bXAlign = 5; break; } path.addRect(SkIntToScalar(l), SkIntToScalar(t), SkIntToScalar(r), SkIntToScalar(b), bCW); if (state.fReporter->verbose()) { pathStr.appendf(" path.addRect(%d, %d, %d, %d," " SkPath::kC%sW_Direction);/n", l, t, r, b, bCW ? "C" : ""); } } else { bXAlign = 5; bYAlign = 5; } if (cShape) { switch (cShape) { case 1: // square l = cXAlign * 6; r = l + 12; t = cYAlign * 6; b = l + 12; break; case 2: l = cXAlign * 6; r = l + 12; t = 20; b = 30; cYAlign = 5;//.........这里部分代码省略.........
开发者ID:MIPS,项目名称:external-skia,代码行数:101,
示例14: testSimplifyQuadralateralsMainstatic void testSimplifyQuadralateralsMain(PathOpsThreadState* data){ SkASSERT(data); PathOpsThreadState& state = *data; SkString pathStr; int ax = state.fA & 0x03; int ay = state.fA >> 2; int bx = state.fB & 0x03; int by = state.fB >> 2; int cx = state.fC & 0x03; int cy = state.fC >> 2; int dx = state.fD & 0x03; int dy = state.fD >> 2; for (int e = 0 ; e < 16; ++e) { int ex = e & 0x03; int ey = e >> 2; for (int f = e ; f < 16; ++f) { int fx = f & 0x03; int fy = f >> 2; for (int g = f ; g < 16; ++g) { int gx = g & 0x03; int gy = g >> 2; for (int h = g ; h < 16; ++h) { int hx = h & 0x03; int hy = h >> 2; SkPath path, out; path.setFillType(SkPath::kWinding_FillType); path.moveTo(SkIntToScalar(ax), SkIntToScalar(ay)); path.lineTo(SkIntToScalar(bx), SkIntToScalar(by)); path.lineTo(SkIntToScalar(cx), SkIntToScalar(cy)); path.lineTo(SkIntToScalar(dx), SkIntToScalar(dy)); path.close(); path.moveTo(SkIntToScalar(ex), SkIntToScalar(ey)); path.lineTo(SkIntToScalar(fx), SkIntToScalar(fy)); path.lineTo(SkIntToScalar(gx), SkIntToScalar(gy)); path.lineTo(SkIntToScalar(hx), SkIntToScalar(hy)); path.close(); if (state.fReporter->verbose()) { pathStr.printf("static void quadralateralSimplify%d(skiatest::Reporter*" "reporter, const char* filename) {/n", loopNo); pathStr.appendf(" SkPath path;/n"); pathStr.appendf(" path.moveTo(%d, %d);/n", ax, ay); pathStr.appendf(" path.lineTo(%d, %d);/n", bx, by); pathStr.appendf(" path.lineTo(%d, %d);/n", cx, cy); pathStr.appendf(" path.lineTo(%d, %d);/n", dx, dy); pathStr.appendf(" path.close();/n"); pathStr.appendf(" path.moveTo(%d, %d);/n", ex, ey); pathStr.appendf(" path.lineTo(%d, %d);/n", fx, fy); pathStr.appendf(" path.lineTo(%d, %d);/n", gx, gy); pathStr.appendf(" path.lineTo(%d, %d);/n", hx, hy); pathStr.appendf(" path.close();/n"); pathStr.appendf(" testPathSimplify(reporter, path, filename);/n"); pathStr.appendf("}/n"); outputProgress(state.fPathStr, pathStr.c_str(), SkPath::kWinding_FillType); } testSimplify(path, false, out, state, pathStr.c_str()); path.setFillType(SkPath::kEvenOdd_FillType); if (state.fReporter->verbose()) { outputProgress(state.fPathStr, pathStr.c_str(), SkPath::kEvenOdd_FillType); } testSimplify(path, true, out, state, pathStr.c_str()); } } } }}
开发者ID:aseprite,项目名称:skia,代码行数:66,
注:本文中的testSimplify函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ testStart函数代码示例 C++ testRuleOnObjCCode函数代码示例 |