OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2008 The Android Open Source Project | 3 * Copyright 2008 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 2654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2665 | 2665 |
2666 SkCanvas* SkCanvas::NewRasterDirect(const SkImageInfo& info, void* pixels, size_
t rowBytes) { | 2666 SkCanvas* SkCanvas::NewRasterDirect(const SkImageInfo& info, void* pixels, size_
t rowBytes) { |
2667 if (!supported_for_raster_canvas(info)) { | 2667 if (!supported_for_raster_canvas(info)) { |
2668 return NULL; | 2668 return NULL; |
2669 } | 2669 } |
2670 | 2670 |
2671 SkBitmap bitmap; | 2671 SkBitmap bitmap; |
2672 if (!bitmap.installPixels(info, pixels, rowBytes)) { | 2672 if (!bitmap.installPixels(info, pixels, rowBytes)) { |
2673 return NULL; | 2673 return NULL; |
2674 } | 2674 } |
2675 | |
2676 // should this functionality be moved into allocPixels()? | |
2677 if (!bitmap.info().isOpaque()) { | |
2678 bitmap.eraseColor(0); | |
2679 } | |
2680 return SkNEW_ARGS(SkCanvas, (bitmap)); | 2675 return SkNEW_ARGS(SkCanvas, (bitmap)); |
2681 } | 2676 } |
OLD | NEW |