Don't make promises about rowbytes
Since we just rely on SkBitmap to manage rowbytes, we don't need to
separately track it in the surface.
Bug: 1038304
Change-Id: Iea2d486019bf4c5bf4f2a87eabc5f00ad71949fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266219
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h
index dba9b5e..be00723 100644
--- a/include/core/SkSurface.h
+++ b/include/core/SkSurface.h
@@ -55,7 +55,7 @@
Pixel buffer size should be info height times computed rowBytes.
Pixels are not initialized.
- To access pixels after drawing, call flush() or peekPixels().
+ To access pixels after drawing, peekPixels() or readPixels().
@param imageInfo width, height, SkColorType, SkAlphaType, SkColorSpace,
of raster surface; width and height must be greater than zero
@@ -109,8 +109,7 @@
info contains SkColorType and SkAlphaType supported by raster surface;
rowBytes is large enough to contain info width pixels of SkColorType, or is zero.
- If rowBytes is not zero, subsequent images returned by makeImageSnapshot()
- have the same rowBytes.
+ If rowBytes is zero, a suitable value will be chosen internally.
@param imageInfo width, height, SkColorType, SkAlphaType, SkColorSpace,
of raster surface; width and height must be greater than zero
diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp
index 44fce51..22c637e 100644
--- a/src/image/SkSurface_Raster.cpp
+++ b/src/image/SkSurface_Raster.cpp
@@ -29,7 +29,6 @@
private:
SkBitmap fBitmap;
- size_t fRowBytes;
bool fWeOwnThePixels;
typedef SkSurface_Base INHERITED;
@@ -74,7 +73,6 @@
: INHERITED(info, props)
{
fBitmap.installPixels(info, pixels, rb, releaseProc, context);
- fRowBytes = 0; // don't need to track the rowbytes
fWeOwnThePixels = false; // We are "Direct"
}
@@ -83,7 +81,6 @@
: INHERITED(pr->width(), pr->height(), props)
{
fBitmap.setInfo(info, pr->rowBytes());
- fRowBytes = pr->rowBytes(); // we track this, so that subsequent re-allocs will match
fBitmap.setPixelRef(std::move(pr), 0, 0);
fWeOwnThePixels = true;
}
@@ -151,7 +148,6 @@
SkASSERT(prev.rowBytes() == fBitmap.rowBytes());
memcpy(fBitmap.getPixels(), prev.getPixels(), fBitmap.computeByteSize());
}
- SkASSERT(fBitmap.rowBytes() == fRowBytes); // be sure we always use the same value
// Now fBitmap is a deep copy of itself (and therefore different from
// what is being used by the image. Next we update the canvas to use