| Index: src/core/SkBitmapProcShader.cpp
|
| diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp
|
| index 6c9410ee3288b9f98a1fa782b4d56a19576704c1..e5b577a20c9bb15b6ce63b926ffadf09c922ada7 100644
|
| --- a/src/core/SkBitmapProcShader.cpp
|
| +++ b/src/core/SkBitmapProcShader.cpp
|
| @@ -68,11 +68,6 @@ void SkBitmapProcShader::flatten(SkWriteBuffer& buffer) const {
|
| buffer.writeUInt(fTileModeY);
|
| }
|
|
|
| -static bool only_scale_and_translate(const SkMatrix& matrix) {
|
| - unsigned mask = SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask;
|
| - return (matrix.getType() & ~mask) == 0;
|
| -}
|
| -
|
| bool SkBitmapProcShader::isOpaque() const {
|
| return fRawBitmap.isOpaque();
|
| }
|
| @@ -110,47 +105,10 @@ SkBitmapProcShader::BitmapProcShaderContext::BitmapProcShaderContext(const SkSha
|
| : INHERITED(shader, rec)
|
| , fState(state)
|
| {
|
| - const SkPixmap& pixmap = fState->fPixmap;
|
| - bool isOpaque = pixmap.isOpaque();
|
| -
|
| - // update fFlags
|
| - uint32_t flags = 0;
|
| - if (isOpaque && (255 == this->getPaintAlpha())) {
|
| - flags |= kOpaqueAlpha_Flag;
|
| - }
|
| -
|
| - switch (pixmap.colorType()) {
|
| - case kRGB_565_SkColorType:
|
| - flags |= (kHasSpan16_Flag | kIntrinsicly16_Flag);
|
| - break;
|
| - case kIndex_8_SkColorType:
|
| - case kN32_SkColorType:
|
| - if (isOpaque) {
|
| - flags |= kHasSpan16_Flag;
|
| - }
|
| - break;
|
| - case kAlpha_8_SkColorType:
|
| - break; // never set kHasSpan16_Flag
|
| - default:
|
| - break;
|
| + fFlags = 0;
|
| + if (fState->fPixmap.isOpaque() && (255 == this->getPaintAlpha())) {
|
| + fFlags |= kOpaqueAlpha_Flag;
|
| }
|
| -
|
| - if (rec.fPaint->isDither() && pixmap.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;
|
| - }
|
| -
|
| - // if we're only 1-pixel high, and we don't rotate, then we can claim this
|
| - if (1 == pixmap.height() &&
|
| - only_scale_and_translate(this->getTotalInverse())) {
|
| - flags |= kConstInY32_Flag;
|
| - if (flags & kHasSpan16_Flag) {
|
| - flags |= kConstInY16_Flag;
|
| - }
|
| - }
|
| -
|
| - fFlags = flags;
|
| }
|
|
|
| SkBitmapProcShader::BitmapProcShaderContext::~BitmapProcShaderContext() {
|
| @@ -221,37 +179,6 @@ SkShader::Context::ShadeProc SkBitmapProcShader::BitmapProcShaderContext::asASha
|
| return nullptr;
|
| }
|
|
|
| -void SkBitmapProcShader::BitmapProcShaderContext::shadeSpan16(int x, int y, uint16_t dstC[],
|
| - int count) {
|
| - const SkBitmapProcState& state = *fState;
|
| - if (state.getShaderProc16()) {
|
| - state.getShaderProc16()(&state, x, y, dstC, count);
|
| - return;
|
| - }
|
| -
|
| - uint32_t buffer[BUF_MAX];
|
| - SkBitmapProcState::MatrixProc mproc = state.getMatrixProc();
|
| - SkBitmapProcState::SampleProc16 sproc = state.getSampleProc16();
|
| - int max = state.maxCountForBufferSize(sizeof(buffer));
|
| -
|
| - SkASSERT(state.fPixmap.addr());
|
| -
|
| - for (;;) {
|
| - int n = count;
|
| - if (n > max) {
|
| - n = max;
|
| - }
|
| - mproc(state, buffer, n, x, y);
|
| - sproc(state, buffer, n, dstC);
|
| -
|
| - if ((count -= n) == 0) {
|
| - break;
|
| - }
|
| - x += n;
|
| - dstC += n;
|
| - }
|
| -}
|
| -
|
| ///////////////////////////////////////////////////////////////////////////////
|
|
|
| #include "SkUnPreMultiply.h"
|
|
|