Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: tests/ImageTest.cpp

Issue 1377473002: SkImage::NewFromBitmap works with Index8 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-09-28 (Monday) 14:48:00 EDT Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/image/SkImage_Raster.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « src/image/SkImage_Raster.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698