| 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 15 matching lines...) Expand all Loading... |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 // crbug.com/295895 | 28 // crbug.com/295895 |
| 29 // Crashing in skia when a pixelref fails in lockPixels | 29 // Crashing in skia when a pixelref fails in lockPixels |
| 30 // | 30 // |
| 31 static void test_faulty_pixelref(skiatest::Reporter* reporter) { | 31 static void test_faulty_pixelref(skiatest::Reporter* reporter) { |
| 32 // need a cache, but don't expect to use it, so the budget is not critical | 32 // need a cache, but don't expect to use it, so the budget is not critical |
| 33 SkAutoTUnref<SkDiscardableMemoryPool> pool( | 33 SkAutoTUnref<SkDiscardableMemoryPool> pool( |
| 34 SkDiscardableMemoryPool::Create(10 * 1000, NULL)); | 34 SkDiscardableMemoryPool::Create(10 * 1000, NULL)); |
| 35 SkBitmap bm; | 35 SkBitmap bm; |
| 36 bool installSuccess = SkInstallDiscardablePixelRef(SkNEW(FailureImageGenerat
or), &bm, pool); | 36 bool success = SkInstallDiscardablePixelRef(SkNEW(FailureImageGenerator), NU
LL, &bm, pool); |
| 37 REPORTER_ASSERT(reporter, installSuccess); | 37 REPORTER_ASSERT(reporter, success); |
| 38 // now our bitmap has a pixelref, but we know it will fail to lock | 38 // now our bitmap has a pixelref, but we know it will fail to lock |
| 39 | 39 |
| 40 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(200, 200)); | 40 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(200, 200)); |
| 41 SkCanvas* canvas = surface->getCanvas(); | 41 SkCanvas* canvas = surface->getCanvas(); |
| 42 | 42 |
| 43 const SkFilterQuality levels[] = { | 43 const SkFilterQuality levels[] = { |
| 44 kNone_SkFilterQuality, | 44 kNone_SkFilterQuality, |
| 45 kLow_SkFilterQuality, | 45 kLow_SkFilterQuality, |
| 46 kMedium_SkFilterQuality, | 46 kMedium_SkFilterQuality, |
| 47 kHigh_SkFilterQuality, | 47 kHigh_SkFilterQuality, |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 | 303 |
| 304 // ensure that we draw nothing if srcR does not intersect the bitmap | 304 // ensure that we draw nothing if srcR does not intersect the bitmap |
| 305 REPORTER_ASSERT(reporter, check_for_all_zeros(dst)); | 305 REPORTER_ASSERT(reporter, check_for_all_zeros(dst)); |
| 306 | 306 |
| 307 test_nan_antihair(); | 307 test_nan_antihair(); |
| 308 test_giantrepeat_crbug118018(reporter); | 308 test_giantrepeat_crbug118018(reporter); |
| 309 | 309 |
| 310 test_treatAsSprite(reporter); | 310 test_treatAsSprite(reporter); |
| 311 test_faulty_pixelref(reporter); | 311 test_faulty_pixelref(reporter); |
| 312 } | 312 } |
| OLD | NEW |