Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: cc/test/tiled_layer_test_common.cc

Issue 12774006: cc: Chromify Layer and LayerImpl classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: MoreAndroidCompilings Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/test/tiled_layer_test_common.h ('k') | cc/texture_layer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 84
85 FakeTiledLayer::FakeTiledLayer(PrioritizedResourceManager* resourceManager) 85 FakeTiledLayer::FakeTiledLayer(PrioritizedResourceManager* resourceManager)
86 : TiledLayer() 86 : TiledLayer()
87 , m_fakeUpdater(make_scoped_refptr(new FakeLayerUpdater)) 87 , m_fakeUpdater(make_scoped_refptr(new FakeLayerUpdater))
88 , m_resourceManager(resourceManager) 88 , m_resourceManager(resourceManager)
89 { 89 {
90 setTileSize(tileSize()); 90 setTileSize(tileSize());
91 setTextureFormat(GL_RGBA); 91 setTextureFormat(GL_RGBA);
92 setBorderTexelOption(LayerTilingData::NoBorderTexels); 92 setBorderTexelOption(LayerTilingData::NoBorderTexels);
93 setIsDrawable(true); // So that we don't get false positives if any of these tests expect to return false from drawsContent() for other reasons. 93 SetIsDrawable(true); // So that we don't get false positives if any of these tests expect to return false from DrawsContent() for other reasons.
94 } 94 }
95 95
96 FakeTiledLayerWithScaledBounds::FakeTiledLayerWithScaledBounds(PrioritizedResour ceManager* resourceManager) 96 FakeTiledLayerWithScaledBounds::FakeTiledLayerWithScaledBounds(PrioritizedResour ceManager* resourceManager)
97 : FakeTiledLayer(resourceManager) 97 : FakeTiledLayer(resourceManager)
98 { 98 {
99 } 99 }
100 100
101 FakeTiledLayerWithScaledBounds::~FakeTiledLayerWithScaledBounds() 101 FakeTiledLayerWithScaledBounds::~FakeTiledLayerWithScaledBounds()
102 { 102 {
103 } 103 }
104 104
105 FakeTiledLayer::~FakeTiledLayer() 105 FakeTiledLayer::~FakeTiledLayer()
106 { 106 {
107 } 107 }
108 108
109 void FakeTiledLayer::setNeedsDisplayRect(const gfx::RectF& rect) 109 void FakeTiledLayer::SetNeedsDisplayRect(const gfx::RectF& rect)
110 { 110 {
111 m_lastNeedsDisplayRect = rect; 111 m_lastNeedsDisplayRect = rect;
112 TiledLayer::setNeedsDisplayRect(rect); 112 TiledLayer::SetNeedsDisplayRect(rect);
113 } 113 }
114 114
115 void FakeTiledLayer::setTexturePriorities(const PriorityCalculator& calculator) 115 void FakeTiledLayer::SetTexturePriorities(const PriorityCalculator& calculator)
116 { 116 {
117 // Ensure there is always a target render surface available. If none has bee n 117 // Ensure there is always a target render surface available. If none has bee n
118 // set (the layer is an orphan for the test), then just set a surface on its elf. 118 // set (the layer is an orphan for the test), then just set a surface on its elf.
119 bool missingTargetRenderSurface = !renderTarget(); 119 bool missingTargetRenderSurface = !render_target();
120 120
121 if (missingTargetRenderSurface) 121 if (missingTargetRenderSurface)
122 createRenderSurface(); 122 CreateRenderSurface();
123 123
124 TiledLayer::setTexturePriorities(calculator); 124 TiledLayer::SetTexturePriorities(calculator);
125 125
126 if (missingTargetRenderSurface) { 126 if (missingTargetRenderSurface) {
127 clearRenderSurface(); 127 ClearRenderSurface();
128 drawProperties().render_target = 0; 128 draw_properties().render_target = 0;
129 } 129 }
130 } 130 }
131 131
132 cc::PrioritizedResourceManager* FakeTiledLayer::resourceManager() const 132 cc::PrioritizedResourceManager* FakeTiledLayer::resourceManager() const
133 { 133 {
134 return m_resourceManager; 134 return m_resourceManager;
135 } 135 }
136 136
137 void FakeTiledLayer::updateContentsScale(float idealContentsScale) 137 void FakeTiledLayer::updateContentsScale(float ideal_contents_scale)
138 { 138 {
139 calculateContentsScale( 139 CalculateContentsScale(
140 idealContentsScale, 140 ideal_contents_scale,
141 false, // animating_transform_to_screen 141 false, // animating_transform_to_screen
142 &drawProperties().contents_scale_x, 142 &draw_properties().contents_scale_x,
143 &drawProperties().contents_scale_y, 143 &draw_properties().contents_scale_y,
144 &drawProperties().content_bounds); 144 &draw_properties().content_bounds);
145 } 145 }
146 146
147 cc::LayerUpdater* FakeTiledLayer::updater() const 147 cc::LayerUpdater* FakeTiledLayer::updater() const
148 { 148 {
149 return m_fakeUpdater.get(); 149 return m_fakeUpdater.get();
150 } 150 }
151 151
152 void FakeTiledLayerWithScaledBounds::setContentBounds(const gfx::Size& contentBo unds) 152 void FakeTiledLayerWithScaledBounds::setContentBounds(const gfx::Size& contentBo unds)
153 { 153 {
154 m_forcedContentBounds = contentBounds; 154 m_forcedContentBounds = contentBounds;
155 drawProperties().content_bounds = m_forcedContentBounds; 155 draw_properties().content_bounds = m_forcedContentBounds;
156 } 156 }
157 157
158 void FakeTiledLayerWithScaledBounds::calculateContentsScale( 158 void FakeTiledLayerWithScaledBounds::CalculateContentsScale(
159 float idealContentsScale, 159 float ideal_contents_scale,
160 bool animatingTransformToScreen, 160 bool animating_transform_to_screen,
161 float* contentsScaleX, 161 float* contents_scale_x,
162 float* contentsScaleY, 162 float* contents_scale_y,
163 gfx::Size* contentBounds) 163 gfx::Size* contentBounds)
164 { 164 {
165 *contentsScaleX = static_cast<float>(m_forcedContentBounds.width()) / bounds ().width(); 165 *contents_scale_x = static_cast<float>(m_forcedContentBounds.width()) / boun ds().width();
166 *contentsScaleY = static_cast<float>(m_forcedContentBounds.height()) / bound s().height(); 166 *contents_scale_y = static_cast<float>(m_forcedContentBounds.height()) / bou nds().height();
167 *contentBounds = m_forcedContentBounds; 167 *contentBounds = m_forcedContentBounds;
168 } 168 }
169 169
170 } // namespace cc 170 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/tiled_layer_test_common.h ('k') | cc/texture_layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698