OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
9 #include "SkData.h" | 10 #include "SkData.h" |
10 #include "SkDevice.h" | 11 #include "SkDevice.h" |
11 #include "SkImageEncoder.h" | 12 #include "SkImageEncoder.h" |
12 #include "SkImage_Base.h" | 13 #include "SkImage_Base.h" |
13 #include "SkPicture.h" | 14 #include "SkPicture.h" |
14 #include "SkPictureRecorder.h" | 15 #include "SkPictureRecorder.h" |
15 #include "SkPixelSerializer.h" | 16 #include "SkPixelSerializer.h" |
16 #include "SkRRect.h" | 17 #include "SkRRect.h" |
17 #include "SkStream.h" | 18 #include "SkStream.h" |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 } | 339 } |
339 } | 340 } |
340 | 341 |
341 image.reset(nullptr); | 342 image.reset(nullptr); |
342 { | 343 { |
343 SkBitmap cachedBitmap; | 344 SkBitmap cachedBitmap; |
344 REPORTER_ASSERT(reporter, !SkBitmapCache::Find(uniqueID, &cachedBitmap))
; | 345 REPORTER_ASSERT(reporter, !SkBitmapCache::Find(uniqueID, &cachedBitmap))
; |
345 } | 346 } |
346 } | 347 } |
347 #endif | 348 #endif |
| 349 |
| 350 // http://skbug.com/4390 |
| 351 DEF_TEST(ImageFromIndex8Bitmap, r) { |
| 352 SkPMColor pmColors[1] = {SkPreMultiplyColor(SK_ColorWHITE)}; |
| 353 SkBitmap bm; |
| 354 SkAutoTUnref<SkColorTable> ctable( |
| 355 new SkColorTable(pmColors, SK_ARRAY_COUNT(pmColors))); |
| 356 SkImageInfo info = |
| 357 SkImageInfo::Make(1, 1, kIndex_8_SkColorType, kPremul_SkAlphaType); |
| 358 bm.allocPixels(info, nullptr, ctable); |
| 359 SkAutoLockPixels autoLockPixels(bm); |
| 360 *bm.getAddr8(0, 0) = 0; |
| 361 SkAutoTUnref<SkImage> img(SkImage::NewFromBitmap(bm)); |
| 362 REPORTER_ASSERT(r, img.get() != nullptr); |
| 363 } |
OLD | NEW |