Index: src/utils/SkCanvasStateUtils.cpp |
diff --git a/src/utils/SkCanvasStateUtils.cpp b/src/utils/SkCanvasStateUtils.cpp |
index 77b0e20c2d46377a61df5148cb2c293738d8d76d..4b8868b02a62a7001c036974ce3a5bbfc09f1733 100644 |
--- a/src/utils/SkCanvasStateUtils.cpp |
+++ b/src/utils/SkCanvasStateUtils.cpp |
@@ -221,11 +221,11 @@ SkCanvasState* SkCanvasStateUtils::CaptureCanvasState(SkCanvas* canvas) { |
layerState->width = bitmap.width(); |
layerState->height = bitmap.height(); |
- switch (bitmap.config()) { |
- case SkBitmap::kARGB_8888_Config: |
+ switch (bitmap.colorType()) { |
+ case kPMColor_SkColorType: |
layerState->raster.config = kARGB_8888_RasterConfig; |
break; |
- case SkBitmap::kRGB_565_Config: |
+ case kRGB_565_SkColorType: |
layerState->raster.config = kRGB_565_RasterConfig; |
break; |
default: |
@@ -279,25 +279,24 @@ static SkCanvas* create_canvas_from_canvas_layer(const SkCanvasLayerState& layer |
SkASSERT(kRaster_CanvasBackend == layerState.type); |
SkBitmap bitmap; |
- SkBitmap::Config config = |
- layerState.raster.config == kARGB_8888_RasterConfig ? SkBitmap::kARGB_8888_Config : |
- layerState.raster.config == kRGB_565_RasterConfig ? SkBitmap::kRGB_565_Config : |
- SkBitmap::kNo_Config; |
+ SkColorType colorType = |
+ layerState.raster.config == kARGB_8888_RasterConfig ? kPMColor_SkColorType : |
+ layerState.raster.config == kRGB_565_RasterConfig ? kRGB_565_SkColorType : |
+ kUnknown_SkColorType; |
- if (config == SkBitmap::kNo_Config) { |
+ if (colorType == kUnknown_SkColorType) { |
return NULL; |
} |
- bitmap.setConfig(config, layerState.width, layerState.height, |
- layerState.raster.rowBytes); |
- bitmap.setPixels(layerState.raster.pixels); |
+ bitmap.installPixels(SkImageInfo::Make(layerState.width, layerState.height, |
+ colorType, kPremul_SkAlphaType), |
+ layerState.raster.pixels, layerState.raster.rowBytes, |
+ NULL, NULL); |
SkASSERT(!bitmap.empty()); |
SkASSERT(!bitmap.isNull()); |
- // create a device & canvas |
- SkAutoTUnref<SkBitmapDevice> device(SkNEW_ARGS(SkBitmapDevice, (bitmap))); |
- SkAutoTUnref<SkCanvas> canvas(SkNEW_ARGS(SkCanvas, (device.get()))); |
+ SkAutoTUnref<SkCanvas> canvas(SkNEW_ARGS(SkCanvas, (bitmap))); |
// setup the matrix and clip |
setup_canvas_from_MC_state(layerState.mcState, canvas.get()); |