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

Unified Diff: src/core/SkBitmapDevice.cpp

Issue 1154293002: don't use 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
« no previous file with comments | « no previous file | 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 3e586e66305abb2541733cd71b36390413be2b0f..2a805cbf02bd1e77b081fd14d2e0a5f0f324924f 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -126,6 +126,10 @@ const SkBitmap& SkBitmapDevice::onAccessBitmap() {
}
bool SkBitmapDevice::onAccessPixels(SkPixmap* pmap) {
+ return fBitmap.lockPixelsAreWritable() && this->onPeekPixels(pmap);
+}
+
+bool SkBitmapDevice::onPeekPixels(SkPixmap* pmap) {
const SkImageInfo info = fBitmap.info();
if (fBitmap.getPixels() && (kUnknown_SkColorType != info.colorType())) {
SkColorTable* ctable = NULL;
@@ -135,11 +139,6 @@ bool SkBitmapDevice::onAccessPixels(SkPixmap* pmap) {
return false;
}
-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) {
// since we don't stop creating un-pixeled devices yet, check for no pixels here
@@ -352,8 +351,7 @@ void SkBitmapDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode
void SkBitmapDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device,
int x, int y, const SkPaint& paint) {
- const SkBitmap& src = device->accessBitmap(false);
- draw.drawSprite(src, x, y, paint);
+ draw.drawSprite(static_cast<SkBitmapDevice*>(device)->fBitmap, x, y, paint);
}
SkSurface* SkBitmapDevice::newSurface(const SkImageInfo& info, const SkSurfaceProps& props) {
« no previous file with comments | « no previous file | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698