| 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "cc/tiled_layer_impl.h" | 7 #include "cc/tiled_layer_impl.h" |
| 8 | 8 |
| 9 #include "FloatQuad.h" | |
| 10 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 11 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| 12 #include "cc/append_quads_data.h" | 11 #include "cc/append_quads_data.h" |
| 13 #include "cc/checkerboard_draw_quad.h" | 12 #include "cc/checkerboard_draw_quad.h" |
| 14 #include "cc/debug_border_draw_quad.h" | 13 #include "cc/debug_border_draw_quad.h" |
| 15 #include "cc/layer_tiling_data.h" | 14 #include "cc/layer_tiling_data.h" |
| 16 #include "cc/math_util.h" | 15 #include "cc/math_util.h" |
| 17 #include "cc/quad_sink.h" | 16 #include "cc/quad_sink.h" |
| 18 #include "cc/solid_color_draw_quad.h" | 17 #include "cc/solid_color_draw_quad.h" |
| 19 #include "cc/tile_draw_quad.h" | 18 #include "cc/tile_draw_quad.h" |
| 20 #include "third_party/khronos/GLES2/gl2.h" | 19 #include "third_party/khronos/GLES2/gl2.h" |
| 21 #include "third_party/skia/include/core/SkColor.h" | 20 #include "third_party/skia/include/core/SkColor.h" |
| 21 #include "ui/gfx/quad_f.h" |
| 22 | 22 |
| 23 using namespace std; | 23 using namespace std; |
| 24 using WebKit::WebTransformationMatrix; | 24 using WebKit::WebTransformationMatrix; |
| 25 | 25 |
| 26 namespace cc { | 26 namespace cc { |
| 27 | 27 |
| 28 static const int debugTileBorderWidth = 1; | 28 static const int debugTileBorderWidth = 1; |
| 29 static const int debugTileBorderAlpha = 100; | 29 static const int debugTileBorderAlpha = 100; |
| 30 static const int debugTileBorderColorRed = 80; | 30 static const int debugTileBorderColorRed = 80; |
| 31 static const int debugTileBorderColorGreen = 200; | 31 static const int debugTileBorderColorGreen = 200; |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 182 |
| 183 // Keep track of how the top left has moved, so the texture can be | 183 // Keep track of how the top left has moved, so the texture can be |
| 184 // offset the same amount. | 184 // offset the same amount. |
| 185 gfx::Vector2d displayOffset = tileRect.origin() - displayRect.origin
(); | 185 gfx::Vector2d displayOffset = tileRect.origin() - displayRect.origin
(); |
| 186 gfx::Vector2d textureOffset = m_tiler->textureOffset(i, j) + display
Offset; | 186 gfx::Vector2d textureOffset = m_tiler->textureOffset(i, j) + display
Offset; |
| 187 float tileWidth = static_cast<float>(m_tiler->tileSize().width()); | 187 float tileWidth = static_cast<float>(m_tiler->tileSize().width()); |
| 188 float tileHeight = static_cast<float>(m_tiler->tileSize().height()); | 188 float tileHeight = static_cast<float>(m_tiler->tileSize().height()); |
| 189 gfx::Size textureSize(tileWidth, tileHeight); | 189 gfx::Size textureSize(tileWidth, tileHeight); |
| 190 | 190 |
| 191 bool clipped = false; | 191 bool clipped = false; |
| 192 FloatQuad visibleContentInTargetQuad = MathUtil::mapQuad(drawTransfo
rm(), FloatQuad(visibleContentRect()), clipped); | 192 gfx::QuadF visibleContentInTargetQuad = MathUtil::mapQuad(drawTransf
orm(), gfx::QuadF(visibleContentRect()), clipped); |
| 193 bool isAxisAlignedInTarget = !clipped && visibleContentInTargetQuad.
isRectilinear(); | 193 bool isAxisAlignedInTarget = !clipped && visibleContentInTargetQuad.
IsRectilinear(); |
| 194 bool useAA = m_tiler->hasBorderTexels() && !isAxisAlignedInTarget; | 194 bool useAA = m_tiler->hasBorderTexels() && !isAxisAlignedInTarget; |
| 195 | 195 |
| 196 bool leftEdgeAA = !i && useAA; | 196 bool leftEdgeAA = !i && useAA; |
| 197 bool topEdgeAA = !j && useAA; | 197 bool topEdgeAA = !j && useAA; |
| 198 bool rightEdgeAA = i == m_tiler->numTilesX() - 1 && useAA; | 198 bool rightEdgeAA = i == m_tiler->numTilesX() - 1 && useAA; |
| 199 bool bottomEdgeAA = j == m_tiler->numTilesY() - 1 && useAA; | 199 bool bottomEdgeAA = j == m_tiler->numTilesY() - 1 && useAA; |
| 200 | 200 |
| 201 const GLint textureFilter = m_tiler->hasBorderTexels() ? GL_LINEAR :
GL_NEAREST; | 201 const GLint textureFilter = m_tiler->hasBorderTexels() ? GL_LINEAR :
GL_NEAREST; |
| 202 quadSink.append(TileDrawQuad::create(sharedQuadState, tileRect, tile
OpaqueRect, tile->resourceId(), textureOffset, textureSize, textureFilter, tile-
>contentsSwizzled(), leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA).PassAs<Dr
awQuad>(), appendQuadsData); | 202 quadSink.append(TileDrawQuad::create(sharedQuadState, tileRect, tile
OpaqueRect, tile->resourceId(), textureOffset, textureSize, textureFilter, tile-
>contentsSwizzled(), leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA).PassAs<Dr
awQuad>(), appendQuadsData); |
| 203 } | 203 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 { | 246 { |
| 247 m_tiler->reset(); | 247 m_tiler->reset(); |
| 248 } | 248 } |
| 249 | 249 |
| 250 const char* TiledLayerImpl::layerTypeAsString() const | 250 const char* TiledLayerImpl::layerTypeAsString() const |
| 251 { | 251 { |
| 252 return "ContentLayer"; | 252 return "ContentLayer"; |
| 253 } | 253 } |
| 254 | 254 |
| 255 } // namespace cc | 255 } // namespace cc |
| OLD | NEW |