| 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 28 matching lines...) Expand all Loading... |
| 39 SkAutoTUnref<SkDiscardableMemoryPool> pool( | 39 SkAutoTUnref<SkDiscardableMemoryPool> pool( |
| 40 SkDiscardableMemoryPool::Create(10 * 1000, NULL)); | 40 SkDiscardableMemoryPool::Create(10 * 1000, NULL)); |
| 41 SkBitmap bm; | 41 SkBitmap bm; |
| 42 bool installSuccess = SkInstallDiscardablePixelRef(SkNEW(FailureImageGenerat
or), &bm, pool); | 42 bool installSuccess = SkInstallDiscardablePixelRef(SkNEW(FailureImageGenerat
or), &bm, pool); |
| 43 REPORTER_ASSERT(reporter, installSuccess); | 43 REPORTER_ASSERT(reporter, installSuccess); |
| 44 // now our bitmap has a pixelref, but we know it will fail to lock | 44 // now our bitmap has a pixelref, but we know it will fail to lock |
| 45 | 45 |
| 46 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(200, 200)); | 46 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(200, 200)); |
| 47 SkCanvas* canvas = surface->getCanvas(); | 47 SkCanvas* canvas = surface->getCanvas(); |
| 48 | 48 |
| 49 const SkPaint::FilterLevel levels[] = { | 49 const SkFilterQuality levels[] = { |
| 50 SkPaint::kNone_FilterLevel, | 50 kNone_SkFilterQuality, |
| 51 SkPaint::kLow_FilterLevel, | 51 kLow_SkFilterQuality, |
| 52 SkPaint::kMedium_FilterLevel, | 52 kMedium_SkFilterQuality, |
| 53 SkPaint::kHigh_FilterLevel, | 53 kHigh_SkFilterQuality, |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 SkPaint paint; | 56 SkPaint paint; |
| 57 canvas->scale(2, 2); // need a scale, otherwise we may ignore filtering | 57 canvas->scale(2, 2); // need a scale, otherwise we may ignore filtering |
| 58 for (size_t i = 0; i < SK_ARRAY_COUNT(levels); ++i) { | 58 for (size_t i = 0; i < SK_ARRAY_COUNT(levels); ++i) { |
| 59 paint.setFilterLevel(levels[i]); | 59 paint.setFilterQuality(levels[i]); |
| 60 canvas->drawBitmap(bm, 0, 0, &paint); | 60 canvas->drawBitmap(bm, 0, 0, &paint); |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 | 63 |
| 64 /////////////////////////////////////////////////////////////////////////////// | 64 /////////////////////////////////////////////////////////////////////////////// |
| 65 | 65 |
| 66 static void rand_matrix(SkMatrix* mat, SkRandom& rand, unsigned mask) { | 66 static void rand_matrix(SkMatrix* mat, SkRandom& rand, unsigned mask) { |
| 67 mat->setIdentity(); | 67 mat->setIdentity(); |
| 68 if (mask & SkMatrix::kTranslate_Mask) { | 68 if (mask & SkMatrix::kTranslate_Mask) { |
| 69 mat->postTranslate(rand.nextSScalar1(), rand.nextSScalar1()); | 69 mat->postTranslate(rand.nextSScalar1(), rand.nextSScalar1()); |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 | 309 |
| 310 // ensure that we draw nothing if srcR does not intersect the bitmap | 310 // ensure that we draw nothing if srcR does not intersect the bitmap |
| 311 REPORTER_ASSERT(reporter, check_for_all_zeros(dst)); | 311 REPORTER_ASSERT(reporter, check_for_all_zeros(dst)); |
| 312 | 312 |
| 313 test_nan_antihair(); | 313 test_nan_antihair(); |
| 314 test_giantrepeat_crbug118018(reporter); | 314 test_giantrepeat_crbug118018(reporter); |
| 315 | 315 |
| 316 test_treatAsSprite(reporter); | 316 test_treatAsSprite(reporter); |
| 317 test_faulty_pixelref(reporter); | 317 test_faulty_pixelref(reporter); |
| 318 } | 318 } |
| OLD | NEW |