|
Lines 28-33
a/Source/WebCore/platform/graphics/TiledBackingStore.cpp_sec1
|
| 28 |
namespace WebCore { |
28 |
namespace WebCore { |
| 29 |
|
29 |
|
| 30 |
static const int defaultTileDimension = 512; |
30 |
static const int defaultTileDimension = 512; |
|
|
31 |
// FIXME: for the time being we pass TBS to BitmapImage this way, |
| 32 |
// but it should be accessed through Frame. |
| 33 |
TiledBackingStore* tbs; |
| 31 |
|
34 |
|
| 32 |
static IntPoint innerBottomRight(const IntRect& rect) |
35 |
static IntPoint innerBottomRight(const IntRect& rect) |
| 33 |
{ |
36 |
{ |
|
Lines 49-54
TiledBackingStore::TiledBackingStore(TiledBackingStoreClient* client, PassOwnPtr
a/Source/WebCore/platform/graphics/TiledBackingStore.cpp_sec2
|
| 49 |
, m_supportsAlpha(false) |
52 |
, m_supportsAlpha(false) |
| 50 |
, m_pendingTileCreation(false) |
53 |
, m_pendingTileCreation(false) |
| 51 |
{ |
54 |
{ |
|
|
55 |
// FIXME |
| 56 |
tbs = this; |
| 52 |
} |
57 |
} |
| 53 |
|
58 |
|
| 54 |
TiledBackingStore::~TiledBackingStore() |
59 |
TiledBackingStore::~TiledBackingStore() |
|
Lines 73-83
void TiledBackingStore::coverWithTilesIfNeeded()
a/Source/WebCore/platform/graphics/TiledBackingStore.cpp_sec3
|
| 73 |
IntRect visibleRect = this->visibleRect(); |
78 |
IntRect visibleRect = this->visibleRect(); |
| 74 |
IntRect rect = mapFromContents(m_client->tiledBackingStoreContentsRect()); |
79 |
IntRect rect = mapFromContents(m_client->tiledBackingStoreContentsRect()); |
| 75 |
|
80 |
|
|
|
81 |
// Animations that became visible should be painted also. |
| 82 |
optimizeDirtyRects(); |
| 83 |
|
| 76 |
bool didChange = m_trajectoryVector != m_pendingTrajectoryVector || m_visibleRect != visibleRect || m_rect != rect; |
84 |
bool didChange = m_trajectoryVector != m_pendingTrajectoryVector || m_visibleRect != visibleRect || m_rect != rect; |
| 77 |
if (didChange || m_pendingTileCreation) |
85 |
if (didChange || m_pendingTileCreation) |
| 78 |
createTiles(); |
86 |
createTiles(); |
| 79 |
} |
87 |
} |
| 80 |
|
88 |
|
|
|
89 |
// Optimization: examine saved pseudo-dirty rects and if it is needed complete dirty rects with them. |
| 90 |
void TiledBackingStore::optimizeDirtyRects() |
| 91 |
{ |
| 92 |
IntRect visibleRect = this->visibleRect(); |
| 93 |
|
| 94 |
TileMap::iterator end = m_tiles.end(); |
| 95 |
for (TileMap::iterator it = m_tiles.begin(); it != end; ++it) { |
| 96 |
IntRect tileRect = it->value->rect(); |
| 97 |
if (tileRect.intersects(visibleRect)) |
| 98 |
it->value->optimizeDirtyRect(visibleRect); |
| 99 |
} |
| 100 |
} |
| 101 |
|
| 102 |
// In addition it can be used in order to avoid the painting of an invisible animation. |
| 103 |
bool TiledBackingStore::isVisible(const FloatRect& rect) |
| 104 |
{ |
| 105 |
FloatRect visibleRect(m_visibleRect); |
| 106 |
if (visibleRect.intersects(rect)) |
| 107 |
return true; |
| 108 |
|
| 109 |
// If rect is completely invisible, store it. |
| 110 |
savePseudoDirtyRect(rect); |
| 111 |
|
| 112 |
return false; |
| 113 |
} |
| 114 |
|
| 115 |
// This method makes sense when we call it with an invisible animation's rect. |
| 116 |
// Pseudo-dirty rect: should only be painted before it becomes visible. |
| 117 |
void TiledBackingStore::savePseudoDirtyRect(const FloatRect& rect) |
| 118 |
{ |
| 119 |
// Rect may intersect more tiles, so split it up between tiles. |
| 120 |
TileMap::iterator end = m_tiles.end(); |
| 121 |
for (TileMap::iterator it = m_tiles.begin(); it != end; ++it) { |
| 122 |
FloatRect tileRect = it->value->rect(); |
| 123 |
FloatRect pseudoDirtyRectSlice = intersection(tileRect, rect); |
| 124 |
if (!pseudoDirtyRectSlice.isEmpty()) |
| 125 |
it->value->savePseudoDirtyRect(pseudoDirtyRectSlice); |
| 126 |
} |
| 127 |
} |
| 128 |
|
| 81 |
void TiledBackingStore::invalidate(const IntRect& contentsDirtyRect) |
129 |
void TiledBackingStore::invalidate(const IntRect& contentsDirtyRect) |
| 82 |
{ |
130 |
{ |
| 83 |
IntRect dirtyRect(mapFromContents(contentsDirtyRect)); |
131 |
IntRect dirtyRect(mapFromContents(contentsDirtyRect)); |