Some execution path appears to be leaving mBucketSizeX and/or Y set
to 0, causing a divide-by-zero exception. This should only be
feasible when mWidth and mHeight are also 0, but, to keep things
safe, we'll initialize to BUCKET_SIZE instead.
Bug:
5391435
Change-Id: I4e01f980731619e6a6fb70a6eb315c44dd677c7b
-PictureSet::PictureSet()
- : mBucketSizeX(0), mBucketSizeY(0), mBucketCountX(0), mBucketCountY(0),
- mHeight(0), mWidth(0)
+PictureSet::PictureSet() :
+#ifdef FAST_PICTURESET
+ mBucketSizeX(BUCKET_SIZE), mBucketSizeY(BUCKET_SIZE),
+ mBucketCountX(0), mBucketCountY(0),
+#endif
+ mHeight(0), mWidth(0)
{
setDimensions(0, 0);
mBaseArea = mAdditionalArea = 0;
}
{
setDimensions(0, 0);
mBaseArea = mAdditionalArea = 0;
}
-PictureSet::PictureSet(SkPicture* picture)
- : mBucketSizeX(0), mBucketSizeY(0), mBucketCountX(0), mBucketCountY(0),
- mHeight(0), mWidth(0)
+PictureSet::PictureSet(SkPicture* picture) :
+#ifdef FAST_PICTURESET
+ mBucketSizeX(BUCKET_SIZE), mBucketSizeY(BUCKET_SIZE),
+ mBucketCountX(0), mBucketCountY(0),
+#endif
+ mHeight(0), mWidth(0)
{
mBaseArea = mAdditionalArea = 0;
if (!picture) {
{
mBaseArea = mAdditionalArea = 0;
if (!picture) {
rect.fLeft, rect.fTop, rect.fRight, rect.fBottom,
rect.width(), rect.height());
rect.fLeft, rect.fTop, rect.fRight, rect.fBottom,
rect.width(), rect.height());
+ if (!mBucketSizeX || !mBucketSizeY) {
+ XLOGC("PictureSet::gatherBucketsForArea() called with bad bucket size: x=%d y=%d",
+ mBucketSizeX, mBucketSizeY);
+ return;
+ }
+
int x = rect.fLeft;
int y = rect.fTop;
int firstTileX = rect.fLeft / mBucketSizeX;
int x = rect.fLeft;
int y = rect.fTop;
int firstTileX = rect.fLeft / mBucketSizeX;
rect.fLeft, rect.fTop, rect.fRight, rect.fBottom,
rect.width(), rect.height());
rect.fLeft, rect.fTop, rect.fRight, rect.fBottom,
rect.width(), rect.height());
+ if (!mBucketSizeX || !mBucketSizeY) {
+ XLOGC("PictureSet::splitAdd() called with bad bucket size: x=%d y=%d",
+ mBucketSizeX, mBucketSizeY);
+ return;
+ }
+
// TODO: reuse gatherBucketsForArea() (change Bucket to be a class)
int x = rect.fLeft;
int y = rect.fTop;
// TODO: reuse gatherBucketsForArea() (change Bucket to be a class)
int x = rect.fLeft;
int y = rect.fTop;
bucket->clear();
}
mBuckets.clear();
bucket->clear();
}
mBuckets.clear();
+ mBucketSizeX = mBucketSizeY = BUCKET_SIZE;
#else
Pictures* last = mPictures.end();
for (Pictures* working = mPictures.begin(); working != last; working++) {
#else
Pictures* last = mPictures.end();
for (Pictures* working = mPictures.begin(); working != last; working++) {
mPictures.clear();
#endif // FAST_PICTURESET
mWidth = mHeight = 0;
mPictures.clear();
#endif // FAST_PICTURESET
mWidth = mHeight = 0;
- mBucketSizeX = mBucketSizeY = 0;
}
bool PictureSet::draw(SkCanvas* canvas)
}
bool PictureSet::draw(SkCanvas* canvas)