bug:
10863163
This fixes two issues
The check for pure translation was incorrect. It was fixed and renamed
for clarity.
Certain matrix paths weren't setting kTypePositiveScale. For
simplicity (and because positive scale is simple to check) removed
flag in favor of dynamic checking.
Change-Id: Ic5ce235653ef49a68b8b242bd89fc2e95874ecc9
TextureVertex* vertex = &vertices[0];
const bool hasLayer = renderer.hasLayer();
- bool transformed = false;
+ bool pureTranslate = true;
// TODO: manually handle rect clip for bitmaps by adjusting texCoords per op,
// and allowing them to be merged in getBatchId()
// When we reach multiDraw(), the matrix can be either
// pureTranslate or simple (translate and/or scale).
// If the matrix is not pureTranslate, then we have a scale
- if (state.mMatrix.isPureTranslate()) transformed = true;
+ pureTranslate &= state.mMatrix.isPureTranslate();
Rect texCoords(0, 0, 1, 1);
((DrawBitmapOp*) ops[i].op)->mUvMapper.map(texCoords);
}
return renderer.drawBitmaps(mBitmap, mEntry, ops.size(), &vertices[0],
- transformed, bounds, mPaint);
+ pureTranslate, bounds, mPaint);
}
virtual void output(int level, uint32_t logFlags) const {
mType |= kTypeRectToRect;
}
}
-
- if (m00 > 0.0f && m11 > 0.0f) {
- mType |= kTypePositiveScale;
- }
}
return mType;
}
}
bool Matrix4::positiveScale() const {
- return getType() & kTypePositiveScale;
+ return (data[kScaleX] > 0.0f && data[kScaleY] > 0.0f);
}
bool Matrix4::changesBounds() const {
kTypeAffine = 0x4,
kTypePerspective = 0x8,
kTypeRectToRect = 0x10,
- kTypePositiveScale = 0x20,
- kTypeUnknown = 0x40,
+ kTypeUnknown = 0x20,
};
static const int sGeometryMask = 0xf;
* The caller is responsible for properly dirtying the current layer.
*/
status_t OpenGLRenderer::drawBitmaps(SkBitmap* bitmap, AssetAtlas::Entry* entry, int bitmapCount,
- TextureVertex* vertices, bool transformed, const Rect& bounds, SkPaint* paint) {
+ TextureVertex* vertices, bool pureTranslate, const Rect& bounds, SkPaint* paint) {
mCaches.activeTexture(0);
Texture* texture = entry ? entry->texture : mCaches.textureCache.get(bitmap);
if (!texture) return DrawGlInfo::kStatusDone;
getAlphaAndMode(paint, &alpha, &mode);
texture->setWrap(GL_CLAMP_TO_EDGE, true);
- texture->setFilter(transformed ? FILTER(paint) : GL_NEAREST, true);
+ texture->setFilter(pureTranslate ? GL_NEAREST : FILTER(paint), true);
const float x = (int) floorf(bounds.left + 0.5f);
const float y = (int) floorf(bounds.top + 0.5f);
virtual status_t drawLayer(Layer* layer, float x, float y);
virtual status_t drawBitmap(SkBitmap* bitmap, float left, float top, SkPaint* paint);
status_t drawBitmaps(SkBitmap* bitmap, AssetAtlas::Entry* entry, int bitmapCount,
- TextureVertex* vertices, bool transformed, const Rect& bounds, SkPaint* paint);
+ TextureVertex* vertices, bool pureTranslate, const Rect& bounds, SkPaint* paint);
virtual status_t drawBitmap(SkBitmap* bitmap, SkMatrix* matrix, SkPaint* paint);
virtual status_t drawBitmap(SkBitmap* bitmap, float srcLeft, float srcTop,
float srcRight, float srcBottom, float dstLeft, float dstTop,