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

Side by Side Diff: src/utils/SkTextureCompressor_LATC.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/utils/SkTextureCompressor_Blitter.h ('k') | src/utils/SkTextureCompressor_R11EAC.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 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 "SkTextureCompressor_LATC.h" 8 #include "SkTextureCompressor_LATC.h"
9 #include "SkTextureCompressor_Blitter.h" 9 #include "SkTextureCompressor_Blitter.h"
10 #include "SkTextureCompressor_Utils.h" 10 #include "SkTextureCompressor_Utils.h"
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 #elif COMPRESS_LATC_SLOW 478 #elif COMPRESS_LATC_SLOW
479 return compress_4x4_a8_to_64bit(dst, src, width, height, rowBytes, compress_ latc_block); 479 return compress_4x4_a8_to_64bit(dst, src, width, height, rowBytes, compress_ latc_block);
480 #else 480 #else
481 #error "Must choose either fast or slow LATC compression" 481 #error "Must choose either fast or slow LATC compression"
482 #endif 482 #endif
483 } 483 }
484 484
485 SkBlitter* CreateLATCBlitter(int width, int height, void* outputBuffer, 485 SkBlitter* CreateLATCBlitter(int width, int height, void* outputBuffer,
486 SkTBlitterAllocator* allocator) { 486 SkTBlitterAllocator* allocator) {
487 if ((width % 4) != 0 || (height % 4) != 0) { 487 if ((width % 4) != 0 || (height % 4) != 0) {
488 return NULL; 488 return nullptr;
489 } 489 }
490 490
491 #if COMPRESS_LATC_FAST 491 #if COMPRESS_LATC_FAST
492 // Memset the output buffer to an encoding that decodes to zero. We must do this 492 // Memset the output buffer to an encoding that decodes to zero. We must do this
493 // in order to avoid having uninitialized values in the buffer if the blitte r 493 // in order to avoid having uninitialized values in the buffer if the blitte r
494 // decides not to write certain scanlines (and skip entire rows of blocks). 494 // decides not to write certain scanlines (and skip entire rows of blocks).
495 // In the case of LATC, if everything is zero, then LUM0 and LUM1 are also z ero, 495 // In the case of LATC, if everything is zero, then LUM0 and LUM1 are also z ero,
496 // and they will only be non-zero (0xFF) if the index is 7. So bzero will do just fine. 496 // and they will only be non-zero (0xFF) if the index is 7. So bzero will do just fine.
497 // (8 bytes per block) * (w * h / 16 blocks) = w * h / 2 497 // (8 bytes per block) * (w * h / 16 blocks) = w * h / 2
498 sk_bzero(outputBuffer, width * height / 2); 498 sk_bzero(outputBuffer, width * height / 2);
499 499
500 return allocator->createT< 500 return allocator->createT<
501 SkTCompressedAlphaBlitter<4, 8, CompressorLATC>, int, int, void* > 501 SkTCompressedAlphaBlitter<4, 8, CompressorLATC>, int, int, void* >
502 (width, height, outputBuffer); 502 (width, height, outputBuffer);
503 #elif COMPRESS_LATC_SLOW 503 #elif COMPRESS_LATC_SLOW
504 // TODO (krajcevski) 504 // TODO (krajcevski)
505 return NULL; 505 return nullptr;
506 #endif 506 #endif
507 } 507 }
508 508
509 void DecompressLATC(uint8_t* dst, int dstRowBytes, const uint8_t* src, int width , int height) { 509 void DecompressLATC(uint8_t* dst, int dstRowBytes, const uint8_t* src, int width , int height) {
510 for (int j = 0; j < height; j += 4) { 510 for (int j = 0; j < height; j += 4) {
511 for (int i = 0; i < width; i += 4) { 511 for (int i = 0; i < width; i += 4) {
512 decompress_latc_block(dst + i, dstRowBytes, src); 512 decompress_latc_block(dst + i, dstRowBytes, src);
513 src += 8; 513 src += 8;
514 } 514 }
515 dst += 4 * dstRowBytes; 515 dst += 4 * dstRowBytes;
516 } 516 }
517 } 517 }
518 518
519 } // SkTextureCompressor 519 } // SkTextureCompressor
OLDNEW
« no previous file with comments | « src/utils/SkTextureCompressor_Blitter.h ('k') | src/utils/SkTextureCompressor_R11EAC.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698