Changeset 116429 in webkit
- Timestamp:
- May 8, 2012 9:21:24 AM (12 years ago)
- Location:
- trunk/Source/WebKit/blackberry
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/blackberry/Api/BackingStore.cpp
r116350 r116429 80 80 Platform::Graphics::Buffer* BackingStorePrivate::s_overScrollImage = 0; 81 81 std::string BackingStorePrivate::s_overScrollImagePath; 82 Platform::IntSize BackingStorePrivate::s_overScrollImageSize; 82 83 83 84 typedef std::pair<int, int> Divisor; … … 1211 1212 1212 1213 SkBitmap bitmap; 1213 1214 1214 if (!SkImageDecoder::DecodeFile(imagePath.c_str(), &bitmap)) { 1215 1215 BlackBerry::Platform::log(BlackBerry::Platform::LogLevelCritical, … … 1218 1218 } 1219 1219 1220 // FIXME: Make it orientation and resolution agnostic.1221 // For now we fallback to solid color if sizes don't match, later we can implement tiling.1222 if (bitmap.width() != surfaceSize().width() || bitmap.height() != surfaceSize().height())1223 return false;1224 1225 1220 destroyBuffer(s_overScrollImage); 1226 1221 s_overScrollImage = createBuffer(Platform::IntSize(bitmap.width(), bitmap.height()), Platform::Graphics::TemporaryBuffer); 1227 1222 1228 1223 SkCanvas* canvas = Platform::Graphics::lockBufferDrawable(s_overScrollImage); 1229 1230 1224 if (!canvas) { 1231 1225 destroyBuffer(s_overScrollImage); … … 1233 1227 return false; 1234 1228 } 1229 1235 1230 SkPaint paint; 1236 1231 paint.setXfermodeMode(SkXfermode::kSrc_Mode); … … 1239 1234 1240 1235 SkRect rect = SkRect::MakeXYWH(0, 0, bitmap.width(), bitmap.height()); 1241 1242 1236 canvas->save(); 1243 1237 canvas->drawBitmapRect(bitmap, 0, rect, &paint); … … 1246 1240 Platform::Graphics::releaseBufferDrawable(s_overScrollImage); 1247 1241 1242 s_overScrollImageSize = Platform::IntSize(bitmap.width(), bitmap.height()); 1248 1243 s_overScrollImagePath = path; 1249 1244 … … 1280 1275 } 1281 1276 1282 if (ensureOverScrollImage()) 1283 blitToWindow(overScrollRect, s_overScrollImage, overScrollRect, false, 255); 1284 else 1277 if (ensureOverScrollImage()) { 1278 // Tile the image on the window region. 1279 Platform::IntRect dstRect; 1280 for (int y = overScrollRect.y(); y < overScrollRect.y() + overScrollRect.height(); y += dstRect.height()) { 1281 for (int x = overScrollRect.x(); x < overScrollRect.x() + overScrollRect.width(); x += dstRect.width()) { 1282 Platform::IntRect imageRect = Platform::IntRect(Platform::IntPoint(x - (x % s_overScrollImageSize.width()), 1283 y - (y % s_overScrollImageSize.height())), s_overScrollImageSize); 1284 dstRect = imageRect; 1285 dstRect.intersect(overScrollRect); 1286 Platform::IntRect srcRect = Platform::IntRect(x - imageRect.x(), y - imageRect.y(), dstRect.width(), dstRect.height()); 1287 blitToWindow(dstRect, s_overScrollImage, srcRect, false, 255); 1288 } 1289 } 1290 } else 1285 1291 clearWindow(overScrollRect, color.red(), color.green(), color.blue(), color.alpha()); 1286 1292 } -
trunk/Source/WebKit/blackberry/Api/BackingStore_p.h
r116199 r116429 372 372 static Platform::Graphics::Buffer* s_overScrollImage; 373 373 static std::string s_overScrollImagePath; 374 static Platform::IntSize s_overScrollImageSize; 374 375 375 376 protected: -
trunk/Source/WebKit/blackberry/ChangeLog
r116418 r116429 1 2012-05-08 Andrew Lo <anlo@rim.com> 2 3 [BlackBerry] Over-scroll image should be tiled 4 https://bugs.webkit.org/show_bug.cgi?id=85860 5 6 Reviewed by Rob Buis. 7 8 Implement tiling for over-scroll image if image dimension don't match 9 the surface dimensions. 10 11 * Api/BackingStore.cpp: 12 (WebKit): 13 (BlackBerry::WebKit::BackingStorePrivate::ensureOverScrollImage): 14 (BlackBerry::WebKit::BackingStorePrivate::paintDefaultBackground): 15 * Api/BackingStore_p.h: 16 (BackingStorePrivate): 17 1 18 2012-05-08 Chris Guan <chris.guan@torchmobile.com.cn> 2 19
Note: See TracChangeset
for help on using the changeset viewer.