third_party/ktx: put WriteBitmapToKTX back

BUG=skia:

Change-Id: I876e802db370a7812cd53e42cb4927702e6c1fb6
Reviewed-on: https://skia-review.googlesource.com/5418
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
Hal Canary 2016-12-01 12:40:02 -05:00
parent b2e29bbf22
commit a4d861a5b4
2 changed files with 11 additions and 2 deletions

View File

@ -6,7 +6,7 @@
*/
#include "ktx.h"
#include "SkPixmap.h"
#include "SkBitmap.h"
#include "SkStream.h"
#include "SkEndian.h"
@ -557,3 +557,9 @@ bool SkKTXFile::WritePixmapToKTX(SkWStream* stream, const SkPixmap& pixmap) {
return true;
}
bool SkKTXFile::WriteBitmapToKTX(SkWStream* stream, const SkBitmap& bitmap) {
SkAutoLockPixels autoLockPixels(bitmap);
SkPixmap pixmap;
return bitmap.peekPixels(&pixmap) && SkKTXFile::WritePixmapToKTX(stream, pixmap);
}

View File

@ -16,6 +16,7 @@
#include "SkString.h"
#include "SkRefCnt.h"
class SkBitmap;
class SkPixmap;
class SkStreamRewindable;
class SkWStream;
@ -65,7 +66,9 @@ public:
static bool WriteETC1ToKTX(SkWStream* stream, const uint8_t *etc1Data,
uint32_t width, uint32_t height);
static bool WritePixmapToKTX(SkWStream* stream, const SkPixmap& bitmap);
static bool WritePixmapToKTX(SkWStream* stream, const SkPixmap& pixmap);
static bool WriteBitmapToKTX(SkWStream* stream, const SkBitmap& bitmap);
private:
// The blob holding the file data.