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

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) 14:48:00 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..7cdf5b4c05d0f1ffdf0702a2388c51830e9b4f22 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
+#include "SkBitmap.h"
#include "SkCanvas.h"
#include "SkData.h"
#include "SkDevice.h"
@@ -345,3 +346,18 @@ DEF_GPUTEST(SkImage_Gpu2Cpu, reporter, factory) {
}
}
#endif
+
+// http://skbug.com/4390
+DEF_TEST(ImageFromIndex8Bitmap, r) {
+ SkPMColor pmColors[1] = {SkPreMultiplyColor(SK_ColorWHITE)};
+ 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