Fix accessBitmap() with deferred clear, GPU path.

When accessBitmap() is called on a GPU device which has deferred clear,
and no drawing has been done, force the clear before returning the
bitmap.

This is covered by the top right test case in the imagefilterscropexpand
GM, where an offset image filter is drawn but the resulting bitmap is
cropped out, resulting in no drawing to the offscreen. It should be
empty, but without this fix it results in garbage (previous scratch
texture contents).

BUG=skia:
R=bsalomon@google.com

Review URL: https://codereview.chromium.org/204903002

git-svn-id: http://skia.googlecode.com/svn/trunk@13860 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
senorblanco@chromium.org 2014-03-19 18:24:04 +00:00
Родитель f5e315ccf1
Коммит b7b7eb32f4
2 изменённых файлов: 7 добавлений и 0 удалений

Просмотреть файл

@ -130,6 +130,8 @@ public:
virtual void onAttachToCanvas(SkCanvas* canvas) SK_OVERRIDE;
virtual void onDetachFromCanvas() SK_OVERRIDE;
virtual const SkBitmap& onAccessBitmap() SK_OVERRIDE;
/**
* Make's this device's rendertarget current in the underlying 3D API.
* Also implicitly flushes.

Просмотреть файл

@ -433,6 +433,11 @@ bool SkGpuDevice::onWritePixels(const SkImageInfo& info, const void* pixels, siz
return true;
}
const SkBitmap& SkGpuDevice::onAccessBitmap() {
DO_DEFERRED_CLEAR();
return INHERITED::onAccessBitmap();
}
void SkGpuDevice::onAttachToCanvas(SkCanvas* canvas) {
INHERITED::onAttachToCanvas(canvas);