| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkCachingPixelRef.h" | 9 #include "SkCachingPixelRef.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 SkASSERT((pixelRefType >= 0) && (pixelRefType <= kLast_PixelRefType)); | 242 SkASSERT((pixelRefType >= 0) && (pixelRefType <= kLast_PixelRefType)); |
| 243 SkAutoTDelete<SkImageGenerator> gen(SkNEW_ARGS(TestImageGenerator, | 243 SkAutoTDelete<SkImageGenerator> gen(SkNEW_ARGS(TestImageGenerator, |
| 244 (type, reporter))); | 244 (type, reporter))); |
| 245 REPORTER_ASSERT(reporter, gen.get() != NULL); | 245 REPORTER_ASSERT(reporter, gen.get() != NULL); |
| 246 SkBitmap lazy; | 246 SkBitmap lazy; |
| 247 bool success; | 247 bool success; |
| 248 if (kSkCaching_PixelRefType == pixelRefType) { | 248 if (kSkCaching_PixelRefType == pixelRefType) { |
| 249 // Ignore factory; use global cache. | 249 // Ignore factory; use global cache. |
| 250 success = SkCachingPixelRef::Install(gen.detach(), &lazy); | 250 success = SkCachingPixelRef::Install(gen.detach(), &lazy); |
| 251 } else { | 251 } else { |
| 252 success = SkInstallDiscardablePixelRef(gen.detach(), &lazy, factory); | 252 success = SkInstallDiscardablePixelRef(gen.detach(), NULL, &lazy, factor
y); |
| 253 } | 253 } |
| 254 REPORTER_ASSERT(reporter, success); | 254 REPORTER_ASSERT(reporter, success); |
| 255 if (TestImageGenerator::kSucceedGetPixels_TestType == type) { | 255 if (TestImageGenerator::kSucceedGetPixels_TestType == type) { |
| 256 check_test_image_generator_bitmap(reporter, lazy); | 256 check_test_image_generator_bitmap(reporter, lazy); |
| 257 } else if (TestImageGenerator::kFailGetPixels_TestType == type) { | 257 } else if (TestImageGenerator::kFailGetPixels_TestType == type) { |
| 258 SkAutoLockPixels autoLockPixels(lazy); | 258 SkAutoLockPixels autoLockPixels(lazy); |
| 259 REPORTER_ASSERT(reporter, NULL == lazy.getPixels()); | 259 REPORTER_ASSERT(reporter, NULL == lazy.getPixels()); |
| 260 } | 260 } |
| 261 } | 261 } |
| 262 | 262 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 canvas.clear(kDefaultColor); | 335 canvas.clear(kDefaultColor); |
| 336 canvas.drawImage(image, 0, 0, NULL); | 336 canvas.drawImage(image, 0, 0, NULL); |
| 337 if (TestImageGenerator::kSucceedGetPixels_TestType == test) { | 337 if (TestImageGenerator::kSucceedGetPixels_TestType == test) { |
| 338 REPORTER_ASSERT( | 338 REPORTER_ASSERT( |
| 339 r, TestImageGenerator::Color() == *bitmap.getAddr32(0, 0)); | 339 r, TestImageGenerator::Color() == *bitmap.getAddr32(0, 0)); |
| 340 } else { | 340 } else { |
| 341 REPORTER_ASSERT(r, kDefaultColor == bitmap.getColor(0,0)); | 341 REPORTER_ASSERT(r, kDefaultColor == bitmap.getColor(0,0)); |
| 342 } | 342 } |
| 343 } | 343 } |
| 344 } | 344 } |
| OLD | NEW |