| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "cc/test/tiled_layer_test_common.h" | 5 #include "cc/test/tiled_layer_test_common.h" |
| 6 | 6 |
| 7 using cc::LayerTilingData; | 7 using cc::LayerTilingData; |
| 8 using cc::LayerUpdater; | 8 using cc::LayerUpdater; |
| 9 using cc::PriorityCalculator; | 9 using cc::PriorityCalculator; |
| 10 using cc::PrioritizedResource; | 10 using cc::PrioritizedResource; |
| 11 using cc::PrioritizedResourceManager; | 11 using cc::PrioritizedResourceManager; |
| 12 using cc::RenderingStats; | 12 using cc::RenderingStats; |
| 13 using cc::ResourceUpdate; | 13 using cc::ResourceUpdate; |
| 14 using cc::ResourceUpdateQueue; | 14 using cc::ResourceUpdateQueue; |
| 15 | 15 |
| 16 namespace cc { | 16 namespace cc { |
| 17 | 17 |
| 18 FakeLayerUpdater::Resource::Resource(FakeLayerUpdater* layer, scoped_ptr<Priorit
izedResource> texture) | 18 FakeLayerUpdater::Resource::Resource(FakeLayerUpdater* layer, scoped_ptr<Priorit
izedResource> texture) |
| 19 : LayerUpdater::Resource(texture.Pass()) | 19 : LayerUpdater::Resource(texture.Pass()) |
| 20 , m_layer(layer) | 20 , m_layer(layer) |
| 21 { | 21 { |
| 22 m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); | 22 m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); |
| 23 m_bitmap.allocPixels(); | 23 m_bitmap.allocPixels(); |
| 24 } | 24 } |
| 25 | 25 |
| 26 FakeLayerUpdater::Resource::~Resource() | 26 FakeLayerUpdater::Resource::~Resource() |
| 27 { | 27 { |
| 28 } | 28 } |
| 29 | 29 |
| 30 void FakeLayerUpdater::Resource::update(ResourceUpdateQueue& queue, const gfx::R
ect&, const gfx::Vector2d&, bool partialUpdate, RenderingStats&) | 30 void FakeLayerUpdater::Resource::update(ResourceUpdateQueue& queue, const gfx::R
ect&, const gfx::Vector2d&, bool partialUpdate, RenderingStats*) |
| 31 { | 31 { |
| 32 const gfx::Rect rect(0, 0, 10, 10); | 32 const gfx::Rect rect(0, 0, 10, 10); |
| 33 ResourceUpdate upload = ResourceUpdate::Create( | 33 ResourceUpdate upload = ResourceUpdate::Create( |
| 34 texture(), &m_bitmap, rect, rect, gfx::Vector2d()); | 34 texture(), &m_bitmap, rect, rect, gfx::Vector2d()); |
| 35 if (partialUpdate) | 35 if (partialUpdate) |
| 36 queue.appendPartialUpload(upload); | 36 queue.appendPartialUpload(upload); |
| 37 else | 37 else |
| 38 queue.appendFullUpload(upload); | 38 queue.appendFullUpload(upload); |
| 39 | 39 |
| 40 m_layer->update(); | 40 m_layer->update(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 FakeLayerUpdater::FakeLayerUpdater() | 43 FakeLayerUpdater::FakeLayerUpdater() |
| 44 : m_prepareCount(0) | 44 : m_prepareCount(0) |
| 45 , m_updateCount(0) | 45 , m_updateCount(0) |
| 46 { | 46 { |
| 47 } | 47 } |
| 48 | 48 |
| 49 FakeLayerUpdater::~FakeLayerUpdater() | 49 FakeLayerUpdater::~FakeLayerUpdater() |
| 50 { | 50 { |
| 51 } | 51 } |
| 52 | 52 |
| 53 void FakeLayerUpdater::prepareToUpdate(const gfx::Rect& contentRect, const gfx::
Size&, float, float, gfx::Rect& resultingOpaqueRect, RenderingStats&) | 53 void FakeLayerUpdater::prepareToUpdate(const gfx::Rect& contentRect, const gfx::
Size&, float, float, gfx::Rect& resultingOpaqueRect, RenderingStats*) |
| 54 { | 54 { |
| 55 m_prepareCount++; | 55 m_prepareCount++; |
| 56 m_lastUpdateRect = contentRect; | 56 m_lastUpdateRect = contentRect; |
| 57 if (!m_rectToInvalidate.IsEmpty()) { | 57 if (!m_rectToInvalidate.IsEmpty()) { |
| 58 m_layer->invalidateContentRect(m_rectToInvalidate); | 58 m_layer->invalidateContentRect(m_rectToInvalidate); |
| 59 m_rectToInvalidate = gfx::Rect(); | 59 m_rectToInvalidate = gfx::Rect(); |
| 60 m_layer = NULL; | 60 m_layer = NULL; |
| 61 } | 61 } |
| 62 resultingOpaqueRect = m_opaquePaintRect; | 62 resultingOpaqueRect = m_opaquePaintRect; |
| 63 } | 63 } |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 *contentsScaleY = static_cast<float>(m_forcedContentBounds.height()) / bound
s().height(); | 164 *contentsScaleY = static_cast<float>(m_forcedContentBounds.height()) / bound
s().height(); |
| 165 *contentBounds = m_forcedContentBounds; | 165 *contentBounds = m_forcedContentBounds; |
| 166 } | 166 } |
| 167 | 167 |
| 168 void FakeTiledLayerWithScaledBounds::didUpdateBounds() | 168 void FakeTiledLayerWithScaledBounds::didUpdateBounds() |
| 169 { | 169 { |
| 170 drawProperties().content_bounds = m_forcedContentBounds; | 170 drawProperties().content_bounds = m_forcedContentBounds; |
| 171 } | 171 } |
| 172 | 172 |
| 173 } // namespace cc | 173 } // namespace cc |
| OLD | NEW |