Merge "Disallow negative scale matrices in merged Bitmap drawing" into klp-dev

This commit is contained in:
Chris Craik
2013-09-18 01:49:32 +00:00
committed by Android (Google) Code Review
4 changed files with 21 additions and 3 deletions

View File

@ -275,6 +275,11 @@ public:
DisplayListLogBuffer& buffer = DisplayListLogBuffer::getInstance();
buffer.writeCommand(0, "multiDraw");
buffer.writeCommand(1, op->name());
#if DEBUG_DISPLAY_LIST_OPS_AS_EVENTS
renderer.eventMark("multiDraw");
renderer.eventMark(op->name());
#endif
status_t status = op->multiDraw(renderer, dirty, mOps, mBounds);
#if DEBUG_MERGE_BEHAVIOR

View File

@ -813,12 +813,15 @@ public:
virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo,
const DeferredDisplayState& state) {
deferInfo.batchId = DeferredDisplayList::kOpBatch_Bitmap;
deferInfo.mergeId = getAtlasEntry() ? (mergeid_t) mEntry->getMergeId() : (mergeid_t) mBitmap;
deferInfo.mergeId = getAtlasEntry() ?
(mergeid_t) mEntry->getMergeId() : (mergeid_t) mBitmap;
// Don't merge non-simply transformed or neg scale ops, SET_TEXTURE doesn't handle rotation
// Don't merge A8 bitmaps - the paint's color isn't compared by mergeId, or in
// MergingDrawBatch::canMergeWith()
// TODO: support clipped bitmaps by handling them in SET_TEXTURE
deferInfo.mergeable = state.mMatrix.isSimple() && !state.mClipSideFlags &&
deferInfo.mergeable = state.mMatrix.isSimple() && state.mMatrix.positiveScale() &&
!state.mClipSideFlags &&
OpenGLRenderer::getXfermodeDirect(mPaint) == SkXfermode::kSrcOver_Mode &&
(mBitmap->getConfig() != SkBitmap::kA8_Config);
}

View File

@ -110,6 +110,10 @@ uint8_t Matrix4::getType() const {
mType |= kTypeRectToRect;
}
}
if (m00 > 0.0f && m11 > 0.0f) {
mType |= kTypePositiveScale;
}
}
return mType;
}
@ -122,6 +126,10 @@ bool Matrix4::rectToRect() const {
return getType() & kTypeRectToRect;
}
bool Matrix4::positiveScale() const {
return getType() & kTypePositiveScale;
}
bool Matrix4::changesBounds() const {
return getType() & (kTypeScale | kTypeAffine | kTypePerspective);
}

View File

@ -64,7 +64,8 @@ public:
kTypeAffine = 0x4,
kTypePerspective = 0x8,
kTypeRectToRect = 0x10,
kTypeUnknown = 0x20,
kTypePositiveScale = 0x20,
kTypeUnknown = 0x40,
};
static const int sGeometryMask = 0xf;
@ -183,6 +184,7 @@ public:
bool isIdentity() const;
bool isPerspective() const;
bool rectToRect() const;
bool positiveScale() const;
bool changesBounds() const;