180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* 280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Copyright 2011 Google Inc. 380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * 480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Use of this source code is governed by a BSD-style license that can be 580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * found in the LICENSE file. 680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */ 780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "gm.h" 880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkCanvas.h" 980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkPaint.h" 1080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkRandom.h" 1180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 1280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querunamespace skiagm { 1380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 1480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass DegenerateSegmentsGM : public GM { 1580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic: 1680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru DegenerateSegmentsGM() {} 1780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 1880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprotected: 1980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru struct PathAndName { 2080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPath fPath; 2180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru const char* fName1; 2280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru const char* fName2; 2380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru }; 2480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 2580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkString onShortName() { 2680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return SkString("degeneratesegments"); 2780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 2880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 2980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkISize onISize() { return make_isize(896, 930); } 3080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 3180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru typedef SkPoint (*AddSegmentFunc)(SkPath&, SkPoint&); 3280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 3380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // We need to use explicit commands here, instead of addPath, because we 3480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // do not want the moveTo that is added at the beginning of a path to 3580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // appear in the appended path. 3680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static SkPoint AddMove(SkPath& path, SkPoint& startPt) { 3780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint moveToPt = startPt + SkPoint::Make(0, 10*SK_Scalar1); 3880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.moveTo(moveToPt); 3980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return moveToPt; 4080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 4180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 4280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static SkPoint AddMoveClose(SkPath& path, SkPoint& startPt) { 4380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint moveToPt = startPt + SkPoint::Make(0, 10*SK_Scalar1); 4480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.moveTo(moveToPt); 4580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.close(); 4680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return moveToPt; 4780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 4880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 4980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static SkPoint AddDegenLine(SkPath& path, SkPoint& startPt) { 5080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.lineTo(startPt); 5180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return startPt; 5280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 5380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 5480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static SkPoint AddMoveDegenLine(SkPath& path, SkPoint& startPt) { 5580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint moveToPt = startPt + SkPoint::Make(0, 10*SK_Scalar1); 5680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.moveTo(moveToPt); 5780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.lineTo(moveToPt); 5880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return moveToPt; 5980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 6080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 6180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static SkPoint AddMoveDegenLineClose(SkPath& path, SkPoint& startPt) { 6280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint moveToPt = startPt + SkPoint::Make(0, 10*SK_Scalar1); 6380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.moveTo(moveToPt); 6480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.lineTo(moveToPt); 6580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.close(); 6680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return moveToPt; 6780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 6880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 6980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static SkPoint AddDegenQuad(SkPath& path, SkPoint& startPt) { 7080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.quadTo(startPt, startPt); 7180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return startPt; 7280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 7380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 7480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static SkPoint AddMoveDegenQuad(SkPath& path, SkPoint& startPt) { 7580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint moveToPt = startPt + SkPoint::Make(0, 10*SK_Scalar1); 7680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.moveTo(moveToPt); 7780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.quadTo(moveToPt, moveToPt); 7880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return moveToPt; 7980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 8080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 8180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static SkPoint AddMoveDegenQuadClose(SkPath& path, SkPoint& startPt) { 8280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint moveToPt = startPt + SkPoint::Make(0, 10*SK_Scalar1); 8380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.moveTo(moveToPt); 8480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.quadTo(moveToPt, moveToPt); 8580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.close(); 8680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return moveToPt; 8780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 8880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 8980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static SkPoint AddDegenCubic(SkPath& path, SkPoint& startPt) { 9080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.cubicTo(startPt, startPt, startPt); 9180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return startPt; 9280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 9380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 9480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static SkPoint AddMoveDegenCubic(SkPath& path, SkPoint& startPt) { 9580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint moveToPt = startPt + SkPoint::Make(0, 10*SK_Scalar1); 9680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.moveTo(moveToPt); 9780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.cubicTo(moveToPt, moveToPt, moveToPt); 9880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return moveToPt; 9980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 10080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 10180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static SkPoint AddMoveDegenCubicClose(SkPath& path, SkPoint& startPt) { 10280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint moveToPt = startPt + SkPoint::Make(0, 10*SK_Scalar1); 10380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.moveTo(moveToPt); 10480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.cubicTo(moveToPt, moveToPt, moveToPt); 10580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.close(); 10680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return moveToPt; 10780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 10880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 10980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static SkPoint AddClose(SkPath& path, SkPoint& startPt) { 11080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.close(); 11180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return startPt; 11280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 11380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 11480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static SkPoint AddLine(SkPath& path, SkPoint& startPt) { 11580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint endPt = startPt + SkPoint::Make(40*SK_Scalar1, 0); 11680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.lineTo(endPt); 11780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return endPt; 11880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 11980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 12080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static SkPoint AddMoveLine(SkPath& path, SkPoint& startPt) { 12180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint moveToPt = startPt + SkPoint::Make(0, 10*SK_Scalar1); 12280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint endPt = moveToPt + SkPoint::Make(40*SK_Scalar1, 0); 12380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.moveTo(moveToPt); 12480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.lineTo(endPt); 12580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return endPt; 12680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 12780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 12880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static SkPoint AddMoveLineClose(SkPath& path, SkPoint& startPt) { 12980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint moveToPt = startPt + SkPoint::Make(0, 10*SK_Scalar1); 13080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint endPt = moveToPt + SkPoint::Make(40*SK_Scalar1, 0); 13180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.moveTo(moveToPt); 13280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.lineTo(endPt); 13380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.close(); 13480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return endPt; 13580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 13680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 13780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static SkPoint AddQuad(SkPath& path, SkPoint& startPt) { 13880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint midPt = startPt + SkPoint::Make(20*SK_Scalar1, 5*SK_Scalar1); 13980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint endPt = startPt + SkPoint::Make(40*SK_Scalar1, 0); 14080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.quadTo(midPt, endPt); 14180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return endPt; 14280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 14380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 14480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static SkPoint AddMoveQuad(SkPath& path, SkPoint& startPt) { 14580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint moveToPt = startPt + SkPoint::Make(0, 10*SK_Scalar1); 14680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint midPt = moveToPt + SkPoint::Make(20*SK_Scalar1, 5*SK_Scalar1); 14780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint endPt = moveToPt + SkPoint::Make(40*SK_Scalar1, 0); 14880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.moveTo(moveToPt); 14980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.quadTo(midPt, endPt); 15080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return endPt; 15180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 15280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 15380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static SkPoint AddMoveQuadClose(SkPath& path, SkPoint& startPt) { 15480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint moveToPt = startPt + SkPoint::Make(0, 10*SK_Scalar1); 15580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint midPt = moveToPt + SkPoint::Make(20*SK_Scalar1, 5*SK_Scalar1); 15680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint endPt = moveToPt + SkPoint::Make(40*SK_Scalar1, 0); 15780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.moveTo(moveToPt); 15880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.quadTo(midPt, endPt); 15980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.close(); 16080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return endPt; 16180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 16280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 16380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static SkPoint AddCubic(SkPath& path, SkPoint& startPt) { 16480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint t1Pt = startPt + SkPoint::Make(15*SK_Scalar1, 5*SK_Scalar1); 16580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint t2Pt = startPt + SkPoint::Make(25*SK_Scalar1, 5*SK_Scalar1); 16680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint endPt = startPt + SkPoint::Make(40*SK_Scalar1, 0); 16780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.cubicTo(t1Pt, t2Pt, endPt); 16880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return endPt; 16980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 17080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 17180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static SkPoint AddMoveCubic(SkPath& path, SkPoint& startPt) { 17280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint moveToPt = startPt + SkPoint::Make(0, 10*SK_Scalar1); 17380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint t1Pt = moveToPt + SkPoint::Make(15*SK_Scalar1, 5*SK_Scalar1); 17480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint t2Pt = moveToPt + SkPoint::Make(25*SK_Scalar1, 5*SK_Scalar1); 17580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint endPt = moveToPt + SkPoint::Make(40*SK_Scalar1, 0); 17680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.moveTo(moveToPt); 17780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.cubicTo(t1Pt, t2Pt, endPt); 17880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return endPt; 17980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 18080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 18180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static SkPoint AddMoveCubicClose(SkPath& path, SkPoint& startPt) { 18280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint moveToPt = startPt + SkPoint::Make(0, 10*SK_Scalar1); 18380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint t1Pt = moveToPt + SkPoint::Make(15*SK_Scalar1, 5*SK_Scalar1); 18480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint t2Pt = moveToPt + SkPoint::Make(25*SK_Scalar1, 5*SK_Scalar1); 18580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint endPt = moveToPt + SkPoint::Make(40*SK_Scalar1, 0); 18680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.moveTo(moveToPt); 18780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.cubicTo(t1Pt, t2Pt, endPt); 18880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.close(); 18980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return endPt; 19080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 19180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 19280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru void drawPath(SkPath& path, SkCanvas* canvas, SkColor color, 19380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru const SkRect& clip, SkPaint::Cap cap, SkPaint::Join join, 19480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPaint::Style style, SkPath::FillType fill, 19580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkScalar strokeWidth) { 19680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru path.setFillType(fill); 19780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPaint paint; 19880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru paint.setStrokeCap(cap); 19980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru paint.setStrokeWidth(strokeWidth); 20080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru paint.setStrokeJoin(join); 20180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru paint.setColor(color); 20280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru paint.setStyle(style); 20380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru canvas->save(); 20480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru canvas->clipRect(clip); 20580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru canvas->drawPath(path, paint); 20680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru canvas->restore(); 20780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 20880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 20980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual void onDraw(SkCanvas* canvas) { 21080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static const AddSegmentFunc gSegmentFunctions[] = { 21180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru AddMove, 21280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru AddMoveClose, 21380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru AddDegenLine, 21480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru AddMoveDegenLine, 21580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru AddMoveDegenLineClose, 21680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru AddDegenQuad, 21780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru AddMoveDegenQuad, 21880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru AddMoveDegenQuadClose, 21980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru AddDegenCubic, 22080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru AddMoveDegenCubic, 22180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru AddMoveDegenCubicClose, 22280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru AddClose, 22380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru AddLine, 22480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru AddMoveLine, 22580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru AddMoveLineClose, 22680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru AddQuad, 22780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru AddMoveQuad, 22880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru AddMoveQuadClose, 22980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru AddCubic, 23080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru AddMoveCubic, 23180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru AddMoveCubicClose 23280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru }; 23380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static const char* gSegmentNames[] = { 23480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "Move", 23580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "MoveClose", 23680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "DegenLine", 23780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "MoveDegenLine", 23880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "MoveDegenLineClose", 23980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "DegenQuad", 24080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "MoveDegenQuad", 24180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "MoveDegenQuadClose", 24280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "DegenCubic", 24380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "MoveDegenCubic", 24480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "MoveDegenCubicClose", 24580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "Close", 24680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "Line", 24780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "MoveLine", 24880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "MoveLineClose", 24980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "Quad", 25080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "MoveQuad", 25180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "MoveQuadClose", 25280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "Cubic", 25380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "MoveCubic", 25480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "MoveCubicClose" 25580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru }; 25680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 25780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru struct FillAndName { 25880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPath::FillType fFill; 25980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru const char* fName; 26080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru }; 26180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static const FillAndName gFills[] = { 26280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru {SkPath::kWinding_FillType, "Winding"}, 26380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru {SkPath::kEvenOdd_FillType, "Even / Odd"}, 26480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru {SkPath::kInverseWinding_FillType, "Inverse Winding"}, 26580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru {SkPath::kInverseEvenOdd_FillType, "Inverse Even / Odd"} 26680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru }; 26780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru struct StyleAndName { 26880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPaint::Style fStyle; 26980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru const char* fName; 27080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru }; 27180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static const StyleAndName gStyles[] = { 27280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru {SkPaint::kFill_Style, "Fill"}, 27380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru {SkPaint::kStroke_Style, "Stroke 10"}, 27480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru {SkPaint::kStrokeAndFill_Style, "Stroke 10 And Fill"} 27580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru }; 27680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru struct CapAndName { 27780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPaint::Cap fCap; 27880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPaint::Join fJoin; 27980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru const char* fName; 28080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru }; 28180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static const CapAndName gCaps[] = { 28280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru {SkPaint::kButt_Cap, SkPaint::kBevel_Join, "Butt"}, 28380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru {SkPaint::kRound_Cap, SkPaint::kRound_Join, "Round"}, 28480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru {SkPaint::kSquare_Cap, SkPaint::kBevel_Join, "Square"} 28580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru }; 28680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 28780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPaint titlePaint; 28880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru titlePaint.setColor(SK_ColorBLACK); 28980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru titlePaint.setAntiAlias(true); 29080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru titlePaint.setLCDRenderText(true); 29180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru titlePaint.setTextSize(15 * SK_Scalar1); 29280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru const char title[] = "Random Paths Drawn Into Rectangle Clips With " 29380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "Indicated Style, Fill and Linecaps, " 29480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "with Stroke width 6"; 29580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru canvas->drawText(title, strlen(title), 29680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 20 * SK_Scalar1, 29780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 20 * SK_Scalar1, 29880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru titlePaint); 29980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 30080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkRandom rand; 30180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkRect rect = SkRect::MakeWH(220*SK_Scalar1, 50*SK_Scalar1); 30280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru canvas->save(); 30380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru canvas->translate(2*SK_Scalar1, 30 * SK_Scalar1); // The title 30480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru canvas->save(); 30580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru unsigned numSegments = SK_ARRAY_COUNT(gSegmentFunctions); 30680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru unsigned numCaps = SK_ARRAY_COUNT(gCaps); 30780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru unsigned numStyles = SK_ARRAY_COUNT(gStyles); 30880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru unsigned numFills = SK_ARRAY_COUNT(gFills); 30980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru for (size_t row = 0; row < 6; ++row) { 31080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru if (0 < row) { 31180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru canvas->translate(0, rect.height() + 100*SK_Scalar1); 31280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 31380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru canvas->save(); 31480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru for (size_t column = 0; column < 4; ++column) { 31580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru if (0 < column) { 31680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru canvas->translate(rect.width() + 4*SK_Scalar1, 0); 31780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 31880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 31980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkColor color = 0xff007000; 32080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru StyleAndName style = gStyles[(rand.nextU() >> 16) % numStyles]; 32180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru CapAndName cap = gCaps[(rand.nextU() >> 16) % numCaps]; 32280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru FillAndName fill = gFills[(rand.nextU() >> 16) % numFills]; 32380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPath path; 32480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru unsigned s1 = (rand.nextU() >> 16) % numSegments; 32580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru unsigned s2 = (rand.nextU() >> 16) % numSegments; 32680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru unsigned s3 = (rand.nextU() >> 16) % numSegments; 32780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru unsigned s4 = (rand.nextU() >> 16) % numSegments; 32880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru unsigned s5 = (rand.nextU() >> 16) % numSegments; 32980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPoint pt = SkPoint::Make(10*SK_Scalar1, 0); 33080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru pt = gSegmentFunctions[s1](path, pt); 33180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru pt = gSegmentFunctions[s2](path, pt); 33280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru pt = gSegmentFunctions[s3](path, pt); 33380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru pt = gSegmentFunctions[s4](path, pt); 33480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru pt = gSegmentFunctions[s5](path, pt); 33580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 33680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru this->drawPath(path, canvas, color, rect, 33780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru cap.fCap, cap.fJoin, style.fStyle, 33880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru fill.fFill, SK_Scalar1*6); 33980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 34080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPaint rectPaint; 34180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru rectPaint.setColor(SK_ColorBLACK); 34280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru rectPaint.setStyle(SkPaint::kStroke_Style); 34380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru rectPaint.setStrokeWidth(-1); 34480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru rectPaint.setAntiAlias(true); 34580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru canvas->drawRect(rect, rectPaint); 34680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 34780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPaint labelPaint; 34880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru labelPaint.setColor(color); 34980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru labelPaint.setAntiAlias(true); 35080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru labelPaint.setLCDRenderText(true); 35180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru labelPaint.setTextSize(10 * SK_Scalar1); 35280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru canvas->drawText(style.fName, 35380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru strlen(style.fName), 35480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 0, rect.height() + 12 * SK_Scalar1, 35580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru labelPaint); 35680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru canvas->drawText(fill.fName, 35780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru strlen(fill.fName), 35880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 0, rect.height() + 24 * SK_Scalar1, 35980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru labelPaint); 36080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru canvas->drawText(cap.fName, 36180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru strlen(cap.fName), 36280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 0, rect.height() + 36 * SK_Scalar1, 36380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru labelPaint); 36480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru canvas->drawText(gSegmentNames[s1], 36580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru strlen(gSegmentNames[s1]), 36680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 0, rect.height() + 48 * SK_Scalar1, 36780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru labelPaint); 36880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru canvas->drawText(gSegmentNames[s2], 36980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru strlen(gSegmentNames[s2]), 37080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 0, rect.height() + 60 * SK_Scalar1, 37180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru labelPaint); 37280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru canvas->drawText(gSegmentNames[s3], 37380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru strlen(gSegmentNames[s3]), 37480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 0, rect.height() + 72 * SK_Scalar1, 37580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru labelPaint); 37680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru canvas->drawText(gSegmentNames[s4], 37780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru strlen(gSegmentNames[s4]), 37880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 0, rect.height() + 84 * SK_Scalar1, 37980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru labelPaint); 38080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru canvas->drawText(gSegmentNames[s5], 38180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru strlen(gSegmentNames[s5]), 38280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 0, rect.height() + 96 * SK_Scalar1, 38380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru labelPaint); 38480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 38580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru canvas->restore(); 38680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 38780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru canvas->restore(); 38880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru canvas->restore(); 38980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 39080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 39180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprivate: 39280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru typedef GM INHERITED; 39380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru}; 39480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 39580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru////////////////////////////////////////////////////////////////////////////// 39680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 39780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic GM* MyFactory(void*) { return new DegenerateSegmentsGM; } 39880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic GMRegistry reg(MyFactory); 39980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 40080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 401