Revert "Make GrDirectContext::updateBackendTexture handle pixmaps with non-type row bytes."
This reverts commit 07d8c0d11cae593c46b2fbc0507b8c07cff9000f.
Reason for revert: Looks like failures on PowerVR? (Test-Android-Clang-TecnoSpark3Pro-GPU-PowerVRGE8320-arm-Release-All-Android)
Original change's description:
> Make GrDirectContext::updateBackendTexture handle pixmaps with non-type row bytes.
>
> Some GL contexts don't support GL_UNPACK_ROW_LENGTH and we must
> copy the src data to a pixmap with tight row bytes.
>
> Bug: chromium:1170392
>
> Change-Id: I4590f20dbc80cb792f30f0059536716cf106f6c3
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361717
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
TBR=bsalomon@google.com,robertphillips@google.com
Change-Id: Ie5791bf19b993d46383c5b837b948584487c0496
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1170392
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363037
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp
index f0758be..0228959 100644
--- a/src/gpu/GrCaps.cpp
+++ b/src/gpu/GrCaps.cpp
@@ -154,9 +154,6 @@
if (options.fClearAllTextures) {
fShouldInitializeTextures = true;
}
- if (options.fDisallowWritePixelRowBytes) {
- fWritePixelsRowBytesSupport = false;
- }
#endif
if (options.fSuppressMipmapSupport) {
fMipmapSupport = false;
diff --git a/src/gpu/GrDirectContext.cpp b/src/gpu/GrDirectContext.cpp
index 6e393e7..ab5c6cf 100644
--- a/src/gpu/GrDirectContext.cpp
+++ b/src/gpu/GrDirectContext.cpp
@@ -505,34 +505,26 @@
const GrBackendTexture& backendTexture,
GrSurfaceOrigin textureOrigin,
sk_sp<GrRefCntedCallback> finishedCallback) {
- bool flip = textureOrigin == kBottomLeft_GrSurfaceOrigin;
- bool mustBeTight = !gpu->caps()->writePixelsRowBytesSupport();
-
- size_t size = 0;
- for (int i = 0; i < numLevels; ++i) {
- size_t minRowBytes = srcData[i].info().minRowBytes();
- if (flip || (mustBeTight && srcData[i].rowBytes() != minRowBytes)) {
- size += minRowBytes * srcData[i].height();
- }
- }
-
std::unique_ptr<char[]> tempStorage;
- if (size) {
- tempStorage.reset(new char[size]);
- }
- size = 0;
SkAutoSTArray<15, GrPixmap> tempPixmaps(numLevels);
- for (int i = 0; i < numLevels; ++i) {
- size_t minRowBytes = srcData[i].info().minRowBytes();
- if (flip || (mustBeTight && srcData[i].rowBytes() != minRowBytes)) {
- tempPixmaps[i] = {srcData[i].info(), tempStorage.get() + size, minRowBytes};
- SkAssertResult(GrConvertPixels(tempPixmaps[i], srcData[i], flip));
- size += minRowBytes*srcData[i].height();
- } else {
+ if (textureOrigin == kBottomLeft_GrSurfaceOrigin) {
+ size_t size = 0;
+ for (int i = 0; i < numLevels; ++i) {
+ size += srcData[i].info().minRowBytes()*srcData[i].height();
+ }
+ tempStorage.reset(new char[size]);
+ size = 0;
+ for (int i = 0; i < numLevels; ++i) {
+ size_t tempRB = srcData[i].info().minRowBytes();
+ tempPixmaps[i] = {srcData[i].info(), tempStorage.get() + size, tempRB};
+ SkAssertResult(GrConvertPixels(tempPixmaps[i], srcData[i], /*flip*/ true));
+ size += tempRB*srcData[i].height();
+ }
+ } else {
+ for (int i = 0; i < numLevels; ++i) {
tempPixmaps[i] = srcData[i];
}
}
-
GrGpu::BackendTextureData data(tempPixmaps.get());
return gpu->updateBackendTexture(backendTexture, std::move(finishedCallback), &data);
}