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

Unified Diff: src/image/SkSurface_Raster.cpp

Issue 551463004: introduce Props to surface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: address comments from #6 Created 6 years, 3 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
Index: src/image/SkSurface_Raster.cpp
diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp
index 13f215589f190f9aa0cbb2d45ac5a1ff841c83e6..7011e2e24f45a56e612ac90d0326f7c896469742 100644
--- a/src/image/SkSurface_Raster.cpp
+++ b/src/image/SkSurface_Raster.cpp
@@ -18,8 +18,9 @@ public:
static bool Valid(const SkImageInfo&, size_t rb = kIgnoreRowBytesValue);
SkSurface_Raster(const SkImageInfo&, void*, size_t rb,
- void (*releaseProc)(void* pixels, void* context), void* context);
- SkSurface_Raster(SkPixelRef*);
+ void (*releaseProc)(void* pixels, void* context), void* context,
+ const Props*);
+ SkSurface_Raster(SkPixelRef*, const Props*);
virtual SkCanvas* onNewCanvas() SK_OVERRIDE;
virtual SkSurface* onNewSurface(const SkImageInfo&) SK_OVERRIDE;
@@ -78,15 +79,16 @@ bool SkSurface_Raster::Valid(const SkImageInfo& info, size_t rowBytes) {
}
SkSurface_Raster::SkSurface_Raster(const SkImageInfo& info, void* pixels, size_t rb,
- void (*releaseProc)(void* pixels, void* context), void* context)
- : INHERITED(info)
+ void (*releaseProc)(void* pixels, void* context), void* context,
+ const Props* props)
+ : INHERITED(info, props ? *props : Props())
{
fBitmap.installPixels(info, pixels, rb, NULL, releaseProc, context);
fWeOwnThePixels = false; // We are "Direct"
}
-SkSurface_Raster::SkSurface_Raster(SkPixelRef* pr)
- : INHERITED(pr->info().width(), pr->info().height())
+SkSurface_Raster::SkSurface_Raster(SkPixelRef* pr, const Props* props)
+ : INHERITED(pr->info().width(), pr->info().height(), props ? *props : Props())
{
const SkImageInfo& info = pr->info();
@@ -100,7 +102,8 @@ SkSurface_Raster::SkSurface_Raster(SkPixelRef* pr)
}
SkCanvas* SkSurface_Raster::onNewCanvas() {
- return SkNEW_ARGS(SkCanvas, (fBitmap));
+ const SkSurfaceProps& props = this->props();
+ return SkNEW_ARGS(SkCanvas, (fBitmap, &props));
}
SkSurface* SkSurface_Raster::onNewSurface(const SkImageInfo& info) {
@@ -140,7 +143,7 @@ void SkSurface_Raster::onCopyOnWrite(ContentChangeMode mode) {
SkSurface* SkSurface::NewRasterDirectReleaseProc(const SkImageInfo& info, void* pixels, size_t rb,
void (*releaseProc)(void* pixels, void* context),
- void* context) {
+ void* context, const Props* props) {
if (NULL == releaseProc) {
context = NULL;
}
@@ -151,14 +154,15 @@ SkSurface* SkSurface::NewRasterDirectReleaseProc(const SkImageInfo& info, void*
return NULL;
}
- return SkNEW_ARGS(SkSurface_Raster, (info, pixels, rb, releaseProc, context));
+ return SkNEW_ARGS(SkSurface_Raster, (info, pixels, rb, releaseProc, context, props));
}
-SkSurface* SkSurface::NewRasterDirect(const SkImageInfo& info, void* pixels, size_t rowBytes) {
- return NewRasterDirectReleaseProc(info, pixels, rowBytes, NULL, NULL);
+SkSurface* SkSurface::NewRasterDirect(const SkImageInfo& info, void* pixels, size_t rowBytes,
+ const Props* props) {
+ return NewRasterDirectReleaseProc(info, pixels, rowBytes, NULL, NULL, props);
}
-SkSurface* SkSurface::NewRaster(const SkImageInfo& info) {
+SkSurface* SkSurface::NewRaster(const SkImageInfo& info, const Props* props) {
if (!SkSurface_Raster::Valid(info)) {
return NULL;
}
@@ -167,5 +171,5 @@ SkSurface* SkSurface::NewRaster(const SkImageInfo& info) {
if (NULL == pr.get()) {
return NULL;
}
- return SkNEW_ARGS(SkSurface_Raster, (pr));
+ return SkNEW_ARGS(SkSurface_Raster, (pr, props));
}

Powered by Google App Engine
This is Rietveld 408576698