Avoid sending empty bitmaps through proxy canvas

Some back ends may crash when asked to draw an empty bitmap, so we
filter it out here.

BUG=skia:3692
R=djsollen@google.com,reed@google.com

Review URL: https://codereview.chromium.org/1072033002
This commit is contained in:
tomhudson 2015-04-09 09:20:19 -07:00 committed by Commit bot
parent a67572ff91
commit 2df6fd650c

View File

@ -1669,20 +1669,32 @@ void SkCanvas::drawImageRect(const SkImage* image, const SkRect* src, const SkRe
}
void SkCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar dx, SkScalar dy, const SkPaint* paint) {
if (bitmap.empty()) {
return;
}
this->onDrawBitmap(bitmap, dx, dy, paint);
}
void SkCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst,
const SkPaint* paint, DrawBitmapRectFlags flags) {
if (bitmap.empty()) {
return;
}
this->onDrawBitmapRect(bitmap, src, dst, paint, flags);
}
void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, const SkRect& dst,
const SkPaint* paint) {
if (bitmap.empty()) {
return;
}
this->onDrawBitmapNine(bitmap, center, dst, paint);
}
void SkCanvas::drawSprite(const SkBitmap& bitmap, int left, int top, const SkPaint* paint) {
if (bitmap.empty()) {
return;
}
this->onDrawSprite(bitmap, left, top, paint);
}