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

Side by Side Diff: src/core/SkCanvas.cpp

Issue 196923004: add NewRasterDirect for creating a canvas drawing to pre-allocated pixels (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/core/SkCanvas.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « include/core/SkCanvas.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698