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

Unified 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, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/image/SkImage_Raster.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ImageTest.cpp
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index 0b27af97807664a3a3beaa118c8ab9958af8ee6c..9b483e2d0607ccc100e4013d6d072ab9189ed09c 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -5,7 +5,9 @@
* found in the LICENSE file.
*/
+#include "SkBitmap.h"
#include "SkCanvas.h"
+#include "SkColorPriv.h"
#include "SkData.h"
#include "SkDevice.h"
#include "SkImageEncoder.h"
@@ -345,3 +347,18 @@ DEF_GPUTEST(SkImage_Gpu2Cpu, reporter, factory) {
}
}
#endif
+
+// http://skbug.com/4390
+DEF_TEST(ImageFromIndex8Bitmap, r) {
+ 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
+ SkBitmap bm;
+ SkAutoTUnref<SkColorTable> ctable(
+ new SkColorTable(pmColors, SK_ARRAY_COUNT(pmColors)));
+ SkImageInfo info =
+ SkImageInfo::Make(1, 1, kIndex_8_SkColorType, kPremul_SkAlphaType);
+ bm.allocPixels(info, nullptr, ctable);
+ SkAutoLockPixels autoLockPixels(bm);
+ *bm.getAddr8(0, 0) = 0;
+ SkAutoTUnref<SkImage> img(SkImage::NewFromBitmap(bm));
+ REPORTER_ASSERT(r, img.get() != nullptr);
+}
« 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