From 8bbdd49805bd77fec61e6e31f59d31a361e8be30 Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Sat, 14 Jan 2017 23:41:12 +0000 Subject: 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 > Reviewed-by: Matt Sarett > Reviewed-by: Brian Salomon > 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 Reviewed-by: Brian Osman --- src/gpu/SkGr.cpp | 18 +++++------------- 1 file 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, -- cgit v1.2.3