share impl between makeNonTexture and makeRaster
Bug: skia:
Change-Id: I1042e25c28b60e99b6ced44b9971d51a3ac239ee
Reviewed-on: https://skia-review.googlesource.com/90201
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp
index 6b35a12..e618f7f 100644
--- a/src/image/SkImage.cpp
+++ b/src/image/SkImage.cpp
@@ -313,6 +313,13 @@
return as_IB(this)->onMakeColorSpace(std::move(target), targetColorType, premulBehavior);
}
+sk_sp<SkImage> SkImage::makeNonTextureImage() const {
+ if (!this->isTextureBacked()) {
+ return sk_ref_sp(const_cast<SkImage*>(this));
+ }
+ return this->makeRasterImage();
+}
+
sk_sp<SkImage> SkImage::makeRasterImage() const {
SkPixmap pm;
if (this->peekPixels(&pm)) {
@@ -411,10 +418,6 @@
return nullptr;
}
-sk_sp<SkImage> SkImage::makeNonTextureImage() const {
- return sk_ref_sp(const_cast<SkImage*>(this));
-}
-
#endif
///////////////////////////////////////////////////////////////////////////////////////////////////