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

Unified Diff: src/core/SkSpecialImage.cpp

Issue 2366723004: Revert of Create special surfaces according to original device (not always in N32) (Closed)
Patch Set: Created 4 years, 3 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/core/SkSpecialImage.h ('k') | src/effects/SkColorFilterImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkSpecialImage.cpp
diff --git a/src/core/SkSpecialImage.cpp b/src/core/SkSpecialImage.cpp
index 5d62c6bc62326cd56c532ad6836efa92eba18c68..240d46921947e450a8f6592ac75c060e6fffb340 100644
--- a/src/core/SkSpecialImage.cpp
+++ b/src/core/SkSpecialImage.cpp
@@ -52,13 +52,11 @@
virtual sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const = 0;
- virtual sk_sp<SkSpecialSurface> onMakeSurface(const SkImageFilter::OutputProperties& outProps,
- const SkISize& size, SkAlphaType at) const = 0;
+ virtual sk_sp<SkSpecialSurface> onMakeSurface(const SkImageInfo& info) const = 0;
virtual sk_sp<SkImage> onMakeTightSubset(const SkIRect& subset) const = 0;
- virtual sk_sp<SkSurface> onMakeTightSurface(const SkImageFilter::OutputProperties& outProps,
- const SkISize& size, SkAlphaType at) const = 0;
+ virtual sk_sp<SkSurface> onMakeTightSurface(const SkImageInfo& info) const = 0;
private:
typedef SkSpecialImage INHERITED;
@@ -153,14 +151,12 @@
}
#endif
-sk_sp<SkSpecialSurface> SkSpecialImage::makeSurface(const SkImageFilter::OutputProperties& outProps,
- const SkISize& size, SkAlphaType at) const {
- return as_SIB(this)->onMakeSurface(outProps, size, at);
-}
-
-sk_sp<SkSurface> SkSpecialImage::makeTightSurface(const SkImageFilter::OutputProperties& outProps,
- const SkISize& size, SkAlphaType at) const {
- return as_SIB(this)->onMakeTightSurface(outProps, size, at);
+sk_sp<SkSpecialSurface> SkSpecialImage::makeSurface(const SkImageInfo& info) const {
+ return as_SIB(this)->onMakeSurface(info);
+}
+
+sk_sp<SkSurface> SkSpecialImage::makeTightSurface(const SkImageInfo& info) const {
+ return as_SIB(this)->onMakeTightSurface(info);
}
sk_sp<SkSpecialImage> SkSpecialImage::makeSubset(const SkIRect& subset) const {
@@ -256,22 +252,7 @@
}
#endif
-// TODO: The raster implementations of image filters all currently assume that the pixels are
-// legacy N32. Until they actually check the format and operate on sRGB or F16 data appropriately,
-// we can't enable this. (They will continue to produce incorrect results, but less-so).
-#define RASTER_IMAGE_FILTERS_SUPPORT_SRGB_AND_F16 0
-
- sk_sp<SkSpecialSurface> onMakeSurface(const SkImageFilter::OutputProperties& outProps,
- const SkISize& size, SkAlphaType at) const override {
-#if RASTER_IMAGE_FILTERS_SUPPORT_SRGB_AND_F16
- SkColorSpace* colorSpace = outProps.colorSpace();
-#else
- SkColorSpace* colorSpace = nullptr;
-#endif
- SkColorType colorType = colorSpace && colorSpace->gammaIsLinear()
- ? kRGBA_F16_SkColorType : kN32_SkColorType;
- SkImageInfo info = SkImageInfo::Make(size.width(), size.height(), colorType, at,
- sk_ref_sp(colorSpace));
+ sk_sp<SkSpecialSurface> onMakeSurface(const SkImageInfo& info) const override {
return SkSpecialSurface::MakeRaster(info, nullptr);
}
@@ -297,17 +278,7 @@
return SkImage::MakeFromBitmap(subsetBM);
}
- sk_sp<SkSurface> onMakeTightSurface(const SkImageFilter::OutputProperties& outProps,
- const SkISize& size, SkAlphaType at) const override {
-#if RASTER_IMAGE_FILTERS_SUPPORT_SRGB_AND_F16
- SkColorSpace* colorSpace = outProps.colorSpace();
-#else
- SkColorSpace* colorSpace = nullptr;
-#endif
- SkColorType colorType = colorSpace && colorSpace->gammaIsLinear()
- ? kRGBA_F16_SkColorType : kN32_SkColorType;
- SkImageInfo info = SkImageInfo::Make(size.width(), size.height(), colorType, at,
- sk_ref_sp(colorSpace));
+ sk_sp<SkSurface> onMakeTightSurface(const SkImageInfo& info) const override {
return SkSurface::MakeRaster(info);
}
@@ -411,16 +382,16 @@
return fColorSpace.get();
}
- sk_sp<SkSpecialSurface> onMakeSurface(const SkImageFilter::OutputProperties& outProps,
- const SkISize& size, SkAlphaType at) const override {
+ sk_sp<SkSpecialSurface> onMakeSurface(const SkImageInfo& info) const override {
if (!fTexture->getContext()) {
return nullptr;
}
- SkColorSpace* colorSpace = outProps.colorSpace();
- return SkSpecialSurface::MakeRenderTarget(
- fTexture->getContext(), size.width(), size.height(),
- GrRenderableConfigForColorSpace(colorSpace), sk_ref_sp(colorSpace));
+ GrPixelConfig config = SkImageInfo2GrPixelConfig(info, *fTexture->getContext()->caps());
+
+ return SkSpecialSurface::MakeRenderTarget(fTexture->getContext(),
+ info.width(), info.height(),
+ config, sk_ref_sp(info.colorSpace()));
}
sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const override {
@@ -457,13 +428,7 @@
fAlphaType, subTx.get(), fColorSpace, SkBudgeted::kYes);
}
- sk_sp<SkSurface> onMakeTightSurface(const SkImageFilter::OutputProperties& outProps,
- const SkISize& size, SkAlphaType at) const override {
- SkColorSpace* colorSpace = outProps.colorSpace();
- SkColorType colorType = colorSpace && colorSpace->gammaIsLinear()
- ? kRGBA_F16_SkColorType : kRGBA_8888_SkColorType;
- SkImageInfo info = SkImageInfo::Make(size.width(), size.height(), colorType, at,
- sk_ref_sp(colorSpace));
+ sk_sp<SkSurface> onMakeTightSurface(const SkImageInfo& info) const override {
return SkSurface::MakeRenderTarget(fTexture->getContext(), SkBudgeted::kYes, info);
}
« no previous file with comments | « src/core/SkSpecialImage.h ('k') | src/effects/SkColorFilterImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698