aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-04-11 12:38:41 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-04-11 12:38:47 +0000
commitc64ee20e135a336ed775ccb6dec8a87efd19ec02 (patch)
tree661c8d0d3ee64ff31b45548758e3c1dfe4abc81d /src/gpu
parent90f09e7853f506808b7dad5c50b60376887277a4 (diff)
Revert "Fix handling of MaskFilter matrices"
This reverts commit 2097fd03ffea48bd904c48c93348b2350600870e. Reason for revert: This is breaking a lot of Windows bots (esp. on the shadermaskfilter_localmatrix) Original change's description: > Fix handling of MaskFilter matrices > > 1) extend GrFPArgs to track pre/post local matrices, add helpers for > creating pre/post wrapper args > > 2) add a SkShaderBase helper (totalLocalMatrix) to centralize the LM > sandwich logic. > > 3) update call sites to use the above > > 4) rename SkMatrixFilter::makeWithLocalMatrix -> makeWithMatrix, to > disambiguate vs. SkShader::makeWithLocalMatrix. > > BUG=skia:7744 > > Change-Id: Ib2b7b007e6924979b00649dde7c94ef4b34771f1 > Reviewed-on: https://skia-review.googlesource.com/119330 > Commit-Queue: Florin Malita <fmalita@chromium.org> > Reviewed-by: Brian Salomon <bsalomon@google.com> TBR=bsalomon@google.com,robertphillips@google.com,fmalita@chromium.org,reed@google.com Change-Id: I918dbb95bf00b3122e6699b84566ec82dbb5fc5c No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia:7744 Reviewed-on: https://skia-review.googlesource.com/120340 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrFPArgs.h75
-rw-r--r--src/gpu/GrTestUtils.cpp3
-rw-r--r--src/gpu/SkGpuDevice.cpp2
-rw-r--r--src/gpu/SkGr.cpp2
4 files changed, 19 insertions, 63 deletions
diff --git a/src/gpu/GrFPArgs.h b/src/gpu/GrFPArgs.h
index 3c1b8e37b9..cdb2e5de50 100644
--- a/src/gpu/GrFPArgs.h
+++ b/src/gpu/GrFPArgs.h
@@ -9,84 +9,39 @@
#define GrFPArgs_DEFINED
#include "SkFilterQuality.h"
-#include "SkMatrix.h"
+class SkMatrix;
class GrContext;
class GrColorSpaceInfo;
struct GrFPArgs {
GrFPArgs(GrContext* context,
const SkMatrix* viewMatrix,
+ const SkMatrix* localMatrix,
+ SkFilterQuality filterQuality,
+ const GrColorSpaceInfo* dstColorSpaceInfo)
+ : fContext(context)
+ , fViewMatrix(viewMatrix)
+ , fLocalMatrix(localMatrix)
+ , fFilterQuality(filterQuality)
+ , fDstColorSpaceInfo(dstColorSpaceInfo) {}
+
+ GrFPArgs(GrContext* context,
+ const SkMatrix* viewMatrix,
SkFilterQuality filterQuality,
const GrColorSpaceInfo* dstColorSpaceInfo)
: fContext(context)
, fViewMatrix(viewMatrix)
+ , fLocalMatrix(nullptr)
, fFilterQuality(filterQuality)
- , fDstColorSpaceInfo(dstColorSpaceInfo) {
- SkASSERT(fContext);
- SkASSERT(fViewMatrix);
- }
-
- class WithMatrixStorage;
-
- WithMatrixStorage makeWithPreLocalMatrix(const SkMatrix&) const;
- WithMatrixStorage makeWithPostLocalMatrix(const SkMatrix&) const;
+ , fDstColorSpaceInfo(dstColorSpaceInfo) {}
GrContext* fContext;
const SkMatrix* fViewMatrix;
-
- // We track both pre and post local matrix adjustments. For a given FP:
- //
- // total_local_matrix = postLocalMatrix x FP_localMatrix x preLocalMatrix
- //
- // Use the helpers above to create pre/post GrFPArgs wrappers.
- //
- const SkMatrix* fPreLocalMatrix = nullptr;
- const SkMatrix* fPostLocalMatrix = nullptr;
-
+ const SkMatrix* fLocalMatrix;
SkFilterQuality fFilterQuality;
const GrColorSpaceInfo* fDstColorSpaceInfo;
};
-class GrFPArgs::WithMatrixStorage final : public GrFPArgs {
-private:
- explicit WithMatrixStorage(const GrFPArgs& args) : INHERITED(args) {}
-
- friend struct GrFPArgs;
- SkMatrix fStorage;
-
- using INHERITED = GrFPArgs;
-};
-
-inline GrFPArgs::WithMatrixStorage GrFPArgs::makeWithPreLocalMatrix(const SkMatrix& lm) const {
- WithMatrixStorage newArgs(*this);
-
- if (!lm.isIdentity()) {
- if (fPreLocalMatrix) {
- newArgs.fStorage.setConcat(lm, *fPreLocalMatrix);
- newArgs.fPreLocalMatrix = newArgs.fStorage.isIdentity() ? nullptr : &newArgs.fStorage;
- } else {
- newArgs.fPreLocalMatrix = &lm;
- }
- }
-
- return newArgs;
-}
-
-inline GrFPArgs::WithMatrixStorage GrFPArgs::makeWithPostLocalMatrix(const SkMatrix& lm) const {
- WithMatrixStorage newArgs(*this);
-
- if (!lm.isIdentity()) {
- if (fPostLocalMatrix) {
- newArgs.fStorage.setConcat(*fPostLocalMatrix, lm);
- newArgs.fPostLocalMatrix = newArgs.fStorage.isIdentity() ? nullptr : &newArgs.fStorage;
- } else {
- newArgs.fPostLocalMatrix = &lm;
- }
- }
-
- return newArgs;
-}
-
#endif
diff --git a/src/gpu/GrTestUtils.cpp b/src/gpu/GrTestUtils.cpp
index 2aff35dad2..8958f84704 100644
--- a/src/gpu/GrTestUtils.cpp
+++ b/src/gpu/GrTestUtils.cpp
@@ -337,7 +337,8 @@ TestAsFPArgs::TestAsFPArgs(GrProcessorTestData* d)
: fViewMatrixStorage(TestMatrix(d->fRandom))
, fColorSpaceInfoStorage(skstd::make_unique<GrColorSpaceInfo>(TestColorSpace(d->fRandom),
kRGBA_8888_GrPixelConfig))
- , fArgs(d->context(), &fViewMatrixStorage, kNone_SkFilterQuality, fColorSpaceInfoStorage.get())
+ , fArgs(d->context(), &fViewMatrixStorage, nullptr, kNone_SkFilterQuality,
+ fColorSpaceInfoStorage.get())
{}
TestAsFPArgs::~TestAsFPArgs() {}
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index fca372eabd..eb26ba2f9b 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1092,7 +1092,7 @@ void SkGpuDevice::drawSpecial(SkSpecialImage* special1, int left, int top, const
if (tmpUnfiltered.getMaskFilter()) {
SkMatrix ctm = this->ctm();
ctm.postTranslate(-SkIntToScalar(left + offset.fX), -SkIntToScalar(top + offset.fY));
- tmpUnfiltered.setMaskFilter(tmpUnfiltered.getMaskFilter()->makeWithMatrix(ctm));
+ tmpUnfiltered.setMaskFilter(tmpUnfiltered.getMaskFilter()->makeWithLocalMatrix(ctm));
}
tmpUnfiltered.setImageFilter(nullptr);
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 99465f620b..b4cb22bd10 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -514,7 +514,7 @@ bool SkPaintToGrPaintWithTexture(GrContext* context,
if (textureIsAlphaOnly) {
if (const auto* shader = as_SB(paint.getShader())) {
shaderFP = shader->asFragmentProcessor(GrFPArgs(
- context, &viewM, paint.getFilterQuality(), &colorSpaceInfo));
+ context, &viewM, nullptr, paint.getFilterQuality(), &colorSpaceInfo));
if (!shaderFP) {
return false;
}