ConstXTileBench(SkShader::TileMode xTile, SkShader::TileMode yTile, bool doFilter, bool doTrans, bool doScale) : fDoFilter(doFilter) , fDoTrans(doTrans) , fDoScale(doScale) { SkBitmap bm; bm.allocN32Pixels(kWidth, kHeight, true); bm.eraseColor(SK_ColorWHITE); create_gradient(&bm); fPaint.setShader(SkShader::MakeBitmapShader(bm, xTile, yTile)); fName.printf("constXTile_"); static const char* gTileModeStr[SkShader::kTileModeCount] = { "C", "R", "M" }; fName.append(gTileModeStr[xTile]); fName.append(gTileModeStr[yTile]); if (doFilter) { fName.append("_filter"); } if (doTrans) { fName.append("_trans"); } if (doScale) { fName.append("_scale"); } }
void on_init(ps_context* gc, int w, int h) { width = w; height = h; scale = height / 512.0f; create_gradient(); create_path(); adjust = ps_matrix_create(); ps_matrix_translate(adjust, -256, -256); ps_matrix_flip_y(adjust); ps_matrix_translate(adjust, 256, 256); tid = set_timer(100); }