public:
/**
* New device that will create an offscreen renderTarget based on the
- * config, width, height. The device's storage will not count against
- * the GrContext's texture cache budget. The device's pixels will be
- * uninitialized.
+ * config, width, height, and sampleCount. The device's storage will not
+ * count against the GrContext's texture cache budget. The device's pixels
+ * will be uninitialized.
*/
- SkGpuDevice(GrContext*, SkBitmap::Config, int width, int height);
+ SkGpuDevice(GrContext*, SkBitmap::Config, int width, int height, int sampleCount = 0);
/**
* New device that will render to the specified renderTarget.
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 &&
SkGpuDevice::SkGpuDevice(GrContext* context,
SkBitmap::Config config,
int width,
- int height)
+ int height,
+ int sampleCount)
: SkDevice(config, width, height, false /*isOpaque*/) {
fDrawProcs = NULL;
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));