aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode/SampleVertices.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-05-02 12:53:34 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-05-02 12:53:34 +0000
commit8295dc1474db279df08d816b2115e807c681fad5 (patch)
tree5b5df977f1ae697b0b0279af749e6a79f0c3443c /samplecode/SampleVertices.cpp
parent152612938020fa46999f33668027d5bc0f7afd18 (diff)
4x4 SSAA with improvements in determination of when to apply. Still disabled at compile time.
Review URL: http://codereview.appspot.com/4445075/ git-svn-id: http://skia.googlecode.com/svn/trunk@1218 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'samplecode/SampleVertices.cpp')
-rw-r--r--samplecode/SampleVertices.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/samplecode/SampleVertices.cpp b/samplecode/SampleVertices.cpp
index f260e1af25..4557cc4e17 100644
--- a/samplecode/SampleVertices.cpp
+++ b/samplecode/SampleVertices.cpp
@@ -21,11 +21,20 @@
static SkShader* make_shader0(SkIPoint* size) {
SkBitmap bm;
-
- SkImageDecoder::DecodeFile("/skimages/logo.png", &bm);
- size->set(bm.width(), bm.height());
- return SkShader::CreateBitmapShader(bm, SkShader::kClamp_TileMode,
- SkShader::kClamp_TileMode);
+ size->set(2, 2);
+ bm.setConfig(SkBitmap::kARGB_8888_Config, size->fX, size->fY);
+ SkPMColor color0 = SkPreMultiplyARGB(0x80, 0x80, 0xff, 0x80);
+ SkPMColor color1 = SkPreMultiplyARGB(0x40, 0xff, 0x00, 0xff);
+ bm.allocPixels();
+ bm.eraseColor(color0);
+ bm.lockPixels();
+ uint32_t* pixels = (uint32_t*) bm.getPixels();
+ pixels[0] = pixels[2] = color0;
+ pixels[1] = pixels[3] = color1;
+ bm.unlockPixels();
+
+ return SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode,
+ SkShader::kRepeat_TileMode);
}
static SkShader* make_shader1(const SkIPoint& size) {