Reland "Move GrGeometryProcessor's textures out of classes and into"
This reverts commit fdf05f4ff4e96e28a31e210cb471d149d736f528.
Reason for revert: Android fixed after removing multitexture support from TextureOp.
Original change's description:
> Revert "Move GrGeometryProcessor's textures out of classes and into"
>
> This reverts commit af87483873f0b370b90ebe956301a13cc8662cbe.
>
> Revert "GrGeometryProcessor derives from GrNonAtomicRef not GrProgramElement."
>
> This reverts commit 607be37e3d4ddbe2163c200d6e13bcee981f6bf7.
>
> Revert "Store GrMeshDrawOps' meshes in GrOpFlushState's arena."
>
> This reverts commit b948572c7862214fe2e1fa6cdfcab4fc7b1666ac.
>
> Revert "Remove multitexturing support from GrTextureOp."
>
> This reverts commit 986f64c601f3ed99f84f0c392d1a42e298f6d618.
>
> Revert "Make result of GrOp::combineIfPossible be an enum."
>
> This reverts commit 641ac7daa81cbfca06b310803fb1a607d0fc2b32.
>
> Bug: b/112244393
> Change-Id: I579491a3f2f2f2093f1e2a6141fa1e4cc7b760a4
> Reviewed-on: https://skia-review.googlesource.com/145646
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
TBR=bsalomon@google.com
Change-Id: I1d41c2ecf7862e31fb025a7a00bb07bae9d83a47
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: b/112244393
Reviewed-on: https://skia-review.googlesource.com/145780
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp
index 32da45c..ee38f43 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.cpp
+++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp
@@ -86,13 +86,12 @@
fColor = btgp.color();
}
- SkASSERT(btgp.numTextureSamplers() >= 1);
- GrTexture* atlas = btgp.textureSampler(0).peekTexture();
- SkASSERT(atlas && SkIsPow2(atlas->width()) && SkIsPow2(atlas->height()));
+ const SkISize& atlasSize = btgp.atlasSize();
+ SkASSERT(SkIsPow2(atlasSize.fWidth) && SkIsPow2(atlasSize.fHeight));
- if (fAtlasSize.fWidth != atlas->width() || fAtlasSize.fHeight != atlas->height()) {
- pdman.set2f(fAtlasSizeInvUniform, 1.0f / atlas->width(), 1.0f / atlas->height());
- fAtlasSize.set(atlas->width(), atlas->height());
+ if (fAtlasSize != atlasSize) {
+ pdman.set2f(fAtlasSizeInvUniform, 1.0f / atlasSize.fWidth, 1.0f / atlasSize.fHeight);
+ fAtlasSize = atlasSize;
}
this->setTransformDataHelper(btgp.localMatrix(), pdman, &transformIter);
}
@@ -149,9 +148,13 @@
this->setVertexAttributeCnt(cnt);
+ if (numActiveProxies) {
+ fAtlasSize = proxies[0]->isize();
+ }
for (int i = 0; i < numActiveProxies; ++i) {
SkASSERT(proxies[i]);
- fTextureSamplers[i].reset(std::move(proxies[i]), params);
+ SkASSERT(proxies[i]->isize() == fAtlasSize);
+ fTextureSamplers[i].reset(proxies[i]->textureType(), proxies[i]->config(), params);
}
this->setTextureSamplerCnt(numActiveProxies);
}
@@ -165,11 +168,16 @@
const GrSamplerState& params) {
SkASSERT(numActiveProxies <= kMaxTextures);
+ if (!fTextureSamplers[0].isInitialized()) {
+ fAtlasSize = proxies[0]->isize();
+ }
+
for (int i = 0; i < numActiveProxies; ++i) {
SkASSERT(proxies[i]);
+ SkASSERT(proxies[i]->isize() == fAtlasSize);
if (!fTextureSamplers[i].isInitialized()) {
- fTextureSamplers[i].reset(std::move(proxies[i]), params);
+ fTextureSamplers[i].reset(proxies[i]->textureType(), proxies[i]->config(), params);
}
}
this->setTextureSamplerCnt(numActiveProxies);