add option to test 1x1 bitmapshader

git-svn-id: http://skia.googlecode.com/svn/trunk@1809 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@google.com 2011-07-06 21:01:29 +00:00
parent cde92111d5
commit f78e78da58

View File

@ -25,6 +25,15 @@
#include "SkBlurMaskFilter.h" #include "SkBlurMaskFilter.h"
static void test_gradient2(SkCanvas* canvas) { static void test_gradient2(SkCanvas* canvas) {
#if 1
SkBitmap bm;
bm.setConfig(SkBitmap::kARGB_8888_Config, 1, 1);
bm.allocPixels();
*bm.getAddr32(0, 0) = SkPackARGB32(0xFF, 0, 0xFF, 0);
SkShader* s = SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode,
SkShader::kRepeat_TileMode);
#else
/* /*
ctx.fillStyle = '#f00'; ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50); ctx.fillRect(0, 0, 100, 50);
@ -46,6 +55,7 @@ static void test_gradient2(SkCanvas* canvas) {
SkShader* s = SkGradientShader::CreateTwoPointRadial(c0, r0, c1, r1, colors, SkShader* s = SkGradientShader::CreateTwoPointRadial(c0, r0, c1, r1, colors,
pos, SK_ARRAY_COUNT(pos), pos, SK_ARRAY_COUNT(pos),
SkShader::kClamp_TileMode); SkShader::kClamp_TileMode);
#endif
SkPaint paint; SkPaint paint;
paint.setShader(s)->unref(); paint.setShader(s)->unref();