OLD | NEW |
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 | 8 |
9 #ifndef SkKTXFile_DEFINED | 9 #ifndef SkKTXFile_DEFINED |
10 #define SkKTXFile_DEFINED | 10 #define SkKTXFile_DEFINED |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 static bool is_ktx(const uint8_t data[], size_t size); | 63 static bool is_ktx(const uint8_t data[], size_t size); |
64 static bool is_ktx(SkStreamRewindable* stream); | 64 static bool is_ktx(SkStreamRewindable* stream); |
65 | 65 |
66 static bool WriteETC1ToKTX(SkWStream* stream, const uint8_t *etc1Data, | 66 static bool WriteETC1ToKTX(SkWStream* stream, const uint8_t *etc1Data, |
67 uint32_t width, uint32_t height); | 67 uint32_t width, uint32_t height); |
68 static bool WriteBitmapToKTX(SkWStream* stream, const SkBitmap& bitmap); | 68 static bool WriteBitmapToKTX(SkWStream* stream, const SkBitmap& bitmap); |
69 private: | 69 private: |
70 | 70 |
71 // The blob holding the file data. | 71 // The blob holding the file data. |
72 SkAutoTUnref<SkData> fData; | 72 sk_sp<SkData> fData; |
73 | 73 |
74 // This header captures all of the data that describes the format | 74 // This header captures all of the data that describes the format |
75 // of the image data in a KTX file. | 75 // of the image data in a KTX file. |
76 struct Header { | 76 struct Header { |
77 uint32_t fGLType; | 77 uint32_t fGLType; |
78 uint32_t fGLTypeSize; | 78 uint32_t fGLTypeSize; |
79 uint32_t fGLFormat; | 79 uint32_t fGLFormat; |
80 uint32_t fGLInternalFormat; | 80 uint32_t fGLInternalFormat; |
81 uint32_t fGLBaseInternalFormat; | 81 uint32_t fGLBaseInternalFormat; |
82 uint32_t fPixelWidth; | 82 uint32_t fPixelWidth; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 // If the endianness of the platform is different than the file, | 133 // If the endianness of the platform is different than the file, |
134 // then we need to do proper byte swapping. | 134 // then we need to do proper byte swapping. |
135 bool fSwapBytes; | 135 bool fSwapBytes; |
136 | 136 |
137 // Read an integer from a buffer, advance the buffer, and swap | 137 // Read an integer from a buffer, advance the buffer, and swap |
138 // bytes if fSwapBytes is set | 138 // bytes if fSwapBytes is set |
139 uint32_t readInt(const uint8_t** buf, size_t* bytesLeft) const; | 139 uint32_t readInt(const uint8_t** buf, size_t* bytesLeft) const; |
140 }; | 140 }; |
141 | 141 |
142 #endif // SkKTXFile_DEFINED | 142 #endif // SkKTXFile_DEFINED |
OLD | NEW |