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

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

Issue 134843008: Revert of Revert "Revert of https://codereview.chromium.org/129423002/" (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 11 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 | « src/image/SkImagePriv.h ('k') | src/image/SkImage_Base.h » ('j') | 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 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkImagePriv.h" 8 #include "SkImagePriv.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkPicture.h" 10 #include "SkPicture.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 68
69 SkImage* SkNewImageFromBitmap(const SkBitmap& bm, bool canSharePixelRef) { 69 SkImage* SkNewImageFromBitmap(const SkBitmap& bm, bool canSharePixelRef) {
70 SkImageInfo info; 70 SkImageInfo info;
71 if (!bm.asImageInfo(&info)) { 71 if (!bm.asImageInfo(&info)) {
72 return NULL; 72 return NULL;
73 } 73 }
74 74
75 SkImage* image = NULL; 75 SkImage* image = NULL;
76 if (canSharePixelRef || bm.isImmutable()) { 76 if (canSharePixelRef || bm.isImmutable()) {
77 image = SkNewImageFromPixelRef(bm.pixelRef()); 77 image = SkNewImageFromPixelRef(info, bm.pixelRef(), bm.rowBytes());
78 } else { 78 } else {
79 bm.lockPixels(); 79 bm.lockPixels();
80 if (bm.getPixels()) { 80 if (bm.getPixels()) {
81 image = SkImage::NewRasterCopy(info, bm.getPixels(), bm.rowBytes()); 81 image = SkImage::NewRasterCopy(info, bm.getPixels(), bm.rowBytes());
82 } 82 }
83 bm.unlockPixels(); 83 bm.unlockPixels();
84 } 84 }
85 return image; 85 return image;
86 } 86 }
87 87
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 canvas->save(); 134 canvas->save();
135 } 135 }
136 canvas->concat(matrix); 136 canvas->concat(matrix);
137 if (!paint || !needs_layer(*paint)) { 137 if (!paint || !needs_layer(*paint)) {
138 canvas->clipRect(tmpSrc); 138 canvas->clipRect(tmpSrc);
139 } 139 }
140 140
141 canvas->drawPicture(*picture); 141 canvas->drawPicture(*picture);
142 canvas->restoreToCount(saveCount); 142 canvas->restoreToCount(saveCount);
143 } 143 }
OLDNEW
« no previous file with comments | « src/image/SkImagePriv.h ('k') | src/image/SkImage_Base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698