Revert "Reduce dependence on GrSurface's origin field"
This reverts commit 467022b1861033d968195687da15270c208279ff.
Reason for revert: GrAHardwareBufferImageGenerator.cpp
Original change's description:
> Reduce dependence on GrSurface's origin field
>
> Unfortunately, GrGPU and its ilk are still using the GrSurface's origin a lot. I will clean that up in a second CL.
>
> Change-Id: Iba729440ce8ea8d24bb7f4e5de55ed576a0f176d
> Reviewed-on: https://skia-review.googlesource.com/24700
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
TBR=bsalomon@google.com,robertphillips@google.com
Change-Id: I1b3f5c3b82d250ac164beb1d5c83abb6c3c6ab3b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/25620
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/effects/GrCircleBlurFragmentProcessor.cpp b/src/effects/GrCircleBlurFragmentProcessor.cpp
index a30bc4b..135b00e 100644
--- a/src/effects/GrCircleBlurFragmentProcessor.cpp
+++ b/src/effects/GrCircleBlurFragmentProcessor.cpp
@@ -174,12 +174,10 @@
builder[0] = sigmaToCircleRRatioFixed;
builder.finish();
- sk_sp<GrTextureProxy> blurProfile = resourceProvider->findProxyByUniqueKey(
- key, kTopLeft_GrSurfaceOrigin);
+ sk_sp<GrTextureProxy> blurProfile = resourceProvider->findProxyByUniqueKey(key);
if (!blurProfile) {
static constexpr int kProfileTextureWidth = 512;
GrSurfaceDesc texDesc;
- texDesc.fOrigin = kTopLeft_GrSurfaceOrigin;
texDesc.fWidth = kProfileTextureWidth;
texDesc.fHeight = 1;
texDesc.fConfig = kAlpha_8_GrPixelConfig;
@@ -199,7 +197,6 @@
return nullptr;
}
- SkASSERT(blurProfile->origin() == kTopLeft_GrSurfaceOrigin);
resourceProvider->assignUniqueKeyToProxy(key, blurProfile.get());
}
diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp
index 28b5870..d85160e 100644
--- a/src/effects/SkBlurMaskFilter.cpp
+++ b/src/effects/SkBlurMaskFilter.cpp
@@ -942,24 +942,23 @@
sk_sp<GrTextureProxy> GrRectBlurEffect::CreateBlurProfileTexture(
GrResourceProvider* resourceProvider,
float sigma) {
+ GrSurfaceDesc texDesc;
+
unsigned int profileSize = SkScalarCeilToInt(6*sigma);
+ texDesc.fWidth = profileSize;
+ texDesc.fHeight = 1;
+ texDesc.fConfig = kAlpha_8_GrPixelConfig;
+ texDesc.fIsMipMapped = false;
+
static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
GrUniqueKey key;
GrUniqueKey::Builder builder(&key, kDomain, 1);
builder[0] = profileSize;
builder.finish();
- sk_sp<GrTextureProxy> blurProfile(resourceProvider->findProxyByUniqueKey(
- key, kTopLeft_GrSurfaceOrigin));
+ sk_sp<GrTextureProxy> blurProfile(resourceProvider->findProxyByUniqueKey(key));
if (!blurProfile) {
- GrSurfaceDesc texDesc;
- texDesc.fOrigin = kTopLeft_GrSurfaceOrigin;
- texDesc.fWidth = profileSize;
- texDesc.fHeight = 1;
- texDesc.fConfig = kAlpha_8_GrPixelConfig;
- texDesc.fIsMipMapped = false;
-
std::unique_ptr<uint8_t[]> profile(SkBlurMask::ComputeBlurProfile(sigma));
blurProfile = GrSurfaceProxy::MakeDeferred(resourceProvider,
@@ -968,7 +967,6 @@
return nullptr;
}
- SkASSERT(blurProfile->origin() == kTopLeft_GrSurfaceOrigin);
resourceProvider->assignUniqueKeyToProxy(key, blurProfile.get());
}
@@ -1119,8 +1117,7 @@
}
builder.finish();
- sk_sp<GrTextureProxy> mask(context->resourceProvider()->findProxyByUniqueKey(
- key, kBottomLeft_GrSurfaceOrigin));
+ sk_sp<GrTextureProxy> mask(context->resourceProvider()->findProxyByUniqueKey(key));
if (!mask) {
// TODO: this could be approx but the texture coords will need to be updated
sk_sp<GrRenderTargetContext> rtc(context->makeDeferredRenderTargetContextWithFallback(
@@ -1157,7 +1154,6 @@
if (!mask) {
return nullptr;
}
- SkASSERT(mask->origin() == kBottomLeft_GrSurfaceOrigin);
context->resourceProvider()->assignUniqueKeyToProxy(key, mask.get());
}
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index 06e7e68..90756a7 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -597,15 +597,14 @@
void GrGLDisplacementMapEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrFragmentProcessor& proc) {
const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMapEffect>();
- GrSurfaceProxy* proxy = displacementMap.textureSampler(1).proxy();
- GrTexture* colorTex = proxy->priv().peekTexture();
+ GrTexture* colorTex = displacementMap.textureSampler(1).peekTexture();
SkScalar scaleX = displacementMap.scale().fX / colorTex->width();
SkScalar scaleY = displacementMap.scale().fY / colorTex->height();
pdman.set2f(fScaleUni, SkScalarToFloat(scaleX),
- proxy->origin() == kTopLeft_GrSurfaceOrigin ?
+ colorTex->origin() == kTopLeft_GrSurfaceOrigin ?
SkScalarToFloat(scaleY) : SkScalarToFloat(-scaleY));
- fGLDomain.setData(pdman, displacementMap.domain(), proxy);
+ fGLDomain.setData(pdman, displacementMap.domain(), colorTex);
if (SkToBool(displacementMap.colorSpaceXform())) {
fColorSpaceHelper.setData(pdman, displacementMap.colorSpaceXform());
}
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index 58064ce..7b72fcd 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -1899,15 +1899,14 @@
fLight = lighting.light()->createGLLight();
}
- GrTextureProxy* proxy = lighting.textureSampler(0).proxy();
- GrTexture* texture = proxy->priv().peekTexture();
+ GrTexture* texture = lighting.textureSampler(0).peekTexture();
- float ySign = proxy->origin() == kTopLeft_GrSurfaceOrigin ? -1.0f : 1.0f;
+ float ySign = texture->origin() == kTopLeft_GrSurfaceOrigin ? -1.0f : 1.0f;
pdman.set2f(fImageIncrementUni, 1.0f / texture->width(), ySign / texture->height());
pdman.set1f(fSurfaceScaleUni, lighting.surfaceScale());
sk_sp<SkImageFilterLight> transformedLight(
lighting.light()->transform(lighting.filterMatrix()));
- fDomain.setData(pdman, lighting.domain(), proxy);
+ fDomain.setData(pdman, lighting.domain(), texture);
fLight->setData(pdman, transformedLight.get());
}
diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp
index b2c6714..90e0a5c 100644
--- a/src/effects/SkMagnifierImageFilter.cpp
+++ b/src/effects/SkMagnifierImageFilter.cpp
@@ -202,15 +202,14 @@
const GrFragmentProcessor& effect) {
const GrMagnifierEffect& zoom = effect.cast<GrMagnifierEffect>();
- GrSurfaceProxy* proxy = zoom.textureSampler(0).proxy();
- GrTexture* tex = proxy->priv().peekTexture();
+ GrTexture* tex = zoom.textureSampler(0).peekTexture();
SkScalar invW = 1.0f / tex->width();
SkScalar invH = 1.0f / tex->height();
{
SkScalar y = zoom.srcRect().y() * invH;
- if (proxy->origin() != kTopLeft_GrSurfaceOrigin) {
+ if (tex->origin() != kTopLeft_GrSurfaceOrigin) {
y = 1.0f - (zoom.srcRect().height() / zoom.bounds().height()) - y;
}
@@ -222,7 +221,7 @@
{
SkScalar y = zoom.bounds().y() * invH;
- if (proxy->origin() != kTopLeft_GrSurfaceOrigin) {
+ if (tex->origin() != kTopLeft_GrSurfaceOrigin) {
y = 1.0f - zoom.bounds().height() * invH;
}
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index 2cc224d..a148bb3 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -293,8 +293,7 @@
void GrGLMorphologyEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrFragmentProcessor& proc) {
const GrMorphologyEffect& m = proc.cast<GrMorphologyEffect>();
- GrSurfaceProxy* proxy = m.textureSampler(0).proxy();
- GrTexture& texture = *proxy->priv().peekTexture();
+ GrTexture& texture = *m.textureSampler(0).peekTexture();
float pixelSize = 0.0f;
switch (m.direction()) {
@@ -312,7 +311,7 @@
if (m.useRange()) {
const float* range = m.range();
if (Gr1DKernelEffect::kY_Direction == m.direction() &&
- proxy->origin() == kBottomLeft_GrSurfaceOrigin) {
+ texture.origin() == kBottomLeft_GrSurfaceOrigin) {
pdman.set2f(fRangeUni, 1.0f - (range[1]*pixelSize), 1.0f - (range[0]*pixelSize));
} else {
pdman.set2f(fRangeUni, range[0] * pixelSize, range[1] * pixelSize);