quick-reject before transforming images
Transforming images is expensive, and pointless if they're clipped out. Bug: chromium:794690 Change-Id: Iffa4f6c60275caf310b8327e083b8857018621c2 Reviewed-on: https://skia-review.googlesource.com/85044 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
10b814260a
commit
d096e0d126
@ -139,26 +139,34 @@ public:
|
||||
void onDrawImage(const SkImage* img,
|
||||
SkScalar l, SkScalar t,
|
||||
const SkPaint* paint) override {
|
||||
fTarget->drawImage(prepareImage(img).get(), l, t, MaybePaint(paint, fXformer.get()));
|
||||
if (!fTarget->quickReject(SkRect::Make(img->bounds()).makeOffset(l,t))) {
|
||||
fTarget->drawImage(prepareImage(img).get(), l, t, MaybePaint(paint, fXformer.get()));
|
||||
}
|
||||
}
|
||||
void onDrawImageRect(const SkImage* img,
|
||||
const SkRect* src, const SkRect& dst,
|
||||
const SkPaint* paint, SrcRectConstraint constraint) override {
|
||||
fTarget->drawImageRect(prepareImage(img).get(),
|
||||
src ? *src : SkRect::MakeIWH(img->width(), img->height()), dst,
|
||||
MaybePaint(paint, fXformer.get()), constraint);
|
||||
if (!fTarget->quickReject(dst)) {
|
||||
fTarget->drawImageRect(prepareImage(img).get(),
|
||||
src ? *src : SkRect::MakeIWH(img->width(), img->height()), dst,
|
||||
MaybePaint(paint, fXformer.get()), constraint);
|
||||
}
|
||||
}
|
||||
void onDrawImageNine(const SkImage* img,
|
||||
const SkIRect& center, const SkRect& dst,
|
||||
const SkPaint* paint) override {
|
||||
fTarget->drawImageNine(prepareImage(img).get(), center, dst,
|
||||
MaybePaint(paint, fXformer.get()));
|
||||
if (!fTarget->quickReject(dst)) {
|
||||
fTarget->drawImageNine(prepareImage(img).get(), center, dst,
|
||||
MaybePaint(paint, fXformer.get()));
|
||||
}
|
||||
}
|
||||
void onDrawImageLattice(const SkImage* img,
|
||||
const Lattice& lattice, const SkRect& dst,
|
||||
const SkPaint* paint) override {
|
||||
fTarget->drawImageLattice(prepareImage(img).get(), lattice, dst,
|
||||
MaybePaint(paint, fXformer.get()));
|
||||
if (!fTarget->quickReject(dst)) {
|
||||
fTarget->drawImageLattice(prepareImage(img).get(), lattice, dst,
|
||||
MaybePaint(paint, fXformer.get()));
|
||||
}
|
||||
}
|
||||
void onDrawAtlas(const SkImage* atlas, const SkRSXform* xforms, const SkRect* tex,
|
||||
const SkColor* colors, int count, SkBlendMode mode,
|
||||
@ -173,6 +181,7 @@ public:
|
||||
MaybePaint(paint, fXformer.get()));
|
||||
}
|
||||
|
||||
// TODO: quick reject bitmap draw calls before transforming too?
|
||||
void onDrawBitmap(const SkBitmap& bitmap,
|
||||
SkScalar l, SkScalar t,
|
||||
const SkPaint* paint) override {
|
||||
|
Loading…
Reference in New Issue
Block a user