Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1364)

Unified Diff: samplecode/SampleColorFilter.cpp

Issue 834303005: Factor out checkerboard function in gm and sampleapp into tools. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rename to sk_tools::DrawCheckerboard Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gyp/tools.gyp ('k') | samplecode/SampleFatBits.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « gyp/tools.gyp ('k') | samplecode/SampleFatBits.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698