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/codec/SkBmpCodec.cpp

Issue 1277213002: Support more swizzles to 565 in SkCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update new 565 swizzling functions for scaling Created 5 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 "SkBmpCodec.h" 8 #include "SkBmpCodec.h"
9 #include "SkBmpMaskCodec.h" 9 #include "SkBmpMaskCodec.h"
10 #include "SkBmpRLECodec.h" 10 #include "SkBmpRLECodec.h"
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 // V3+, we are guaranteed to be able to read at least this size. 390 // V3+, we are guaranteed to be able to read at least this size.
391 SkASSERT(infoBytesRemaining > 52); 391 SkASSERT(infoBytesRemaining > 52);
392 inputMasks.alpha = get_int(iBuffer.get(), 48); 392 inputMasks.alpha = get_int(iBuffer.get(), 48);
393 if (inputMasks.alpha != 0) { 393 if (inputMasks.alpha != 0) {
394 alphaType = kUnpremul_SkAlphaType; 394 alphaType = kUnpremul_SkAlphaType;
395 } 395 }
396 } 396 }
397 iBuffer.free(); 397 iBuffer.free();
398 398
399 // Additionally, 32 bit bmp-in-icos use the alpha channel. 399 // Additionally, 32 bit bmp-in-icos use the alpha channel.
400 // FIXME (msarett): Don't all bmp-in-icos use the alpha channel?
400 // And, RLE inputs may skip pixels, leaving them as transparent. This 401 // And, RLE inputs may skip pixels, leaving them as transparent. This
401 // is uncommon, but we cannot be certain that an RLE bmp will be opaque. 402 // is uncommon, but we cannot be certain that an RLE bmp will be opaque.
402 if ((inIco && 32 == bitsPerPixel) || (kRLE_BmpInputFormat == inputFormat)) { 403 if ((inIco && 32 == bitsPerPixel) || (kRLE_BmpInputFormat == inputFormat)) {
403 alphaType = kUnpremul_SkAlphaType; 404 alphaType = kUnpremul_SkAlphaType;
404 } 405 }
405 406
406 // Check for valid bits per pixel. 407 // Check for valid bits per pixel.
407 // At the same time, use this information to choose a suggested color type 408 // At the same time, use this information to choose a suggested color type
408 // and to set default masks. 409 // and to set default masks.
409 SkColorType colorType = kN32_SkColorType; 410 SkColorType colorType = kN32_SkColorType;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 */ 556 */
556 uint32_t SkBmpCodec::computeNumColors(uint32_t numColors) { 557 uint32_t SkBmpCodec::computeNumColors(uint32_t numColors) {
557 // Zero is a default for maxColors 558 // Zero is a default for maxColors
558 // Also set numColors to maxColors when it is too large 559 // Also set numColors to maxColors when it is too large
559 uint32_t maxColors = 1 << fBitsPerPixel; 560 uint32_t maxColors = 1 << fBitsPerPixel;
560 if (numColors == 0 || numColors >= maxColors) { 561 if (numColors == 0 || numColors >= maxColors) {
561 return maxColors; 562 return maxColors;
562 } 563 }
563 return numColors; 564 return numColors;
564 } 565 }
OLDNEW
« no previous file with comments | « dm/DMSrcSink.h ('k') | src/codec/SkBmpMaskCodec.cpp » ('j') | src/codec/SkSwizzler.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698