summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Roard <nicolasroard@google.com>2011-03-17 18:20:38 -0700
committerNicolas Roard <nicolasroard@google.com>2011-03-17 18:32:54 -0700
commit776c5d4485a2b75fb4e143b0a5984cba47aaac4d (patch)
tree75b0eae7beb7ff38c6b553bd3fa0fd04a149249c
parent1ae2d07bc763fbb9dc3df9a62631d2f8fb707ce2 (diff)
downloadexternal_webkit-776c5d4485a2b75fb4e143b0a5984cba47aaac4d.zip
external_webkit-776c5d4485a2b75fb4e143b0a5984cba47aaac4d.tar.gz
external_webkit-776c5d4485a2b75fb4e143b0a5984cba47aaac4d.tar.bz2
Limit the SkPicture size we use to paint.
This improves performances by a visible factor on some websites. bug:4124418 Change-Id: I9b24408b686e24cf323eb5bae977d74a0f2e2a34
-rw-r--r--WebCore/platform/graphics/android/BaseTile.cpp13
-rw-r--r--WebCore/platform/graphics/android/LayerAndroid.cpp15
-rw-r--r--WebCore/platform/graphics/android/TiledPage.cpp3
3 files changed, 20 insertions, 11 deletions
diff --git a/WebCore/platform/graphics/android/BaseTile.cpp b/WebCore/platform/graphics/android/BaseTile.cpp
index 4400ea5..c67e2b8 100644
--- a/WebCore/platform/graphics/android/BaseTile.cpp
+++ b/WebCore/platform/graphics/android/BaseTile.cpp
@@ -32,6 +32,7 @@
#include "SkBitmap.h"
#include "SkBitmapRef.h"
#include "SkCanvas.h"
+#include "SkPicture.h"
#include "TilesManager.h"
#include <EGL/egl.h>
@@ -420,11 +421,13 @@ int BaseTile::paintPartialBitmap(SkIRect r, float ptx, float pty,
SkCanvas canvas(bitmap);
canvas.drawARGB(255, 255, 255, 255);
- canvas.save();
- canvas.scale(scale, scale);
- canvas.translate(tx, ty);
- int pictureCount = tiledPage->paintBaseLayerContent(&canvas);
- canvas.restore();
+ SkPicture picture;
+ SkCanvas* nCanvas = picture.beginRecording(rect.width(), rect.height());
+ nCanvas->scale(scale, scale);
+ nCanvas->translate(tx, ty);
+ int pictureCount = tiledPage->paintBaseLayerContent(nCanvas);
+ picture.endRecording();
+ picture.draw(&canvas);
if (TilesManager::instance()->getShowVisualIndicator()) {
int color = 20 + pictureCount % 100;
diff --git a/WebCore/platform/graphics/android/LayerAndroid.cpp b/WebCore/platform/graphics/android/LayerAndroid.cpp
index 33d98ea..0f2faa0 100644
--- a/WebCore/platform/graphics/android/LayerAndroid.cpp
+++ b/WebCore/platform/graphics/android/LayerAndroid.cpp
@@ -1014,13 +1014,16 @@ void LayerAndroid::paintBitmapGL()
float scale = texture->scale();
IntRect textureRect = texture->rect();
-
- canvas->save();
canvas->drawARGB(0, 0, 0, 0, SkXfermode::kClear_Mode);
- canvas->scale(scale, scale);
- canvas->translate(-textureRect.x(), -textureRect.y());
- contentDraw(canvas);
- canvas->restore();
+
+ SkPicture picture;
+ SkCanvas* nCanvas = picture.beginRecording(textureRect.width(),
+ textureRect.height());
+ nCanvas->scale(scale, scale);
+ nCanvas->translate(-textureRect.x(), -textureRect.y());
+ contentDraw(nCanvas);
+ picture.endRecording();
+ picture.draw(canvas);
m_atomicSync.lock();
texture->setTextureInfoFor(this);
diff --git a/WebCore/platform/graphics/android/TiledPage.cpp b/WebCore/platform/graphics/android/TiledPage.cpp
index a400a4a..4fa3e0e 100644
--- a/WebCore/platform/graphics/android/TiledPage.cpp
+++ b/WebCore/platform/graphics/android/TiledPage.cpp
@@ -151,6 +151,9 @@ void TiledPage::prepareRow(bool goingLeft, int tilesInRow, int firstTileX, int y
else
x += i;
+ if (x < 0)
+ continue;
+
BaseTile* currentTile = 0;
BaseTile* availableTile = 0;
for (int j = 0; j < m_baseTileSize; j++) {