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

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

Issue 334793002: hide Config in SkImageDecoder -- use SkColorType instead (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix warning 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
« no previous file with comments | « samplecode/SampleUnpremul.cpp ('k') | src/image/SkImage_Codec.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 15 matching lines...) Expand all
26 case kIndex_8_SkColorType: 26 case kIndex_8_SkColorType:
27 return SkBitmap::kIndex8_Config; 27 return SkBitmap::kIndex8_Config;
28 28
29 default: 29 default:
30 // break for unsupported colortypes 30 // break for unsupported colortypes
31 break; 31 break;
32 } 32 }
33 return SkBitmap::kNo_Config; 33 return SkBitmap::kNo_Config;
34 } 34 }
35 35
36 SkBitmap::Config SkImageInfoToBitmapConfig(const SkImageInfo& info) {
37 return SkColorTypeToBitmapConfig(info.fColorType);
38 }
39
40 SkColorType SkBitmapConfigToColorType(SkBitmap::Config config) { 36 SkColorType SkBitmapConfigToColorType(SkBitmap::Config config) {
41 static const SkColorType gCT[] = { 37 static const SkColorType gCT[] = {
42 kUnknown_SkColorType, // kNo_Config 38 kUnknown_SkColorType, // kNo_Config
43 kAlpha_8_SkColorType, // kA8_Config 39 kAlpha_8_SkColorType, // kA8_Config
44 kIndex_8_SkColorType, // kIndex8_Config 40 kIndex_8_SkColorType, // kIndex8_Config
45 kRGB_565_SkColorType, // kRGB_565_Config 41 kRGB_565_SkColorType, // kRGB_565_Config
46 kARGB_4444_SkColorType, // kARGB_4444_Config 42 kARGB_4444_SkColorType, // kARGB_4444_Config
47 kN32_SkColorType, // kARGB_8888_Config 43 kN32_SkColorType, // kARGB_8888_Config
48 }; 44 };
49 SkASSERT((unsigned)config < SK_ARRAY_COUNT(gCT)); 45 SkASSERT((unsigned)config < SK_ARRAY_COUNT(gCT));
(...skipping 11 matching lines...) Expand all
61 image = SkNewImageFromPixelRef(info, bm.pixelRef(), bm.rowBytes()); 57 image = SkNewImageFromPixelRef(info, bm.pixelRef(), bm.rowBytes());
62 } else { 58 } else {
63 bm.lockPixels(); 59 bm.lockPixels();
64 if (bm.getPixels()) { 60 if (bm.getPixels()) {
65 image = SkImage::NewRasterCopy(info, bm.getPixels(), bm.rowBytes()); 61 image = SkImage::NewRasterCopy(info, bm.getPixels(), bm.rowBytes());
66 } 62 }
67 bm.unlockPixels(); 63 bm.unlockPixels();
68 } 64 }
69 return image; 65 return image;
70 } 66 }
OLDNEW
« no previous file with comments | « samplecode/SampleUnpremul.cpp ('k') | src/image/SkImage_Codec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698