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 "cc/tiled_layer_impl.h" | 5 #include "cc/tiled_layer_impl.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "cc/append_quads_data.h" | 9 #include "cc/append_quads_data.h" |
10 #include "cc/checkerboard_draw_quad.h" | 10 #include "cc/checkerboard_draw_quad.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 // Keep track of how the top left has moved, so the texture can be | 188 // Keep track of how the top left has moved, so the texture can be |
189 // offset the same amount. | 189 // offset the same amount. |
190 gfx::Vector2d displayOffset = tileRect.origin() - displayRect.origin
(); | 190 gfx::Vector2d displayOffset = tileRect.origin() - displayRect.origin
(); |
191 gfx::Vector2d textureOffset = m_tiler->textureOffset(i, j) + display
Offset; | 191 gfx::Vector2d textureOffset = m_tiler->textureOffset(i, j) + display
Offset; |
192 gfx::RectF texCoordRect = gfx::RectF(tileRect.size()) + textureOffse
t; | 192 gfx::RectF texCoordRect = gfx::RectF(tileRect.size()) + textureOffse
t; |
193 | 193 |
194 float tileWidth = static_cast<float>(m_tiler->tileSize().width()); | 194 float tileWidth = static_cast<float>(m_tiler->tileSize().width()); |
195 float tileHeight = static_cast<float>(m_tiler->tileSize().height()); | 195 float tileHeight = static_cast<float>(m_tiler->tileSize().height()); |
196 gfx::Size textureSize(tileWidth, tileHeight); | 196 gfx::Size textureSize(tileWidth, tileHeight); |
197 | 197 |
198 bool clipped = false; | 198 bool leftEdgeAA = !i; |
199 gfx::QuadF visibleContentInTargetQuad = MathUtil::mapQuad(drawTransf
orm(), gfx::QuadF(visibleContentRect()), clipped); | 199 bool topEdgeAA = !j; |
200 bool isAxisAlignedInTarget = !clipped && visibleContentInTargetQuad.
IsRectilinear(); | 200 bool rightEdgeAA = i == m_tiler->numTilesX() - 1; |
201 bool useAA = m_tiler->hasBorderTexels() && !isAxisAlignedInTarget; | 201 bool bottomEdgeAA = j == m_tiler->numTilesY() - 1; |
202 | |
203 bool leftEdgeAA = !i && useAA; | |
204 bool topEdgeAA = !j && useAA; | |
205 bool rightEdgeAA = i == m_tiler->numTilesX() - 1 && useAA; | |
206 bool bottomEdgeAA = j == m_tiler->numTilesY() - 1 && useAA; | |
207 | 202 |
208 scoped_ptr<TileDrawQuad> quad = TileDrawQuad::Create(); | 203 scoped_ptr<TileDrawQuad> quad = TileDrawQuad::Create(); |
209 quad->SetNew(sharedQuadState, tileRect, tileOpaqueRect, tile->resour
ceId(), texCoordRect, textureSize, tile->contentsSwizzled(), leftEdgeAA, topEdge
AA, rightEdgeAA, bottomEdgeAA); | 204 quad->SetNew(sharedQuadState, tileRect, tileOpaqueRect, tile->resour
ceId(), texCoordRect, textureSize, tile->contentsSwizzled(), leftEdgeAA, topEdge
AA, rightEdgeAA, bottomEdgeAA); |
210 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData); | 205 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData); |
211 } | 206 } |
212 } | 207 } |
213 } | 208 } |
214 | 209 |
215 void TiledLayerImpl::setTilingData(const LayerTilingData& tiler) | 210 void TiledLayerImpl::setTilingData(const LayerTilingData& tiler) |
216 { | 211 { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 m_tiler->reset(); | 257 m_tiler->reset(); |
263 safeToDeleteDrawableTile = false; | 258 safeToDeleteDrawableTile = false; |
264 } | 259 } |
265 | 260 |
266 const char* TiledLayerImpl::layerTypeAsString() const | 261 const char* TiledLayerImpl::layerTypeAsString() const |
267 { | 262 { |
268 return "ContentLayer"; | 263 return "ContentLayer"; |
269 } | 264 } |
270 | 265 |
271 } // namespace cc | 266 } // namespace cc |
OLD | NEW |