aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-01-14 23:41:12 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-14 23:41:28 +0000
commit8bbdd49805bd77fec61e6e31f59d31a361e8be30 (patch)
tree2bbb1b0e8d05bd0ee60835ffe5848ffa7c4e3c27
parent7035f3c466826a4116e2f31deb64d1645ea9441b (diff)
Revert "Enforce our rules about valid images when making textures"
This reverts commit 7035f3c466826a4116e2f31deb64d1645ea9441b. Reason for revert: Need to revert earlier change to fix DEPS roll. Original change's description: > Enforce our rules about valid images when making textures > > I'm working to make GrUploadPixmapToTexture more robust > and easier to follow. This is one step on that journey. > > BUG=skia: > > Change-Id: I3ac39057e20ff8249843bb41ceca25f629aff31c > Reviewed-on: https://skia-review.googlesource.com/7037 > Commit-Queue: Brian Osman <brianosman@google.com> > Reviewed-by: Matt Sarett <msarett@google.com> > Reviewed-by: Brian Salomon <bsalomon@google.com> > TBR=bsalomon@google.com,msarett@google.com,robertphillips@google.com,brianosman@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Change-Id: I1d7fef2d3777f0fcabc6c36749908409bd31a0f1 Reviewed-on: https://skia-review.googlesource.com/7094 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
-rw-r--r--src/gpu/SkGr.cpp18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 50c7cc25a1..3cca52f2b0 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -23,7 +23,6 @@
#include "SkColorFilter.h"
#include "SkConfig8888.h"
#include "SkData.h"
-#include "SkImageInfoPriv.h"
#include "SkMaskFilter.h"
#include "SkMessageBus.h"
#include "SkMipMap.h"
@@ -126,10 +125,6 @@ GrTexture* GrUploadPixmapToTexture(GrContext* ctx, const SkPixmap& pixmap, SkBud
SkPixmap tmpPixmap;
SkBitmap tmpBitmap;
- if (!SkImageInfoIsValid(pixmap.info())) {
- return nullptr;
- }
-
const GrCaps* caps = ctx->caps();
GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(pixmap.info(), *caps);
@@ -204,10 +199,6 @@ GrTexture* GrGenerateMipMapsAndUploadToTexture(GrContext* ctx, const SkBitmap& b
? SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware
: SkDestinationSurfaceColorMode::kLegacy;
- if (!SkImageInfoIsValid(bitmap.info())) {
- return nullptr;
- }
-
GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bitmap.info(), *ctx->caps());
// We don't support Gray8 directly in the GL backend, so fail-over to GrUploadBitmapToTexture.
@@ -219,6 +210,11 @@ GrTexture* GrGenerateMipMapsAndUploadToTexture(GrContext* ctx, const SkBitmap& b
return nullptr;
}
+ SkASSERT(sizeof(int) <= sizeof(uint32_t));
+ if (bitmap.width() < 0 || bitmap.height() < 0) {
+ return nullptr;
+ }
+
SkAutoPixmapUnlock srcUnlocker;
if (!bitmap.requestLock(&srcUnlocker)) {
return nullptr;
@@ -268,10 +264,6 @@ GrTexture* GrGenerateMipMapsAndUploadToTexture(GrContext* ctx, const SkBitmap& b
GrTexture* GrUploadMipMapToTexture(GrContext* ctx, const SkImageInfo& info,
const GrMipLevel* texels, int mipLevelCount) {
- if (!SkImageInfoIsValid(info)) {
- return nullptr;
- }
-
const GrCaps* caps = ctx->caps();
return ctx->textureProvider()->createMipMappedTexture(GrImageInfoToSurfaceDesc(info, *caps),
SkBudgeted::kYes, texels,