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

Side by Side Diff: src/ports/SkImageGenerator_skia.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/ports/SkImageGenerator_none.cpp ('k') | src/ports/SkMemory_malloc.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 2015 The Android Open Source Project 2 * Copyright 2015 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 "SkData.h" 8 #include "SkData.h"
9 #include "SkImageDecoder.h" 9 #include "SkImageDecoder.h"
10 #include "SkImageGenerator.h" 10 #include "SkImageGenerator.h"
(...skipping 10 matching lines...) Expand all
21 {} 21 {}
22 22
23 protected: 23 protected:
24 bool allocPixelRef(SkBitmap* bm, SkColorTable* ctable) override { 24 bool allocPixelRef(SkBitmap* bm, SkColorTable* ctable) override {
25 const SkImageInfo bmi = bm->info(); 25 const SkImageInfo bmi = bm->info();
26 if (bmi.width() != fInfo.width() || bmi.height() != fInfo.height() || 26 if (bmi.width() != fInfo.width() || bmi.height() != fInfo.height() ||
27 bmi.colorType() != fInfo.colorType()) 27 bmi.colorType() != fInfo.colorType())
28 { 28 {
29 return false; 29 return false;
30 } 30 }
31 return bm->installPixels(bmi, fMemory, fRowBytes, ctable, NULL, NULL); 31 return bm->installPixels(bmi, fMemory, fRowBytes, ctable, nullptr, nullp tr);
32 } 32 }
33 }; 33 };
34 34
35 class SkImageDecoderGenerator : public SkImageGenerator { 35 class SkImageDecoderGenerator : public SkImageGenerator {
36 const SkImageInfo fInfo; 36 const SkImageInfo fInfo;
37 SkAutoTDelete<SkImageDecoder> fDecoder; 37 SkAutoTDelete<SkImageDecoder> fDecoder;
38 SkAutoTUnref<SkData> fData; 38 SkAutoTUnref<SkData> fData;
39 39
40 public: 40 public:
41 SkImageDecoderGenerator(const SkImageInfo& info, SkImageDecoder* decoder, Sk Data* data) 41 SkImageDecoderGenerator(const SkImageInfo& info, SkImageDecoder* decoder, Sk Data* data)
(...skipping 18 matching lines...) Expand all
60 if (SkImageDecoder::kFailure == result) { 60 if (SkImageDecoder::kFailure == result) {
61 return false; 61 return false;
62 } 62 }
63 63
64 SkASSERT(info.colorType() == bm.info().colorType()); 64 SkASSERT(info.colorType() == bm.info().colorType());
65 65
66 if (kIndex_8_SkColorType == info.colorType()) { 66 if (kIndex_8_SkColorType == info.colorType()) {
67 SkASSERT(ctableEntries); 67 SkASSERT(ctableEntries);
68 68
69 SkColorTable* ctable = bm.getColorTable(); 69 SkColorTable* ctable = bm.getColorTable();
70 if (NULL == ctable) { 70 if (nullptr == ctable) {
71 return false; 71 return false;
72 } 72 }
73 const int count = ctable->count(); 73 const int count = ctable->count();
74 memcpy(ctableEntries, ctable->readColors(), count * sizeof(SkPMColor )); 74 memcpy(ctableEntries, ctable->readColors(), count * sizeof(SkPMColor ));
75 *ctableCount = count; 75 *ctableCount = count;
76 } 76 }
77 return true; 77 return true;
78 } 78 }
79 79
80 bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3], 80 bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
81 SkYUVColorSpace* colorSpace) override { 81 SkYUVColorSpace* colorSpace) override {
82 SkMemoryStream stream(fData->data(), fData->size(), false); 82 SkMemoryStream stream(fData->data(), fData->size(), false);
83 return fDecoder->decodeYUV8Planes(&stream, sizes, planes, rowBytes, colo rSpace); 83 return fDecoder->decodeYUV8Planes(&stream, sizes, planes, rowBytes, colo rSpace);
84 } 84 }
85 85
86 private: 86 private:
87 typedef SkImageGenerator INHERITED; 87 typedef SkImageGenerator INHERITED;
88 }; 88 };
89 89
90 SkImageGenerator* SkImageGenerator::NewFromEncodedImpl(SkData* data) { 90 SkImageGenerator* SkImageGenerator::NewFromEncodedImpl(SkData* data) {
91 SkMemoryStream stream(data->data(), data->size(), false); 91 SkMemoryStream stream(data->data(), data->size(), false);
92 SkImageDecoder* decoder = SkImageDecoder::Factory(&stream); 92 SkImageDecoder* decoder = SkImageDecoder::Factory(&stream);
93 if (NULL == decoder) { 93 if (nullptr == decoder) {
94 return NULL; 94 return nullptr;
95 } 95 }
96 96
97 SkBitmap bm; 97 SkBitmap bm;
98 stream.rewind(); 98 stream.rewind();
99 if (!decoder->decode(&stream, &bm, kUnknown_SkColorType, SkImageDecoder::kDe codeBounds_Mode)) { 99 if (!decoder->decode(&stream, &bm, kUnknown_SkColorType, SkImageDecoder::kDe codeBounds_Mode)) {
100 delete decoder; 100 delete decoder;
101 return NULL; 101 return nullptr;
102 } 102 }
103 103
104 return new SkImageDecoderGenerator(bm.info(), decoder, data); 104 return new SkImageDecoderGenerator(bm.info(), decoder, data);
105 } 105 }
OLDNEW
« no previous file with comments | « src/ports/SkImageGenerator_none.cpp ('k') | src/ports/SkMemory_malloc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698