| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "CCTiledLayerImpl.h" | 7 #include "CCTiledLayerImpl.h" |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 static const int defaultCheckerboardColorBlue = 241; | 39 static const int defaultCheckerboardColorBlue = 241; |
| 40 static const int debugTileEvictedCheckerboardColorRed = 255; | 40 static const int debugTileEvictedCheckerboardColorRed = 255; |
| 41 static const int debugTileEvictedCheckerboardColorGreen = 200; | 41 static const int debugTileEvictedCheckerboardColorGreen = 200; |
| 42 static const int debugTileEvictedCheckerboardColorBlue = 200; | 42 static const int debugTileEvictedCheckerboardColorBlue = 200; |
| 43 static const int debugTileInvalidatedCheckerboardColorRed = 128; | 43 static const int debugTileInvalidatedCheckerboardColorRed = 128; |
| 44 static const int debugTileInvalidatedCheckerboardColorGreen = 200; | 44 static const int debugTileInvalidatedCheckerboardColorGreen = 200; |
| 45 static const int debugTileInvalidatedCheckerboardColorBlue = 245; | 45 static const int debugTileInvalidatedCheckerboardColorBlue = 245; |
| 46 | 46 |
| 47 class DrawableTile : public CCLayerTilingData::Tile { | 47 class DrawableTile : public CCLayerTilingData::Tile { |
| 48 public: | 48 public: |
| 49 static PassOwnPtr<DrawableTile> create() { return adoptPtr(new DrawableTile(
)); } | 49 static scoped_ptr<DrawableTile> create() { return make_scoped_ptr(new Drawab
leTile()); } |
| 50 | 50 |
| 51 CCResourceProvider::ResourceId resourceId() const { return m_resourceId; } | 51 CCResourceProvider::ResourceId resourceId() const { return m_resourceId; } |
| 52 void setResourceId(CCResourceProvider::ResourceId resourceId) { m_resourceId
= resourceId; } | 52 void setResourceId(CCResourceProvider::ResourceId resourceId) { m_resourceId
= resourceId; } |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 DrawableTile() : m_resourceId(0) { } | 55 DrawableTile() : m_resourceId(0) { } |
| 56 | 56 |
| 57 CCResourceProvider::ResourceId m_resourceId; | 57 CCResourceProvider::ResourceId m_resourceId; |
| 58 | 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(DrawableTile); | 59 DISALLOW_COPY_AND_ASSIGN(DrawableTile); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 return hasTileAt(i, j) && tileAt(i, j)->resourceId(); | 99 return hasTileAt(i, j) && tileAt(i, j)->resourceId(); |
| 100 } | 100 } |
| 101 | 101 |
| 102 DrawableTile* CCTiledLayerImpl::tileAt(int i, int j) const | 102 DrawableTile* CCTiledLayerImpl::tileAt(int i, int j) const |
| 103 { | 103 { |
| 104 return static_cast<DrawableTile*>(m_tiler->tileAt(i, j)); | 104 return static_cast<DrawableTile*>(m_tiler->tileAt(i, j)); |
| 105 } | 105 } |
| 106 | 106 |
| 107 DrawableTile* CCTiledLayerImpl::createTile(int i, int j) | 107 DrawableTile* CCTiledLayerImpl::createTile(int i, int j) |
| 108 { | 108 { |
| 109 OwnPtr<DrawableTile> tile(DrawableTile::create()); | 109 scoped_ptr<DrawableTile> tile(DrawableTile::create()); |
| 110 DrawableTile* addedTile = tile.get(); | 110 DrawableTile* addedTile = tile.get(); |
| 111 m_tiler->addTile(tile.release(), i, j); | 111 m_tiler->addTile(tile.PassAs<CCLayerTilingData::Tile>(), i, j); |
| 112 return addedTile; | 112 return addedTile; |
| 113 } | 113 } |
| 114 | 114 |
| 115 void CCTiledLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appe
ndQuadsData) | 115 void CCTiledLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appe
ndQuadsData) |
| 116 { | 116 { |
| 117 const IntRect& contentRect = visibleContentRect(); | 117 const IntRect& contentRect = visibleContentRect(); |
| 118 | 118 |
| 119 if (!m_tiler || m_tiler->hasEmptyBounds() || contentRect.isEmpty()) | 119 if (!m_tiler || m_tiler->hasEmptyBounds() || contentRect.isEmpty()) |
| 120 return; | 120 return; |
| 121 | 121 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 { | 240 { |
| 241 m_tiler->reset(); | 241 m_tiler->reset(); |
| 242 } | 242 } |
| 243 | 243 |
| 244 const char* CCTiledLayerImpl::layerTypeAsString() const | 244 const char* CCTiledLayerImpl::layerTypeAsString() const |
| 245 { | 245 { |
| 246 return "ContentLayer"; | 246 return "ContentLayer"; |
| 247 } | 247 } |
| 248 | 248 |
| 249 } // namespace cc | 249 } // namespace cc |
| OLD | NEW |