Chromium Code Reviews| 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" |
| 10 #include "SkColorPriv.h" | |
| 9 #include "SkData.h" | 11 #include "SkData.h" |
| 10 #include "SkDevice.h" | 12 #include "SkDevice.h" |
| 11 #include "SkImageEncoder.h" | 13 #include "SkImageEncoder.h" |
| 12 #include "SkImage_Base.h" | 14 #include "SkImage_Base.h" |
| 13 #include "SkPicture.h" | 15 #include "SkPicture.h" |
| 14 #include "SkPictureRecorder.h" | 16 #include "SkPictureRecorder.h" |
| 15 #include "SkPixelSerializer.h" | 17 #include "SkPixelSerializer.h" |
| 16 #include "SkRRect.h" | 18 #include "SkRRect.h" |
| 17 #include "SkStream.h" | 19 #include "SkStream.h" |
| 18 #include "SkSurface.h" | 20 #include "SkSurface.h" |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 338 } | 340 } |
| 339 } | 341 } |
| 340 | 342 |
| 341 image.reset(nullptr); | 343 image.reset(nullptr); |
| 342 { | 344 { |
| 343 SkBitmap cachedBitmap; | 345 SkBitmap cachedBitmap; |
| 344 REPORTER_ASSERT(reporter, !SkBitmapCache::Find(uniqueID, &cachedBitmap)) ; | 346 REPORTER_ASSERT(reporter, !SkBitmapCache::Find(uniqueID, &cachedBitmap)) ; |
| 345 } | 347 } |
| 346 } | 348 } |
| 347 #endif | 349 #endif |
| 350 | |
| 351 // http://skbug.com/4390 | |
| 352 DEF_TEST(ImageFromIndex8Bitmap, r) { | |
| 353 SkPMColor pmColors[1] = {SkPremultiplyARGBInline(255, 255, 255, 255)}; | |
|
reed1
2015/09/28 18:08:55
No need to bring in colorpriv.h
can use SkPreMult
| |
| 354 SkBitmap bm; | |
| 355 SkAutoTUnref<SkColorTable> ctable( | |
| 356 new SkColorTable(pmColors, SK_ARRAY_COUNT(pmColors))); | |
| 357 SkImageInfo info = | |
| 358 SkImageInfo::Make(1, 1, kIndex_8_SkColorType, kPremul_SkAlphaType); | |
| 359 bm.allocPixels(info, nullptr, ctable); | |
| 360 SkAutoLockPixels autoLockPixels(bm); | |
| 361 *bm.getAddr8(0, 0) = 0; | |
| 362 SkAutoTUnref<SkImage> img(SkImage::NewFromBitmap(bm)); | |
| 363 REPORTER_ASSERT(r, img.get() != nullptr); | |
| 364 } | |
| OLD | NEW |