summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell Brenner <russellbrenner@google.com>2011-09-30 11:00:21 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-09-30 11:00:21 -0700
commite0b26337fd49de2e4e7f55d9429cd5355bc50784 (patch)
tree7c66aebbd28560db067c6499a995cb34d1dedfad
parent4dc48f9adb7bd282ce905e3bce330d527377a609 (diff)
parent7ab7fecfa0a24fe9563c23a04148af77e11bf551 (diff)
downloadexternal_webkit-e0b26337fd49de2e4e7f55d9429cd5355bc50784.zip
external_webkit-e0b26337fd49de2e4e7f55d9429cd5355bc50784.tar.gz
external_webkit-e0b26337fd49de2e4e7f55d9429cd5355bc50784.tar.bz2
Merge "Initialize to BUCKET_SIZE instead of 0"
-rw-r--r--Source/WebKit/android/jni/PictureSet.cpp32
1 files changed, 25 insertions, 7 deletions
diff --git a/Source/WebKit/android/jni/PictureSet.cpp b/Source/WebKit/android/jni/PictureSet.cpp
index 3f40174..6edb7ba 100644
--- a/Source/WebKit/android/jni/PictureSet.cpp
+++ b/Source/WebKit/android/jni/PictureSet.cpp
@@ -81,17 +81,23 @@ public:
namespace android {
-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;
}
-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) {
@@ -311,6 +317,12 @@ void PictureSet::gatherBucketsForArea(WTF::Vector<Bucket*>& list, const SkIRect&
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;
@@ -337,6 +349,12 @@ void PictureSet::splitAdd(const SkIRect& rect)
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;
@@ -631,6 +649,7 @@ void PictureSet::clear()
bucket->clear();
}
mBuckets.clear();
+ mBucketSizeX = mBucketSizeY = BUCKET_SIZE;
#else
Pictures* last = mPictures.end();
for (Pictures* working = mPictures.begin(); working != last; working++) {
@@ -640,7 +659,6 @@ void PictureSet::clear()
mPictures.clear();
#endif // FAST_PICTURESET
mWidth = mHeight = 0;
- mBucketSizeX = mBucketSizeY = 0;
}
bool PictureSet::draw(SkCanvas* canvas)