Revert "Enforce our rules about valid images when making textures"
This reverts commit 7035f3c466
.
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>
This commit is contained in:
parent
7035f3c466
commit
8bbdd49805
@ -23,7 +23,6 @@
|
|||||||
#include "SkColorFilter.h"
|
#include "SkColorFilter.h"
|
||||||
#include "SkConfig8888.h"
|
#include "SkConfig8888.h"
|
||||||
#include "SkData.h"
|
#include "SkData.h"
|
||||||
#include "SkImageInfoPriv.h"
|
|
||||||
#include "SkMaskFilter.h"
|
#include "SkMaskFilter.h"
|
||||||
#include "SkMessageBus.h"
|
#include "SkMessageBus.h"
|
||||||
#include "SkMipMap.h"
|
#include "SkMipMap.h"
|
||||||
@ -126,10 +125,6 @@ GrTexture* GrUploadPixmapToTexture(GrContext* ctx, const SkPixmap& pixmap, SkBud
|
|||||||
SkPixmap tmpPixmap;
|
SkPixmap tmpPixmap;
|
||||||
SkBitmap tmpBitmap;
|
SkBitmap tmpBitmap;
|
||||||
|
|
||||||
if (!SkImageInfoIsValid(pixmap.info())) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const GrCaps* caps = ctx->caps();
|
const GrCaps* caps = ctx->caps();
|
||||||
GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(pixmap.info(), *caps);
|
GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(pixmap.info(), *caps);
|
||||||
|
|
||||||
@ -204,10 +199,6 @@ GrTexture* GrGenerateMipMapsAndUploadToTexture(GrContext* ctx, const SkBitmap& b
|
|||||||
? SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware
|
? SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware
|
||||||
: SkDestinationSurfaceColorMode::kLegacy;
|
: SkDestinationSurfaceColorMode::kLegacy;
|
||||||
|
|
||||||
if (!SkImageInfoIsValid(bitmap.info())) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bitmap.info(), *ctx->caps());
|
GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bitmap.info(), *ctx->caps());
|
||||||
|
|
||||||
// We don't support Gray8 directly in the GL backend, so fail-over to GrUploadBitmapToTexture.
|
// 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;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SkASSERT(sizeof(int) <= sizeof(uint32_t));
|
||||||
|
if (bitmap.width() < 0 || bitmap.height() < 0) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
SkAutoPixmapUnlock srcUnlocker;
|
SkAutoPixmapUnlock srcUnlocker;
|
||||||
if (!bitmap.requestLock(&srcUnlocker)) {
|
if (!bitmap.requestLock(&srcUnlocker)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -268,10 +264,6 @@ GrTexture* GrGenerateMipMapsAndUploadToTexture(GrContext* ctx, const SkBitmap& b
|
|||||||
|
|
||||||
GrTexture* GrUploadMipMapToTexture(GrContext* ctx, const SkImageInfo& info,
|
GrTexture* GrUploadMipMapToTexture(GrContext* ctx, const SkImageInfo& info,
|
||||||
const GrMipLevel* texels, int mipLevelCount) {
|
const GrMipLevel* texels, int mipLevelCount) {
|
||||||
if (!SkImageInfoIsValid(info)) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const GrCaps* caps = ctx->caps();
|
const GrCaps* caps = ctx->caps();
|
||||||
return ctx->textureProvider()->createMipMappedTexture(GrImageInfoToSurfaceDesc(info, *caps),
|
return ctx->textureProvider()->createMipMappedTexture(GrImageInfoToSurfaceDesc(info, *caps),
|
||||||
SkBudgeted::kYes, texels,
|
SkBudgeted::kYes, texels,
|
||||||
|
Loading…
Reference in New Issue
Block a user