Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(526)

Unified Diff: src/image/SkImage_Raster.cpp

Issue 1372153006: SkImage doesn't use props, so don't need to store it (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/image/SkImage_Gpu.cpp ('k') | src/image/SkSurface_Gpu.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkImage_Raster.cpp
diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp
index c88e17689c868e612653b0f66ac0361e31fd3d5f..b6c62e842349ab5d53c621fc9668338ec43ba801 100644
--- a/src/image/SkImage_Raster.cpp
+++ b/src/image/SkImage_Raster.cpp
@@ -63,7 +63,7 @@ public:
return true;
}
- SkImage_Raster(const SkImageInfo&, SkData*, size_t rb, SkColorTable*, const SkSurfaceProps*);
+ SkImage_Raster(const SkImageInfo&, SkData*, size_t rb, SkColorTable*);
virtual ~SkImage_Raster();
bool onReadPixels(const SkImageInfo&, void*, size_t, int srcX, int srcY) const override;
@@ -74,16 +74,15 @@ public:
SkImage* onNewSubset(const SkIRect&) const override;
// exposed for SkSurface_Raster via SkNewImageFromPixelRef
- SkImage_Raster(const SkImageInfo&, SkPixelRef*, const SkIPoint& pixelRefOrigin, size_t rowBytes,
- const SkSurfaceProps*);
+ SkImage_Raster(const SkImageInfo&, SkPixelRef*, const SkIPoint& origin, size_t rowBytes);
SkPixelRef* getPixelRef() const { return fBitmap.pixelRef(); }
bool isOpaque() const override;
bool onAsLegacyBitmap(SkBitmap*, LegacyBitmapMode) const override;
- SkImage_Raster(const SkBitmap& bm, const SkSurfaceProps* props)
- : INHERITED(bm.width(), bm.height(), bm.getGenerationID(), props)
+ SkImage_Raster(const SkBitmap& bm)
+ : INHERITED(bm.width(), bm.height(), bm.getGenerationID())
, fBitmap(bm)
{
if (bm.pixelRef()->isPreLocked()) {
@@ -99,11 +98,7 @@ public:
}
private:
- SkImage_Raster() : INHERITED(0, 0, kNeedNewImageUniqueID, nullptr) {
- fBitmap.setImmutable();
- }
-
- SkBitmap fBitmap;
+ SkBitmap fBitmap;
typedef SkImage_Base INHERITED;
};
@@ -116,8 +111,8 @@ static void release_data(void* addr, void* context) {
}
SkImage_Raster::SkImage_Raster(const Info& info, SkData* data, size_t rowBytes,
- SkColorTable* ctable, const SkSurfaceProps* props)
- : INHERITED(info.width(), info.height(), kNeedNewImageUniqueID, props)
+ SkColorTable* ctable)
+ : INHERITED(info.width(), info.height(), kNeedNewImageUniqueID)
{
data->ref();
void* addr = const_cast<void*>(data->data());
@@ -128,8 +123,8 @@ SkImage_Raster::SkImage_Raster(const Info& info, SkData* data, size_t rowBytes,
}
SkImage_Raster::SkImage_Raster(const Info& info, SkPixelRef* pr, const SkIPoint& pixelRefOrigin,
- size_t rowBytes, const SkSurfaceProps* props)
- : INHERITED(info.width(), info.height(), pr->getGenerationID(), props)
+ size_t rowBytes)
+ : INHERITED(info.width(), info.height(), pr->getGenerationID())
{
fBitmap.setInfo(info, rowBytes);
fBitmap.setPixelRef(pr, pixelRefOrigin);
@@ -223,7 +218,7 @@ SkImage* SkImage::NewRasterCopy(const SkImageInfo& info, const void* pixels, siz
// Here we actually make a copy of the caller's pixel data
SkAutoDataUnref data(SkData::NewWithCopy(pixels, size));
- return new SkImage_Raster(info, data, rowBytes, ctable, nullptr);
+ return new SkImage_Raster(info, data, rowBytes, ctable);
}
@@ -239,7 +234,7 @@ SkImage* SkImage::NewRasterData(const SkImageInfo& info, SkData* data, size_t ro
}
SkColorTable* ctable = nullptr;
- return new SkImage_Raster(info, data, rowBytes, ctable, nullptr);
+ return new SkImage_Raster(info, data, rowBytes, ctable);
}
SkImage* SkImage::NewFromRaster(const SkImageInfo& info, const void* pixels, size_t rowBytes,
@@ -251,20 +246,18 @@ SkImage* SkImage::NewFromRaster(const SkImageInfo& info, const void* pixels, siz
SkColorTable* ctable = nullptr;
SkAutoDataUnref data(SkData::NewWithProc(pixels, size, proc, ctx));
- return new SkImage_Raster(info, data, rowBytes, ctable, nullptr);
+ return new SkImage_Raster(info, data, rowBytes, ctable);
}
SkImage* SkNewImageFromPixelRef(const SkImageInfo& info, SkPixelRef* pr,
- const SkIPoint& pixelRefOrigin, size_t rowBytes,
- const SkSurfaceProps* props) {
+ const SkIPoint& pixelRefOrigin, size_t rowBytes) {
if (!SkImage_Raster::ValidArgs(info, rowBytes, false, nullptr)) {
return nullptr;
}
- return new SkImage_Raster(info, pr, pixelRefOrigin, rowBytes, props);
+ return new SkImage_Raster(info, pr, pixelRefOrigin, rowBytes);
}
-SkImage* SkNewImageFromRasterBitmap(const SkBitmap& bm, const SkSurfaceProps* props,
- ForceCopyMode forceCopy) {
+SkImage* SkNewImageFromRasterBitmap(const SkBitmap& bm, ForceCopyMode forceCopy) {
SkASSERT(nullptr == bm.getTexture());
bool hasColorTable = false;
@@ -285,13 +278,8 @@ SkImage* SkNewImageFromRasterBitmap(const SkBitmap& bm, const SkSurfaceProps* pr
image = SkImage::NewRasterCopy(tmp.info(), tmp.getPixels(), tmp.rowBytes(),
tmp.getColorTable());
}
-
- // we don't expose props to NewRasterCopy (need a private vers) so post-init it here
- if (image && props) {
- as_IB(image)->initWithProps(*props);
- }
} else {
- image = new SkImage_Raster(bm, props);
+ image = new SkImage_Raster(bm);
}
return image;
}
« no previous file with comments | « src/image/SkImage_Gpu.cpp ('k') | src/image/SkSurface_Gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698