| Index: src/core/SkBitmapProcShader.cpp
|
| diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp
|
| index 44bdc6d348e7f3af6505bceb87f3f38a22812c8b..46cf7db136d93e8bd2391d134d17e009a666c706 100644
|
| --- a/src/core/SkBitmapProcShader.cpp
|
| +++ b/src/core/SkBitmapProcShader.cpp
|
| @@ -97,10 +97,7 @@ static bool valid_for_drawing(const SkBitmap& bm) {
|
| return true;
|
| }
|
|
|
| -bool SkBitmapProcShader::validInternal(const SkBitmap& device,
|
| - const SkPaint& paint,
|
| - const SkMatrix& matrix,
|
| - SkMatrix* totalInverse,
|
| +bool SkBitmapProcShader::validInternal(const ContextRec& rec, SkMatrix* totalInverse,
|
| SkBitmapProcState* state) const {
|
| if (!fRawBitmap.getTexture() && !valid_for_drawing(fRawBitmap)) {
|
| return false;
|
| @@ -113,7 +110,7 @@ bool SkBitmapProcShader::validInternal(const SkBitmap& device,
|
| }
|
|
|
| // Do this first, so we know the matrix can be inverted.
|
| - if (!this->INHERITED::validContext(device, paint, matrix, totalInverse)) {
|
| + if (!this->INHERITED::validContext(rec, totalInverse)) {
|
| return false;
|
| }
|
|
|
| @@ -121,28 +118,23 @@ bool SkBitmapProcShader::validInternal(const SkBitmap& device,
|
| state->fTileModeX = fTileModeX;
|
| state->fTileModeY = fTileModeY;
|
| state->fOrigBitmap = fRawBitmap;
|
| - return state->chooseProcs(*totalInverse, paint);
|
| + return state->chooseProcs(*totalInverse, *rec.fPaint);
|
| }
|
|
|
| -bool SkBitmapProcShader::validContext(const SkBitmap& device,
|
| - const SkPaint& paint,
|
| - const SkMatrix& matrix,
|
| - SkMatrix* totalInverse) const {
|
| +bool SkBitmapProcShader::validContext(const ContextRec& rec, SkMatrix* totalInverse) const {
|
| SkBitmapProcState state;
|
| - return this->validInternal(device, paint, matrix, totalInverse, &state);
|
| + return this->validInternal(rec, totalInverse, &state);
|
| }
|
|
|
| -SkShader::Context* SkBitmapProcShader::createContext(const SkBitmap& device, const SkPaint& paint,
|
| - const SkMatrix& matrix, void* storage) const {
|
| +SkShader::Context* SkBitmapProcShader::createContext(const ContextRec& rec, void* storage) const {
|
| void* stateStorage = (char*)storage + sizeof(BitmapProcShaderContext);
|
| SkBitmapProcState* state = SkNEW_PLACEMENT(stateStorage, SkBitmapProcState);
|
| - if (!this->validInternal(device, paint, matrix, NULL, state)) {
|
| + if (!this->validInternal(rec, NULL, state)) {
|
| state->~SkBitmapProcState();
|
| return NULL;
|
| }
|
|
|
| - return SkNEW_PLACEMENT_ARGS(storage, BitmapProcShaderContext,
|
| - (*this, device, paint, matrix, state));
|
| + return SkNEW_PLACEMENT_ARGS(storage, BitmapProcShaderContext, (*this, rec, state));
|
| }
|
|
|
| size_t SkBitmapProcShader::contextSize() const {
|
| @@ -152,9 +144,8 @@ size_t SkBitmapProcShader::contextSize() const {
|
| }
|
|
|
| SkBitmapProcShader::BitmapProcShaderContext::BitmapProcShaderContext(
|
| - const SkBitmapProcShader& shader, const SkBitmap& device,
|
| - const SkPaint& paint, const SkMatrix& matrix, SkBitmapProcState* state)
|
| - : INHERITED(shader, device, paint, matrix)
|
| + const SkBitmapProcShader& shader, const ContextRec& rec, SkBitmapProcState* state)
|
| + : INHERITED(shader, rec)
|
| , fState(state)
|
| {
|
| const SkBitmap& bitmap = *fState->fBitmap;
|
| @@ -182,7 +173,7 @@ SkBitmapProcShader::BitmapProcShaderContext::BitmapProcShaderContext(
|
| break;
|
| }
|
|
|
| - if (paint.isDither() && bitmap.colorType() != kRGB_565_SkColorType) {
|
| + if (rec.fPaint->isDither() && bitmap.colorType() != kRGB_565_SkColorType) {
|
| // gradients can auto-dither in their 16bit sampler, but we don't so
|
| // we clear the flag here.
|
| flags &= ~kHasSpan16_Flag;
|
|
|