Index: samplecode/SampleColorFilter.cpp |
diff --git a/samplecode/SampleColorFilter.cpp b/samplecode/SampleColorFilter.cpp |
index fb5d42744f2a502b6ff5265f932f1c906e59fcef..175f724710a1f48bd84efba346d698b367e2fa0d 100644 |
--- a/samplecode/SampleColorFilter.cpp |
+++ b/samplecode/SampleColorFilter.cpp |
@@ -5,6 +5,7 @@ |
* Use of this source code is governed by a BSD-style license that can be |
* found in the LICENSE file. |
*/ |
+#include "Checkerboard.h" |
#include "SampleCode.h" |
#include "SkView.h" |
#include "SkCanvas.h" |
@@ -84,20 +85,6 @@ static void test_5bits() { |
SkDebugf("--- trunc: %d %d round: %d %d new: %d %d\n", e0, ae0, e1, ae1, e2, ae2); |
} |
-// No longer marked static, since it is externed in SampleUnpremul. |
-SkShader* createChecker(); |
-SkShader* createChecker() { |
- SkBitmap bm; |
- bm.allocN32Pixels(2, 2); |
- bm.lockPixels(); |
- *bm.getAddr32(0, 0) = *bm.getAddr32(1, 1) = SkPreMultiplyColor(0xFFFFFFFF); |
- *bm.getAddr32(0, 1) = *bm.getAddr32(1, 0) = SkPreMultiplyColor(0xFFCCCCCC); |
- SkMatrix m; |
- m.setScale(12, 12); |
- return SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode, |
- SkShader::kRepeat_TileMode, &m); |
-} |
- |
static SkBitmap createBitmap(int n) { |
SkBitmap bitmap; |
bitmap.allocN32Pixels(n, n); |
@@ -131,7 +118,8 @@ class ColorFilterView : public SampleView { |
public: |
ColorFilterView() { |
fBitmap = createBitmap(N); |
- fShader = createChecker(); |
+ fShader = sk_tools::CreateCheckerboardShader( |
+ 0xFFCCCCCC, 0xFFFFFFFF, 12); |
if (false) { // avoid bit rot, suppress warning |
test_5bits(); |