SkPDF: simplify SkPDFDevice::drawPaint.
Now just calls drawRect with the current clip's bounding box. This might be slightly more efficient for the rasterizer. Deletes 20 lines of code, making things more maintainable. remove internalDrawPaint(). Of 702 test images: 692 produced identical results. 19 produced slightly different PDFs that render identically. 1 rendered impoerceptable differently in perspective. Change-Id: I5539e58c8a27ead461922a04f2518daa1c7995ba Reviewed-on: https://skia-review.googlesource.com/156366 Commit-Queue: Ben Wagner <bungeman@google.com> Auto-Submit: Hal Canary <halcanary@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
This commit is contained in:
parent
ac9f090976
commit
abf8e41ccb
@ -593,40 +593,19 @@ void SkPDFDevice::drawAnnotation(const SkRect& rect, const char key[], SkData* v
|
||||
}
|
||||
|
||||
void SkPDFDevice::drawPaint(const SkPaint& srcPaint) {
|
||||
SkMatrix inverse;
|
||||
if (!this->ctm().invert(&inverse)) {
|
||||
return;
|
||||
}
|
||||
SkRect bbox = this->cs().bounds(this->bounds());
|
||||
inverse.mapRect(&bbox);
|
||||
bbox.roundOut(&bbox);
|
||||
if (this->hasEmptyClip()) {
|
||||
return;
|
||||
}
|
||||
SkPaint newPaint = srcPaint;
|
||||
remove_color_filter(&newPaint);
|
||||
replace_srcmode_on_opaque_paint(&newPaint);
|
||||
newPaint.setStyle(SkPaint::kFill_Style);
|
||||
|
||||
SkMatrix ctm = this->ctm();
|
||||
if (ctm.getType() & SkMatrix::kPerspective_Mask) {
|
||||
if (newPaint.getShader()) {
|
||||
transform_shader(&newPaint, ctm);
|
||||
}
|
||||
ctm = SkMatrix::I();
|
||||
}
|
||||
ScopedContentEntry content(this, this->cs(), ctm, newPaint);
|
||||
this->internalDrawPaint(newPaint, content.entry());
|
||||
}
|
||||
|
||||
void SkPDFDevice::internalDrawPaint(const SkPaint& paint,
|
||||
SkPDFDevice::ContentEntry* contentEntry) {
|
||||
if (!contentEntry) {
|
||||
return;
|
||||
}
|
||||
SkRect bbox = SkRect::Make(this->imageInfo().dimensions());
|
||||
SkMatrix inverse;
|
||||
if (!contentEntry->fState.fMatrix.invert(&inverse)) {
|
||||
return;
|
||||
}
|
||||
inverse.mapRect(&bbox);
|
||||
|
||||
SkPDFUtils::AppendRectangle(bbox, &contentEntry->fContent);
|
||||
SkPDFUtils::PaintPath(paint.getStyle(), SkPath::kWinding_FillType,
|
||||
&contentEntry->fContent);
|
||||
this->drawRect(bbox, newPaint);
|
||||
}
|
||||
|
||||
void SkPDFDevice::drawPoints(SkCanvas::PointMode mode,
|
||||
|
@ -210,8 +210,6 @@ private:
|
||||
|
||||
void internalDrawGlyphRun(const SkGlyphRun& glyphRun, SkPoint offset);
|
||||
|
||||
void internalDrawPaint(const SkPaint& paint, ContentEntry* contentEntry);
|
||||
|
||||
void internalDrawImageRect(SkKeyedImage,
|
||||
const SkRect* src,
|
||||
const SkRect& dst,
|
||||
|
Loading…
Reference in New Issue
Block a user