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

Unified Diff: src/core/SkBitmapController.cpp

Issue 2029373004: respect srgb gamma when building mips (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix warning Created 4 years, 6 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/SkBitmapController.h ('k') | src/core/SkBitmapProcShader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmapController.cpp
diff --git a/src/core/SkBitmapController.cpp b/src/core/SkBitmapController.cpp
index ac1029db8131307b83a9967f476eeb58dd809415..f4ee0fb6c1b8894264bd3f5cf8bab578bfeabec5 100644
--- a/src/core/SkBitmapController.cpp
+++ b/src/core/SkBitmapController.cpp
@@ -44,10 +44,12 @@ SkBitmapController::State* SkBitmapController::requestBitmap(const SkBitmapProvi
class SkDefaultBitmapControllerState : public SkBitmapController::State {
public:
- SkDefaultBitmapControllerState(const SkBitmapProvider&, const SkMatrix& inv, SkFilterQuality);
+ SkDefaultBitmapControllerState(const SkBitmapProvider&, const SkMatrix& inv, SkFilterQuality,
+ SkSourceGammaTreatment);
private:
SkBitmap fResultBitmap;
+ SkSourceGammaTreatment fSrcGammaTreatment;
SkAutoTUnref<const SkMipMap> fCurrMip;
bool processHQRequest(const SkBitmapProvider&);
@@ -164,13 +166,13 @@ bool SkDefaultBitmapControllerState::processMediumRequest(const SkBitmapProvider
}
if (invScaleSize.width() > SK_Scalar1 || invScaleSize.height() > SK_Scalar1) {
- fCurrMip.reset(SkMipMapCache::FindAndRef(provider.makeCacheDesc()));
+ fCurrMip.reset(SkMipMapCache::FindAndRef(provider.makeCacheDesc(), fSrcGammaTreatment));
if (nullptr == fCurrMip.get()) {
SkBitmap orig;
if (!provider.asBitmap(&orig)) {
return false;
}
- fCurrMip.reset(SkMipMapCache::AddAndRef(orig));
+ fCurrMip.reset(SkMipMapCache::AddAndRef(orig, fSrcGammaTreatment));
if (nullptr == fCurrMip.get()) {
return false;
}
@@ -200,9 +202,11 @@ bool SkDefaultBitmapControllerState::processMediumRequest(const SkBitmapProvider
SkDefaultBitmapControllerState::SkDefaultBitmapControllerState(const SkBitmapProvider& provider,
const SkMatrix& inv,
- SkFilterQuality qual) {
+ SkFilterQuality qual,
+ SkSourceGammaTreatment treatment) {
fInvMatrix = inv;
fQuality = qual;
+ fSrcGammaTreatment = treatment;
if (this->processHQRequest(provider) || this->processMediumRequest(provider)) {
SkASSERT(fResultBitmap.getPixels());
@@ -223,5 +227,6 @@ SkBitmapController::State* SkDefaultBitmapController::onRequestBitmap(const SkBi
const SkMatrix& inverse,
SkFilterQuality quality,
void* storage, size_t size) {
- return SkInPlaceNewCheck<SkDefaultBitmapControllerState>(storage, size, bm, inverse, quality);
+ return SkInPlaceNewCheck<SkDefaultBitmapControllerState>(storage, size, bm, inverse, quality,
+ fSrcGammaTreatment);
}
« no previous file with comments | « src/core/SkBitmapController.h ('k') | src/core/SkBitmapProcShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698