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

Side by Side Diff: third_party/ktx/ktx.h

Issue 440783004: Add support for all compressed formats in KTX file format (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix boolean stuff Created 6 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
« no previous file with comments | « src/utils/SkTextureCompressor.h ('k') | third_party/ktx/ktx.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 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkKTXFile_DEFINED 10 #ifndef SkKTXFile_DEFINED
11 #define SkKTXFile_DEFINED 11 #define SkKTXFile_DEFINED
12 12
13 #include "SkData.h" 13 #include "SkData.h"
14 #include "SkTextureCompressor.h"
14 #include "SkTypes.h" 15 #include "SkTypes.h"
15 #include "SkTDArray.h" 16 #include "SkTDArray.h"
16 #include "SkString.h" 17 #include "SkString.h"
17 #include "SkRefCnt.h" 18 #include "SkRefCnt.h"
18 19
19 class SkBitmap; 20 class SkBitmap;
20 class SkStreamRewindable; 21 class SkStreamRewindable;
21 class SkWStream; 22 class SkWStream;
22 23
23 // KTX Image File 24 // KTX Image File
(...skipping 27 matching lines...) Expand all
51 return this->valid() ? fPixelData[mipmap].data() : NULL; 52 return this->valid() ? fPixelData[mipmap].data() : NULL;
52 } 53 }
53 54
54 // If the decoded KTX file has the following key, then it will 55 // If the decoded KTX file has the following key, then it will
55 // return the associated value. If not found, the empty string 56 // return the associated value. If not found, the empty string
56 // is returned. 57 // is returned.
57 SkString getValueForKey(const SkString& key) const; 58 SkString getValueForKey(const SkString& key) const;
58 59
59 int numMipmaps() const { return static_cast<int>(fHeader.fNumberOfMipmapLeve ls); } 60 int numMipmaps() const { return static_cast<int>(fHeader.fNumberOfMipmapLeve ls); }
60 61
61 bool isETC1() const; 62 bool isCompressedFormat(SkTextureCompressor::Format fmt) const;
62 bool isRGBA8() const; 63 bool isRGBA8() const;
63 bool isRGB8() const; 64 bool isRGB8() const;
64 65
65 static bool is_ktx(const uint8_t *data); 66 static bool is_ktx(const uint8_t *data);
66 static bool is_ktx(SkStreamRewindable* stream); 67 static bool is_ktx(SkStreamRewindable* stream);
67 68
68 static bool WriteETC1ToKTX(SkWStream* stream, const uint8_t *etc1Data, 69 static bool WriteETC1ToKTX(SkWStream* stream, const uint8_t *etc1Data,
69 uint32_t width, uint32_t height); 70 uint32_t width, uint32_t height);
70 static bool WriteBitmapToKTX(SkWStream* stream, const SkBitmap& bitmap); 71 static bool WriteBitmapToKTX(SkWStream* stream, const SkBitmap& bitmap);
71 private: 72 private:
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // If the endianness of the platform is different than the file, 136 // If the endianness of the platform is different than the file,
136 // then we need to do proper byte swapping. 137 // then we need to do proper byte swapping.
137 bool fSwapBytes; 138 bool fSwapBytes;
138 139
139 // Read an integer from a buffer, advance the buffer, and swap 140 // Read an integer from a buffer, advance the buffer, and swap
140 // bytes if fSwapBytes is set 141 // bytes if fSwapBytes is set
141 uint32_t readInt(const uint8_t** buf, size_t* bytesLeft) const; 142 uint32_t readInt(const uint8_t** buf, size_t* bytesLeft) const;
142 }; 143 };
143 144
144 #endif // SkKTXFile_DEFINED 145 #endif // SkKTXFile_DEFINED
OLDNEW
« no previous file with comments | « src/utils/SkTextureCompressor.h ('k') | third_party/ktx/ktx.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698