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

Side by Side Diff: tests/DrawBitmapRectTest.cpp

Issue 117053002: remove SK_SCALAR_IS_[FLOAT,FIXED] and assume floats (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years 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 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "Test.h" 8 #include "Test.h"
9 #include "TestClassDef.h" 9 #include "TestClassDef.h"
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 * can't represent those coordinates in our transport format (yet). 234 * can't represent those coordinates in our transport format (yet).
235 * 2. Perform an unsigned shift during the calculation, so we don't get 235 * 2. Perform an unsigned shift during the calculation, so we don't get
236 * sign-extension bleed when packing the two values (X,Y) into our 32bit 236 * sign-extension bleed when packing the two values (X,Y) into our 32bit
237 * slot. 237 * slot.
238 * 238 *
239 * This tests exercises the original setup, plus 3 more to ensure that we can, 239 * This tests exercises the original setup, plus 3 more to ensure that we can,
240 * in fact, handle bitmaps at 64K-1 (assuming we don't exceed the total 240 * in fact, handle bitmaps at 64K-1 (assuming we don't exceed the total
241 * memory allocation limit). 241 * memory allocation limit).
242 */ 242 */
243 static void test_giantrepeat_crbug118018(skiatest::Reporter* reporter) { 243 static void test_giantrepeat_crbug118018(skiatest::Reporter* reporter) {
244 #ifdef SK_SCALAR_IS_FLOAT
245 static const struct { 244 static const struct {
246 int fWidth; 245 int fWidth;
247 int fHeight; 246 int fHeight;
248 bool fExpectedToDraw; 247 bool fExpectedToDraw;
249 } gTests[] = { 248 } gTests[] = {
250 { 0x1b294, 0x7f, false }, // crbug 118018 (width exceeds 64K) 249 { 0x1b294, 0x7f, false }, // crbug 118018 (width exceeds 64K)
251 { 0xFFFF, 0x7f, true }, // should draw, test max width 250 { 0xFFFF, 0x7f, true }, // should draw, test max width
252 { 0x7f, 0xFFFF, true }, // should draw, test max height 251 { 0x7f, 0xFFFF, true }, // should draw, test max height
253 { 0xFFFF, 0xFFFF, false }, // allocation fails (too much RAM) 252 { 0xFFFF, 0xFFFF, false }, // allocation fails (too much RAM)
254 }; 253 };
255 254
256 for (size_t i = 0; i < SK_ARRAY_COUNT(gTests); ++i) { 255 for (size_t i = 0; i < SK_ARRAY_COUNT(gTests); ++i) {
257 test_wacky_bitmapshader(reporter, 256 test_wacky_bitmapshader(reporter,
258 gTests[i].fWidth, gTests[i].fHeight, 257 gTests[i].fWidth, gTests[i].fHeight,
259 gTests[i].fExpectedToDraw); 258 gTests[i].fExpectedToDraw);
260 } 259 }
261 #endif
262 } 260 }
263 261
264 /////////////////////////////////////////////////////////////////////////////// 262 ///////////////////////////////////////////////////////////////////////////////
265 263
266 static void test_nan_antihair() { 264 static void test_nan_antihair() {
267 SkBitmap bm; 265 SkBitmap bm;
268 bm.setConfig(SkBitmap::kARGB_8888_Config, 20, 20); 266 bm.setConfig(SkBitmap::kARGB_8888_Config, 20, 20);
269 bm.allocPixels(); 267 bm.allocPixels();
270 268
271 SkCanvas canvas(bm); 269 SkCanvas canvas(bm);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 322
325 // ensure that we draw nothing if srcR does not intersect the bitmap 323 // ensure that we draw nothing if srcR does not intersect the bitmap
326 REPORTER_ASSERT(reporter, check_for_all_zeros(dst)); 324 REPORTER_ASSERT(reporter, check_for_all_zeros(dst));
327 325
328 test_nan_antihair(); 326 test_nan_antihair();
329 test_giantrepeat_crbug118018(reporter); 327 test_giantrepeat_crbug118018(reporter);
330 328
331 test_treatAsSprite(reporter); 329 test_treatAsSprite(reporter);
332 test_faulty_pixelref(reporter); 330 test_faulty_pixelref(reporter);
333 } 331 }
OLDNEW
« src/core/SkCanvas.cpp ('K') | « src/xml/SkXMLWriter.cpp ('k') | tests/DrawPathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698