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

Unified Diff: src/core/SkBitmapDevice.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/SkBitmapDevice.cpp
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index 995b427697f5ff6ca3ae632da3a9af3a5be9d44e..3e586e66305abb2541733cd71b36390413be2b0f 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -9,6 +9,7 @@
#include "SkConfig8888.h"
#include "SkDeviceProperties.h"
#include "SkDraw.h"
+#include "SkPixelRef.h"
#include "SkRasterClip.h"
#include "SkShader.h"
#include "SkSurface.h"
@@ -124,17 +125,20 @@ const SkBitmap& SkBitmapDevice::onAccessBitmap() {
return fBitmap;
}
-void* SkBitmapDevice::onAccessPixels(SkImageInfo* info, size_t* rowBytes) {
- if (fBitmap.getPixels()) {
- *info = fBitmap.info();
- *rowBytes = fBitmap.rowBytes();
- return fBitmap.getPixels();
+bool SkBitmapDevice::onAccessPixels(SkPixmap* pmap) {
+ const SkImageInfo info = fBitmap.info();
+ if (fBitmap.getPixels() && (kUnknown_SkColorType != info.colorType())) {
+ SkColorTable* ctable = NULL;
+ pmap->reset(fBitmap.info(), fBitmap.getPixels(), fBitmap.rowBytes(), ctable);
+ return true;
}
- return NULL;
+ return false;
}
-#include "SkConfig8888.h"
-#include "SkPixelRef.h"
+bool SkBitmapDevice::onPeekPixels(SkPixmap* pmap) {
+ // peek and access are the exact same logic for us
+ return this->onAccessPixels(pmap);
+}
bool SkBitmapDevice::onWritePixels(const SkImageInfo& srcInfo, const void* srcPixels,
size_t srcRowBytes, int x, int y) {
@@ -356,20 +360,6 @@ SkSurface* SkBitmapDevice::newSurface(const SkImageInfo& info, const SkSurfacePr
return SkSurface::NewRaster(info, &props);
}
-const void* SkBitmapDevice::peekPixels(SkImageInfo* info, size_t* rowBytes) {
- const SkImageInfo bmInfo = fBitmap.info();
- if (fBitmap.getPixels() && (kUnknown_SkColorType != bmInfo.colorType())) {
- if (info) {
- *info = bmInfo;
- }
- if (rowBytes) {
- *rowBytes = fBitmap.rowBytes();
- }
- return fBitmap.getPixels();
- }
- return NULL;
-}
-
SkImageFilter::Cache* SkBitmapDevice::getImageFilterCache() {
SkImageFilter::Cache* cache = SkImageFilter::Cache::Get();
cache->ref();
« no previous file with comments | « include/core/SkPixmap.h ('k') | src/core/SkCanvas.cpp » ('j') | src/core/SkPixmap.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698