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

Side by Side Diff: tests/DrawBitmapRectTest.cpp

Issue 510423005: make allocPixels throw on failure (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 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
« no previous file with comments | « tests/CachedDecodingPixelRefTest.cpp ('k') | tests/ImageDecodingTest.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 * 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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkData.h" 10 #include "SkData.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 matrix.setAll(-119.34097f, 183 matrix.setAll(-119.34097f,
184 -43.436558f, 184 -43.436558f,
185 93489.945f, 185 93489.945f,
186 43.436558f, 186 43.436558f,
187 -119.34097f, 187 -119.34097f,
188 123.98426f, 188 123.98426f,
189 0, 0, SK_Scalar1); 189 0, 0, SK_Scalar1);
190 c.concat(matrix); 190 c.concat(matrix);
191 191
192 SkBitmap bm; 192 SkBitmap bm;
193 bm.allocN32Pixels(width, height); 193 if (bm.tryAllocN32Pixels(width, height)) {
194 // allow this to fail silently, to test the code downstream
195 }
194 bm.eraseColor(SK_ColorRED); 196 bm.eraseColor(SK_ColorRED);
195 197
196 matrix.setAll(0.0078740157f, 198 matrix.setAll(0.0078740157f,
197 0, 199 0,
198 SkIntToScalar(249), 200 SkIntToScalar(249),
199 0, 201 0,
200 0.0078740157f, 202 0.0078740157f,
201 SkIntToScalar(239), 203 SkIntToScalar(239),
202 0, 0, SK_Scalar1); 204 0, 0, SK_Scalar1);
203 SkShader* s = SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode, 205 SkShader* s = SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode,
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 312
311 // ensure that we draw nothing if srcR does not intersect the bitmap 313 // ensure that we draw nothing if srcR does not intersect the bitmap
312 REPORTER_ASSERT(reporter, check_for_all_zeros(dst)); 314 REPORTER_ASSERT(reporter, check_for_all_zeros(dst));
313 315
314 test_nan_antihair(); 316 test_nan_antihair();
315 test_giantrepeat_crbug118018(reporter); 317 test_giantrepeat_crbug118018(reporter);
316 318
317 test_treatAsSprite(reporter); 319 test_treatAsSprite(reporter);
318 test_faulty_pixelref(reporter); 320 test_faulty_pixelref(reporter);
319 } 321 }
OLDNEW
« no previous file with comments | « tests/CachedDecodingPixelRefTest.cpp ('k') | tests/ImageDecodingTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698