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

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) 13:36:28 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"
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
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 }
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