Ensure that SkDeferredCanvas::onCreateCompatibleDevice unrefs its temp device.
Also update my GM to use createCompatibleDevice. Review URL: https://codereview.appspot.com/6357061 git-svn-id: http://skia.googlecode.com/svn/trunk@4450 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
44f7c4a6f8
commit
d7dbd423f2
@ -72,13 +72,11 @@ protected:
|
||||
canvas->translate(0, SkIntToScalar(bitmap.height() + 20));
|
||||
canvas->drawBitmap(subset, 0, 0);
|
||||
}
|
||||
/*
|
||||
|
||||
// Now do the same but with a device bitmap as source image
|
||||
SkRefPtr<SkDevice> primaryDevice(canvas->getDevice());
|
||||
SkRefPtr<SkDevice> secondDevice(canvas->createCompatibleDevice(
|
||||
SkAutoTUnref<SkDevice> secondDevice(canvas->createCompatibleDevice(
|
||||
SkBitmap::kARGB_8888_Config, bitmap.width(),
|
||||
bitmap.height(), true));
|
||||
secondDevice->unref();
|
||||
SkCanvas secondCanvas(secondDevice.get());
|
||||
secondCanvas.writePixels(bitmap, 0, 0);
|
||||
|
||||
@ -91,7 +89,7 @@ protected:
|
||||
|
||||
canvas->drawBitmap(deviceBitmap, 0, 0);
|
||||
canvas->drawBitmap(deviceSubset, 0, 0);
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -589,9 +589,9 @@ SkDevice* SkDeferredCanvas::DeferredDevice::onCreateCompatibleDevice(
|
||||
// Save layer usage not supported, and not required by SkDeferredCanvas.
|
||||
SkASSERT(usage != kSaveLayer_Usage);
|
||||
// Create a compatible non-deferred device.
|
||||
SkDevice* compatibleDevice =
|
||||
fImmediateDevice->createCompatibleDevice(config, width, height,
|
||||
isOpaque);
|
||||
SkAutoTUnref<SkDevice> compatibleDevice
|
||||
(fImmediateDevice->createCompatibleDevice(config, width, height,
|
||||
isOpaque));
|
||||
return SkNEW_ARGS(DeferredDevice, (compatibleDevice, fDeviceContext));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user