aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2016-12-06 10:34:51 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-12-06 16:09:37 +0000
commit13bf6227c5701903b38b5c21a15c8323dec7734a (patch)
tree227e839169a291a2fc3e752f157e3c9888f168c8
parente932d4b3a99905a6272c5574f21ac651632f4e82 (diff)
Remove dest surface color mode from bitmap controller
This is already on the bitmap provider - no need to plumb it here. BUG=skia: Change-Id: Ie8c5aef8ea443c58d59598aa66e357ad4c212b25 Reviewed-on: https://skia-review.googlesource.com/5621 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
-rw-r--r--src/core/SkBitmapController.cpp20
-rw-r--r--src/core/SkBitmapController.h5
-rw-r--r--src/core/SkBitmapProcShader.cpp6
-rw-r--r--src/core/SkBitmapProcState.cpp6
-rw-r--r--src/core/SkBitmapProcState.h9
-rw-r--r--src/core/SkBitmapProvider.h1
-rw-r--r--src/image/SkImageShader.cpp2
7 files changed, 17 insertions, 32 deletions
diff --git a/src/core/SkBitmapController.cpp b/src/core/SkBitmapController.cpp
index ed9903e7d3..80af4d70fc 100644
--- a/src/core/SkBitmapController.cpp
+++ b/src/core/SkBitmapController.cpp
@@ -40,12 +40,10 @@ SkBitmapController::State* SkBitmapController::requestBitmap(const SkBitmapProvi
class SkDefaultBitmapControllerState : public SkBitmapController::State {
public:
- SkDefaultBitmapControllerState(const SkBitmapProvider&, const SkMatrix& inv, SkFilterQuality,
- SkDestinationSurfaceColorMode);
+ SkDefaultBitmapControllerState(const SkBitmapProvider&, const SkMatrix& inv, SkFilterQuality);
private:
SkBitmap fResultBitmap;
- SkDestinationSurfaceColorMode fColorMode;
sk_sp<const SkMipMap> fCurrMip;
bool processExternalRequest(const SkBitmapProvider&);
@@ -185,13 +183,13 @@ bool SkDefaultBitmapControllerState::processMediumRequest(const SkBitmapProvider
}
if (invScaleSize.width() > SK_Scalar1 || invScaleSize.height() > SK_Scalar1) {
- fCurrMip.reset(SkMipMapCache::FindAndRef(provider.makeCacheDesc(), fColorMode));
+ fCurrMip.reset(SkMipMapCache::FindAndRef(provider.makeCacheDesc(), provider.colorMode()));
if (nullptr == fCurrMip.get()) {
SkBitmap orig;
if (!provider.asBitmap(&orig)) {
return false;
}
- fCurrMip.reset(SkMipMapCache::AddAndRef(orig, fColorMode));
+ fCurrMip.reset(SkMipMapCache::AddAndRef(orig, provider.colorMode()));
if (nullptr == fCurrMip.get()) {
return false;
}
@@ -219,14 +217,11 @@ bool SkDefaultBitmapControllerState::processMediumRequest(const SkBitmapProvider
return false;
}
-SkDefaultBitmapControllerState::SkDefaultBitmapControllerState(
- const SkBitmapProvider& provider,
- const SkMatrix& inv,
- SkFilterQuality qual,
- SkDestinationSurfaceColorMode colorMode) {
+SkDefaultBitmapControllerState::SkDefaultBitmapControllerState(const SkBitmapProvider& provider,
+ const SkMatrix& inv,
+ SkFilterQuality qual) {
fInvMatrix = inv;
fQuality = qual;
- fColorMode = colorMode;
bool processed = this->processExternalRequest(provider);
@@ -253,6 +248,5 @@ SkBitmapController::State* SkDefaultBitmapController::onRequestBitmap(const SkBi
const SkMatrix& inverse,
SkFilterQuality quality,
void* storage, size_t size) {
- return SkInPlaceNewCheck<SkDefaultBitmapControllerState>(storage, size, bm, inverse, quality,
- fColorMode);
+ return SkInPlaceNewCheck<SkDefaultBitmapControllerState>(storage, size, bm, inverse, quality);
}
diff --git a/src/core/SkBitmapController.h b/src/core/SkBitmapController.h
index 2e7a9f3895..9eff2d28ff 100644
--- a/src/core/SkBitmapController.h
+++ b/src/core/SkBitmapController.h
@@ -57,14 +57,11 @@ protected:
class SkDefaultBitmapController : public SkBitmapController {
public:
- SkDefaultBitmapController(SkDestinationSurfaceColorMode colorMode) : fColorMode(colorMode) {}
+ SkDefaultBitmapController() {}
protected:
State* onRequestBitmap(const SkBitmapProvider&, const SkMatrix& inverse, SkFilterQuality,
void* storage, size_t storageSize) override;
-
-private:
- const SkDestinationSurfaceColorMode fColorMode;
};
#endif
diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp
index 8ec157578e..4bb61f14ad 100644
--- a/src/core/SkBitmapProcShader.cpp
+++ b/src/core/SkBitmapProcShader.cpp
@@ -214,11 +214,10 @@ SkShader::Context* SkBitmapProcLegacyShader::MakeContext(const SkShader& shader,
// Decide if we can/want to use the new linear pipeline
bool useLinearPipeline = choose_linear_pipeline(rec, provider.info());
- SkDestinationSurfaceColorMode colorMode = SkMipMap::DeduceColorMode(rec);
if (useLinearPipeline) {
void* infoStorage = (char*)storage + sizeof(LinearPipelineContext);
- SkBitmapProcInfo* info = new (infoStorage) SkBitmapProcInfo(provider, tmx, tmy, colorMode);
+ SkBitmapProcInfo* info = new (infoStorage) SkBitmapProcInfo(provider, tmx, tmy);
if (!info->init(totalInverse, *rec.fPaint)) {
info->~SkBitmapProcInfo();
return nullptr;
@@ -227,8 +226,7 @@ SkShader::Context* SkBitmapProcLegacyShader::MakeContext(const SkShader& shader,
return new (storage) LinearPipelineContext(shader, rec, info);
} else {
void* stateStorage = (char*)storage + sizeof(BitmapProcShaderContext);
- SkBitmapProcState* state = new (stateStorage) SkBitmapProcState(provider, tmx, tmy,
- colorMode);
+ SkBitmapProcState* state = new (stateStorage) SkBitmapProcState(provider, tmx, tmy);
if (!state->setup(totalInverse, *rec.fPaint)) {
state->~SkBitmapProcState();
return nullptr;
diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp
index 33ab736215..3c4f414c23 100644
--- a/src/core/SkBitmapProcState.cpp
+++ b/src/core/SkBitmapProcState.cpp
@@ -37,12 +37,10 @@ extern void Clamp_S32_opaque_D32_nofilter_DX_shaderproc(const void*, int, int, u
#include "SkBitmapProcState_procs.h"
SkBitmapProcInfo::SkBitmapProcInfo(const SkBitmapProvider& provider,
- SkShader::TileMode tmx, SkShader::TileMode tmy,
- SkDestinationSurfaceColorMode colorMode)
+ SkShader::TileMode tmx, SkShader::TileMode tmy)
: fProvider(provider)
, fTileModeX(tmx)
, fTileModeY(tmy)
- , fColorMode(colorMode)
, fBMState(nullptr)
{}
@@ -111,7 +109,7 @@ bool SkBitmapProcInfo::init(const SkMatrix& inv, const SkPaint& paint) {
allow_ignore_fractional_translate = false;
}
- SkDefaultBitmapController controller(fColorMode);
+ SkDefaultBitmapController controller;
fBMState = controller.requestBitmap(fProvider, inv, paint.getFilterQuality(),
fBMStateStorage.get(), fBMStateStorage.size());
// Note : we allow the controller to return an empty (zero-dimension) result. Should we?
diff --git a/src/core/SkBitmapProcState.h b/src/core/SkBitmapProcState.h
index 6b4317e1a0..cdf02ea9e0 100644
--- a/src/core/SkBitmapProcState.h
+++ b/src/core/SkBitmapProcState.h
@@ -28,8 +28,7 @@ typedef SkFixed3232 SkFractionalInt;
class SkPaint;
struct SkBitmapProcInfo {
- SkBitmapProcInfo(const SkBitmapProvider&, SkShader::TileMode tmx, SkShader::TileMode tmy,
- SkDestinationSurfaceColorMode);
+ SkBitmapProcInfo(const SkBitmapProvider&, SkShader::TileMode tmx, SkShader::TileMode tmy);
~SkBitmapProcInfo();
const SkBitmapProvider fProvider;
@@ -43,7 +42,6 @@ struct SkBitmapProcInfo {
SkShader::TileMode fTileModeY;
SkFilterQuality fFilterQuality;
SkMatrix::TypeMask fInvType;
- SkDestinationSurfaceColorMode fColorMode;
bool init(const SkMatrix& inverse, const SkPaint&);
@@ -56,9 +54,8 @@ private:
};
struct SkBitmapProcState : public SkBitmapProcInfo {
- SkBitmapProcState(const SkBitmapProvider& prov, SkShader::TileMode tmx, SkShader::TileMode tmy,
- SkDestinationSurfaceColorMode colorMode)
- : SkBitmapProcInfo(prov, tmx, tmy, colorMode) {}
+ SkBitmapProcState(const SkBitmapProvider& prov, SkShader::TileMode tmx, SkShader::TileMode tmy)
+ : SkBitmapProcInfo(prov, tmx, tmy) {}
bool setup(const SkMatrix& inv, const SkPaint& paint) {
return this->init(inv, paint) && this->chooseProcs();
diff --git a/src/core/SkBitmapProvider.h b/src/core/SkBitmapProvider.h
index 4437889fb0..9ea2442a2d 100644
--- a/src/core/SkBitmapProvider.h
+++ b/src/core/SkBitmapProvider.h
@@ -26,6 +26,7 @@ public:
int width() const;
int height() const;
uint32_t getID() const;
+ SkDestinationSurfaceColorMode colorMode() const { return fColorMode; }
SkImageInfo info() const;
bool isVolatile() const;
diff --git a/src/image/SkImageShader.cpp b/src/image/SkImageShader.cpp
index 16b8eb6036..d2ddc95744 100644
--- a/src/image/SkImageShader.cpp
+++ b/src/image/SkImageShader.cpp
@@ -284,7 +284,7 @@ bool SkImageShader::onAppendStages(SkRasterPipeline* p, SkColorSpace* dst, SkFal
auto mode = (dst == nullptr) ? SkDestinationSurfaceColorMode::kLegacy
: SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware;
SkBitmapProvider provider(fImage.get(), mode);
- SkDefaultBitmapController controller(mode);
+ SkDefaultBitmapController controller;
std::unique_ptr<SkBitmapController::State> state {
controller.requestBitmap(provider, matrix, quality)
};