aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-09-05 21:06:47 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-05 21:06:53 +0000
commitafb0bd4f447c3c58007ced563f31b3e856346d3b (patch)
treecd31446a627d8fd51df5443c8f6416392c19c706 /src
parent2259bd42cf7cede7c1196d10f1a5a68180c94a32 (diff)
Revert "Optimize SkColorSpaceXformCanvas for GPU-acceleration"
This reverts commit 19c8726a0829e506c5c42d22d67b3fe7505ed24e. Reason for revert: Breaking Chrome roll Original change's description: > Optimize SkColorSpaceXformCanvas for GPU-acceleration > > This change ensures that SkImages are uploaded to the GPU before > applying the xform when the destination canvas is on the GPU. This > makes it possible to get hits in the texture cache and it ensure > that transforms get computed on the GPU. > > This fixes a severe performance regression in Chrome that happened > when color correction was enabled. > > BUG=chromium:760738 > > Change-Id: I52032a9f06ccbe1a7fd56a91db15377925143b26 > Reviewed-on: https://skia-review.googlesource.com/42422 > Reviewed-by: Brian Osman <brianosman@google.com> > Commit-Queue: Justin Novosad <junov@chromium.org> TBR=brianosman@google.com,junov@chromium.org Change-Id: Ia117d6f95c34324383aaf3bfc990bb13e48bed6e No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: chromium:760738 Reviewed-on: https://skia-review.googlesource.com/42720 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/SkColorSpaceXformCanvas.cpp24
1 files changed, 5 insertions, 19 deletions
diff --git a/src/core/SkColorSpaceXformCanvas.cpp b/src/core/SkColorSpaceXformCanvas.cpp
index 4e1b75b117..6d6d27b399 100644
--- a/src/core/SkColorSpaceXformCanvas.cpp
+++ b/src/core/SkColorSpaceXformCanvas.cpp
@@ -139,25 +139,25 @@ 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()));
+ fTarget->drawImage(fXformer->apply(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(),
+ fTarget->drawImageRect(fXformer->apply(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,
+ fTarget->drawImageNine(fXformer->apply(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,
+ fTarget->drawImageLattice(fXformer->apply(img).get(), lattice, dst,
MaybePaint(paint, fXformer.get()));
}
void onDrawAtlas(const SkImage* atlas, const SkRSXform* xforms, const SkRect* tex,
@@ -169,7 +169,7 @@ public:
fXformer->apply(xformed.begin(), colors, count);
colors = xformed.begin();
}
- fTarget->drawAtlas(prepareImage(atlas).get(), xforms, tex, colors, count, mode, cull,
+ fTarget->drawAtlas(fXformer->apply(atlas).get(), xforms, tex, colors, count, mode, cull,
MaybePaint(paint, fXformer.get()));
}
@@ -308,20 +308,6 @@ public:
void onFlush() override { return fTarget->flush(); }
private:
- sk_sp<SkImage> prepareImage(const SkImage* image) {
- GrContext* gr = fTarget->getGrContext();
- if (gr) {
- // If fTarget is GPU-accelerated, we want to upload to a texture
- // before applying the transform. This way, we can get cache hits
- // in the texture cache and the transform gets applied on the GPU.
- return fXformer->apply(image->makeTextureImage(gr, nullptr).get());
- }
- // TODO: Extract a sub image corresponding to the src rect in order
- // to xform only the useful part of the image. Sub image could be reduced
- // even further by taking into account dst_rect+ctm+clip
- return fXformer->apply(image);
- }
-
bool skipXform(const SkBitmap& bitmap) {
return (!bitmap.colorSpace() && fTargetCS->isSRGB()) ||
(SkColorSpace::Equals(bitmap.colorSpace(), fTargetCS.get())) ||