aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2016-12-01 12:40:02 -0500
committerGravatar Hal Canary <halcanary@google.com>2016-12-01 17:45:12 +0000
commita4d861a5b44d2139678291d7ab3b1da3a8d6252d (patch)
tree99c7adc3ec046c7ceeff0a1b8a5ea5f7f2f7ca6f /third_party
parentb2e29bbf224443867308863958237039bbee1349 (diff)
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>
Diffstat (limited to 'third_party')
-rw-r--r--third_party/ktx/ktx.cpp8
-rw-r--r--third_party/ktx/ktx.h5
2 files changed, 11 insertions, 2 deletions
diff --git a/third_party/ktx/ktx.cpp b/third_party/ktx/ktx.cpp
index 1a6ce8810a..ba3ba1fc27 100644
--- a/third_party/ktx/ktx.cpp
+++ b/third_party/ktx/ktx.cpp
@@ -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);
+}
diff --git a/third_party/ktx/ktx.h b/third_party/ktx/ktx.h
index 6772f86057..3aaea15726 100644
--- a/third_party/ktx/ktx.h
+++ b/third_party/ktx/ktx.h
@@ -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.