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

Side by Side Diff: src/images/SkImageEncoder.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/SkImageDecoder_wbmp.cpp ('k') | src/images/SkImageEncoder_Factory.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 2009 The Android Open Source Project 2 * Copyright 2009 The Android Open Source Project
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 "SkStream.h" 10 #include "SkStream.h"
(...skipping 13 matching lines...) Expand all
24 SkFILEWStream stream(file); 24 SkFILEWStream stream(file);
25 return this->onEncode(&stream, bm, quality); 25 return this->onEncode(&stream, bm, quality);
26 } 26 }
27 27
28 SkData* SkImageEncoder::encodeData(const SkBitmap& bm, int quality) { 28 SkData* SkImageEncoder::encodeData(const SkBitmap& bm, int quality) {
29 SkDynamicMemoryWStream stream; 29 SkDynamicMemoryWStream stream;
30 quality = SkMin32(100, SkMax32(0, quality)); 30 quality = SkMin32(100, SkMax32(0, quality));
31 if (this->onEncode(&stream, bm, quality)) { 31 if (this->onEncode(&stream, bm, quality)) {
32 return stream.copyToData(); 32 return stream.copyToData();
33 } 33 }
34 return NULL; 34 return nullptr;
35 } 35 }
36 36
37 bool SkImageEncoder::EncodeFile(const char file[], const SkBitmap& bm, Type t, 37 bool SkImageEncoder::EncodeFile(const char file[], const SkBitmap& bm, Type t,
38 int quality) { 38 int quality) {
39 SkAutoTDelete<SkImageEncoder> enc(SkImageEncoder::Create(t)); 39 SkAutoTDelete<SkImageEncoder> enc(SkImageEncoder::Create(t));
40 return enc.get() && enc.get()->encodeFile(file, bm, quality); 40 return enc.get() && enc.get()->encodeFile(file, bm, quality);
41 } 41 }
42 42
43 bool SkImageEncoder::EncodeStream(SkWStream* stream, const SkBitmap& bm, Type t, 43 bool SkImageEncoder::EncodeStream(SkWStream* stream, const SkBitmap& bm, Type t,
44 int quality) { 44 int quality) {
45 SkAutoTDelete<SkImageEncoder> enc(SkImageEncoder::Create(t)); 45 SkAutoTDelete<SkImageEncoder> enc(SkImageEncoder::Create(t));
46 return enc.get() && enc.get()->encodeStream(stream, bm, quality); 46 return enc.get() && enc.get()->encodeStream(stream, bm, quality);
47 } 47 }
48 48
49 SkData* SkImageEncoder::EncodeData(const SkBitmap& bm, Type t, int quality) { 49 SkData* SkImageEncoder::EncodeData(const SkBitmap& bm, Type t, int quality) {
50 SkAutoTDelete<SkImageEncoder> enc(SkImageEncoder::Create(t)); 50 SkAutoTDelete<SkImageEncoder> enc(SkImageEncoder::Create(t));
51 return enc.get() ? enc.get()->encodeData(bm, quality) : NULL; 51 return enc.get() ? enc.get()->encodeData(bm, quality) : nullptr;
52 } 52 }
53 53
54 SkData* SkImageEncoder::EncodeData(const SkImageInfo& info, const void* pixels, size_t rowBytes, 54 SkData* SkImageEncoder::EncodeData(const SkImageInfo& info, const void* pixels, size_t rowBytes,
55 Type t, int quality) { 55 Type t, int quality) {
56 SkBitmap bm; 56 SkBitmap bm;
57 if (!bm.installPixels(info, const_cast<void*>(pixels), rowBytes)) { 57 if (!bm.installPixels(info, const_cast<void*>(pixels), rowBytes)) {
58 return NULL; 58 return nullptr;
59 } 59 }
60 SkAutoTDelete<SkImageEncoder> enc(SkImageEncoder::Create(t)); 60 SkAutoTDelete<SkImageEncoder> enc(SkImageEncoder::Create(t));
61 return enc.get() ? enc.get()->encodeData(bm, quality) : NULL; 61 return enc.get() ? enc.get()->encodeData(bm, quality) : nullptr;
62 } 62 }
OLDNEW
« no previous file with comments | « src/images/SkImageDecoder_wbmp.cpp ('k') | src/images/SkImageEncoder_Factory.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698