Changeset 142366 in webkit
- Timestamp:
- Feb 9, 2013 10:15:14 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 added
- 10 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r142193 r142366 2017 2017 platform/graphics/texmap/TextureMapperImageBuffer.cpp 2018 2018 platform/graphics/texmap/TextureMapperLayer.cpp 2019 platform/graphics/texmap/TextureMapperSurfaceBackingStore.cpp 2020 platform/graphics/texmap/TextureMapperTile.cpp 2021 platform/graphics/texmap/TextureMapperTiledBackingStore.cpp 2019 2022 2020 2023 platform/graphics/transforms/AffineTransform.cpp -
trunk/Source/WebCore/ChangeLog
r142365 r142366 1 2013-02-09 Rafael Brandao <rafael.lobo@openbossa.org> 2 3 [TexMap] Separate classes per file in TextureMapperBackingStore.h 4 https://bugs.webkit.org/show_bug.cgi?id=109333 5 6 Reviewed by Noam Rosenthal. 7 8 TextureMapperBackingStore.h had the classes TextureMapperBackingStore, 9 TextureMapperTiledBackingStore, TextureMapperSurfaceBackingStore and 10 TextureMapperTile which was quite confusing. Now each one has its 11 own header and its own source file. 12 13 No new tests needed, refactoring only. 14 15 * CMakeLists.txt: 16 * GNUmakefile.list.am: 17 * Target.pri: 18 * WebCore.gypi: 19 * platform/graphics/texmap/GraphicsLayerTextureMapper.h: 20 * platform/graphics/texmap/TextureMapperBackingStore.cpp: 21 * platform/graphics/texmap/TextureMapperBackingStore.h: 22 * platform/graphics/texmap/TextureMapperSurfaceBackingStore.cpp: Added. 23 (WebCore): 24 (WebCore::TextureMapperSurfaceBackingStore::setGraphicsSurface): 25 (WebCore::TextureMapperSurfaceBackingStore::swapBuffersIfNeeded): 26 (WebCore::TextureMapperSurfaceBackingStore::texture): 27 (WebCore::TextureMapperSurfaceBackingStore::paintToTextureMapper): 28 * platform/graphics/texmap/TextureMapperSurfaceBackingStore.h: Added. 29 (WebCore): 30 (TextureMapperSurfaceBackingStore): 31 (WebCore::TextureMapperSurfaceBackingStore::create): 32 (WebCore::TextureMapperSurfaceBackingStore::~TextureMapperSurfaceBackingStore): 33 (WebCore::TextureMapperSurfaceBackingStore::TextureMapperSurfaceBackingStore): 34 * platform/graphics/texmap/TextureMapperTile.cpp: Added. 35 (WebCore): 36 (WebCore::TextureMapperTile::updateContents): 37 (WebCore::TextureMapperTile::paint): 38 * platform/graphics/texmap/TextureMapperTile.h: Added. 39 (WebCore): 40 (TextureMapperTile): 41 (WebCore::TextureMapperTile::texture): 42 (WebCore::TextureMapperTile::rect): 43 (WebCore::TextureMapperTile::setTexture): 44 (WebCore::TextureMapperTile::setRect): 45 (WebCore::TextureMapperTile::~TextureMapperTile): 46 (WebCore::TextureMapperTile::TextureMapperTile): 47 * platform/graphics/texmap/TextureMapperTiledBackingStore.cpp: Copied from Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp. 48 (WebCore): 49 (WebCore::TextureMapperTiledBackingStore::TextureMapperTiledBackingStore): 50 (WebCore::TextureMapperTiledBackingStore::updateContentsFromImageIfNeeded): 51 (WebCore::TextureMapperTiledBackingStore::adjustedTransformForRect): 52 (WebCore::TextureMapperTiledBackingStore::paintToTextureMapper): 53 (WebCore::TextureMapperTiledBackingStore::drawBorder): 54 (WebCore::TextureMapperTiledBackingStore::drawRepaintCounter): 55 (WebCore::TextureMapperTiledBackingStore::createOrDestroyTilesIfNeeded): 56 (WebCore::TextureMapperTiledBackingStore::updateContents): 57 (WebCore::TextureMapperTiledBackingStore::texture): 58 * platform/graphics/texmap/TextureMapperTiledBackingStore.h: Added. 59 (WebCore): 60 (TextureMapperTiledBackingStore): 61 (WebCore::TextureMapperTiledBackingStore::create): 62 (WebCore::TextureMapperTiledBackingStore::~TextureMapperTiledBackingStore): 63 (WebCore::TextureMapperTiledBackingStore::setContentsToImage): 64 (WebCore::TextureMapperTiledBackingStore::rect): 65 * platform/graphics/texmap/coordinated/CoordinatedBackingStore.h: 66 * platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h: 67 1 68 2013-02-09 Philip Rogers <pdr@google.com> 2 69 -
trunk/Source/WebCore/GNUmakefile.list.am
r142193 r142366 6484 6484 Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp \ 6485 6485 Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h \ 6486 Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h 6486 Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h \ 6487 Source/WebCore/platform/graphics/texmap/TextureMapperSurfaceBackingStore.cpp \ 6488 Source/WebCore/platform/graphics/texmap/TextureMapperSurfaceBackingStore.h \ 6489 Source/WebCore/platform/graphics/texmap/TextureMapperTile.cpp \ 6490 Source/WebCore/platform/graphics/texmap/TextureMapperTile.h \ 6491 Source/WebCore/platform/graphics/texmap/TextureMapperTiledBackingStore.cpp \ 6492 Source/WebCore/platform/graphics/texmap/TextureMapperTiledBackingStore.h 6487 6493 endif # END USE_TEXTURE_MAPPER_CAIRO 6488 6494 … … 6509 6515 Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp \ 6510 6516 Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h \ 6511 Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h 6517 Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h \ 6518 Source/WebCore/platform/graphics/texmap/TextureMapperSurfaceBackingStore.cpp \ 6519 Source/WebCore/platform/graphics/texmap/TextureMapperSurfaceBackingStore.h \ 6520 Source/WebCore/platform/graphics/texmap/TextureMapperTile.cpp \ 6521 Source/WebCore/platform/graphics/texmap/TextureMapperTile.h \ 6522 Source/WebCore/platform/graphics/texmap/TextureMapperTiledBackingStore.cpp \ 6523 Source/WebCore/platform/graphics/texmap/TextureMapperTiledBackingStore.h 6512 6524 endif # END USE_TEXTURE_MAPPER_GL 6513 6525 endif # USE_ACCELERATED_COMPOSITING -
trunk/Source/WebCore/Target.pri
r142355 r142366 31 31 Modules/geolocation/GeolocationController.cpp \ 32 32 Modules/geolocation/NavigatorGeolocation.cpp \ 33 \34 33 Modules/webdatabase/DOMWindowWebDatabase.cpp \ 35 34 Modules/webdatabase/Database.cpp \ … … 40 39 Modules/webdatabase/DatabaseSync.cpp \ 41 40 Modules/webdatabase/WorkerContextWebDatabase.cpp \ 42 \43 41 accessibility/AccessibilityImageMapLink.cpp \ 44 42 accessibility/AccessibilityMediaControls.cpp \ … … 2271 2269 platform/graphics/texmap/TextureMapperLayer.h \ 2272 2270 platform/graphics/texmap/TextureMapperPlatformLayer.h \ 2271 platform/graphics/texmap/TextureMapperSurfaceBackingStore.h \ 2272 platform/graphics/texmap/TextureMapperTile.h \ 2273 platform/graphics/texmap/TextureMapperTiledBackingStore.h \ 2273 2274 platform/graphics/Tile.h \ 2274 2275 platform/graphics/TiledBackingStore.h \ … … 2905 2906 platform/graphics/texmap/TextureMapperImageBuffer.cpp \ 2906 2907 platform/graphics/texmap/TextureMapperLayer.cpp \ 2908 platform/graphics/texmap/TextureMapperSurfaceBackingStore.cpp \ 2909 platform/graphics/texmap/TextureMapperTile.cpp \ 2910 platform/graphics/texmap/TextureMapperTiledBackingStore.cpp \ 2907 2911 platform/network/DNSResolveQueue.cpp \ 2908 2912 platform/network/MIMESniffing.cpp \ -
trunk/Source/WebCore/WebCore.gypi
r142193 r142366 4191 4191 'platform/graphics/texmap/TextureMapperLayer.h', 4192 4192 'platform/graphics/texmap/TextureMapperPlatformLayer.h', 4193 'platform/graphics/texmap/TextureMapperSurfaceBackingStore.cpp', 4194 'platform/graphics/texmap/TextureMapperSurfaceBackingStore.h', 4195 'platform/graphics/texmap/TextureMapperTile.cpp', 4196 'platform/graphics/texmap/TextureMapperTile.h', 4197 'platform/graphics/texmap/TextureMapperTiledBackingStore.cpp', 4198 'platform/graphics/texmap/TextureMapperTiledBackingStore.h', 4193 4199 'platform/graphics/transforms/IdentityTransformOperation.h', 4194 4200 'platform/graphics/transforms/Matrix3DTransformOperation.cpp', -
trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h
r141543 r142366 25 25 #include "Image.h" 26 26 #include "TextureMapperLayer.h" 27 #include "TextureMapperTiledBackingStore.h" 27 28 #include "Timer.h" 28 29 -
trunk/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp
r141637 r142366 34 34 namespace WebCore { 35 35 36 #if USE(GRAPHICS_SURFACE)37 void TextureMapperSurfaceBackingStore::setGraphicsSurface(PassRefPtr<GraphicsSurface> surface)38 {39 m_graphicsSurface = surface;40 }41 42 void TextureMapperSurfaceBackingStore::swapBuffersIfNeeded(uint32_t)43 {44 if (m_graphicsSurface)45 m_graphicsSurface->swapBuffers();46 }47 48 PassRefPtr<BitmapTexture> TextureMapperSurfaceBackingStore::texture() const49 {50 // FIXME: Instead of just returning an empty texture, we should wrap the texture contents into a BitmapTexture.51 RefPtr<BitmapTexture> emptyTexture;52 return emptyTexture;53 }54 55 void TextureMapperSurfaceBackingStore::paintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& transform, float opacity, BitmapTexture* mask)56 {57 if (m_graphicsSurface)58 m_graphicsSurface->paintToTextureMapper(textureMapper, targetRect, transform, opacity, mask);59 }60 #endif61 62 void TextureMapperTile::updateContents(TextureMapper* textureMapper, Image* image, const IntRect& dirtyRect, BitmapTexture::UpdateContentsFlag updateContentsFlag)63 {64 IntRect targetRect = enclosingIntRect(m_rect);65 targetRect.intersect(dirtyRect);66 if (targetRect.isEmpty())67 return;68 IntPoint sourceOffset = targetRect.location();69 70 // Normalize sourceRect to the buffer's coordinates.71 sourceOffset.move(-dirtyRect.x(), -dirtyRect.y());72 73 // Normalize targetRect to the texture's coordinates.74 targetRect.move(-m_rect.x(), -m_rect.y());75 if (!m_texture) {76 m_texture = textureMapper->createTexture();77 m_texture->reset(targetRect.size(), image->currentFrameKnownToBeOpaque() ? 0 : BitmapTexture::SupportsAlpha);78 }79 80 m_texture->updateContents(image, targetRect, sourceOffset, updateContentsFlag);81 }82 83 void TextureMapperTile::updateContents(TextureMapper* textureMapper, GraphicsLayer* sourceLayer, const IntRect& dirtyRect, BitmapTexture::UpdateContentsFlag updateContentsFlag)84 {85 IntRect targetRect = enclosingIntRect(m_rect);86 targetRect.intersect(dirtyRect);87 if (targetRect.isEmpty())88 return;89 IntPoint sourceOffset = targetRect.location();90 91 // Normalize targetRect to the texture's coordinates.92 targetRect.move(-m_rect.x(), -m_rect.y());93 94 if (!m_texture) {95 m_texture = textureMapper->createTexture();96 m_texture->reset(targetRect.size(), BitmapTexture::SupportsAlpha);97 }98 99 m_texture->updateContents(textureMapper, sourceLayer, targetRect, sourceOffset, updateContentsFlag);100 }101 102 void TextureMapperTile::paint(TextureMapper* textureMapper, const TransformationMatrix& transform, float opacity, BitmapTexture* mask, const unsigned exposedEdges)103 {104 if (texture().get())105 textureMapper->drawTexture(*texture().get(), rect(), transform, opacity, mask, exposedEdges);106 }107 108 TextureMapperTiledBackingStore::TextureMapperTiledBackingStore()109 {110 }111 112 void TextureMapperTiledBackingStore::updateContentsFromImageIfNeeded(TextureMapper* textureMapper)113 {114 if (!m_image)115 return;116 117 updateContents(textureMapper, m_image.get(), m_image->size(), m_image->rect(), BitmapTexture::UpdateCannotModifyOriginalImageData);118 m_image.clear();119 }120 121 36 unsigned TextureMapperBackingStore::calculateExposedTileEdges(const FloatRect& totalRect, const FloatRect& tileRect) 122 37 { … … 133 48 } 134 49 135 TransformationMatrix TextureMapperTiledBackingStore::adjustedTransformForRect(const FloatRect& targetRect)136 {137 return TransformationMatrix::rectToRect(rect(), targetRect);138 }139 140 void TextureMapperTiledBackingStore::paintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& transform, float opacity, BitmapTexture* mask)141 {142 updateContentsFromImageIfNeeded(textureMapper);143 TransformationMatrix adjustedTransform = transform * adjustedTransformForRect(targetRect);144 for (size_t i = 0; i < m_tiles.size(); ++i)145 m_tiles[i].paint(textureMapper, adjustedTransform, opacity, mask, calculateExposedTileEdges(rect(), m_tiles[i].rect()));146 }147 148 void TextureMapperTiledBackingStore::drawBorder(TextureMapper* textureMapper, const Color& borderColor, float borderWidth, const FloatRect& targetRect, const TransformationMatrix& transform)149 {150 TransformationMatrix adjustedTransform = transform * adjustedTransformForRect(targetRect);151 for (size_t i = 0; i < m_tiles.size(); ++i)152 textureMapper->drawBorder(borderColor, borderWidth, m_tiles[i].rect(), adjustedTransform);153 }154 155 void TextureMapperTiledBackingStore::drawRepaintCounter(TextureMapper* textureMapper, int repaintCount, const Color& borderColor, const FloatRect& targetRect, const TransformationMatrix& transform)156 {157 TransformationMatrix adjustedTransform = transform * adjustedTransformForRect(targetRect);158 for (size_t i = 0; i < m_tiles.size(); ++i)159 textureMapper->drawRepaintCounter(repaintCount, borderColor, m_tiles[i].rect().location(), adjustedTransform);160 }161 162 void TextureMapperTiledBackingStore::createOrDestroyTilesIfNeeded(const FloatSize& size, const IntSize& tileSize, bool hasAlpha)163 {164 if (size == m_size)165 return;166 167 m_size = size;168 169 Vector<FloatRect> tileRectsToAdd;170 Vector<int> tileIndicesToRemove;171 static const size_t TileEraseThreshold = 6;172 173 // This method recycles tiles. We check which tiles we need to add, which to remove, and use as many174 // removable tiles as replacement for new tiles when possible.175 for (float y = 0; y < m_size.height(); y += tileSize.height()) {176 for (float x = 0; x < m_size.width(); x += tileSize.width()) {177 FloatRect tileRect(x, y, tileSize.width(), tileSize.height());178 tileRect.intersect(rect());179 tileRectsToAdd.append(tileRect);180 }181 }182 183 // Check which tiles need to be removed, and which already exist.184 for (int i = m_tiles.size() - 1; i >= 0; --i) {185 FloatRect oldTile = m_tiles[i].rect();186 bool existsAlready = false;187 188 for (int j = tileRectsToAdd.size() - 1; j >= 0; --j) {189 FloatRect newTile = tileRectsToAdd[j];190 if (oldTile != newTile)191 continue;192 193 // A tile that we want to add already exists, no need to add or remove it.194 existsAlready = true;195 tileRectsToAdd.remove(j);196 break;197 }198 199 // This tile is not needed.200 if (!existsAlready)201 tileIndicesToRemove.append(i);202 }203 204 // Recycle removable tiles to be used for newly requested tiles.205 for (size_t i = 0; i < tileRectsToAdd.size(); ++i) {206 if (!tileIndicesToRemove.isEmpty()) {207 // We recycle an existing tile for usage with a new tile rect.208 TextureMapperTile& tile = m_tiles[tileIndicesToRemove.last()];209 tileIndicesToRemove.removeLast();210 tile.setRect(tileRectsToAdd[i]);211 212 if (tile.texture())213 tile.texture()->reset(enclosingIntRect(tile.rect()).size(), hasAlpha ? BitmapTexture::SupportsAlpha : 0);214 continue;215 }216 217 m_tiles.append(TextureMapperTile(tileRectsToAdd[i]));218 }219 220 // Remove unnecessary tiles, if they weren't recycled.221 // We use a threshold to make sure we don't create/destroy tiles too eagerly.222 for (size_t i = 0; i < tileIndicesToRemove.size() && m_tiles.size() > TileEraseThreshold; ++i)223 m_tiles.remove(tileIndicesToRemove[i]);224 }225 226 void TextureMapperTiledBackingStore::updateContents(TextureMapper* textureMapper, Image* image, const FloatSize& totalSize, const IntRect& dirtyRect, BitmapTexture::UpdateContentsFlag updateContentsFlag)227 {228 createOrDestroyTilesIfNeeded(totalSize, textureMapper->maxTextureSize(), !image->currentFrameKnownToBeOpaque());229 for (size_t i = 0; i < m_tiles.size(); ++i)230 m_tiles[i].updateContents(textureMapper, image, dirtyRect, updateContentsFlag);231 }232 233 void TextureMapperTiledBackingStore::updateContents(TextureMapper* textureMapper, GraphicsLayer* sourceLayer, const FloatSize& totalSize, const IntRect& dirtyRect, BitmapTexture::UpdateContentsFlag updateContentsFlag)234 {235 createOrDestroyTilesIfNeeded(totalSize, textureMapper->maxTextureSize(), true);236 for (size_t i = 0; i < m_tiles.size(); ++i)237 m_tiles[i].updateContents(textureMapper, sourceLayer, dirtyRect, updateContentsFlag);238 }239 240 PassRefPtr<BitmapTexture> TextureMapperTiledBackingStore::texture() const241 {242 for (size_t i = 0; i < m_tiles.size(); ++i) {243 RefPtr<BitmapTexture> texture = m_tiles[i].texture();244 if (texture)245 return texture;246 }247 248 return PassRefPtr<BitmapTexture>();249 }250 251 50 } 252 51 #endif -
trunk/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.h
r140821 r142366 44 44 virtual ~TextureMapperBackingStore() { } 45 45 46 47 46 protected: 48 47 static unsigned calculateExposedTileEdges(const FloatRect& totalRect, const FloatRect& tileRect); 49 };50 51 #if USE(GRAPHICS_SURFACE)52 class TextureMapperSurfaceBackingStore : public TextureMapperBackingStore {53 public:54 static PassRefPtr<TextureMapperSurfaceBackingStore> create() { return adoptRef(new TextureMapperSurfaceBackingStore); }55 void setGraphicsSurface(PassRefPtr<GraphicsSurface>);56 void swapBuffersIfNeeded(uint32_t frontBuffer);57 virtual PassRefPtr<BitmapTexture> texture() const;58 virtual void paintToTextureMapper(TextureMapper*, const FloatRect&, const TransformationMatrix&, float, BitmapTexture*);59 virtual ~TextureMapperSurfaceBackingStore() { }60 61 private:62 TextureMapperSurfaceBackingStore()63 : TextureMapperBackingStore()64 { }65 66 RefPtr<GraphicsSurface> m_graphicsSurface;67 };68 #endif69 70 class TextureMapperTile {71 public:72 inline PassRefPtr<BitmapTexture> texture() const { return m_texture; }73 inline FloatRect rect() const { return m_rect; }74 inline void setTexture(BitmapTexture* texture) { m_texture = texture; }75 inline void setRect(const FloatRect& rect) { m_rect = rect; }76 77 void updateContents(TextureMapper*, Image*, const IntRect&, BitmapTexture::UpdateContentsFlag UpdateCanModifyOriginalImageData);78 void updateContents(TextureMapper*, GraphicsLayer*, const IntRect&, BitmapTexture::UpdateContentsFlag UpdateCanModifyOriginalImageData);79 virtual void paint(TextureMapper*, const TransformationMatrix&, float, BitmapTexture*, const unsigned exposedEdges);80 virtual ~TextureMapperTile() { }81 82 explicit TextureMapperTile(const FloatRect& rect)83 : m_rect(rect)84 {85 }86 87 private:88 RefPtr<BitmapTexture> m_texture;89 FloatRect m_rect;90 };91 92 class TextureMapperTiledBackingStore : public TextureMapperBackingStore {93 public:94 static PassRefPtr<TextureMapperTiledBackingStore> create() { return adoptRef(new TextureMapperTiledBackingStore); }95 virtual ~TextureMapperTiledBackingStore() { }96 97 virtual PassRefPtr<BitmapTexture> texture() const OVERRIDE;98 virtual void paintToTextureMapper(TextureMapper*, const FloatRect&, const TransformationMatrix&, float, BitmapTexture*) OVERRIDE;99 virtual void drawBorder(TextureMapper*, const Color&, float borderWidth, const FloatRect&, const TransformationMatrix&) OVERRIDE;100 virtual void drawRepaintCounter(TextureMapper*, int repaintCount, const Color&, const FloatRect&, const TransformationMatrix&) OVERRIDE;101 void updateContents(TextureMapper*, Image*, const FloatSize&, const IntRect&, BitmapTexture::UpdateContentsFlag);102 void updateContents(TextureMapper*, GraphicsLayer*, const FloatSize&, const IntRect&, BitmapTexture::UpdateContentsFlag);103 104 void setContentsToImage(Image* image) { m_image = image; }105 106 private:107 TextureMapperTiledBackingStore();108 void createOrDestroyTilesIfNeeded(const FloatSize& backingStoreSize, const IntSize& tileSize, bool hasAlpha);109 void updateContentsFromImageIfNeeded(TextureMapper*);110 TransformationMatrix adjustedTransformForRect(const FloatRect&);111 inline FloatRect rect() const { return FloatRect(FloatPoint::zero(), m_size); }112 113 Vector<TextureMapperTile> m_tiles;114 FloatSize m_size;115 RefPtr<Image> m_image;116 48 }; 117 49 -
trunk/Source/WebCore/platform/graphics/texmap/TextureMapperTiledBackingStore.cpp
r142365 r142366 21 21 22 22 #if USE(ACCELERATED_COMPOSITING) 23 #include "TextureMapper BackingStore.h"23 #include "TextureMapperTiledBackingStore.h" 24 24 25 #include "GraphicsLayer.h"26 25 #include "ImageBuffer.h" 27 26 #include "TextureMapper.h" 28 27 29 #if USE(GRAPHICS_SURFACE)30 #include "GraphicsSurface.h"31 #include "TextureMapperGL.h"32 #endif33 34 28 namespace WebCore { 35 29 36 #if USE(GRAPHICS_SURFACE) 37 void TextureMapperSurfaceBackingStore::setGraphicsSurface(PassRefPtr<GraphicsSurface> surface) 38 { 39 m_graphicsSurface = surface; 40 } 41 42 void TextureMapperSurfaceBackingStore::swapBuffersIfNeeded(uint32_t) 43 { 44 if (m_graphicsSurface) 45 m_graphicsSurface->swapBuffers(); 46 } 47 48 PassRefPtr<BitmapTexture> TextureMapperSurfaceBackingStore::texture() const 49 { 50 // FIXME: Instead of just returning an empty texture, we should wrap the texture contents into a BitmapTexture. 51 RefPtr<BitmapTexture> emptyTexture; 52 return emptyTexture; 53 } 54 55 void TextureMapperSurfaceBackingStore::paintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& transform, float opacity, BitmapTexture* mask) 56 { 57 if (m_graphicsSurface) 58 m_graphicsSurface->paintToTextureMapper(textureMapper, targetRect, transform, opacity, mask); 59 } 60 #endif 61 62 void TextureMapperTile::updateContents(TextureMapper* textureMapper, Image* image, const IntRect& dirtyRect, BitmapTexture::UpdateContentsFlag updateContentsFlag) 63 { 64 IntRect targetRect = enclosingIntRect(m_rect); 65 targetRect.intersect(dirtyRect); 66 if (targetRect.isEmpty()) 67 return; 68 IntPoint sourceOffset = targetRect.location(); 69 70 // Normalize sourceRect to the buffer's coordinates. 71 sourceOffset.move(-dirtyRect.x(), -dirtyRect.y()); 72 73 // Normalize targetRect to the texture's coordinates. 74 targetRect.move(-m_rect.x(), -m_rect.y()); 75 if (!m_texture) { 76 m_texture = textureMapper->createTexture(); 77 m_texture->reset(targetRect.size(), image->currentFrameKnownToBeOpaque() ? 0 : BitmapTexture::SupportsAlpha); 78 } 79 80 m_texture->updateContents(image, targetRect, sourceOffset, updateContentsFlag); 81 } 82 83 void TextureMapperTile::updateContents(TextureMapper* textureMapper, GraphicsLayer* sourceLayer, const IntRect& dirtyRect, BitmapTexture::UpdateContentsFlag updateContentsFlag) 84 { 85 IntRect targetRect = enclosingIntRect(m_rect); 86 targetRect.intersect(dirtyRect); 87 if (targetRect.isEmpty()) 88 return; 89 IntPoint sourceOffset = targetRect.location(); 90 91 // Normalize targetRect to the texture's coordinates. 92 targetRect.move(-m_rect.x(), -m_rect.y()); 93 94 if (!m_texture) { 95 m_texture = textureMapper->createTexture(); 96 m_texture->reset(targetRect.size(), BitmapTexture::SupportsAlpha); 97 } 98 99 m_texture->updateContents(textureMapper, sourceLayer, targetRect, sourceOffset, updateContentsFlag); 100 } 101 102 void TextureMapperTile::paint(TextureMapper* textureMapper, const TransformationMatrix& transform, float opacity, BitmapTexture* mask, const unsigned exposedEdges) 103 { 104 if (texture().get()) 105 textureMapper->drawTexture(*texture().get(), rect(), transform, opacity, mask, exposedEdges); 106 } 30 class GraphicsLayer; 107 31 108 32 TextureMapperTiledBackingStore::TextureMapperTiledBackingStore() … … 117 41 updateContents(textureMapper, m_image.get(), m_image->size(), m_image->rect(), BitmapTexture::UpdateCannotModifyOriginalImageData); 118 42 m_image.clear(); 119 }120 121 unsigned TextureMapperBackingStore::calculateExposedTileEdges(const FloatRect& totalRect, const FloatRect& tileRect)122 {123 unsigned exposedEdges = TextureMapper::NoEdges;124 if (!tileRect.x())125 exposedEdges |= TextureMapper::LeftEdge;126 if (!tileRect.y())127 exposedEdges |= TextureMapper::TopEdge;128 if (tileRect.width() + tileRect.x() >= totalRect.width())129 exposedEdges |= TextureMapper::RightEdge;130 if (tileRect.height() + tileRect.y() >= totalRect.height())131 exposedEdges |= TextureMapper::BottomEdge;132 return exposedEdges;133 43 } 134 44 … … 249 159 } 250 160 251 } 161 } // namespace WebCore 252 162 #endif -
trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBackingStore.h
r141543 r142366 25 25 #include "TextureMapper.h" 26 26 #include "TextureMapperBackingStore.h" 27 #include "TextureMapperTile.h" 27 28 #include <wtf/HashMap.h> 28 29 #include <wtf/HashSet.h> -
trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h
r141543 r142366 38 38 #include <wtf/ThreadingPrimitives.h> 39 39 #include <wtf/Vector.h> 40 41 #if USE(GRAPHICS_SURFACE) 42 #include "TextureMapperSurfaceBackingStore.h" 43 #endif 40 44 41 45 namespace WebCore {
Note: See TracChangeset
for help on using the changeset viewer.