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

Side by Side Diff: src/images/SkImageEncoder_argb.cpp

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 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/images/SkImageEncoder_Factory.cpp ('k') | src/images/SkJpegUtility.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 2013 Google Inc. 2 * Copyright 2013 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 "SkImageEncoder.h" 8 #include "SkImageEncoder.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 switch (ct) { 75 switch (ct) {
76 case kN32_SkColorType: 76 case kN32_SkColorType:
77 return ARGB_8888_To_ARGB; 77 return ARGB_8888_To_ARGB;
78 case kRGB_565_SkColorType: 78 case kRGB_565_SkColorType:
79 return RGB_565_To_ARGB; 79 return RGB_565_To_ARGB;
80 case kARGB_4444_SkColorType: 80 case kARGB_4444_SkColorType:
81 return ARGB_4444_To_ARGB; 81 return ARGB_4444_To_ARGB;
82 case kIndex_8_SkColorType: 82 case kIndex_8_SkColorType:
83 return Index8_To_ARGB; 83 return Index8_To_ARGB;
84 default: 84 default:
85 return NULL; 85 return nullptr;
86 } 86 }
87 } 87 }
88 88
89 bool SkARGBImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bitmap, int ) { 89 bool SkARGBImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bitmap, int ) {
90 const ScanlineImporter scanline_import = ChooseImporter(bitmap.colorType()); 90 const ScanlineImporter scanline_import = ChooseImporter(bitmap.colorType());
91 if (NULL == scanline_import) { 91 if (nullptr == scanline_import) {
92 return false; 92 return false;
93 } 93 }
94 94
95 SkAutoLockPixels alp(bitmap); 95 SkAutoLockPixels alp(bitmap);
96 const uint8_t* src = (uint8_t*)bitmap.getPixels(); 96 const uint8_t* src = (uint8_t*)bitmap.getPixels();
97 if (NULL == bitmap.getPixels()) { 97 if (nullptr == bitmap.getPixels()) {
98 return false; 98 return false;
99 } 99 }
100 100
101 const SkPMColor* colors = bitmap.getColorTable() ? bitmap.getColorTable()->r eadColors() : NULL; 101 const SkPMColor* colors = bitmap.getColorTable() ? bitmap.getColorTable()->r eadColors() : nullptr;
102 102
103 const int argbStride = bitmap.width() * 4; 103 const int argbStride = bitmap.width() * 4;
104 SkAutoTDeleteArray<uint8_t> ada(new uint8_t[argbStride]); 104 SkAutoTDeleteArray<uint8_t> ada(new uint8_t[argbStride]);
105 uint8_t* argb = ada.get(); 105 uint8_t* argb = ada.get();
106 for (int y = 0; y < bitmap.height(); ++y) { 106 for (int y = 0; y < bitmap.height(); ++y) {
107 scanline_import(src + y * bitmap.rowBytes(), argb, bitmap.width(), color s); 107 scanline_import(src + y * bitmap.rowBytes(), argb, bitmap.width(), color s);
108 stream->write(argb, argbStride); 108 stream->write(argb, argbStride);
109 } 109 }
110 110
111 return true; 111 return true;
112 } 112 }
113 113
114 114
115 /////////////////////////////////////////////////////////////////////////////// 115 ///////////////////////////////////////////////////////////////////////////////
116 DEFINE_ENCODER_CREATOR(ARGBImageEncoder); 116 DEFINE_ENCODER_CREATOR(ARGBImageEncoder);
117 /////////////////////////////////////////////////////////////////////////////// 117 ///////////////////////////////////////////////////////////////////////////////
OLDNEW
« no previous file with comments | « src/images/SkImageEncoder_Factory.cpp ('k') | src/images/SkJpegUtility.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698