shadertext.cpp revision ae933ce0ea5fd9d21cb6ef2cee7e729d32690aac
1ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com
2ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com/*
3ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Copyright 2011 Google Inc.
4ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com *
5ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Use of this source code is governed by a BSD-style license that can be
6ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * found in the LICENSE file.
7ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com */
80fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com#include "gm.h"
90fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com#include "SkCanvas.h"
100fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com#include "SkGradientShader.h"
110fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com#include "SkUnitMappers.h"
120fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
130fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.comnamespace skiagm {
140fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
150fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.comstatic void makebm(SkBitmap* bm, SkBitmap::Config config, int w, int h) {
160fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    bm->setConfig(config, w, h);
170fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    bm->allocPixels();
180fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    bm->eraseColor(0);
190fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
200fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    SkCanvas    canvas(*bm);
21b28b5e4e26183b6e14846fb00501cc445a4fdd7eepoger@google.com    SkScalar    s = SkIntToScalar(SkMin32(w, h));
22386900790bbb2c07a6cc39bd46feb2e6526dbe01reed@google.com    SkPoint     pts[] = { { 0, 0 }, { s, s } };
230fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    SkColor     colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE };
240fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    SkScalar    pos[] = { 0, SK_Scalar1/2, SK_Scalar1 };
250fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    SkPaint     paint;
260fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
270fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    SkUnitMapper*   um = NULL;
280fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
290fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    um = new SkCosineMapper;
300fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
310fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    SkAutoUnref au(um);
320fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
330fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    paint.setDither(true);
340fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    paint.setShader(SkGradientShader::CreateLinear(pts, colors, pos,
350fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com                SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode, um))->unref();
360fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    canvas.drawPaint(paint);
370fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com}
380fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
391313086ef4d901176e569d1f4b6362250ac02cd7caryclark@google.comstatic SkShader* MakeBitmapShader(SkShader::TileMode tx, SkShader::TileMode ty,
400fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com                           int w, int h) {
410fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    static SkBitmap bmp;
420fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    if (bmp.isNull()) {
430fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        makebm(&bmp, SkBitmap::kARGB_8888_Config, w/2, h/4);
440fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    }
450fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    return SkShader::CreateBitmapShader(bmp, tx, ty);
460fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com}
470fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
480fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com///////////////////////////////////////////////////////////////////////////////
490fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
500fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.comstruct GradData {
510fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    int             fCount;
520fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    const SkColor*  fColors;
530fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    const SkScalar* fPos;
540fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com};
550fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
560fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.comstatic const SkColor gColors[] = {
570fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE, SK_ColorBLACK
580fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com};
590fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
600fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.comstatic const GradData gGradData[] = {
610fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    { 2, gColors, NULL },
620fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    { 5, gColors, NULL },
630fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com};
640fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
650fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.comstatic SkShader* MakeLinear(const SkPoint pts[2], const GradData& data,
660fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com                            SkShader::TileMode tm, SkUnitMapper* mapper) {
670fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    return SkGradientShader::CreateLinear(pts, data.fColors, data.fPos,
680fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com                                          data.fCount, tm, mapper);
690fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com}
700fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
710fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.comstatic SkShader* MakeRadial(const SkPoint pts[2], const GradData& data,
720fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com                            SkShader::TileMode tm, SkUnitMapper* mapper) {
730fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    SkPoint center;
740fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    center.set(SkScalarAve(pts[0].fX, pts[1].fX),
750fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com               SkScalarAve(pts[0].fY, pts[1].fY));
760fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    return SkGradientShader::CreateRadial(center, center.fX, data.fColors,
770fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com                                          data.fPos, data.fCount, tm, mapper);
780fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com}
790fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
800fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.comstatic SkShader* MakeSweep(const SkPoint pts[2], const GradData& data,
810fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com                           SkShader::TileMode tm, SkUnitMapper* mapper) {
820fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    SkPoint center;
830fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    center.set(SkScalarAve(pts[0].fX, pts[1].fX),
840fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com               SkScalarAve(pts[0].fY, pts[1].fY));
850fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    return SkGradientShader::CreateSweep(center.fX, center.fY, data.fColors,
860fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com                                         data.fPos, data.fCount, mapper);
870fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com}
880fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
890fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.comstatic SkShader* Make2Radial(const SkPoint pts[2], const GradData& data,
900fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com                           SkShader::TileMode tm, SkUnitMapper* mapper) {
910fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    SkPoint center0, center1;
920fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    center0.set(SkScalarAve(pts[0].fX, pts[1].fX),
930fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com                SkScalarAve(pts[0].fY, pts[1].fY));
940fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    center1.set(SkScalarInterp(pts[0].fX, pts[1].fX, SkIntToScalar(3)/5),
950fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com                SkScalarInterp(pts[0].fY, pts[1].fY, SkIntToScalar(1)/4));
960fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    return SkGradientShader::CreateTwoPointRadial(
970fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com                            center1, (pts[1].fX - pts[0].fX) / 7,
980fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com                            center0, (pts[1].fX - pts[0].fX) / 2,
990fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com                            data.fColors, data.fPos, data.fCount, tm, mapper);
1000fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com}
1010fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
1020fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.comtypedef SkShader* (*GradMaker)(const SkPoint pts[2], const GradData& data,
1030fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com                     SkShader::TileMode tm, SkUnitMapper* mapper);
1040fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.comstatic const GradMaker gGradMakers[] = {
1050fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    MakeLinear, MakeRadial, MakeSweep, Make2Radial
1060fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com};
1070fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
1080fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com///////////////////////////////////////////////////////////////////////////////
1090fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
1100fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.comclass ShaderTextGM : public GM {
1110fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.compublic:
112ae933ce0ea5fd9d21cb6ef2cee7e729d32690aacrmistry@google.com    ShaderTextGM() {
11348dd1a26ec07c5baa04856202e4e7e2a53e4d7e5bsalomon@google.com        this->setBGColor(0xFFDDDDDD);
11448dd1a26ec07c5baa04856202e4e7e2a53e4d7e5bsalomon@google.com    }
1150fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
1160fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.comprotected:
1170fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
1180fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    SkString onShortName() {
1190fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        return SkString("shadertext");
1200fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    }
1210fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
122ae933ce0ea5fd9d21cb6ef2cee7e729d32690aacrmistry@google.com    SkISize onISize() { return make_isize(1450, 500); }
1230fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
1240fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    virtual void onDraw(SkCanvas* canvas) {
1250fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        const char text[] = "Shaded Text";
1260fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        const int textLen = SK_ARRAY_COUNT(text) - 1;
1273914958a49ee089ddeb04acc16373aae8bc2eaf7bsalomon@google.com        const int pointSize = 36;
1280fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
1290fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        int w = pointSize * textLen;
1300fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        int h = pointSize;
1310fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
1320fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        SkPoint pts[2] = {
1330fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com            { 0, 0 },
1340fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com            { SkIntToScalar(w), SkIntToScalar(h) }
1350fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        };
1360fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        SkScalar textBase = SkIntToScalar(h/2);
1370fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
1380fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        SkShader::TileMode tileModes[] = {
1390fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com            SkShader::kClamp_TileMode,
1400fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com            SkShader::kRepeat_TileMode,
1410fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com            SkShader::kMirror_TileMode
1420fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        };
1430fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
1440fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        static const int gradCount = SK_ARRAY_COUNT(gGradData) *
1450fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com                                     SK_ARRAY_COUNT(gGradMakers);
1460fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        static const int bmpCount = SK_ARRAY_COUNT(tileModes) *
1470fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com                                    SK_ARRAY_COUNT(tileModes);
1480fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        SkShader* shaders[gradCount + bmpCount];
1490fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
1500fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        int shdIdx = 0;
1510fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        for (size_t d = 0; d < SK_ARRAY_COUNT(gGradData); ++d) {
1520fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com            for (size_t m = 0; m < SK_ARRAY_COUNT(gGradMakers); ++m) {
1530fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com                shaders[shdIdx++] = gGradMakers[m](pts,
1540fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com                                                   gGradData[d],
1550fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com                                                   SkShader::kClamp_TileMode,
1560fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com                                                   NULL);
1570fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com            }
1580fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        }
1590fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        for (size_t tx = 0; tx < SK_ARRAY_COUNT(tileModes); ++tx) {
1600fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com            for (size_t ty = 0; ty < SK_ARRAY_COUNT(tileModes); ++ty) {
1610fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com                shaders[shdIdx++] = MakeBitmapShader(tileModes[tx],
1620fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com                                                     tileModes[ty],
1630fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com                                                     w/8, h);
1640fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com            }
1650fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        }
1660fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
1670fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        SkPaint paint;
1680fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        paint.setDither(true);
1690fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        paint.setAntiAlias(true);
1700fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        paint.setTextSize(SkIntToScalar(pointSize));
1710fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
1720fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        canvas->save();
1730fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        canvas->translate(SkIntToScalar(20), SkIntToScalar(10));
1740fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
1753914958a49ee089ddeb04acc16373aae8bc2eaf7bsalomon@google.com        SkPath path;
176137c428290ac7a4804edf564c552711ffb9dfa58bsalomon@google.com        path.arcTo(SkRect::MakeXYWH(SkIntToScalar(-40), SkIntToScalar(15),
177ae933ce0ea5fd9d21cb6ef2cee7e729d32690aacrmistry@google.com                                    SkIntToScalar(300), SkIntToScalar(90)),
178ae933ce0ea5fd9d21cb6ef2cee7e729d32690aacrmistry@google.com                                    SkIntToScalar(225), SkIntToScalar(90),
179137c428290ac7a4804edf564c552711ffb9dfa58bsalomon@google.com                                    false);
1803914958a49ee089ddeb04acc16373aae8bc2eaf7bsalomon@google.com        path.close();
1813914958a49ee089ddeb04acc16373aae8bc2eaf7bsalomon@google.com
1820fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        static const int testsPerCol = 8;
1830fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        static const int rowHeight = 60;
1840fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        static const int colWidth = 300;
1850fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        canvas->save();
1860fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        for (size_t s = 0; s < SK_ARRAY_COUNT(shaders); s++) {
1870fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com            canvas->save();
1883914958a49ee089ddeb04acc16373aae8bc2eaf7bsalomon@google.com            int i = 2*s;
1893914958a49ee089ddeb04acc16373aae8bc2eaf7bsalomon@google.com            canvas->translate(SkIntToScalar((i / testsPerCol) * colWidth),
1903914958a49ee089ddeb04acc16373aae8bc2eaf7bsalomon@google.com                              SkIntToScalar((i % testsPerCol) * rowHeight));
1913914958a49ee089ddeb04acc16373aae8bc2eaf7bsalomon@google.com            paint.setShader(shaders[s])->unref();
1920fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com            canvas->drawText(text, textLen, 0, textBase, paint);
1930fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com            canvas->restore();
1943914958a49ee089ddeb04acc16373aae8bc2eaf7bsalomon@google.com            canvas->save();
1953914958a49ee089ddeb04acc16373aae8bc2eaf7bsalomon@google.com            ++i;
1963914958a49ee089ddeb04acc16373aae8bc2eaf7bsalomon@google.com            canvas->translate(SkIntToScalar((i / testsPerCol) * colWidth),
1973914958a49ee089ddeb04acc16373aae8bc2eaf7bsalomon@google.com                              SkIntToScalar((i % testsPerCol) * rowHeight));
1983914958a49ee089ddeb04acc16373aae8bc2eaf7bsalomon@google.com            canvas->drawTextOnPath(text, textLen, path, NULL, paint);
1993914958a49ee089ddeb04acc16373aae8bc2eaf7bsalomon@google.com            canvas->restore();
2000fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        }
2010fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com        canvas->restore();
2023914958a49ee089ddeb04acc16373aae8bc2eaf7bsalomon@google.com
2030fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    }
2040fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
2050fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.comprivate:
2060fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com    typedef GM INHERITED;
2070fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com};
2080fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
2090fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com///////////////////////////////////////////////////////////////////////////////
2100fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com
211ceb2a0311fa2ad01b93ce3488515a34486ae7a49borenet@google.com#ifndef SK_BUILD_FOR_ANDROID
2120fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.comstatic GM* MyFactory(void*) { return new ShaderTextGM; }
2130fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.comstatic GMRegistry reg(MyFactory);
214ceb2a0311fa2ad01b93ce3488515a34486ae7a49borenet@google.com#endif
2150fdaa22dea3b139d7afa1daec4248aca1793460absalomon@google.com}
216