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

Unified Diff: src/image/SkImage_Raster.cpp

Issue 869743002: more reinforcement that images never have zero width or height (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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_Gpu.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkImage_Raster.cpp
diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp
index 4636686e8d7e7811e161c69fe7deb87fba94cc8e..1dd57d6dc21c26d28d7c9218afb267e84977258a 100644
--- a/src/image/SkImage_Raster.cpp
+++ b/src/image/SkImage_Raster.cpp
@@ -186,11 +186,18 @@ SkImage* SkImage::NewFromGenerator(SkImageGenerator* generator) {
if (!SkInstallDiscardablePixelRef(generator, &bitmap)) {
return NULL;
}
+ if (0 == bitmap.width() || 0 == bitmap.height()) {
+ return NULL;
+ }
+
return SkNEW_ARGS(SkImage_Raster, (bitmap, NULL));
}
SkImage* SkNewImageFromPixelRef(const SkImageInfo& info, SkPixelRef* pr, size_t rowBytes,
const SkSurfaceProps* props) {
+ if (!SkImage_Raster::ValidArgs(info, rowBytes)) {
+ return NULL;
+ }
return SkNEW_ARGS(SkImage_Raster, (info, pr, rowBytes, props));
}
« no previous file with comments | « src/image/SkImage_Gpu.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698