Remove duplicated code in SkPictureRecord::drawRRect

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

git-svn-id: http://skia.googlecode.com/svn/trunk@9093 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
junov@chromium.org 2013-05-10 14:39:26 +00:00
parent c978478514
commit 0ce0df7d24

View File

@ -929,30 +929,20 @@ void SkPictureRecord::drawRect(const SkRect& rect, const SkPaint& paint) {
} }
void SkPictureRecord::drawRRect(const SkRRect& rrect, const SkPaint& paint) { void SkPictureRecord::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
uint32_t initialOffset, size;
if (rrect.isRect()) { if (rrect.isRect()) {
// op + paint index + rect this->SkPictureRecord::drawRect(rrect.getBounds(), paint);
size = 2 * kUInt32Size + sizeof(SkRect);
initialOffset = this->addDraw(DRAW_RECT, &size);
SkASSERT(initialOffset+getPaintOffset(DRAW_RECT, size) == fWriter.size());
addPaint(paint);
addRect(rrect.getBounds());
} else if (rrect.isOval()) { } else if (rrect.isOval()) {
// op + paint index + rect this->SkPictureRecord::drawOval(rrect.getBounds(), paint);
size = 2 * kUInt32Size + sizeof(SkRect);
initialOffset = this->addDraw(DRAW_OVAL, &size);
SkASSERT(initialOffset+getPaintOffset(DRAW_OVAL, size) == fWriter.size());
addPaint(paint);
addRect(rrect.getBounds());
} else { } else {
// op + paint index + rrect // op + paint index + rrect
uint32_t initialOffset, size;
size = 2 * kUInt32Size + SkRRect::kSizeInMemory; size = 2 * kUInt32Size + SkRRect::kSizeInMemory;
initialOffset = this->addDraw(DRAW_RRECT, &size); initialOffset = this->addDraw(DRAW_RRECT, &size);
SkASSERT(initialOffset+getPaintOffset(DRAW_RRECT, size) == fWriter.size()); SkASSERT(initialOffset+getPaintOffset(DRAW_RRECT, size) == fWriter.size());
addPaint(paint); addPaint(paint);
addRRect(rrect); addRRect(rrect);
}
validate(initialOffset, size); validate(initialOffset, size);
}
} }
void SkPictureRecord::drawPath(const SkPath& path, const SkPaint& paint) { void SkPictureRecord::drawPath(const SkPath& path, const SkPaint& paint) {