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>
This commit is contained in:
Mike Reed 2020-01-23 12:30:31 -05:00 committed by Skia Commit-Bot
parent cce65006ad
commit 11b05bc11f
2 changed files with 2 additions and 7 deletions

View File

@ -55,7 +55,7 @@ public:
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 @@ public:
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

View File

@ -29,7 +29,6 @@ public:
private:
SkBitmap fBitmap;
size_t fRowBytes;
bool fWeOwnThePixels;
typedef SkSurface_Base INHERITED;
@ -74,7 +73,6 @@ SkSurface_Raster::SkSurface_Raster(const SkImageInfo& info, void* pixels, size_t
: 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 @@ SkSurface_Raster::SkSurface_Raster(const SkImageInfo& info, sk_sp<SkPixelRef> pr
: 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 @@ void SkSurface_Raster::onCopyOnWrite(ContentChangeMode mode) {
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