aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-10-31 13:56:35 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-10-31 13:56:35 +0000
commitd3eb336d56b2ad989229c8fb21ea20f5a7b14a32 (patch)
tree2b31bd60980a78b66e2558ee46bb8c0ce5bcba97 /src/gpu
parent209a1143a1a26935578d45c7f86dc6f9aa2eb1a6 (diff)
Add validation check to GrGpu::createTexture & minor SkGpuDevice cleanup
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrGpu.cpp4
-rw-r--r--src/gpu/SkGpuDevice.cpp8
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));