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

* commit 'a42ceb03cf6a1cbcd9f526afb02d806b2c200ee3':
  Disallow negative scale matrices in merged Bitmap drawing
This commit is contained in:
Chris Craik
2013-09-17 18:53:11 -07:00
committed by Android Git Automerger
4 changed files with 21 additions and 3 deletions

View File

@ -275,6 +275,11 @@ public:
DisplayListLogBuffer& buffer = DisplayListLogBuffer::getInstance(); DisplayListLogBuffer& buffer = DisplayListLogBuffer::getInstance();
buffer.writeCommand(0, "multiDraw"); buffer.writeCommand(0, "multiDraw");
buffer.writeCommand(1, op->name()); 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); status_t status = op->multiDraw(renderer, dirty, mOps, mBounds);
#if DEBUG_MERGE_BEHAVIOR #if DEBUG_MERGE_BEHAVIOR

View File

@ -813,12 +813,15 @@ public:
virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo, virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo,
const DeferredDisplayState& state) { const DeferredDisplayState& state) {
deferInfo.batchId = DeferredDisplayList::kOpBatch_Bitmap; 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 // Don't merge A8 bitmaps - the paint's color isn't compared by mergeId, or in
// MergingDrawBatch::canMergeWith() // MergingDrawBatch::canMergeWith()
// TODO: support clipped bitmaps by handling them in SET_TEXTURE // 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 && OpenGLRenderer::getXfermodeDirect(mPaint) == SkXfermode::kSrcOver_Mode &&
(mBitmap->getConfig() != SkBitmap::kA8_Config); (mBitmap->getConfig() != SkBitmap::kA8_Config);
} }

View File

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

View File

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