Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 67da665

Browse files
egdanielSkia Commit-Bot
authored andcommitted
Pass origin into GrCoordTransform.
This allows us to not need to read the origin from the stored proxy Bug: skia:9556 Change-Id: I1c09805201518db2aac2279d02e20b20fc2c0084 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270374 Reviewed-by: Brian Salomon <[email protected]> Commit-Queue: Greg Daniel <[email protected]>
1 parent 2b67bf3 commit 67da665

11 files changed

+21
-16
lines changed

src/effects/imagefilters/SkDisplacementMapEffect.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,9 +486,10 @@ GrDisplacementMapEffect::GrDisplacementMapEffect(
486486
, fDisplacementTransform(
487487
SkMatrix::Concat(SkMatrix::MakeTrans(displSubset.x(), displSubset.y()),
488488
offsetMatrix),
489-
displacement.proxy())
489+
displacement.proxy(), displacement.origin())
490490
, fDisplacementSampler(std::move(displacement))
491-
, fColorTransform(SkMatrix::MakeTrans(colorSubset.x(), colorSubset.y()), color.proxy())
491+
, fColorTransform(SkMatrix::MakeTrans(colorSubset.x(), colorSubset.y()), color.proxy(),
492+
color.origin())
492493
, fDomain(color.proxy(),
493494
GrTextureDomain::MakeTexelDomain(colorSubset,
494495
GrTextureDomain::kDecal_Mode),

src/effects/imagefilters/SkLightingImageFilter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1615,7 +1615,7 @@ GrLightingEffect::GrLightingEffect(ClassID classID,
16151615
const SkIRect* srcBounds)
16161616
// Perhaps this could advertise the opaque or coverage-as-alpha optimizations?
16171617
: INHERITED(classID, kNone_OptimizationFlags)
1618-
, fCoordTransform(view.proxy())
1618+
, fCoordTransform(view.proxy(), view.origin())
16191619
, fDomain(create_domain(view.proxy(), srcBounds, GrTextureDomain::kDecal_Mode))
16201620
, fTextureSampler(std::move(view))
16211621
, fLight(std::move(light))

src/effects/imagefilters/SkMorphologyImageFilter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ GrMorphologyEffect::GrMorphologyEffect(GrSurfaceProxyView view,
400400
MorphType type,
401401
const float range[2])
402402
: INHERITED(kGrMorphologyEffect_ClassID, ModulateForClampedSamplerOptFlags(srcAlphaType))
403-
, fCoordTransform(view.proxy())
403+
, fCoordTransform(view.proxy(), view.origin())
404404
, fTextureSampler(std::move(view))
405405
, fDirection(direction)
406406
, fRadius(radius)

src/gpu/GrCoordTransform.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@ class GrCoordTransform {
2929
* Create a transformation that maps [0, proxy->width()] x [0, proxy->height()] to a proxy's
3030
* extent.
3131
*/
32-
GrCoordTransform(GrSurfaceProxy* proxy) : fProxy(proxy) {}
32+
GrCoordTransform(GrSurfaceProxy* proxy, GrSurfaceOrigin origin)
33+
: fProxy(proxy), fOrigin(origin) {}
3334

3435
/**
35-
* Create a transformation from a matrix. The proxy origin also implies whether a y-reversal
36-
* should be performed.
36+
* Create a transformation from a matrix. The origin implies whether a y-reversal should be
37+
* performed.
3738
*/
38-
GrCoordTransform(const SkMatrix& m, GrSurfaceProxy* proxy) : fProxy(proxy), fMatrix(m) {
39+
GrCoordTransform(const SkMatrix& m, GrSurfaceProxy* proxy, GrSurfaceOrigin origin)
40+
: fProxy(proxy), fOrigin(origin), fMatrix(m) {
3941
SkASSERT(proxy);
4042
}
4143

@@ -75,7 +77,7 @@ class GrCoordTransform {
7577
bool normalize() const {
7678
return fProxy && fProxy->backendFormat().textureType() != GrTextureType::kRectangle;
7779
}
78-
bool reverseY() const { return fProxy && fProxy->origin() == kBottomLeft_GrSurfaceOrigin; }
80+
bool reverseY() const { return fProxy && fOrigin == kBottomLeft_GrSurfaceOrigin; }
7981
bool isNoOp() const { return fMatrix.isIdentity() && !this->normalize() && !this->reverseY(); }
8082

8183
// This should only ever be called at flush time after the backing texture has been
@@ -84,6 +86,7 @@ class GrCoordTransform {
8486

8587
private:
8688
const GrSurfaceProxy* fProxy = nullptr;
89+
GrSurfaceOrigin fOrigin = kTopLeft_GrSurfaceOrigin;
8790
SkMatrix fMatrix = SkMatrix::I();
8891
};
8992

src/gpu/effects/GrBicubicEffect.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ GrBicubicEffect::GrBicubicEffect(GrSurfaceProxyView view, const SkMatrix& matrix
169169
: INHERITED{kGrBicubicEffect_ClassID,
170170
ModulateForSamplerOptFlags(
171171
alphaType, GrTextureDomain::IsDecalSampled(wrapModes, modeX, modeY))}
172-
, fCoordTransform(matrix, view.proxy())
172+
, fCoordTransform(matrix, view.proxy(), view.origin())
173173
, fDomain(view.proxy(), domain, modeX, modeY)
174174
, fTextureSampler(std::move(view),
175175
GrSamplerState(wrapModes, GrSamplerState::Filter::kNearest))

src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ GrGaussianConvolutionFragmentProcessor::GrGaussianConvolutionFragmentProcessor(
224224
int bounds[2])
225225
: INHERITED(kGrGaussianConvolutionFragmentProcessor_ClassID,
226226
ModulateForSamplerOptFlags(alphaType, mode == GrTextureDomain::kDecal_Mode))
227-
, fCoordTransform(view.proxy())
227+
, fCoordTransform(view.proxy(), view.origin())
228228
, fTextureSampler(std::move(view))
229229
, fRadius(radius)
230230
, fDirection(direction)

src/gpu/effects/GrMatrixConvolutionEffect.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(GrSurfaceProxyView srcView,
155155
// To advertise either the modulation or opaqueness optimizations we'd have to examine the
156156
// parameters.
157157
: INHERITED(kGrMatrixConvolutionEffect_ClassID, kNone_OptimizationFlags)
158-
, fCoordTransform(srcView.proxy())
158+
, fCoordTransform(srcView.proxy(), srcView.origin())
159159
, fDomain(srcView.proxy(), GrTextureDomain::MakeTexelDomain(srcBounds, tileMode),
160160
tileMode, tileMode)
161161
, fTextureSampler(std::move(srcView))

src/gpu/effects/GrTextureEffect.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ GrTextureEffect::GrTextureEffect(GrSurfaceProxyView view, SkAlphaType alphaType,
414414
const SkMatrix& matrix, const Sampling& sampling)
415415
: GrFragmentProcessor(kGrTextureEffect_ClassID,
416416
ModulateForSamplerOptFlags(alphaType, sampling.usesDecal()))
417-
, fCoordTransform(matrix, view.proxy())
417+
, fCoordTransform(matrix, view.proxy(), view.origin())
418418
, fSampler(std::move(view), sampling.fHWSampler)
419419
, fSubset(sampling.fShaderSubset)
420420
, fShaderModes{sampling.fShaderModes[0], sampling.fShaderModes[1]} {

src/gpu/effects/generated/GrAlphaThresholdFragmentProcessor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class GrAlphaThresholdFragmentProcessor : public GrFragmentProcessor {
4040
: INHERITED(kGrAlphaThresholdFragmentProcessor_ClassID, kNone_OptimizationFlags)
4141
, maskCoordTransform(
4242
SkMatrix::MakeTrans(SkIntToScalar(-bounds.x()), SkIntToScalar(-bounds.y())),
43-
mask.proxy())
43+
mask.proxy(), mask.origin())
4444
, mask(std::move(mask))
4545
, innerThreshold(innerThreshold)
4646
, outerThreshold(outerThreshold) {

src/gpu/effects/generated/GrMagnifierEffect.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class GrMagnifierEffect : public GrFragmentProcessor {
3939
GrMagnifierEffect(GrSurfaceProxyView src, SkIRect bounds, SkRect srcRect, float xInvZoom,
4040
float yInvZoom, float xInvInset, float yInvInset)
4141
: INHERITED(kGrMagnifierEffect_ClassID, kNone_OptimizationFlags)
42-
, srcCoordTransform(SkMatrix::I(), src.proxy())
42+
, srcCoordTransform(SkMatrix::I(), src.proxy(), src.origin())
4343
, src(std::move(src))
4444
, bounds(bounds)
4545
, srcRect(srcRect)

0 commit comments

Comments
 (0)