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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 // Keep track of how the top left has moved, so the texture can be | 211 // Keep track of how the top left has moved, so the texture can be |
212 // offset the same amount. | 212 // offset the same amount. |
213 gfx::Vector2d displayOffset = tileRect.origin() - displayRect.origin
(); | 213 gfx::Vector2d displayOffset = tileRect.origin() - displayRect.origin
(); |
214 gfx::Vector2d textureOffset = m_tiler->textureOffset(i, j) + display
Offset; | 214 gfx::Vector2d textureOffset = m_tiler->textureOffset(i, j) + display
Offset; |
215 gfx::RectF texCoordRect = gfx::RectF(tileRect.size()) + textureOffse
t; | 215 gfx::RectF texCoordRect = gfx::RectF(tileRect.size()) + textureOffse
t; |
216 | 216 |
217 float tileWidth = static_cast<float>(m_tiler->tileSize().width()); | 217 float tileWidth = static_cast<float>(m_tiler->tileSize().width()); |
218 float tileHeight = static_cast<float>(m_tiler->tileSize().height()); | 218 float tileHeight = static_cast<float>(m_tiler->tileSize().height()); |
219 gfx::Size textureSize(tileWidth, tileHeight); | 219 gfx::Size textureSize(tileWidth, tileHeight); |
220 | 220 |
221 bool clipped = false; | |
222 gfx::QuadF visibleContentInTargetQuad = MathUtil::mapQuad(drawTransf
orm(), gfx::QuadF(visibleContentRect()), clipped); | |
223 bool isAxisAlignedInTarget = !clipped && visibleContentInTargetQuad.
IsRectilinear(); | |
224 bool useAA = m_tiler->hasBorderTexels() && !isAxisAlignedInTarget; | |
225 | |
226 bool leftEdgeAA = !i && useAA; | |
227 bool topEdgeAA = !j && useAA; | |
228 bool rightEdgeAA = i == m_tiler->numTilesX() - 1 && useAA; | |
229 bool bottomEdgeAA = j == m_tiler->numTilesY() - 1 && useAA; | |
230 | |
231 scoped_ptr<TileDrawQuad> quad = TileDrawQuad::Create(); | 221 scoped_ptr<TileDrawQuad> quad = TileDrawQuad::Create(); |
232 quad->SetNew(sharedQuadState, tileRect, tileOpaqueRect, tile->resour
ceId(), texCoordRect, textureSize, tile->contentsSwizzled(), leftEdgeAA, topEdge
AA, rightEdgeAA, bottomEdgeAA); | 222 quad->SetNew(sharedQuadState, tileRect, tileOpaqueRect, tile->resour
ceId(), texCoordRect, textureSize, tile->contentsSwizzled()); |
233 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData); | 223 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData); |
234 } | 224 } |
235 } | 225 } |
236 } | 226 } |
237 | 227 |
238 void TiledLayerImpl::setTilingData(const LayerTilingData& tiler) | 228 void TiledLayerImpl::setTilingData(const LayerTilingData& tiler) |
239 { | 229 { |
240 safeToDeleteDrawableTile = true; | 230 safeToDeleteDrawableTile = true; |
241 | 231 |
242 if (m_tiler) | 232 if (m_tiler) |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 m_tiler->reset(); | 275 m_tiler->reset(); |
286 safeToDeleteDrawableTile = false; | 276 safeToDeleteDrawableTile = false; |
287 } | 277 } |
288 | 278 |
289 const char* TiledLayerImpl::layerTypeAsString() const | 279 const char* TiledLayerImpl::layerTypeAsString() const |
290 { | 280 { |
291 return "ContentLayer"; | 281 return "ContentLayer"; |
292 } | 282 } |
293 | 283 |
294 } // namespace cc | 284 } // namespace cc |
OLD | NEW |