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

Side by Side Diff: src/images/SkImageDecoder.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/SkDecodingImageGenerator.cpp ('k') | src/images/SkImageDecoder_FactoryDefault.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 2006 The Android Open Source Project 2 * Copyright 2006 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 8
9 #include "SkImageDecoder.h" 9 #include "SkImageDecoder.h"
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
11 #include "SkImagePriv.h" 11 #include "SkImagePriv.h"
12 #include "SkPixelRef.h" 12 #include "SkPixelRef.h"
13 #include "SkStream.h" 13 #include "SkStream.h"
14 #include "SkTemplates.h" 14 #include "SkTemplates.h"
15 #include "SkCanvas.h" 15 #include "SkCanvas.h"
16 16
17 SkImageDecoder::SkImageDecoder() 17 SkImageDecoder::SkImageDecoder()
18 : fPeeker(NULL) 18 : fPeeker(nullptr)
19 , fAllocator(NULL) 19 , fAllocator(nullptr)
20 , fSampleSize(1) 20 , fSampleSize(1)
21 , fDefaultPref(kUnknown_SkColorType) 21 , fDefaultPref(kUnknown_SkColorType)
22 , fPreserveSrcDepth(false) 22 , fPreserveSrcDepth(false)
23 , fDitherImage(true) 23 , fDitherImage(true)
24 , fSkipWritingZeroes(false) 24 , fSkipWritingZeroes(false)
25 , fPreferQualityOverSpeed(false) 25 , fPreferQualityOverSpeed(false)
26 , fRequireUnpremultipliedColors(false) { 26 , fRequireUnpremultipliedColors(false) {
27 } 27 }
28 28
29 SkImageDecoder::~SkImageDecoder() { 29 SkImageDecoder::~SkImageDecoder() {
30 SkSafeUnref(fPeeker); 30 SkSafeUnref(fPeeker);
31 SkSafeUnref(fAllocator); 31 SkSafeUnref(fAllocator);
32 } 32 }
33 33
34 void SkImageDecoder::copyFieldsToOther(SkImageDecoder* other) { 34 void SkImageDecoder::copyFieldsToOther(SkImageDecoder* other) {
35 if (NULL == other) { 35 if (nullptr == other) {
36 return; 36 return;
37 } 37 }
38 other->setPeeker(fPeeker); 38 other->setPeeker(fPeeker);
39 other->setAllocator(fAllocator); 39 other->setAllocator(fAllocator);
40 other->setSampleSize(fSampleSize); 40 other->setSampleSize(fSampleSize);
41 other->setPreserveSrcDepth(fPreserveSrcDepth); 41 other->setPreserveSrcDepth(fPreserveSrcDepth);
42 other->setDitherImage(fDitherImage); 42 other->setDitherImage(fDitherImage);
43 other->setSkipWritingZeroes(fSkipWritingZeroes); 43 other->setSkipWritingZeroes(fSkipWritingZeroes);
44 other->setPreferQualityOverSpeed(fPreferQualityOverSpeed); 44 other->setPreferQualityOverSpeed(fPreferQualityOverSpeed);
45 other->setRequireUnpremultipliedColors(fRequireUnpremultipliedColors); 45 other->setRequireUnpremultipliedColors(fRequireUnpremultipliedColors);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 // allocation, which was already done on src). 181 // allocation, which was already done on src).
182 int x = (dstX - srcX) / sampleSize; 182 int x = (dstX - srcX) / sampleSize;
183 int y = (dstY - srcY) / sampleSize; 183 int y = (dstY - srcY) / sampleSize;
184 SkIRect subset = SkIRect::MakeXYWH(x, y, w, h); 184 SkIRect subset = SkIRect::MakeXYWH(x, y, w, h);
185 return src->extractSubset(dst, subset); 185 return src->extractSubset(dst, subset);
186 } 186 }
187 // if the destination has no pixels then we must allocate them. 187 // if the destination has no pixels then we must allocate them.
188 if (dst->isNull()) { 188 if (dst->isNull()) {
189 dst->setInfo(src->info().makeWH(w, h)); 189 dst->setInfo(src->info().makeWH(w, h));
190 190
191 if (!this->allocPixelRef(dst, NULL)) { 191 if (!this->allocPixelRef(dst, nullptr)) {
192 SkDEBUGF(("failed to allocate pixels needed to crop the bitmap")); 192 SkDEBUGF(("failed to allocate pixels needed to crop the bitmap"));
193 return false; 193 return false;
194 } 194 }
195 } 195 }
196 // check to see if the destination is large enough to decode the desired 196 // check to see if the destination is large enough to decode the desired
197 // region. If this assert fails we will just draw as much of the source 197 // region. If this assert fails we will just draw as much of the source
198 // into the destination that we can. 198 // into the destination that we can.
199 if (dst->width() < w || dst->height() < h) { 199 if (dst->width() < w || dst->height() < h) {
200 SkDEBUGF(("SkImageDecoder::cropBitmap does not have a large enough bitma p.\n")); 200 SkDEBUGF(("SkImageDecoder::cropBitmap does not have a large enough bitma p.\n"));
201 } 201 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 return success; 265 return success;
266 } 266 }
267 267
268 bool SkImageDecoder::decodeYUV8Planes(SkStream* stream, SkISize componentSizes[3 ], void* planes[3], 268 bool SkImageDecoder::decodeYUV8Planes(SkStream* stream, SkISize componentSizes[3 ], void* planes[3],
269 size_t rowBytes[3], SkYUVColorSpace* color Space) { 269 size_t rowBytes[3], SkYUVColorSpace* color Space) {
270 // we reset this to false before calling onDecodeYUV8Planes 270 // we reset this to false before calling onDecodeYUV8Planes
271 fShouldCancelDecode = false; 271 fShouldCancelDecode = false;
272 272
273 return this->onDecodeYUV8Planes(stream, componentSizes, planes, rowBytes, co lorSpace); 273 return this->onDecodeYUV8Planes(stream, componentSizes, planes, rowBytes, co lorSpace);
274 } 274 }
OLDNEW
« no previous file with comments | « src/images/SkDecodingImageGenerator.cpp ('k') | src/images/SkImageDecoder_FactoryDefault.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698