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

Side by Side Diff: src/core/SkConfig8888.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/core/SkConfig8888.h ('k') | src/core/SkConvolver.h » ('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 2014 Google Inc. 2 * Copyright 2014 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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkConfig8888.h" 10 #include "SkConfig8888.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 } 230 }
231 231
232 // Can no longer draw directly into 4444, but we can manually whack it for a few combinations 232 // Can no longer draw directly into 4444, but we can manually whack it for a few combinations
233 if (kARGB_4444_SkColorType == dstInfo.colorType() && 233 if (kARGB_4444_SkColorType == dstInfo.colorType() &&
234 (kN32_SkColorType == srcInfo.colorType() || kIndex_8_SkColorType == srcI nfo.colorType())) { 234 (kN32_SkColorType == srcInfo.colorType() || kIndex_8_SkColorType == srcI nfo.colorType())) {
235 if (srcInfo.alphaType() == kUnpremul_SkAlphaType) { 235 if (srcInfo.alphaType() == kUnpremul_SkAlphaType) {
236 // Our method for converting to 4444 assumes premultiplied. 236 // Our method for converting to 4444 assumes premultiplied.
237 return false; 237 return false;
238 } 238 }
239 239
240 const SkPMColor* table = NULL; 240 const SkPMColor* table = nullptr;
241 if (kIndex_8_SkColorType == srcInfo.colorType()) { 241 if (kIndex_8_SkColorType == srcInfo.colorType()) {
242 if (NULL == ctable) { 242 if (nullptr == ctable) {
243 return false; 243 return false;
244 } 244 }
245 table = ctable->readColors(); 245 table = ctable->readColors();
246 } 246 }
247 247
248 for (int y = 0; y < height; ++y) { 248 for (int y = 0; y < height; ++y) {
249 DITHER_4444_SCAN(y); 249 DITHER_4444_SCAN(y);
250 SkPMColor16* SK_RESTRICT dstRow = (SkPMColor16*)dstPixels; 250 SkPMColor16* SK_RESTRICT dstRow = (SkPMColor16*)dstPixels;
251 if (table) { 251 if (table) {
252 const uint8_t* SK_RESTRICT srcRow = (const uint8_t*)srcPixels; 252 const uint8_t* SK_RESTRICT srcRow = (const uint8_t*)srcPixels;
(...skipping 16 matching lines...) Expand all
269 // We do not support drawing to unpremultiplied bitmaps. 269 // We do not support drawing to unpremultiplied bitmaps.
270 return false; 270 return false;
271 } 271 }
272 272
273 // Final fall-back, draw with a canvas 273 // Final fall-back, draw with a canvas
274 // 274 //
275 // Always clear the dest in case one of the blitters accesses it 275 // Always clear the dest in case one of the blitters accesses it
276 // TODO: switch the allocation of tmpDst to call sk_calloc_throw 276 // TODO: switch the allocation of tmpDst to call sk_calloc_throw
277 { 277 {
278 SkBitmap bm; 278 SkBitmap bm;
279 if (!bm.installPixels(srcInfo, const_cast<void*>(srcPixels), srcRB, ctab le, NULL, NULL)) { 279 if (!bm.installPixels(srcInfo, const_cast<void*>(srcPixels), srcRB, ctab le, nullptr, nullptr)) {
280 return false; 280 return false;
281 } 281 }
282 SkAutoTUnref<SkCanvas> canvas(SkCanvas::NewRasterDirect(dstInfo, dstPixe ls, dstRB)); 282 SkAutoTUnref<SkCanvas> canvas(SkCanvas::NewRasterDirect(dstInfo, dstPixe ls, dstRB));
283 if (NULL == canvas.get()) { 283 if (nullptr == canvas.get()) {
284 return false; 284 return false;
285 } 285 }
286 286
287 SkPaint paint; 287 SkPaint paint;
288 paint.setDither(true); 288 paint.setDither(true);
289 289
290 canvas->clear(0); 290 canvas->clear(0);
291 canvas->drawBitmap(bm, 0, 0, &paint); 291 canvas->drawBitmap(bm, 0, 0, &paint);
292 return true; 292 return true;
293 } 293 }
294 } 294 }
295 295
OLDNEW
« no previous file with comments | « src/core/SkConfig8888.h ('k') | src/core/SkConvolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698