diff options
author | 2012-10-31 13:56:35 +0000 | |
---|---|---|
committer | 2012-10-31 13:56:35 +0000 | |
commit | d3eb336d56b2ad989229c8fb21ea20f5a7b14a32 (patch) | |
tree | 2b31bd60980a78b66e2558ee46bb8c0ce5bcba97 /src/gpu | |
parent | 209a1143a1a26935578d45c7f86dc6f9aa2eb1a6 (diff) |
Add validation check to GrGpu::createTexture & minor SkGpuDevice cleanup
https://codereview.appspot.com/6821055/
git-svn-id: http://skia.googlecode.com/svn/trunk@6213 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/GrGpu.cpp | 4 | ||||
-rw-r--r-- | src/gpu/SkGpuDevice.cpp | 8 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp index 542c458d3f..57eb085152 100644 --- a/src/gpu/GrGpu.cpp +++ b/src/gpu/GrGpu.cpp @@ -126,6 +126,10 @@ void GrGpu::unimpl(const char msg[]) { GrTexture* GrGpu::createTexture(const GrTextureDesc& desc, const void* srcData, size_t rowBytes) { + if (kUnknown_GrPixelConfig == desc.fConfig) { + return NULL; + } + this->handleDirtyContext(); GrTexture* tex = this->onCreateTexture(desc, srcData, rowBytes); if (NULL != tex && diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 8f62e283ab..b0f4ac188b 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -204,7 +204,8 @@ void SkGpuDevice::initFromRenderTarget(GrContext* context, SkGpuDevice::SkGpuDevice(GrContext* context, SkBitmap::Config config, int width, - int height) + int height, + int sampleCount) : SkDevice(config, width, height, false /*isOpaque*/) { fDrawProcs = NULL; @@ -218,14 +219,13 @@ SkGpuDevice::SkGpuDevice(GrContext* context, if (config != SkBitmap::kRGB_565_Config) { config = SkBitmap::kARGB_8888_Config; } - SkBitmap bm; - bm.setConfig(config, width, height); GrTextureDesc desc; desc.fFlags = kRenderTarget_GrTextureFlagBit; desc.fWidth = width; desc.fHeight = height; - desc.fConfig = SkBitmapConfig2GrPixelConfig(bm.config()); + desc.fConfig = SkBitmapConfig2GrPixelConfig(config); + desc.fSampleCnt = sampleCount; SkAutoTUnref<GrTexture> texture(fContext->createUncachedTexture(desc, NULL, 0)); |