SampleVertices.cpp revision 64cc579efa7e416c7298ed159d76b074b283c0f9
18a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SampleCode.h"
28a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkView.h"
38a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkCanvas.h"
48a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkGradientShader.h"
58a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkGraphics.h"
68a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkImageDecoder.h"
78a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkPath.h"
88a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkRandom.h"
98a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkRegion.h"
108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkShader.h"
118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkUtils.h"
128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkXfermode.h"
138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkColorPriv.h"
148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkColorFilter.h"
158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkTime.h"
168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkTypeface.h"
178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkOSFile.h"
198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkStream.h"
208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkNinePatch.h"
218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comstatic SkShader* make_shader0(SkIPoint* size) {
238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkBitmap    bm;
248295dc1474db279df08d816b2115e807c681fad5bsalomon@google.com    size->set(2, 2);
258295dc1474db279df08d816b2115e807c681fad5bsalomon@google.com    bm.setConfig(SkBitmap::kARGB_8888_Config, size->fX, size->fY);
268295dc1474db279df08d816b2115e807c681fad5bsalomon@google.com    SkPMColor color0 = SkPreMultiplyARGB(0x80, 0x80, 0xff, 0x80);
278295dc1474db279df08d816b2115e807c681fad5bsalomon@google.com    SkPMColor color1 = SkPreMultiplyARGB(0x40, 0xff, 0x00, 0xff);
288295dc1474db279df08d816b2115e807c681fad5bsalomon@google.com    bm.allocPixels();
298295dc1474db279df08d816b2115e807c681fad5bsalomon@google.com    bm.eraseColor(color0);
308295dc1474db279df08d816b2115e807c681fad5bsalomon@google.com    bm.lockPixels();
318295dc1474db279df08d816b2115e807c681fad5bsalomon@google.com    uint32_t* pixels = (uint32_t*) bm.getPixels();
328295dc1474db279df08d816b2115e807c681fad5bsalomon@google.com    pixels[0] = pixels[2] = color0;
338295dc1474db279df08d816b2115e807c681fad5bsalomon@google.com    pixels[1] = pixels[3] = color1;
348295dc1474db279df08d816b2115e807c681fad5bsalomon@google.com    bm.unlockPixels();
3582065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
368295dc1474db279df08d816b2115e807c681fad5bsalomon@google.com    return SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode,
378295dc1474db279df08d816b2115e807c681fad5bsalomon@google.com                                            SkShader::kRepeat_TileMode);
388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}
398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comstatic SkShader* make_shader1(const SkIPoint& size) {
4164cc579efa7e416c7298ed159d76b074b283c0f9senorblanco@chromium.org    SkPoint pts[] = { { 0, 0 },
4264cc579efa7e416c7298ed159d76b074b283c0f9senorblanco@chromium.org                      { SkIntToScalar(size.fX), SkIntToScalar(size.fY) } };
438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorRED };
448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    return SkGradientShader::CreateLinear(pts, colors, NULL,
458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                    SK_ARRAY_COUNT(colors), SkShader::kMirror_TileMode, NULL);
468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}
478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
48f21833999d90ad9c8c584cff3238797b39cfc00breed@google.comclass VerticesView : public SampleView {
498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkShader*   fShader0;
508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkShader*   fShader1;
518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
5282065d667f64e232bcde2ad849756a6096fcbe6freed@google.compublic:
538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com	VerticesView() {
548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        SkIPoint    size;
5582065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        fShader0 = make_shader0(&size);
578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        fShader1 = make_shader1(size);
588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        make_strip(&fRecs[0], size.fX, size.fY);
608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        make_fan(&fRecs[1], size.fX, size.fY);
618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        make_tris(&fRecs[2]);
6282065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        fScale = SK_Scalar1;
64f21833999d90ad9c8c584cff3238797b39cfc00breed@google.com
65f21833999d90ad9c8c584cff3238797b39cfc00breed@google.com        this->setBGColor(SK_ColorGRAY);
668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
6782065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual ~VerticesView() {
6982065d667f64e232bcde2ad849756a6096fcbe6freed@google.com        SkSafeUnref(fShader0);
7082065d667f64e232bcde2ad849756a6096fcbe6freed@google.com        SkSafeUnref(fShader1);
718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
7282065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comprotected:
748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // overrides from SkEventSink
758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual bool onQuery(SkEvent* evt)  {
768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        if (SampleCode::TitleQ(*evt))
778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        {
788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            SkString str("Vertices");
798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            SampleCode::TitleR(evt, str.c_str());
808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            return true;
818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        }
828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        return this->INHERITED::onQuery(evt);
838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
8482065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkScalar fScale;
8682065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
87f21833999d90ad9c8c584cff3238797b39cfc00breed@google.com    virtual void onDrawContent(SkCanvas* canvas) {
888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        SkPaint paint;
898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        paint.setDither(true);
908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        paint.setFilterBitmap(true);
9182065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
9264cc579efa7e416c7298ed159d76b074b283c0f9senorblanco@chromium.org        for (size_t i = 0; i < SK_ARRAY_COUNT(fRecs); i++) {
938a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            canvas->save();
9482065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
958a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            paint.setShader(NULL);
968a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            canvas->drawVertices(fRecs[i].fMode, fRecs[i].fCount,
978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                                 fRecs[i].fVerts, fRecs[i].fTexs,
988a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                                 NULL, NULL, NULL, 0, paint);
9982065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
1008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            canvas->translate(SkIntToScalar(250), 0);
10182065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
1028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            paint.setShader(fShader0);
1038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            canvas->drawVertices(fRecs[i].fMode, fRecs[i].fCount,
1048a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                                 fRecs[i].fVerts, fRecs[i].fTexs,
1058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                                 NULL, NULL, NULL, 0, paint);
1068a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1078a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            canvas->translate(SkIntToScalar(250), 0);
10882065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
1098a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            paint.setShader(fShader1);
1108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            canvas->drawVertices(fRecs[i].fMode, fRecs[i].fCount,
1118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                                 fRecs[i].fVerts, fRecs[i].fTexs,
1128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                                 NULL, NULL, NULL, 0, paint);
1138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            canvas->restore();
11482065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
1158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            canvas->translate(0, SkIntToScalar(250));
1168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        }
1178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
11882065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
1198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y) {
1208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        return new Click(this);
1218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
12282065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
1238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual bool onClick(Click* click) {
1248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    //    fCurrX = click->fICurr.fX;
1258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    //    fCurrY = click->fICurr.fY;
1268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        this->inval(NULL);
1278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        return true;
1288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
12982065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
1308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comprivate:
1318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    struct Rec {
1328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        SkCanvas::VertexMode    fMode;
1338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        int                     fCount;
1348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        SkPoint*                fVerts;
1358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        SkPoint*                fTexs;
13682065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
1378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        Rec() : fCount(0), fVerts(NULL), fTexs(NULL) {}
1388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        ~Rec() { delete[] fVerts; delete[] fTexs; }
1398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    };
1408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void make_tris(Rec* rec) {
1428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        int n = 10;
1438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        SkRandom    rand;
14482065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
1458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        rec->fMode = SkCanvas::kTriangles_VertexMode;
1468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        rec->fCount = n * 3;
1478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        rec->fVerts = new SkPoint[rec->fCount];
14882065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
1498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        for (int i = 0; i < n; i++) {
1508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            SkPoint* v = &rec->fVerts[i*3];
1518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            for (int j = 0; j < 3; j++) {
1528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                v[j].set(rand.nextUScalar1() * 250, rand.nextUScalar1() * 250);
1538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            }
1548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        }
1558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
15682065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
1578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void make_fan(Rec* rec, int texWidth, int texHeight) {
1588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        const SkScalar tx = SkIntToScalar(texWidth);
1598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        const SkScalar ty = SkIntToScalar(texHeight);
1608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        const int n = 24;
16182065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
1628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        rec->fMode = SkCanvas::kTriangleFan_VertexMode;
1638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        rec->fCount = n + 2;
1648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        rec->fVerts = new SkPoint[rec->fCount];
1658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        rec->fTexs  = new SkPoint[rec->fCount];
16682065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
1678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        SkPoint* v = rec->fVerts;
1688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        SkPoint* t = rec->fTexs;
1698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        v[0].set(0, 0);
1718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        t[0].set(0, 0);
1728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        for (int i = 0; i < n; i++) {
1738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            SkScalar cos;
1748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            SkScalar sin = SkScalarSinCos(SK_ScalarPI * 2 * i / n, &cos);
1758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            v[i+1].set(cos, sin);
1768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            t[i+1].set(i*tx/n, ty);
1778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        }
1788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        v[n+1] = v[1];
1798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        t[n+1].set(tx, ty);
18082065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
1818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        SkMatrix m;
1828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        m.setScale(SkIntToScalar(100), SkIntToScalar(100));
1838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        m.postTranslate(SkIntToScalar(110), SkIntToScalar(110));
1848a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        m.mapPoints(v, rec->fCount);
1858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
18682065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
1878a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void make_strip(Rec* rec, int texWidth, int texHeight) {
1888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        const SkScalar tx = SkIntToScalar(texWidth);
1898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        const SkScalar ty = SkIntToScalar(texHeight);
1908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        const int n = 24;
19182065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
1928a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        rec->fMode = SkCanvas::kTriangleStrip_VertexMode;
1938a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        rec->fCount = 2 * (n + 1);
1948a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        rec->fVerts = new SkPoint[rec->fCount];
1958a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        rec->fTexs  = new SkPoint[rec->fCount];
19682065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
1978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        SkPoint* v = rec->fVerts;
1988a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        SkPoint* t = rec->fTexs;
19982065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
2008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        for (int i = 0; i < n; i++) {
2018a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            SkScalar cos;
2028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            SkScalar sin = SkScalarSinCos(SK_ScalarPI * 2 * i / n, &cos);
2038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            v[i*2 + 0].set(cos/2, sin/2);
2048a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            v[i*2 + 1].set(cos, sin);
20582065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
2068a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            t[i*2 + 0].set(tx * i / n, ty);
2078a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            t[i*2 + 1].set(tx * i / n, 0);
2088a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        }
2098a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        v[2*n + 0] = v[0];
2108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        v[2*n + 1] = v[1];
21182065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
2128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        t[2*n + 0].set(tx, ty);
2138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        t[2*n + 1].set(tx, 0);
21482065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
2158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        SkMatrix m;
2168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        m.setScale(SkIntToScalar(100), SkIntToScalar(100));
2178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        m.postTranslate(SkIntToScalar(110), SkIntToScalar(110));
2188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        m.mapPoints(v, rec->fCount);
2198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
22082065d667f64e232bcde2ad849756a6096fcbe6freed@google.com
2218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    Rec fRecs[3];
2228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
223f21833999d90ad9c8c584cff3238797b39cfc00breed@google.com    typedef SampleView INHERITED;
2248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com};
2258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com//////////////////////////////////////////////////////////////////////////////
2278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comstatic SkView* MyFactory() { return new VerticesView; }
2298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comstatic SkViewRegister reg(MyFactory);
2308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
231