| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #include "Checkerboard.h" | 8 #include "sk_tool_utils.h" |
| 9 #include "SampleCode.h" | 9 #include "SampleCode.h" |
| 10 #include "SkView.h" | 10 #include "SkView.h" |
| 11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
| 12 #include "SkColorFilter.h" | 12 #include "SkColorFilter.h" |
| 13 #include "SkDevice.h" | 13 #include "SkDevice.h" |
| 14 #include "SkPaint.h" | 14 #include "SkPaint.h" |
| 15 #include "SkShader.h" | 15 #include "SkShader.h" |
| 16 | 16 |
| 17 static int inflate5To8(int x) { | 17 static int inflate5To8(int x) { |
| 18 return (x << 3) | (x >> 2); | 18 return (x << 3) | (x >> 2); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 111 |
| 112 class ColorFilterView : public SampleView { | 112 class ColorFilterView : public SampleView { |
| 113 SkBitmap fBitmap; | 113 SkBitmap fBitmap; |
| 114 SkShader* fShader; | 114 SkShader* fShader; |
| 115 enum { | 115 enum { |
| 116 N = 64 | 116 N = 64 |
| 117 }; | 117 }; |
| 118 public: | 118 public: |
| 119 ColorFilterView() { | 119 ColorFilterView() { |
| 120 fBitmap = createBitmap(N); | 120 fBitmap = createBitmap(N); |
| 121 fShader = sk_tools::CreateCheckerboardShader( | 121 fShader = sk_tool_utils::create_checkerboard_shader( |
| 122 0xFFCCCCCC, 0xFFFFFFFF, 12); | 122 0xFFCCCCCC, 0xFFFFFFFF, 12); |
| 123 | 123 |
| 124 if (false) { // avoid bit rot, suppress warning | 124 if (false) { // avoid bit rot, suppress warning |
| 125 test_5bits(); | 125 test_5bits(); |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 | 128 |
| 129 virtual ~ColorFilterView() { | 129 virtual ~ColorFilterView() { |
| 130 fShader->unref(); | 130 fShader->unref(); |
| 131 } | 131 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 } | 197 } |
| 198 | 198 |
| 199 private: | 199 private: |
| 200 typedef SampleView INHERITED; | 200 typedef SampleView INHERITED; |
| 201 }; | 201 }; |
| 202 | 202 |
| 203 ////////////////////////////////////////////////////////////////////////////// | 203 ////////////////////////////////////////////////////////////////////////////// |
| 204 | 204 |
| 205 static SkView* MyFactory() { return new ColorFilterView; } | 205 static SkView* MyFactory() { return new ColorFilterView; } |
| 206 static SkViewRegister reg(MyFactory); | 206 static SkViewRegister reg(MyFactory); |
| OLD | NEW |