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

Unified Diff: samplecode/SampleEncode.cpp

Issue 1018953003: Add SkEncodedFormat, used by SkCodec. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Use a common enum for SkImageEncoder and SkImageDecoder and SkCodec Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: samplecode/SampleEncode.cpp
diff --git a/samplecode/SampleEncode.cpp b/samplecode/SampleEncode.cpp
index 185208b35bd8bece2ddd4d4049594493e4dbbff4..fc7d60a40bb6a1a2b1123ebe871e3a871c338d47 100644
--- a/samplecode/SampleEncode.cpp
+++ b/samplecode/SampleEncode.cpp
@@ -9,6 +9,7 @@
#include "SkView.h"
#include "SkCanvas.h"
#include "SkData.h"
+#include "SkEncodedFormat.h"
#include "SkImageGenerator.h"
#include "SkGradientShader.h"
#include "SkGraphics.h"
@@ -91,10 +92,10 @@ static const char* const gConfigLabels[] = {
"8888", "565", "Index8", "Index8 alpha"
};
-// types to encode into. Can be at most these 3. Must match up with gExt[]
-static const SkImageEncoder::Type gTypes[] = {
- SkImageEncoder::kJPEG_Type,
- SkImageEncoder::kPNG_Type
+// types to encode into. Can be at most these 2. Must match up with gExt[]
+static const SkEncodedFormat gTypes[] = {
+ kJPEG_SkEncodedFormat,
+ kPNG_SkEncodedFormat,
};
// must match up with gTypes[]
@@ -133,9 +134,9 @@ public:
__FILE__, __LINE__,gConfigLabels[i], gExt[j]);
continue;
}
- if (SkImageEncoder::kJPEG_Type == gTypes[j]) {
+ if (kJPEG_SkEncodedFormat == gTypes[j]) {
fEncodedJPEGs[i].reset(data.detach());
- } else if (SkImageEncoder::kPNG_Type == gTypes[j]) {
+ } else if (kPNG_SkEncodedFormat == gTypes[j]) {
fEncodedPNGs[i].reset(data.detach());
}
}
@@ -187,9 +188,9 @@ protected:
SkBitmap bm;
SkData* encoded = NULL;
- if (SkImageEncoder::kJPEG_Type == gTypes[j]) {
+ if (kJPEG_SkEncodedFormat == gTypes[j]) {
encoded = fEncodedJPEGs[i].get();
- } else if (SkImageEncoder::kPNG_Type == gTypes[j]) {
+ } else if (kPNG_SkEncodedFormat == gTypes[j]) {
encoded = fEncodedPNGs[i].get();
}
if (encoded) {

Powered by Google App Engine
This is Rietveld 408576698