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

Unified Diff: src/image/SkImage.cpp

Issue 15806010: Separate core and images project. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Change FORCE_LINKING to be more specific. Created 7 years, 7 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 | « src/animator/SkSnapshot.cpp ('k') | src/image/SkImage_Codec.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkImage.cpp
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp
index 1169459df638d79d9a4262216f531274b139f402..9c60f55aa749cfbade31164b4222c3f7f75ebc6f 100644
--- a/src/image/SkImage.cpp
+++ b/src/image/SkImage.cpp
@@ -5,17 +5,21 @@
* found in the LICENSE file.
*/
-#include "SkImage_Base.h"
-#include "SkImagePriv.h"
#include "SkBitmap.h"
#include "SkCanvas.h"
+#include "SkImagePriv.h"
+#include "SkImage_Base.h"
SK_DEFINE_INST_COUNT(SkImage)
-static SkImage_Base* asIB(SkImage* image) {
+static SkImage_Base* as_IB(SkImage* image) {
return static_cast<SkImage_Base*>(image);
}
+static const SkImage_Base* as_IB(const SkImage* image) {
+ return static_cast<const SkImage_Base*>(image);
+}
+
uint32_t SkImage::NextUniqueID() {
static int32_t gUniqueID;
@@ -29,9 +33,17 @@ uint32_t SkImage::NextUniqueID() {
void SkImage::draw(SkCanvas* canvas, SkScalar x, SkScalar y,
const SkPaint* paint) {
- asIB(this)->onDraw(canvas, x, y, paint);
+ as_IB(this)->onDraw(canvas, x, y, paint);
}
GrTexture* SkImage::getTexture() {
- return asIB(this)->onGetTexture();
+ return as_IB(this)->onGetTexture();
+}
+
+SkData* SkImage::encode(SkImageEncoder::Type type, int quality) const {
+ SkBitmap bm;
+ if (as_IB(this)->getROPixels(&bm)) {
+ return SkImageEncoder::EncodeData(bm, type, quality);
+ }
+ return NULL;
}
« no previous file with comments | « src/animator/SkSnapshot.cpp ('k') | src/image/SkImage_Codec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698