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

Unified Diff: include/core/SkImage.h

Issue 656503003: Move SkImage::encode to SkImageEncoder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « bench/nanobench.cpp ('k') | include/core/SkImageEncoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkImage.h
diff --git a/include/core/SkImage.h b/include/core/SkImage.h
index 4e016348559b0f32358a710269724dedba545fd4..35515af9bb9f8251abbc7187445fa25e1b15bdf7 100644
--- a/include/core/SkImage.h
+++ b/include/core/SkImage.h
@@ -9,7 +9,6 @@
#define SkImage_DEFINED
#include "SkImageInfo.h"
-#include "SkImageEncoder.h"
#include "SkRefCnt.h"
#include "SkScalar.h"
#include "SkShader.h"
@@ -17,6 +16,7 @@
class SkData;
class SkCanvas;
class SkImageGenerator;
+class SkImageEncoder;
class SkPaint;
class GrContext;
class GrTexture;
@@ -82,16 +82,6 @@ public:
*/
const void* peekPixels(SkImageInfo* info, size_t* rowBytes) const;
- /**
- * Encode the image's pixels and return the result as a new SkData, which
- * the caller must manage (i.e. call unref() when they are done).
- *
- * If the image type cannot be encoded, or the requested encoder type is
- * not supported, this will return NULL.
- */
- SkData* encode(SkImageEncoder::Type t = SkImageEncoder::kPNG_Type,
- int quality = 80) const;
-
protected:
SkImage(int width, int height) :
fWidth(width),
@@ -112,6 +102,7 @@ private:
typedef SkRefCnt INHERITED;
friend class SkCanvas;
+ friend class SkImageEncoder;
void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const;
@@ -146,6 +137,11 @@ private:
// - should it have separate entrypoints for preallocated and not bitmaps?
// - isn't it enough to allow the caller to draw() the image into a canvas?
bool readPixels(SkBitmap* bitmap, const SkIRect* subset = NULL) const;
+
+ /** Returns the image for encoding.
+ * Returns true if bm contains the image, false if the operation fails.
+ */
+ bool getBitmapForEncoding(SkBitmap* bm) const;
};
#endif
« no previous file with comments | « bench/nanobench.cpp ('k') | include/core/SkImageEncoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698