aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/image/SkSurface_Raster.cpp
diff options
context:
space:
mode:
authorGravatar Matt Sarett <msarett@google.com>2017-04-27 16:52:29 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-27 21:19:32 +0000
commit2cbb6662e329981840f90ef4edd62f70f69e6030 (patch)
tree63e5d20cba696369a6ca15495fafd6afac14a866 /src/image/SkSurface_Raster.cpp
parent0122af08f6af0dee490e1a4f35b552377d0d4753 (diff)
Only store width and height on SkPixelRef
Bug: skia:6535 Change-Id: Id91e8d1e82f593be7d4b23ca5abde752f2666a77 Reviewed-on: https://skia-review.googlesource.com/14105 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Mike Reed <reed@google.com>
Diffstat (limited to 'src/image/SkSurface_Raster.cpp')
-rw-r--r--src/image/SkSurface_Raster.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp
index 2de1ed70d3..c4796c402f 100644
--- a/src/image/SkSurface_Raster.cpp
+++ b/src/image/SkSurface_Raster.cpp
@@ -20,7 +20,7 @@ public:
SkSurface_Raster(const SkImageInfo&, void*, size_t rb,
void (*releaseProc)(void* pixels, void* context), void* context,
const SkSurfaceProps*);
- SkSurface_Raster(sk_sp<SkPixelRef>, const SkSurfaceProps*);
+ SkSurface_Raster(const SkImageInfo& info, sk_sp<SkPixelRef>, const SkSurfaceProps*);
SkCanvas* onNewCanvas() override;
sk_sp<SkSurface> onNewSurface(const SkImageInfo&) override;
@@ -108,11 +108,10 @@ SkSurface_Raster::SkSurface_Raster(const SkImageInfo& info, void* pixels, size_t
fWeOwnThePixels = false; // We are "Direct"
}
-SkSurface_Raster::SkSurface_Raster(sk_sp<SkPixelRef> pr, const SkSurfaceProps* props)
- : INHERITED(pr->info().width(), pr->info().height(), props)
+SkSurface_Raster::SkSurface_Raster(const SkImageInfo& info, sk_sp<SkPixelRef> pr,
+ const SkSurfaceProps* props)
+ : INHERITED(pr->width(), pr->height(), props)
{
- const SkImageInfo& info = pr->info();
-
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);
@@ -215,5 +214,5 @@ sk_sp<SkSurface> SkSurface::MakeRaster(const SkImageInfo& info, size_t rowBytes,
if (rowBytes) {
SkASSERT(pr->rowBytes() == rowBytes);
}
- return sk_make_sp<SkSurface_Raster>(std::move(pr), props);
+ return sk_make_sp<SkSurface_Raster>(info, std::move(pr), props);
}