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

Side by Side Diff: src/image/SkImagePriv.cpp

Issue 951483002: Make SkNewImageFromBitmap take pixel ref origin into account (Closed) Base URL: https://skia.googlesource.com/skia.git@skimage-filters-01-deferred-canvas-writepixels-skip
Patch Set: Created 5 years, 10 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
« no previous file with comments | « src/image/SkImagePriv.h ('k') | src/image/SkImage_Raster.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2012 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "SkImagePriv.h"
9 #include "SkImage_Base.h"
10 #include "SkCanvas.h"
11 #include "SkPicture.h"
12
13 SkImage* SkNewImageFromBitmap(const SkBitmap& bm, bool canSharePixelRef,
14 const SkSurfaceProps* props) {
15 const SkImageInfo info = bm.info();
16 if (kUnknown_SkColorType == info.colorType()) {
17 return NULL;
18 }
19
20 SkImage* image = NULL;
21 if (canSharePixelRef || bm.isImmutable()) {
22 image = SkNewImageFromPixelRef(info, bm.pixelRef(), bm.rowBytes(), props );
23 } else {
24 bm.lockPixels();
25 if (bm.getPixels()) {
26 image = SkImage::NewRasterCopy(info, bm.getPixels(), bm.rowBytes());
27 }
28 bm.unlockPixels();
29
30 // we don't expose props to NewRasterCopy (need a private vers) so post- init it here
31 if (image && props) {
32 as_IB(image)->initWithProps(*props);
33 }
34 }
35 return image;
36 }
OLDNEW
« no previous file with comments | « src/image/SkImagePriv.h ('k') | src/image/SkImage_Raster.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698