Created
March 5, 2012 13:32
-
-
Save kenchris/1978313 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit b0c117509858464dbdf226138a8f221e6dc941b8 | |
Author: Kenneth Rohde Christiansen <kenneth@webkit.org> | |
Date: Mon Mar 5 14:10:52 2012 +0100 | |
Rename some variables and methods for clarity and consistence. | |
First of all the visibleContentsRect is now called visibleRect as it is | |
not in contents coordinates. | |
The panningTrajectoryVector and m_visibleRectTrajectoryVector are renamed | |
to just *[m_]trajectoryVector, as that is descriptive enough. | |
the previous prefix has also been removed, as it is being used as the | |
current one in the code. This avoids confusion. | |
diff --git a/Source/WebCore/platform/graphics/TiledBackingStore.cpp b/Source/WebCore/platform/graphics/TiledBackingStore.cpp | |
index a789bc9..254ebf6 100644 | |
--- a/Source/WebCore/platform/graphics/TiledBackingStore.cpp | |
+++ b/Source/WebCore/platform/graphics/TiledBackingStore.cpp | |
@@ -68,14 +68,14 @@ void TiledBackingStore::setTileCreationDelay(double delay) | |
m_tileCreationDelay = delay; | |
} | |
-void TiledBackingStore::coverWithTilesIfNeeded(const FloatPoint& panningTrajectoryVector) | |
+void TiledBackingStore::coverWithTilesIfNeeded(const FloatPoint& trajectoryVector) | |
{ | |
- IntRect visibleRect = visibleContentsRect(); | |
- if (m_visibleRectTrajectoryVector == panningTrajectoryVector && m_previousVisibleRect == visibleRect) | |
+ IntRect visibleRect = this->visibleRect(); | |
+ if (m_trajectoryVector == trajectoryVector && m_visibleRect == visibleRect) | |
return; | |
- m_visibleRectTrajectoryVector = panningTrajectoryVector; | |
- m_previousVisibleRect = visibleRect; | |
+ m_trajectoryVector = trajectoryVector; | |
+ m_visibleRect = visibleRect; | |
startTileCreationTimer(); | |
} | |
@@ -164,7 +164,7 @@ void TiledBackingStore::paint(GraphicsContext* context, const IntRect& rect) | |
context->restore(); | |
} | |
-IntRect TiledBackingStore::visibleContentsRect() const | |
+IntRect TiledBackingStore::visibleRect() const | |
{ | |
return mapFromContents(intersection(m_client->tiledBackingStoreVisibleRect(), m_client->tiledBackingStoreContentsRect())); | |
} | |
@@ -225,7 +225,7 @@ float TiledBackingStore::coverageRatio(const WebCore::IntRect& contentsRect) con | |
bool TiledBackingStore::visibleAreaIsCovered() const | |
{ | |
- return coverageRatio(visibleContentsRect()) == 1.0f; | |
+ return coverageRatio(visibleRect()) == 1.0f; | |
} | |
void TiledBackingStore::createTiles() | |
@@ -236,8 +236,8 @@ void TiledBackingStore::createTiles() | |
const IntRect previousRect = m_rect; | |
m_rect = mapFromContents(m_client->tiledBackingStoreContentsRect()); | |
- const IntRect visibleRect = visibleContentsRect(); | |
- m_previousVisibleRect = visibleRect; | |
+ const IntRect visibleRect = this->visibleRect(); | |
+ m_visibleRect = visibleRect; | |
if (visibleRect.isEmpty()) | |
return; | |
@@ -338,7 +338,7 @@ void TiledBackingStore::computeCoverAndKeepRect(const IntRect& visibleRect, IntR | |
coverRect.inflateY(visibleRect.height() * (m_coverAreaMultiplier - 1) / 2); | |
keepRect = coverRect; | |
- float trajectoryVectorNorm = sqrt(pow(m_visibleRectTrajectoryVector.x(), 2) + pow(m_visibleRectTrajectoryVector.y(), 2)); | |
+ float trajectoryVectorNorm = sqrt(pow(m_trajectoryVector.x(), 2) + pow(m_trajectoryVector.y(), 2)); | |
if (trajectoryVectorNorm) { | |
// A null trajectory vector (no motion) means that tiles for the coverArea will be created. | |
// A non-null trajectory vector will shrink the covered rect to visibleRect plus its expansion from its | |
@@ -354,8 +354,8 @@ void TiledBackingStore::computeCoverAndKeepRect(const IntRect& visibleRect, IntR | |
// Unite the visible rect with a "ghost" of the visible rect moved in the direction of the trajectory vector. | |
coverRect = visibleRect; | |
- coverRect.move(coverRect.width() * m_visibleRectTrajectoryVector.x() / trajectoryVectorNorm * trajectoryVectorMultiplier, | |
- coverRect.height() * m_visibleRectTrajectoryVector.y() / trajectoryVectorNorm * trajectoryVectorMultiplier); | |
+ coverRect.move(coverRect.width() * m_trajectoryVector.x() / trajectoryVectorNorm * trajectoryVectorMultiplier, | |
+ coverRect.height() * m_trajectoryVector.y() / trajectoryVectorNorm * trajectoryVectorMultiplier); | |
coverRect.unite(visibleRect); | |
} | |
@@ -416,7 +416,7 @@ void TiledBackingStore::setKeepRect(const IntRect& keepRect) | |
void TiledBackingStore::removeAllNonVisibleTiles() | |
{ | |
- setKeepRect(visibleContentsRect()); | |
+ setKeepRect(visibleRect()); | |
} | |
PassRefPtr<Tile> TiledBackingStore::tileAt(const Tile::Coordinate& coordinate) const | |
diff --git a/Source/WebCore/platform/graphics/TiledBackingStore.h b/Source/WebCore/platform/graphics/TiledBackingStore.h | |
index 16d6611..8b572d7 100644 | |
--- a/Source/WebCore/platform/graphics/TiledBackingStore.h | |
+++ b/Source/WebCore/platform/graphics/TiledBackingStore.h | |
@@ -99,7 +99,7 @@ private: | |
void setTile(const Tile::Coordinate& coordinate, PassRefPtr<Tile> tile); | |
void removeTile(const Tile::Coordinate& coordinate); | |
- IntRect visibleContentsRect() const; | |
+ IntRect visibleRect() const; | |
float coverageRatio(const IntRect&) const; | |
void adjustForContentsRect(IntRect&) const; | |
@@ -119,9 +119,9 @@ private: | |
IntSize m_tileSize; | |
double m_tileCreationDelay; | |
float m_coverAreaMultiplier; | |
- FloatPoint m_visibleRectTrajectoryVector; | |
- IntRect m_previousVisibleRect; | |
+ FloatPoint m_trajectoryVector; | |
+ IntRect m_visibleRect; | |
IntRect m_keepRect; | |
IntRect m_rect; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment