Adding a flush method to SkCanvas

BUG=http://code.google.com/p/skia/issues/detail?id=467
REVIEW=http://codereview.appspot.com/5600044/
TEST=gm uses the new code path on all its test cases



git-svn-id: http://skia.googlecode.com/svn/trunk@3102 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
junov@chromium.org 2012-01-30 14:53:22 +00:00
parent 9aed114505
commit bf6c1e4aff
4 changed files with 14 additions and 3 deletions

View File

@ -287,9 +287,7 @@ static ErrorBitfield generate_image(GM* gm, const ConfigData& gRec,
}
SkAutoUnref canvasUnref(canvas);
invokeGM(gm, canvas);
if (deferred) {
canvas->getDevice()->accessBitmap(false); // trigger a flush
}
canvas->flush();
} else { // GPU
if (NULL == context) {
return ERROR_NO_GPU_CONTEXT;

View File

@ -61,6 +61,11 @@ public:
///////////////////////////////////////////////////////////////////////////
/**
* Trigger the immediate execution of all pending draw operations.
*/
void flush();
/**
* Return the width/height of the underlying device. The current drawable
* area may be small (due to clipping or saveLayer). For a canvas with

View File

@ -470,6 +470,13 @@ SkDrawFilter* SkCanvas::setDrawFilter(SkDrawFilter* filter) {
///////////////////////////////////////////////////////////////////////////////
void SkCanvas::flush() {
SkDevice* device = this->getDevice();
if (device) {
device->flush();
}
}
SkISize SkCanvas::getDeviceSize() const {
SkDevice* d = this->getDevice();
return d ? SkISize::Make(d->width(), d->height()) : SkISize::Make(0, 0);

View File

@ -535,6 +535,7 @@ void SkDeferredCanvas::DeferredDevice::flushPending()
void SkDeferredCanvas::DeferredDevice::flush()
{
flushPending();
fImmediateCanvas->flush();
}
void SkDeferredCanvas::DeferredDevice::flushContext()