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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/test/tiled_layer_test_common.h" | 7 #include "cc/test/tiled_layer_test_common.h" |
8 | 8 |
9 using namespace cc; | 9 using namespace cc; |
10 | 10 |
11 namespace WebKitTests { | 11 namespace WebKitTests { |
12 | 12 |
13 FakeLayerUpdater::Resource::Resource(FakeLayerUpdater* layer, scoped_ptr<Priorit
izedTexture> texture) | 13 FakeLayerUpdater::Resource::Resource(FakeLayerUpdater* layer, scoped_ptr<Priorit
izedTexture> texture) |
14 : LayerUpdater::Resource(texture.Pass()) | 14 : LayerUpdater::Resource(texture.Pass()) |
15 , m_layer(layer) | 15 , m_layer(layer) |
16 { | 16 { |
17 m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); | 17 m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); |
18 m_bitmap.allocPixels(); | 18 m_bitmap.allocPixels(); |
19 } | 19 } |
20 | 20 |
21 FakeLayerUpdater::Resource::~Resource() | 21 FakeLayerUpdater::Resource::~Resource() |
22 { | 22 { |
23 } | 23 } |
24 | 24 |
25 void FakeLayerUpdater::Resource::update(ResourceUpdateQueue& queue, const IntRec
t&, const IntSize&, bool partialUpdate, RenderingStats&) | 25 void FakeLayerUpdater::Resource::update(ResourceUpdateQueue& queue, const gfx::R
ect&, const gfx::Vector2d&, bool partialUpdate, RenderingStats&) |
26 { | 26 { |
27 const IntRect rect(0, 0, 10, 10); | 27 const gfx::Rect rect(0, 0, 10, 10); |
28 ResourceUpdate upload = ResourceUpdate::Create( | 28 ResourceUpdate upload = ResourceUpdate::Create( |
29 texture(), &m_bitmap, rect, rect, IntSize()); | 29 texture(), &m_bitmap, rect, rect, gfx::Vector2d()); |
30 if (partialUpdate) | 30 if (partialUpdate) |
31 queue.appendPartialUpload(upload); | 31 queue.appendPartialUpload(upload); |
32 else | 32 else |
33 queue.appendFullUpload(upload); | 33 queue.appendFullUpload(upload); |
34 | 34 |
35 m_layer->update(); | 35 m_layer->update(); |
36 } | 36 } |
37 | 37 |
38 FakeLayerUpdater::FakeLayerUpdater() | 38 FakeLayerUpdater::FakeLayerUpdater() |
39 : m_prepareCount(0) | 39 : m_prepareCount(0) |
40 , m_updateCount(0) | 40 , m_updateCount(0) |
41 { | 41 { |
42 } | 42 } |
43 | 43 |
44 FakeLayerUpdater::~FakeLayerUpdater() | 44 FakeLayerUpdater::~FakeLayerUpdater() |
45 { | 45 { |
46 } | 46 } |
47 | 47 |
48 void FakeLayerUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize
&, float, float, IntRect& resultingOpaqueRect, RenderingStats&) | 48 void FakeLayerUpdater::prepareToUpdate(const gfx::Rect& contentRect, const gfx::
Size&, float, float, gfx::Rect& resultingOpaqueRect, RenderingStats&) |
49 { | 49 { |
50 m_prepareCount++; | 50 m_prepareCount++; |
51 m_lastUpdateRect = contentRect; | 51 m_lastUpdateRect = contentRect; |
52 if (!m_rectToInvalidate.isEmpty()) { | 52 if (!m_rectToInvalidate.isEmpty()) { |
53 m_layer->invalidateContentRect(m_rectToInvalidate); | 53 m_layer->invalidateContentRect(m_rectToInvalidate); |
54 m_rectToInvalidate = IntRect(); | 54 m_rectToInvalidate = IntRect(); |
55 m_layer = NULL; | 55 m_layer = NULL; |
56 } | 56 } |
57 resultingOpaqueRect = m_opaquePaintRect; | 57 resultingOpaqueRect = m_opaquePaintRect; |
58 } | 58 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 { | 133 { |
134 return m_fakeUpdater.get(); | 134 return m_fakeUpdater.get(); |
135 } | 135 } |
136 | 136 |
137 cc::IntSize FakeTiledLayerWithScaledBounds::contentBounds() const | 137 cc::IntSize FakeTiledLayerWithScaledBounds::contentBounds() const |
138 { | 138 { |
139 return m_forcedContentBounds; | 139 return m_forcedContentBounds; |
140 } | 140 } |
141 | 141 |
142 } // namespace | 142 } // namespace |
OLD | NEW |