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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkData.h" | 10 #include "SkData.h" |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 REPORTER_ASSERT(reporter, 0 == errors); | 248 REPORTER_ASSERT(reporter, 0 == errors); |
249 } | 249 } |
250 | 250 |
251 static void check_pixelref(TestImageGenerator::TestType type, | 251 static void check_pixelref(TestImageGenerator::TestType type, |
252 skiatest::Reporter* reporter, | 252 skiatest::Reporter* reporter, |
253 SkDiscardableMemory::Factory* factory, | 253 SkDiscardableMemory::Factory* factory, |
254 SkColorType colorType) { | 254 SkColorType colorType) { |
255 SkAutoTDelete<SkImageGenerator> gen(new TestImageGenerator(type, reporter, c
olorType)); | 255 SkAutoTDelete<SkImageGenerator> gen(new TestImageGenerator(type, reporter, c
olorType)); |
256 REPORTER_ASSERT(reporter, gen.get() != nullptr); | 256 REPORTER_ASSERT(reporter, gen.get() != nullptr); |
257 SkBitmap lazy; | 257 SkBitmap lazy; |
258 bool success = SkDEPRECATED_InstallDiscardablePixelRef(gen.detach(), nullptr
, &lazy, factory); | 258 bool success = SkDEPRECATED_InstallDiscardablePixelRef(gen.release(), nullpt
r, &lazy, factory); |
259 | 259 |
260 REPORTER_ASSERT(reporter, success); | 260 REPORTER_ASSERT(reporter, success); |
261 if (TestImageGenerator::kSucceedGetPixels_TestType == type) { | 261 if (TestImageGenerator::kSucceedGetPixels_TestType == type) { |
262 check_test_image_generator_bitmap(reporter, lazy); | 262 check_test_image_generator_bitmap(reporter, lazy); |
263 } else if (TestImageGenerator::kFailGetPixels_TestType == type) { | 263 } else if (TestImageGenerator::kFailGetPixels_TestType == type) { |
264 SkAutoLockPixels autoLockPixels(lazy); | 264 SkAutoLockPixels autoLockPixels(lazy); |
265 REPORTER_ASSERT(reporter, nullptr == lazy.getPixels()); | 265 REPORTER_ASSERT(reporter, nullptr == lazy.getPixels()); |
266 } | 266 } |
267 } | 267 } |
268 | 268 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 if (TestImageGenerator::kSucceedGetPixels_TestType == test) { | 339 if (TestImageGenerator::kSucceedGetPixels_TestType == test) { |
340 REPORTER_ASSERT( | 340 REPORTER_ASSERT( |
341 r, TestImageGenerator::Color() == bitmap.getColor(0, 0)); | 341 r, TestImageGenerator::Color() == bitmap.getColor(0, 0)); |
342 } | 342 } |
343 else { | 343 else { |
344 REPORTER_ASSERT(r, kDefaultColor == bitmap.getColor(0, 0)); | 344 REPORTER_ASSERT(r, kDefaultColor == bitmap.getColor(0, 0)); |
345 } | 345 } |
346 } | 346 } |
347 } | 347 } |
348 } | 348 } |
OLD | NEW |