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

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

Issue 305483005: remove SkBitmap::asImageInfo (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 6 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/SkImage.cpp ('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
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 kIndex_8_SkColorType, // kIndex8_Config 44 kIndex_8_SkColorType, // kIndex8_Config
45 kRGB_565_SkColorType, // kRGB_565_Config 45 kRGB_565_SkColorType, // kRGB_565_Config
46 kARGB_4444_SkColorType, // kARGB_4444_Config 46 kARGB_4444_SkColorType, // kARGB_4444_Config
47 kN32_SkColorType, // kARGB_8888_Config 47 kN32_SkColorType, // kARGB_8888_Config
48 }; 48 };
49 SkASSERT((unsigned)config < SK_ARRAY_COUNT(gCT)); 49 SkASSERT((unsigned)config < SK_ARRAY_COUNT(gCT));
50 return gCT[config]; 50 return gCT[config];
51 } 51 }
52 52
53 SkImage* SkNewImageFromBitmap(const SkBitmap& bm, bool canSharePixelRef) { 53 SkImage* SkNewImageFromBitmap(const SkBitmap& bm, bool canSharePixelRef) {
54 SkImageInfo info; 54 const SkImageInfo info = bm.info();
55 if (!bm.asImageInfo(&info)) { 55 if (kUnknown_SkColorType == info.colorType()) {
56 return NULL; 56 return NULL;
57 } 57 }
58 58
59 SkImage* image = NULL; 59 SkImage* image = NULL;
60 if (canSharePixelRef || bm.isImmutable()) { 60 if (canSharePixelRef || bm.isImmutable()) {
61 image = SkNewImageFromPixelRef(info, bm.pixelRef(), bm.rowBytes()); 61 image = SkNewImageFromPixelRef(info, bm.pixelRef(), bm.rowBytes());
62 } else { 62 } else {
63 bm.lockPixels(); 63 bm.lockPixels();
64 if (bm.getPixels()) { 64 if (bm.getPixels()) {
65 image = SkImage::NewRasterCopy(info, bm.getPixels(), bm.rowBytes()); 65 image = SkImage::NewRasterCopy(info, bm.getPixels(), bm.rowBytes());
66 } 66 }
67 bm.unlockPixels(); 67 bm.unlockPixels();
68 } 68 }
69 return image; 69 return image;
70 } 70 }
OLDNEW
« no previous file with comments | « src/image/SkImage.cpp ('k') | src/image/SkImage_Raster.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698