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

Side by Side Diff: tests/GradientTest.cpp

Issue 22978012: Split SkDevice into SkBaseDevice and SkBitmapDevice (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Moved code around to make code review easier Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "Test.h" 8 #include "Test.h"
9 #include "SkDevice.h" 9 #include "SkDevice.h"
10 #include "SkTemplates.h" 10 #include "SkTemplates.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 SkAutoTUnref<SkShader> s(SkGradientShader::CreateLinear(pts, 139 SkAutoTUnref<SkShader> s(SkGradientShader::CreateLinear(pts,
140 colors, 140 colors,
141 pos, 141 pos,
142 2, 142 2,
143 SkShader::kClamp_Til eMode)); 143 SkShader::kClamp_Til eMode));
144 SkBitmap outBitmap; 144 SkBitmap outBitmap;
145 outBitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 1); 145 outBitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 1);
146 outBitmap.allocPixels(); 146 outBitmap.allocPixels();
147 SkPaint paint; 147 SkPaint paint;
148 paint.setShader(s.get()); 148 paint.setShader(s.get());
149 SkDevice device(outBitmap); 149 SkRasterDevice device(outBitmap);
150 SkCanvas canvas(&device); 150 SkCanvas canvas(&device);
151 canvas.drawPaint(paint); 151 canvas.drawPaint(paint);
152 SkAutoLockPixels alp(outBitmap); 152 SkAutoLockPixels alp(outBitmap);
153 for (int i = 0; i < 10; i++) { 153 for (int i = 0; i < 10; i++) {
154 // The following is commented out because it currently fails 154 // The following is commented out because it currently fails
155 // Related bug: https://code.google.com/p/skia/issues/detail?id=1098 155 // Related bug: https://code.google.com/p/skia/issues/detail?id=1098
156 156
157 // REPORTER_ASSERT(reporter, SK_ColorBLUE == outBitmap.getColor(i, 0)); 157 // REPORTER_ASSERT(reporter, SK_ColorBLUE == outBitmap.getColor(i, 0));
158 } 158 }
159 } 159 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 gProcs[i](reporter, rec); 191 gProcs[i](reporter, rec);
192 } 192 }
193 } 193 }
194 194
195 static void TestGradients(skiatest::Reporter* reporter) { 195 static void TestGradients(skiatest::Reporter* reporter) {
196 TestGradientShaders(reporter); 196 TestGradientShaders(reporter);
197 TestConstantGradient(reporter); 197 TestConstantGradient(reporter);
198 } 198 }
199 #include "TestClassDef.h" 199 #include "TestClassDef.h"
200 DEFINE_TESTCLASS("Gradients", TestGradientsClass, TestGradients) 200 DEFINE_TESTCLASS("Gradients", TestGradientsClass, TestGradients)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698