summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--WebCore/Android.mk2
-rw-r--r--WebCore/platform/graphics/android/TexturesGenerator.cpp8
-rw-r--r--WebCore/platform/graphics/android/TexturesGenerator.h6
-rw-r--r--WebCore/platform/graphics/android/TileSet.cpp (renamed from WebCore/platform/graphics/android/TilesSet.cpp)49
-rw-r--r--WebCore/platform/graphics/android/TileSet.h (renamed from WebCore/platform/graphics/android/TilesSet.h)35
-rw-r--r--WebCore/platform/graphics/android/TiledPage.cpp25
-rw-r--r--WebCore/platform/graphics/android/TiledPage.h6
-rw-r--r--WebCore/platform/graphics/android/TilesManager.h7
8 files changed, 67 insertions, 71 deletions
diff --git a/WebCore/Android.mk b/WebCore/Android.mk
index 9f84b10..50a4b33 100644
--- a/WebCore/Android.mk
+++ b/WebCore/Android.mk
@@ -585,7 +585,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
platform/graphics/android/TexturesGenerator.cpp \
platform/graphics/android/TilesManager.cpp \
platform/graphics/android/TiledPage.cpp \
- platform/graphics/android/TilesSet.cpp \
+ platform/graphics/android/TileSet.cpp \
platform/graphics/android/android_graphics.cpp \
ifeq ($(ENABLE_SVG), true)
diff --git a/WebCore/platform/graphics/android/TexturesGenerator.cpp b/WebCore/platform/graphics/android/TexturesGenerator.cpp
index ca05d10..1b8baa0 100644
--- a/WebCore/platform/graphics/android/TexturesGenerator.cpp
+++ b/WebCore/platform/graphics/android/TexturesGenerator.cpp
@@ -49,11 +49,11 @@
namespace WebCore {
-void TexturesGenerator::schedulePaintForTilesSet(TilesSet* set)
+void TexturesGenerator::schedulePaintForTileSet(TileSet* set)
{
android::Mutex::Autolock lock(mRequestedPixmapsLock);
for (unsigned int i = 0; i < mRequestedPixmaps.size(); i++) {
- TilesSet* s = mRequestedPixmaps[i];
+ TileSet* s = mRequestedPixmaps[i];
if (s && *s == *set) {
// Similar set already in the queue
delete set;
@@ -61,7 +61,7 @@ void TexturesGenerator::schedulePaintForTilesSet(TilesSet* set)
}
}
- XLOG("%x schedulePaintForTilesSet (%x) %d, %d, %d, %d", this, set,
+ XLOG("%x schedulePaintForTileSet (%x) %d, %d, %d, %d", this, set,
set->firstTileX(), set->firstTileY(), set->nbRows(), set->nbCols());
mRequestedPixmaps.append(set);
m_newRequestLock.lock();
@@ -91,7 +91,7 @@ bool TexturesGenerator::threadLoop()
bool stop = false;
while (!stop) {
mRequestedPixmapsLock.lock();
- TilesSet* set = 0;
+ TileSet* set = 0;
if (mRequestedPixmaps.size())
set = mRequestedPixmaps.first();
mRequestedPixmapsLock.unlock();
diff --git a/WebCore/platform/graphics/android/TexturesGenerator.h b/WebCore/platform/graphics/android/TexturesGenerator.h
index b68fcb1..4d94705 100644
--- a/WebCore/platform/graphics/android/TexturesGenerator.h
+++ b/WebCore/platform/graphics/android/TexturesGenerator.h
@@ -28,7 +28,7 @@
#if USE(ACCELERATED_COMPOSITING)
-#include "TilesSet.h"
+#include "TileSet.h"
#include <utils/threads.h>
namespace WebCore {
@@ -41,11 +41,11 @@ public:
virtual ~TexturesGenerator() { }
virtual status_t readyToRun();
- void schedulePaintForTilesSet(TilesSet* set);
+ void schedulePaintForTileSet(TileSet* set);
private:
virtual bool threadLoop();
- Vector<TilesSet*> mRequestedPixmaps;
+ Vector<TileSet*> mRequestedPixmaps;
android::Mutex mRequestedPixmapsLock;
android::Mutex m_newRequestLock;
android::Condition m_newRequestCond;
diff --git a/WebCore/platform/graphics/android/TilesSet.cpp b/WebCore/platform/graphics/android/TileSet.cpp
index 25f93e5..5cf0815 100644
--- a/WebCore/platform/graphics/android/TilesSet.cpp
+++ b/WebCore/platform/graphics/android/TileSet.cpp
@@ -24,7 +24,7 @@
*/
#include "config.h"
-#include "TilesSet.h"
+#include "TileSet.h"
#if USE(ACCELERATED_COMPOSITING)
@@ -35,7 +35,7 @@
#include <wtf/text/CString.h>
#undef XLOG
-#define XLOG(...) android_printLog(ANDROID_LOG_DEBUG, "TilesSet", __VA_ARGS__)
+#define XLOG(...) android_printLog(ANDROID_LOG_DEBUG, "TileSet", __VA_ARGS__)
#else
@@ -47,56 +47,55 @@
namespace WebCore {
#ifdef DEBUG
-static int gTilesSetCount = 0;
-int TilesSet::count()
+static int gTileSetCount = 0;
+int TileSet::count()
{
- return gTilesSetCount;
+ return gTileSetCount;
}
#endif
-TilesSet::TilesSet(int id, float scale, int firstTileX, int firstTileY, int rows, int cols)
+TileSet::TileSet(int id, int firstTileX, int firstTileY, int rows, int cols)
: m_id(id)
- , m_scale(scale)
, m_firstTileX(firstTileX)
, m_firstTileY(firstTileY)
, m_nbRows(rows)
, m_nbCols(cols)
- , m_painting(false)
{
#ifdef DEBUG
gTilesSetCount++;
#endif
}
-TilesSet::~TilesSet()
+TileSet::~TileSet()
{
#ifdef DEBUG
- gTilesSetCount--;
+ gTileSetCount--;
#endif
}
-bool TilesSet::operator==(const TilesSet& set)
+bool TileSet::operator==(const TileSet& set)
{
- return (id() == set.id())
- && (firstTileX() == set.firstTileX())
- && (firstTileY() == set.firstTileY())
- && (nbRows() == set.nbRows())
- && (nbCols() == set.nbCols());
+ return m_id == set.m_id
+ && m_firstTileX == set.m_firstTileX
+ && m_firstTileY == set.m_firstTileY
+ && m_nbRows == set.m_nbRows
+ && m_nbCols == set.m_nbCols;
}
-void TilesSet::reserveTextures()
+
+void TileSet::reserveTextures()
{
- XLOG("reserveTextures (%d tiles)", mTiles.size());
- for (unsigned int i = 0; i < mTiles.size(); i++)
- mTiles[i]->reserveTexture();
+ XLOG("reserveTextures (%d tiles)", m_tiles.size());
+ for (unsigned int i = 0; i < m_tiles.size(); i++)
+ m_tiles[i]->reserveTexture();
}
-void TilesSet::paint()
+void TileSet::paint()
{
- XLOG("%x, painting %d tiles", this, mTiles.size());
- for (unsigned int i = 0; i < mTiles.size(); i++)
- mTiles[i]->paintBitmap();
- XLOG("%x, end of painting %d tiles", this, mTiles.size());
+ XLOG("%x, painting %d tiles", this, m_tiles.size());
+ for (unsigned int i = 0; i < m_tiles.size(); i++)
+ m_tiles[i]->paintBitmap();
+ XLOG("%x, end of painting %d tiles", this, m_tiles.size());
}
} // namespace WebCore
diff --git a/WebCore/platform/graphics/android/TilesSet.h b/WebCore/platform/graphics/android/TileSet.h
index 0e2ebb5..c5da7e7 100644
--- a/WebCore/platform/graphics/android/TilesSet.h
+++ b/WebCore/platform/graphics/android/TileSet.h
@@ -23,8 +23,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef TilesSet_h
-#define TilesSet_h
+#ifndef TileSet_h
+#define TileSet_h
#if USE(ACCELERATED_COMPOSITING)
@@ -33,44 +33,41 @@
namespace WebCore {
-class TilesSet {
+/**
+ * This purpose of this class is to act as a container for BaseTiles that need
+ * to upload their contents to the GPU. A TiledPage creates a new TileSet and
+ * provides the set with identifying characteristics of the TiledPage's current
+ * state (see constructor). This information allows the consumer of the TileSet
+ * to determine if an equivalent TileSet already exists in the upload pipeline.
+ */
+class TileSet {
public:
#ifdef DEBUG
static int count();
#endif
- TilesSet(int id, float scale, int firstTileX, int firstTileY, int rows, int cols);
- ~TilesSet();
+ TileSet(int id, int firstTileX, int firstTileY, int rows, int cols);
+ ~TileSet();
- int id() const { return m_id; }
- float scale() const { return m_scale; }
- int firstTileX() const { return m_firstTileX; }
- int firstTileY() const { return m_firstTileY; }
- int nbRows() const { return m_nbRows; }
- int nbCols() const { return m_nbCols; }
- bool operator==(const TilesSet& set);
+ bool operator==(const TileSet& set);
void reserveTextures();
-
void paint();
- void setPainting(bool state) { m_painting = state; }
void add(BaseTile* texture)
{
- mTiles.append(texture);
+ m_tiles.append(texture);
}
private:
- Vector<BaseTile*> mTiles;
+ Vector<BaseTile*> m_tiles;
int m_id;
- float m_scale;
int m_firstTileX;
int m_firstTileY;
int m_nbRows;
int m_nbCols;
- bool m_painting;
};
} // namespace WebCore
#endif // USE(ACCELERATED_COMPOSITING)
-#endif // TilesSet_h
+#endif // TileSet_h
diff --git a/WebCore/platform/graphics/android/TiledPage.cpp b/WebCore/platform/graphics/android/TiledPage.cpp
index 666c00f..01b9570 100644
--- a/WebCore/platform/graphics/android/TiledPage.cpp
+++ b/WebCore/platform/graphics/android/TiledPage.cpp
@@ -58,21 +58,20 @@ TiledPage::TiledPage(int id, GLWebViewState* state)
{
}
-BaseTile* TiledPage::getBaseTile(int x, int y, int quality)
+BaseTile* TiledPage::getBaseTile(int x, int y)
{
TileKey key(x + 1, y + 1);
return m_baseTextures.get(key);
}
-void TiledPage::prepareRow(bool goingLeft, int firstTileX, int y, TilesSet* set, int quality)
+void TiledPage::prepareRow(bool goingLeft, int tilesInRow, int firstTileX, int y, TileSet* set)
{
if (y < 0)
return;
if (!set)
return;
- int nbCols = set->nbCols();
- for (int i = 0; i < nbCols; i++) {
+ for (int i = 0; i < tilesInRow; i++) {
int x = firstTileX;
// If we are goingLeft, we want to schedule the tiles
@@ -80,7 +79,7 @@ void TiledPage::prepareRow(bool goingLeft, int firstTileX, int y, TilesSet* set,
if (goingLeft)
x += i;
else
- x += (nbCols - 1) - i;
+ x += (tilesInRow - 1) - i;
TileKey key(x + 1, y + 1);
BaseTile* tile = 0;
@@ -132,16 +131,16 @@ void TiledPage::prepare(bool goingDown, bool goingLeft, int firstTileX, int firs
int nbTilesWidth = m_glWebViewState->nbTilesWidth();
int nbTilesHeight = m_glWebViewState->nbTilesHeight();
- TilesSet* highResSet = new TilesSet(m_id + 1, scale(), firstTileX, firstTileY,
- nbTilesHeight, nbTilesWidth);
+ TileSet* highResSet = new TileSet(m_id, firstTileX, firstTileY, nbTilesHeight, nbTilesWidth);
// We chose to display tiles depending on the scroll direction:
if (goingDown) {
for (int i = 0; i < nbTilesHeight; i++)
- prepareRow(goingLeft, firstTileX, firstTileY + i, highResSet, 1);
+ prepareRow(goingLeft, nbTilesWidth, firstTileX, firstTileY + i, highResSet);
} else {
+ int startingTileY = firstTileY + (nbTilesHeight - 1);
for (int i = 0; i < nbTilesHeight; i++)
- prepareRow(goingLeft, firstTileX, firstTileY + (nbTilesHeight - 1) - i, highResSet, 1);
+ prepareRow(goingLeft, nbTilesWidth, firstTileX, startingTileY - i, highResSet);
}
TileMap::const_iterator end = m_baseTextures.end();
@@ -164,9 +163,9 @@ void TiledPage::prepare(bool goingDown, bool goingLeft, int firstTileX, int firs
nbTilesWidth, nbTilesHeight, firstTileX, firstTileY, this);
#endif // DEBUG
- // schedulePaintForTilesSet will take ownership of the highResSet here,
+ // schedulePaintForTileSet will take ownership of the highResSet here,
// so no delete necessary.
- TilesManager::instance()->schedulePaintForTilesSet(highResSet);
+ TilesManager::instance()->schedulePaintForTileSet(highResSet);
}
bool TiledPage::ready(int firstTileX, int firstTileY)
@@ -181,7 +180,7 @@ bool TiledPage::ready(int firstTileX, int firstTileY)
for (int j = 0; j < nbTilesWidth; j++) {
int x = j + firstTileX;
int y = i + firstTileY;
- BaseTile* t = getBaseTile(x, y, 1);
+ BaseTile* t = getBaseTile(x, y);
if (!t || !t->isBitmapReady())
return false;
}
@@ -206,7 +205,7 @@ void TiledPage::draw(float transparency, SkRect& viewport,
int x = j + firstTileX;
int y = i + firstTileY;
- BaseTile* tile = getBaseTile(x, y, 1);
+ BaseTile* tile = getBaseTile(x, y);
if (!tile) {
XLOG("NO TILE AT %d, %d", x, y);
diff --git a/WebCore/platform/graphics/android/TiledPage.h b/WebCore/platform/graphics/android/TiledPage.h
index 712566c..bb4e9cb 100644
--- a/WebCore/platform/graphics/android/TiledPage.h
+++ b/WebCore/platform/graphics/android/TiledPage.h
@@ -31,7 +31,7 @@
#include "BaseTile.h"
#include "GLWebViewState.h"
#include "SkCanvas.h"
-#include "TilesSet.h"
+#include "TileSet.h"
namespace WebCore {
@@ -39,7 +39,7 @@ class TiledPage {
public:
TiledPage(int id, GLWebViewState* state);
~TiledPage() { }
- BaseTile* getBaseTile(int x, int y, int quality);
+ BaseTile* getBaseTile(int x, int y);
void prepare(bool goingDown, bool goingLeft, int firstTileX, int firstTileY);
void setScale(float scale) { m_scale = scale; }
bool ready(int firstTileX, int firstTileY);
@@ -51,7 +51,7 @@ public:
GLWebViewState* glWebViewState() { return m_glWebViewState; }
private:
void setTileLevel(BaseTile* tile, int firstTileX, int firstTileY);
- void prepareRow(bool goingLeft, int firstTileX, int y, TilesSet* set, int quality);
+ void prepareRow(bool goingLeft, int tilesInRow, int firstTileX, int y, TileSet* set);
TileMap m_baseTextures;
int m_id;
float m_scale;
diff --git a/WebCore/platform/graphics/android/TilesManager.h b/WebCore/platform/graphics/android/TilesManager.h
index 2ac0ca6..8e6ba1b 100644
--- a/WebCore/platform/graphics/android/TilesManager.h
+++ b/WebCore/platform/graphics/android/TilesManager.h
@@ -33,18 +33,19 @@
#include "ShaderProgram.h"
#include "TexturesGenerator.h"
#include "TiledPage.h"
-#include "TilesSet.h"
#include <utils/threads.h>
namespace WebCore {
+class TileSet;
+
class TilesManager {
public:
static TilesManager* instance();
- void schedulePaintForTilesSet(TilesSet* set)
+ void schedulePaintForTileSet(TileSet* set)
{
- m_pixmapsGenerationThread->schedulePaintForTilesSet(set);
+ m_pixmapsGenerationThread->schedulePaintForTileSet(set);
}
ShaderProgram* shader() { return &m_shader; }