Modified: trunk/Source/WebKit/blackberry/Api/BackingStore.cpp (116428 => 116429)
--- trunk/Source/WebKit/blackberry/Api/BackingStore.cpp 2012-05-08 15:53:42 UTC (rev 116428)
+++ trunk/Source/WebKit/blackberry/Api/BackingStore.cpp 2012-05-08 16:21:24 UTC (rev 116429)
@@ -79,6 +79,7 @@
WebPage* BackingStorePrivate::s_currentBackingStoreOwner = 0;
Platform::Graphics::Buffer* BackingStorePrivate::s_overScrollImage = 0;
std::string BackingStorePrivate::s_overScrollImagePath;
+Platform::IntSize BackingStorePrivate::s_overScrollImageSize;
typedef std::pair<int, int> Divisor;
typedef Vector<Divisor> DivisorList;
@@ -1210,41 +1211,35 @@
std::string imagePath = Platform::Client::get()->getApplicationLocalDirectory() + path;
SkBitmap bitmap;
-
if (!SkImageDecoder::DecodeFile(imagePath.c_str(), &bitmap)) {
BlackBerry::Platform::log(BlackBerry::Platform::LogLevelCritical,
"BackingStorePrivate::ensureOverScrollImage could not decode overscroll image: %s", imagePath.c_str());
return false;
}
- // FIXME: Make it orientation and resolution agnostic.
- // For now we fallback to solid color if sizes don't match, later we can implement tiling.
- if (bitmap.width() != surfaceSize().width() || bitmap.height() != surfaceSize().height())
- return false;
-
destroyBuffer(s_overScrollImage);
s_overScrollImage = createBuffer(Platform::IntSize(bitmap.width(), bitmap.height()), Platform::Graphics::TemporaryBuffer);
SkCanvas* canvas = Platform::Graphics::lockBufferDrawable(s_overScrollImage);
-
if (!canvas) {
destroyBuffer(s_overScrollImage);
s_overScrollImage = 0;
return false;
}
+
SkPaint paint;
paint.setXfermodeMode(SkXfermode::kSrc_Mode);
paint.setFlags(SkPaint::kAntiAlias_Flag);
paint.setFilterBitmap(true);
SkRect rect = SkRect::MakeXYWH(0, 0, bitmap.width(), bitmap.height());
-
canvas->save();
canvas->drawBitmapRect(bitmap, 0, rect, &paint);
canvas->restore();
Platform::Graphics::releaseBufferDrawable(s_overScrollImage);
+ s_overScrollImageSize = Platform::IntSize(bitmap.width(), bitmap.height());
s_overScrollImagePath = path;
return true;
@@ -1279,9 +1274,20 @@
overScrollRect.intersect(Platform::IntRect(Platform::IntPoint(0, 0), surfaceSize()));
}
- if (ensureOverScrollImage())
- blitToWindow(overScrollRect, s_overScrollImage, overScrollRect, false, 255);
- else
+ if (ensureOverScrollImage()) {
+ // Tile the image on the window region.
+ Platform::IntRect dstRect;
+ for (int y = overScrollRect.y(); y < overScrollRect.y() + overScrollRect.height(); y += dstRect.height()) {
+ for (int x = overScrollRect.x(); x < overScrollRect.x() + overScrollRect.width(); x += dstRect.width()) {
+ Platform::IntRect imageRect = Platform::IntRect(Platform::IntPoint(x - (x % s_overScrollImageSize.width()),
+ y - (y % s_overScrollImageSize.height())), s_overScrollImageSize);
+ dstRect = imageRect;
+ dstRect.intersect(overScrollRect);
+ Platform::IntRect srcRect = Platform::IntRect(x - imageRect.x(), y - imageRect.y(), dstRect.width(), dstRect.height());
+ blitToWindow(dstRect, s_overScrollImage, srcRect, false, 255);
+ }
+ }
+ } else
clearWindow(overScrollRect, color.red(), color.green(), color.blue(), color.alpha());
}
}
Modified: trunk/Source/WebKit/blackberry/Api/BackingStore_p.h (116428 => 116429)
--- trunk/Source/WebKit/blackberry/Api/BackingStore_p.h 2012-05-08 15:53:42 UTC (rev 116428)
+++ trunk/Source/WebKit/blackberry/Api/BackingStore_p.h 2012-05-08 16:21:24 UTC (rev 116429)
@@ -371,6 +371,7 @@
static Platform::Graphics::Buffer* s_overScrollImage;
static std::string s_overScrollImagePath;
+ static Platform::IntSize s_overScrollImageSize;
protected:
virtual ~BackingStorePrivate();
Modified: trunk/Source/WebKit/blackberry/ChangeLog (116428 => 116429)
--- trunk/Source/WebKit/blackberry/ChangeLog 2012-05-08 15:53:42 UTC (rev 116428)
+++ trunk/Source/WebKit/blackberry/ChangeLog 2012-05-08 16:21:24 UTC (rev 116429)
@@ -1,3 +1,20 @@
+2012-05-08 Andrew Lo <[email protected]>
+
+ [BlackBerry] Over-scroll image should be tiled
+ https://bugs.webkit.org/show_bug.cgi?id=85860
+
+ Reviewed by Rob Buis.
+
+ Implement tiling for over-scroll image if image dimension don't match
+ the surface dimensions.
+
+ * Api/BackingStore.cpp:
+ (WebKit):
+ (BlackBerry::WebKit::BackingStorePrivate::ensureOverScrollImage):
+ (BlackBerry::WebKit::BackingStorePrivate::paintDefaultBackground):
+ * Api/BackingStore_p.h:
+ (BackingStorePrivate):
+
2012-05-08 Chris Guan <[email protected]>
[Blackberry] remove m_isRequestedByPlugin in ResourceRequest