Plumb dst color space in many places, rather than "mode"
This is less to type in most cases, and gives us more information
(for things like picture-backed images, where we need to know all
about the destination surface).
Additionally, strip out the plumbing entirely for bitmap sources,
where we don't need to know anything.
BUG=skia:
Change-Id: I4deff6c7c345fcf62eb08b2aff0560adae4313da
Reviewed-on: https://skia-review.googlesource.com/5748
Reviewed-by: Mike Klein <mtklein@chromium.org>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/GrTextureMaker.cpp b/src/gpu/GrTextureMaker.cpp
index d303dcf..7123a66 100644
--- a/src/gpu/GrTextureMaker.cpp
+++ b/src/gpu/GrTextureMaker.cpp
@@ -11,7 +11,7 @@
#include "GrGpu.h"
GrTexture* GrTextureMaker::refTextureForParams(const GrSamplerParams& params,
- SkDestinationSurfaceColorMode colorMode,
+ SkColorSpace* dstColorSpace,
sk_sp<SkColorSpace>* texColorSpace) {
CopyParams copyParams;
bool willBeMipped = params.filterMode() == GrSamplerParams::kMipMap_FilterMode;
@@ -21,15 +21,15 @@
}
if (texColorSpace) {
- *texColorSpace = this->getColorSpace(colorMode);
+ *texColorSpace = this->getColorSpace(dstColorSpace);
}
if (!fContext->getGpu()->makeCopyForTextureParams(this->width(), this->height(), params,
©Params)) {
- return this->refOriginalTexture(willBeMipped, colorMode);
+ return this->refOriginalTexture(willBeMipped, dstColorSpace);
}
GrUniqueKey copyKey;
- this->makeCopyKey(copyParams, ©Key, colorMode);
+ this->makeCopyKey(copyParams, ©Key, dstColorSpace);
if (copyKey.isValid()) {
GrTexture* result = fContext->textureProvider()->findAndRefTextureByUniqueKey(copyKey);
if (result) {
@@ -37,7 +37,7 @@
}
}
- GrTexture* result = this->generateTextureForParams(copyParams, willBeMipped, colorMode);
+ GrTexture* result = this->generateTextureForParams(copyParams, willBeMipped, dstColorSpace);
if (!result) {
return nullptr;
}
@@ -55,8 +55,7 @@
FilterConstraint filterConstraint,
bool coordsLimitedToConstraintRect,
const GrSamplerParams::FilterMode* filterOrNullForBicubic,
- SkColorSpace* dstColorSpace,
- SkDestinationSurfaceColorMode colorMode) {
+ SkColorSpace* dstColorSpace) {
const GrSamplerParams::FilterMode* fmForDetermineDomain = filterOrNullForBicubic;
if (filterOrNullForBicubic && GrSamplerParams::kMipMap_FilterMode == *filterOrNullForBicubic &&
@@ -78,7 +77,7 @@
params.reset(SkShader::kClamp_TileMode, GrSamplerParams::kNone_FilterMode);
}
sk_sp<SkColorSpace> texColorSpace;
- sk_sp<GrTexture> texture(this->refTextureForParams(params, colorMode, &texColorSpace));
+ sk_sp<GrTexture> texture(this->refTextureForParams(params, dstColorSpace, &texColorSpace));
if (!texture) {
return nullptr;
}
@@ -98,8 +97,8 @@
}
GrTexture* GrTextureMaker::generateTextureForParams(const CopyParams& copyParams, bool willBeMipped,
- SkDestinationSurfaceColorMode colorMode) {
- sk_sp<GrTexture> original(this->refOriginalTexture(willBeMipped, colorMode));
+ SkColorSpace* dstColorSpace) {
+ sk_sp<GrTexture> original(this->refOriginalTexture(willBeMipped, dstColorSpace));
if (!original) {
return nullptr;
}