| OLD | NEW | 
|---|
| 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 #include "ktx.h" | 9 #include "ktx.h" | 
| 10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" | 
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 128     size_t bytesWrittenPadFour = (bytesWritten + 3) & ~3; | 128     size_t bytesWrittenPadFour = (bytesWritten + 3) & ~3; | 
| 129     uint8_t nullBuf[4] = { 0, 0, 0, 0 }; | 129     uint8_t nullBuf[4] = { 0, 0, 0, 0 }; | 
| 130 | 130 | 
| 131     size_t padding = bytesWrittenPadFour - bytesWritten; | 131     size_t padding = bytesWrittenPadFour - bytesWritten; | 
| 132     SkASSERT(padding < 4); | 132     SkASSERT(padding < 4); | 
| 133 | 133 | 
| 134     return strm->write(nullBuf, padding); | 134     return strm->write(nullBuf, padding); | 
| 135 } | 135 } | 
| 136 | 136 | 
| 137 uint32_t SkKTXFile::readInt(const uint8_t** buf, size_t* bytesLeft) const { | 137 uint32_t SkKTXFile::readInt(const uint8_t** buf, size_t* bytesLeft) const { | 
| 138     SkASSERT(NULL != buf && NULL != bytesLeft); | 138     SkASSERT(buf && bytesLeft); | 
| 139 | 139 | 
| 140     uint32_t result; | 140     uint32_t result; | 
| 141 | 141 | 
| 142     if (*bytesLeft < 4) { | 142     if (*bytesLeft < 4) { | 
| 143         SkASSERT(false); | 143         SkASSERT(false); | 
| 144         return 0; | 144         return 0; | 
| 145     } | 145     } | 
| 146 | 146 | 
| 147     memcpy(&result, *buf, 4); | 147     memcpy(&result, *buf, 4); | 
| 148     *buf += 4; | 148     *buf += 4; | 
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 550         for (int i = 0; i < height; ++i) { | 550         for (int i = 0; i < height; ++i) { | 
| 551             if (!stream->write(rowPtr, bpp*width)) { | 551             if (!stream->write(rowPtr, bpp*width)) { | 
| 552                 return false; | 552                 return false; | 
| 553             } | 553             } | 
| 554             rowPtr += bitmap.rowBytes(); | 554             rowPtr += bitmap.rowBytes(); | 
| 555         } | 555         } | 
| 556     } | 556     } | 
| 557 | 557 | 
| 558     return true; | 558     return true; | 
| 559 } | 559 } | 
| OLD | NEW | 
|---|