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); |
+} |