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

Unified Diff: src/core/SkBitmapDevice.cpp

Issue 161733002: add peekPixels to SkCanvas and SkSurface (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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 | « samplecode/SampleLayers.cpp ('k') | src/core/SkCanvas.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmapDevice.cpp
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index 9dde6e172ec1077fabe5261dea1a5e5ceeefce43..374bef98c127caacf6f6c139dda0666e5a4fcfeb 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -54,6 +54,10 @@ SkBitmapDevice::SkBitmapDevice(SkBitmap::Config config, int width, int height, b
SkBitmapDevice::~SkBitmapDevice() {
}
+SkImageInfo SkBitmapDevice::imageInfo() const {
+ return fBitmap.info();
+}
+
void SkBitmapDevice::replaceBitmapBackendForRasterSurface(const SkBitmap& bm) {
SkASSERT(bm.width() == fBitmap.width());
SkASSERT(bm.height() == fBitmap.height());
@@ -386,6 +390,16 @@ SkSurface* SkBitmapDevice::newSurface(const SkImageInfo& info) {
return SkSurface::NewRaster(info);
}
+const void* SkBitmapDevice::peekPixels(SkImageInfo* info, size_t* rowBytes) {
+ if (fBitmap.getPixels() && fBitmap.asImageInfo(info)) {
+ if (rowBytes) {
+ *rowBytes = fBitmap.rowBytes();
+ }
+ return fBitmap.getPixels();
+ }
+ return NULL;
+}
+
///////////////////////////////////////////////////////////////////////////////
bool SkBitmapDevice::filterTextFlags(const SkPaint& paint, TextFlags* flags) {
« no previous file with comments | « samplecode/SampleLayers.cpp ('k') | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698