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

Side by Side Diff: include/codec/SkCodecPriv.h

Issue 947283002: Bmp Image Decoding (Closed) Base URL: https://skia.googlesource.com/skia.git@decode-leon-3
Patch Set: Improved efficiency of ResultAlpha and code sharing Created 5 years, 9 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
(Empty)
1 /*
2 * Copyright 2015 The Android Open Source Project
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8
9 #include "SkCodec.h"
10 #include "SkImageInfo.h"
11 #include "SkTypes.h"
12
13 /*
14 *
15 * Checks if alpha types are premul and unpremul
16 *
17 */
18 static inline bool premul_and_unpremul(SkAlphaType dst, SkAlphaType src) {
19 return kPremul_SkAlphaType == dst && kUnpremul_SkAlphaType == src;
20 }
21
22 /*
23 *
24 * Get a byte from a buffer
25 * This method is unsafe, the caller is responsible for performing a check
26 *
27 */
28 static inline uint8_t get_byte(uint8_t* buffer, uint32_t i) {
29 return buffer[i];
30 }
31
32 /*
33 *
34 * Get a short from a buffer
35 * This method is unsafe, the caller is responsible for performing a check
36 *
37 */
38 static inline uint16_t get_short(uint8_t* buffer, uint32_t i) {
39 uint16_t result;
40 memcpy(&result, &(buffer[i]), 2);
41 #ifdef SK_CPU_BENDIAN
42 return SkEndianSwap16(result);
43 #else
44 return result;
45 #endif
46 }
47
48 /*
49 *
50 * Get an int from a buffer
51 * This method is unsafe, the caller is responsible for performing a check
52 *
53 */
54 static inline uint32_t get_int(uint8_t* buffer, uint32_t i) {
55 uint32_t result;
56 memcpy(&result, &(buffer[i]), 4);
57 #ifdef SK_CPU_BENDIAN
58 return SkEndianSwap32(result);
59 #else
60 return result;
61 #endif
62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698