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

Unified Diff: src/core/SkCanvas.cpp

Issue 1155443004: change internals over to SkPixmap and stop using accessBitmap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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/core/SkCanvas.cpp
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index aa25ca0b41c96dcafe053d05d7066a50e8bcb8b8..bf4e86cafa044c9e438e36ce193088eb617982b2 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1133,25 +1133,44 @@ SkImageInfo SkCanvas::imageInfo() const {
}
const void* SkCanvas::peekPixels(SkImageInfo* info, size_t* rowBytes) {
- return this->onPeekPixels(info, rowBytes);
+ SkPixmap pmap;
+ if (!this->onPeekPixels(&pmap)) {
+ return NULL;
+ }
+ if (info) {
+ *info = pmap.info();
+ }
+ if (rowBytes) {
+ *rowBytes = pmap.rowBytes();
+ }
+ return pmap.addr();
}
-const void* SkCanvas::onPeekPixels(SkImageInfo* info, size_t* rowBytes) {
+bool SkCanvas::onPeekPixels(SkPixmap* pmap) {
SkBaseDevice* dev = this->getDevice();
- return dev ? dev->peekPixels(info, rowBytes) : NULL;
+ return dev && dev->peekPixels(pmap);
}
void* SkCanvas::accessTopLayerPixels(SkImageInfo* info, size_t* rowBytes, SkIPoint* origin) {
- void* pixels = this->onAccessTopLayerPixels(info, rowBytes);
- if (pixels && origin) {
+ SkPixmap pmap;
+ if (!this->onAccessTopLayerPixels(&pmap)) {
+ return NULL;
+ }
+ if (info) {
+ *info = pmap.info();
+ }
+ if (rowBytes) {
+ *rowBytes = pmap.rowBytes();
+ }
+ if (origin) {
*origin = this->getTopDevice(false)->getOrigin();
}
- return pixels;
+ return pmap.writable_addr();
}
-void* SkCanvas::onAccessTopLayerPixels(SkImageInfo* info, size_t* rowBytes) {
+bool SkCanvas::onAccessTopLayerPixels(SkPixmap* pmap) {
SkBaseDevice* dev = this->getTopDevice();
- return dev ? dev->accessPixels(info, rowBytes) : NULL;
+ return dev && dev->accessPixels(pmap);
}
SkAutoROCanvasPixels::SkAutoROCanvasPixels(SkCanvas* canvas) {
« no previous file with comments | « src/core/SkBitmapDevice.cpp ('k') | src/core/SkDevice.cpp » ('j') | src/core/SkPixmap.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698