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

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: Updating to ToT (10994) Created 7 years, 3 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
« no previous file with comments | « tests/DeferredCanvasTest.cpp ('k') | tests/LayerDrawLooperTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "SkBitmapDevice.h"
10 #include "SkTemplates.h"
11 #include "SkShader.h"
12 #include "SkColorShader.h" 10 #include "SkColorShader.h"
13 #include "SkEmptyShader.h" 11 #include "SkEmptyShader.h"
14 #include "SkGradientShader.h" 12 #include "SkGradientShader.h"
13 #include "SkShader.h"
14 #include "SkTemplates.h"
15 15
16 struct GradRec { 16 struct GradRec {
17 int fColorCount; 17 int fColorCount;
18 const SkColor* fColors; 18 const SkColor* fColors;
19 const SkScalar* fPos; 19 const SkScalar* fPos;
20 const SkPoint* fPoint; // 2 20 const SkPoint* fPoint; // 2
21 const SkScalar* fRadius; // 2 21 const SkScalar* fRadius; // 2
22 SkShader::TileMode fTileMode; 22 SkShader::TileMode fTileMode;
23 23
24 void gradCheck(skiatest::Reporter* reporter, SkShader* shader, 24 void gradCheck(skiatest::Reporter* reporter, SkShader* shader,
(...skipping 114 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 SkBitmapDevice 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
« no previous file with comments | « tests/DeferredCanvasTest.cpp ('k') | tests/LayerDrawLooperTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698