Index: src/image/SkImage_Gpu.cpp |
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp |
index fa697cd4b99ca6e131cd9233087b04ab8e873cb3..c331a295ce6d44031f1c0fb480aa3335b5a8eed2 100644 |
--- a/src/image/SkImage_Gpu.cpp |
+++ b/src/image/SkImage_Gpu.cpp |
@@ -43,6 +43,14 @@ extern void SkTextureImageApplyBudgetedDecision(SkImage* image) { |
} |
} |
+SkImageInfo SkImage_Gpu::onImageInfo() const { |
+ SkColorType ct; |
+ if (!GrPixelConfigToColorType(fTexture->config(), &ct)) { |
+ ct = kUnknown_SkColorType; |
+ } |
+ return SkImageInfo::Make(fTexture->width(), fTexture->height(), ct, fAlphaType, fColorSpace); |
Brian Osman
2016/07/21 20:57:07
This is now slightly different semantically - it u
|
+} |
+ |
static SkImageInfo make_info(int w, int h, bool isOpaque, sk_sp<SkColorSpace> colorSpace) { |
return SkImageInfo::MakeN32(w, h, isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType, |
std::move(colorSpace)); |
@@ -316,17 +324,10 @@ sk_sp<SkImage> SkImage::makeTextureImage(GrContext *context) const { |
} |
sk_sp<SkImage> SkImage::makeNonTextureImage() const { |
- GrTexture* texture = as_IB(this)->peekTexture(); |
- if (!texture) { |
+ if (!this->isTextureBacked()) { |
return sk_ref_sp(const_cast<SkImage*>(this)); |
} |
- SkColorType ct; |
- sk_sp<SkColorSpace> cs; |
- if (!GrPixelConfigToColorAndColorSpace(texture->config(), &ct, &cs)) { |
- return nullptr; |
- } |
- SkAlphaType at = this->isOpaque() ? kOpaque_SkAlphaType : kPremul_SkAlphaType; |
- auto info = SkImageInfo::Make(this->width(), this->height(), ct, at, cs); |
+ SkImageInfo info = as_IB(this)->onImageInfo(); |
Brian Osman
2016/07/21 20:57:07
Similar to above. We already have the *correct* al
|
size_t rowBytes = info.minRowBytes(); |
size_t size = info.getSafeSize(rowBytes); |
auto data = SkData::MakeUninitialized(size); |