|
Lines 32-37
a/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp_sec1
|
| 32 |
#include "GraphicsContext3D.h" |
32 |
#include "GraphicsContext3D.h" |
| 33 |
#include "LayerTextureUpdater.h" |
33 |
#include "LayerTextureUpdater.h" |
| 34 |
#include "ManagedTexture.h" |
34 |
#include "ManagedTexture.h" |
|
|
35 |
#include "TextureCopier.h" |
| 35 |
|
36 |
|
| 36 |
using namespace std; |
37 |
using namespace std; |
| 37 |
|
38 |
|
|
Lines 49-78
CCTextureUpdater::~CCTextureUpdater()
a/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp_sec2
|
| 49 |
{ |
50 |
{ |
| 50 |
} |
51 |
} |
| 51 |
|
52 |
|
| 52 |
void CCTextureUpdater::append(LayerTextureUpdater::Texture* texture, const IntRect& sourceRect, const IntRect& destRect, Vector<UpdateEntry>& entries) |
53 |
void CCTextureUpdater::appendUpdate(LayerTextureUpdater::Texture* texture, const IntRect& sourceRect, const IntRect& destRect, Vector<UpdateEntry>& entries) |
| 53 |
{ |
54 |
{ |
| 54 |
ASSERT(texture); |
55 |
ASSERT(texture); |
| 55 |
|
56 |
|
| 56 |
UpdateEntry entry; |
57 |
UpdateEntry entry; |
| 57 |
entry.m_texture = texture; |
58 |
entry.texture = texture; |
| 58 |
entry.m_sourceRect = sourceRect; |
59 |
entry.sourceRect = sourceRect; |
| 59 |
entry.m_destRect = destRect; |
60 |
entry.destRect = destRect; |
| 60 |
entries.append(entry); |
61 |
entries.append(entry); |
| 61 |
} |
62 |
} |
| 62 |
|
63 |
|
| 63 |
void CCTextureUpdater::append(LayerTextureUpdater::Texture* texture, const IntRect& sourceRect, const IntRect& destRect) |
64 |
void CCTextureUpdater::appendUpdate(LayerTextureUpdater::Texture* texture, const IntRect& sourceRect, const IntRect& destRect) |
| 64 |
{ |
65 |
{ |
| 65 |
append(texture, sourceRect, destRect, m_entries); |
66 |
appendUpdate(texture, sourceRect, destRect, m_entries); |
| 66 |
} |
67 |
} |
| 67 |
|
68 |
|
| 68 |
void CCTextureUpdater::appendPartial(LayerTextureUpdater::Texture* texture, const IntRect& sourceRect, const IntRect& destRect) |
69 |
void CCTextureUpdater::appendPartialUpdate(LayerTextureUpdater::Texture* texture, const IntRect& sourceRect, const IntRect& destRect) |
| 69 |
{ |
70 |
{ |
| 70 |
append(texture, sourceRect, destRect, m_partialEntries); |
71 |
appendUpdate(texture, sourceRect, destRect, m_partialEntries); |
|
|
72 |
} |
| 73 |
|
| 74 |
void CCTextureUpdater::appendCopy(unsigned sourceTexture, unsigned destTexture, const IntSize& size) |
| 75 |
{ |
| 76 |
CopyEntry copy; |
| 77 |
copy.sourceTexture = sourceTexture; |
| 78 |
copy.destTexture = destTexture; |
| 79 |
copy.size = size; |
| 80 |
m_copyEntries.append(copy); |
| 71 |
} |
81 |
} |
| 72 |
|
82 |
|
| 73 |
bool CCTextureUpdater::hasMoreUpdates() const |
83 |
bool CCTextureUpdater::hasMoreUpdates() const |
| 74 |
{ |
84 |
{ |
| 75 |
return m_entries.size() || m_partialEntries.size(); |
85 |
return m_entries.size() || m_partialEntries.size() || m_copyEntries.size(); |
| 76 |
} |
86 |
} |
| 77 |
|
87 |
|
| 78 |
bool CCTextureUpdater::update(GraphicsContext3D* context, size_t count) |
88 |
bool CCTextureUpdater::update(GraphicsContext3D* context, size_t count) |
|
Lines 81-87
bool CCTextureUpdater::update(GraphicsContext3D* context, size_t count)
a/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp_sec3
|
| 81 |
size_t maxIndex = min(m_entryIndex + count, m_entries.size()); |
91 |
size_t maxIndex = min(m_entryIndex + count, m_entries.size()); |
| 82 |
for (index = m_entryIndex; index < maxIndex; ++index) { |
92 |
for (index = m_entryIndex; index < maxIndex; ++index) { |
| 83 |
UpdateEntry& entry = m_entries[index]; |
93 |
UpdateEntry& entry = m_entries[index]; |
| 84 |
entry.m_texture->updateRect(context, m_allocator, entry.m_sourceRect, entry.m_destRect); |
94 |
entry.texture->updateRect(context, m_allocator, entry.sourceRect, entry.destRect); |
| 85 |
} |
95 |
} |
| 86 |
|
96 |
|
| 87 |
bool moreUpdates = maxIndex < m_entries.size(); |
97 |
bool moreUpdates = maxIndex < m_entries.size(); |
|
Lines 99-106
bool CCTextureUpdater::update(GraphicsContext3D* context, size_t count)
a/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp_sec4
|
| 99 |
|
109 |
|
| 100 |
for (index = 0; index < m_partialEntries.size(); ++index) { |
110 |
for (index = 0; index < m_partialEntries.size(); ++index) { |
| 101 |
UpdateEntry& entry = m_partialEntries[index]; |
111 |
UpdateEntry& entry = m_partialEntries[index]; |
| 102 |
entry.m_texture->updateRect(context, m_allocator, entry.m_sourceRect, entry.m_destRect); |
112 |
entry.texture->updateRect(context, m_allocator, entry.sourceRect, entry.destRect); |
|
|
113 |
} |
| 114 |
|
| 115 |
for (index = 0; index < m_copyEntries.size(); ++index) { |
| 116 |
CopyEntry& copyEntry = m_copyEntries[index]; |
| 117 |
m_copier->copyTexture(context, copyEntry.sourceTexture, copyEntry.destTexture, copyEntry.size); |
| 103 |
} |
118 |
} |
|
|
119 |
// If we've performed any texture copies, we need to insert a flush here into the compositor context |
| 120 |
// before letting the main thread proceed as it may make draw calls to the source texture of one of |
| 121 |
// our copy operations. |
| 122 |
if (m_copyEntries.size()) |
| 123 |
context->flush(); |
| 104 |
|
124 |
|
| 105 |
// If no entries left to process, auto-clear. |
125 |
// If no entries left to process, auto-clear. |
| 106 |
clear(); |
126 |
clear(); |
|
Lines 112-117
void CCTextureUpdater::clear()
a/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp_sec5
|
| 112 |
m_entryIndex = 0; |
132 |
m_entryIndex = 0; |
| 113 |
m_entries.clear(); |
133 |
m_entries.clear(); |
| 114 |
m_partialEntries.clear(); |
134 |
m_partialEntries.clear(); |
|
|
135 |
m_copyEntries.clear(); |
| 115 |
} |
136 |
} |
| 116 |
|
137 |
|
| 117 |
} |
138 |
} |