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 2531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2542 if (!bitmap.allocPixels(info)) { | 2542 if (!bitmap.allocPixels(info)) { |
2543 return NULL; | 2543 return NULL; |
2544 } | 2544 } |
2545 | 2545 |
2546 // should this functionality be moved into allocPixels()? | 2546 // should this functionality be moved into allocPixels()? |
2547 if (!bitmap.info().isOpaque()) { | 2547 if (!bitmap.info().isOpaque()) { |
2548 bitmap.eraseColor(0); | 2548 bitmap.eraseColor(0); |
2549 } | 2549 } |
2550 return SkNEW_ARGS(SkCanvas, (bitmap)); | 2550 return SkNEW_ARGS(SkCanvas, (bitmap)); |
2551 } | 2551 } |
| 2552 |
| 2553 SkCanvas* SkCanvas::NewRasterDirect(const SkImageInfo& info, void* pixels, size_
t rowBytes) { |
| 2554 if (!supported_for_raster_canvas(info)) { |
| 2555 return NULL; |
| 2556 } |
| 2557 |
| 2558 SkBitmap bitmap; |
| 2559 if (!bitmap.installPixels(info, pixels, rowBytes)) { |
| 2560 return NULL; |
| 2561 } |
| 2562 |
| 2563 // should this functionality be moved into allocPixels()? |
| 2564 if (!bitmap.info().isOpaque()) { |
| 2565 bitmap.eraseColor(0); |
| 2566 } |
| 2567 return SkNEW_ARGS(SkCanvas, (bitmap)); |
| 2568 } |
| 2569 |
| 2570 |
OLD | NEW |