OLD | NEW |
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 25 matching lines...) Expand all Loading... |
36 // to decode into pixels. | 36 // to decode into pixels. |
37 return false; | 37 return false; |
38 } | 38 } |
39 }; | 39 }; |
40 | 40 |
41 // crbug.com/295895 | 41 // crbug.com/295895 |
42 // Crashing in skia when a pixelref fails in lockPixels | 42 // Crashing in skia when a pixelref fails in lockPixels |
43 // | 43 // |
44 static void test_faulty_pixelref(skiatest::Reporter* reporter) { | 44 static void test_faulty_pixelref(skiatest::Reporter* reporter) { |
45 // need a cache, but don't expect to use it, so the budget is not critical | 45 // need a cache, but don't expect to use it, so the budget is not critical |
46 SkAutoTUnref<SkDiscardableMemoryPool> pool(SkNEW_ARGS(SkDiscardableMemoryPoo
l, | 46 SkAutoTUnref<SkDiscardableMemoryPool> pool( |
47 (10 * 1000, NULL))); | 47 SkDiscardableMemoryPool::Create(10 * 1000, NULL)); |
48 SkBitmap bm; | 48 SkBitmap bm; |
49 bool installSuccess = SkInstallDiscardablePixelRef(SkNEW(FailureImageGenerat
or), &bm, pool); | 49 bool installSuccess = SkInstallDiscardablePixelRef(SkNEW(FailureImageGenerat
or), &bm, pool); |
50 REPORTER_ASSERT(reporter, installSuccess); | 50 REPORTER_ASSERT(reporter, installSuccess); |
51 // now our bitmap has a pixelref, but we know it will fail to lock | 51 // now our bitmap has a pixelref, but we know it will fail to lock |
52 | 52 |
53 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterPMColor(200, 200)); | 53 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterPMColor(200, 200)); |
54 SkCanvas* canvas = surface->getCanvas(); | 54 SkCanvas* canvas = surface->getCanvas(); |
55 | 55 |
56 const SkPaint::FilterLevel levels[] = { | 56 const SkPaint::FilterLevel levels[] = { |
57 SkPaint::kNone_FilterLevel, | 57 SkPaint::kNone_FilterLevel, |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 | 315 |
316 // ensure that we draw nothing if srcR does not intersect the bitmap | 316 // ensure that we draw nothing if srcR does not intersect the bitmap |
317 REPORTER_ASSERT(reporter, check_for_all_zeros(dst)); | 317 REPORTER_ASSERT(reporter, check_for_all_zeros(dst)); |
318 | 318 |
319 test_nan_antihair(); | 319 test_nan_antihair(); |
320 test_giantrepeat_crbug118018(reporter); | 320 test_giantrepeat_crbug118018(reporter); |
321 | 321 |
322 test_treatAsSprite(reporter); | 322 test_treatAsSprite(reporter); |
323 test_faulty_pixelref(reporter); | 323 test_faulty_pixelref(reporter); |
324 } | 324 } |
OLD | NEW |