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

Unified Diff: src/utils/SkCanvasStateUtils.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 | « src/image/SkSurface_Gpu.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkCanvasStateUtils.cpp
diff --git a/src/utils/SkCanvasStateUtils.cpp b/src/utils/SkCanvasStateUtils.cpp
index f7a9447de2efe53e6bf2b2765229a34b41b2d58b..759ba92fc835a18879bf2f4083acac294af1e290 100644
--- a/src/utils/SkCanvasStateUtils.cpp
+++ b/src/utils/SkCanvasStateUtils.cpp
@@ -224,8 +224,8 @@ SkCanvasState* SkCanvasStateUtils::CaptureCanvasState(SkCanvas* canvas) {
for (SkCanvas::LayerIter layer(canvas, true/*skipEmptyClips*/); !layer.done(); layer.next()) {
// we currently only work for bitmap backed devices
- const SkBitmap& bitmap = layer.device()->accessBitmap(true/*changePixels*/);
- if (bitmap.empty() || bitmap.isNull() || !bitmap.lockPixelsAreWritable()) {
+ SkPixmap pmap;
+ if (!layer.device()->accessPixels(&pmap) || 0 == pmap.width() || 0 == pmap.height()) {
return NULL;
}
@@ -234,10 +234,10 @@ SkCanvasState* SkCanvasStateUtils::CaptureCanvasState(SkCanvas* canvas) {
layerState->type = kRaster_CanvasBackend;
layerState->x = layer.x();
layerState->y = layer.y();
- layerState->width = bitmap.width();
- layerState->height = bitmap.height();
+ layerState->width = pmap.width();
+ layerState->height = pmap.height();
- switch (bitmap.colorType()) {
+ switch (pmap.colorType()) {
case kN32_SkColorType:
layerState->raster.config = kARGB_8888_RasterConfig;
break;
@@ -247,8 +247,8 @@ SkCanvasState* SkCanvasStateUtils::CaptureCanvasState(SkCanvas* canvas) {
default:
return NULL;
}
- layerState->raster.rowBytes = bitmap.rowBytes();
- layerState->raster.pixels = bitmap.getPixels();
+ layerState->raster.rowBytes = pmap.rowBytes();
+ layerState->raster.pixels = pmap.writable_addr();
setup_MC_state(&layerState->mcState, layer.matrix(), layer.clip());
layerCount++;
« no previous file with comments | « src/image/SkSurface_Gpu.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698