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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 if (original.empty() || original.isNull()) { | 100 if (original.empty() || original.isNull()) { |
101 return; | 101 return; |
102 } | 102 } |
103 static const SkImageEncoder::Type types[] = { | 103 static const SkImageEncoder::Type types[] = { |
104 SkImageEncoder::kPNG_Type, | 104 SkImageEncoder::kPNG_Type, |
105 SkImageEncoder::kJPEG_Type, | 105 SkImageEncoder::kJPEG_Type, |
106 SkImageEncoder::kWEBP_Type | 106 SkImageEncoder::kWEBP_Type |
107 }; | 107 }; |
108 for (size_t i = 0; i < SK_ARRAY_COUNT(types); i++) { | 108 for (size_t i = 0; i < SK_ARRAY_COUNT(types); i++) { |
109 SkImageEncoder::Type type = types[i]; | 109 SkImageEncoder::Type type = types[i]; |
110 SkAutoDataUnref encoded(create_data_from_bitmap(original, type)); | 110 sk_sp<SkData> encoded(create_data_from_bitmap(original, type)); |
111 REPORTER_ASSERT(reporter, encoded.get() != nullptr); | 111 REPORTER_ASSERT(reporter, encoded.get() != nullptr); |
112 if (nullptr == encoded.get()) { | 112 if (nullptr == encoded.get()) { |
113 continue; | 113 continue; |
114 } | 114 } |
115 SkBitmap lazy; | 115 SkBitmap lazy; |
116 bool installSuccess = install(encoded.get(), &lazy); | 116 bool installSuccess = install(encoded.get(), &lazy); |
117 REPORTER_ASSERT(reporter, installSuccess); | 117 REPORTER_ASSERT(reporter, installSuccess); |
118 if (!installSuccess) { | 118 if (!installSuccess) { |
119 continue; | 119 continue; |
120 } | 120 } |
(...skipping 218 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 |