| 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 "CCTiledLayerImpl.h" | 7 #include "CCTiledLayerImpl.h" |
| 8 | 8 |
| 9 #include "base/basictypes.h" | |
| 10 #include "base/stringprintf.h" | |
| 11 #include "CCAppendQuadsData.h" | 9 #include "CCAppendQuadsData.h" |
| 12 #include "CCCheckerboardDrawQuad.h" | 10 #include "CCCheckerboardDrawQuad.h" |
| 13 #include "CCDebugBorderDrawQuad.h" | 11 #include "CCDebugBorderDrawQuad.h" |
| 14 #include "CCLayerTilingData.h" | 12 #include "CCLayerTilingData.h" |
| 15 #include "CCMathUtil.h" | 13 #include "CCMathUtil.h" |
| 16 #include "CCQuadSink.h" | 14 #include "CCQuadSink.h" |
| 17 #include "CCSolidColorDrawQuad.h" | 15 #include "CCSolidColorDrawQuad.h" |
| 18 #include "CCTileDrawQuad.h" | 16 #include "CCTileDrawQuad.h" |
| 19 #include "FloatQuad.h" | 17 #include "FloatQuad.h" |
| 20 #include "GraphicsContext3D.h" | 18 #include "base/basictypes.h" |
| 19 #include "base/stringprintf.h" |
| 20 #include "third_party/khronos/GLES2/gl2.h" |
| 21 #include "third_party/skia/include/core/SkColor.h" | 21 #include "third_party/skia/include/core/SkColor.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; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 bool clipped = false; | 187 bool clipped = false; |
| 188 FloatQuad visibleContentInTargetQuad = CCMathUtil::mapQuad(drawTrans
form(), FloatQuad(visibleContentRect()), clipped); | 188 FloatQuad visibleContentInTargetQuad = CCMathUtil::mapQuad(drawTrans
form(), FloatQuad(visibleContentRect()), clipped); |
| 189 bool isAxisAlignedInTarget = !clipped && visibleContentInTargetQuad.
isRectilinear(); | 189 bool isAxisAlignedInTarget = !clipped && visibleContentInTargetQuad.
isRectilinear(); |
| 190 bool useAA = m_tiler->hasBorderTexels() && !isAxisAlignedInTarget; | 190 bool useAA = m_tiler->hasBorderTexels() && !isAxisAlignedInTarget; |
| 191 | 191 |
| 192 bool leftEdgeAA = !i && useAA; | 192 bool leftEdgeAA = !i && useAA; |
| 193 bool topEdgeAA = !j && useAA; | 193 bool topEdgeAA = !j && useAA; |
| 194 bool rightEdgeAA = i == m_tiler->numTilesX() - 1 && useAA; | 194 bool rightEdgeAA = i == m_tiler->numTilesX() - 1 && useAA; |
| 195 bool bottomEdgeAA = j == m_tiler->numTilesY() - 1 && useAA; | 195 bool bottomEdgeAA = j == m_tiler->numTilesY() - 1 && useAA; |
| 196 | 196 |
| 197 const GC3Dint textureFilter = m_tiler->hasBorderTexels() ? GraphicsC
ontext3D::LINEAR : GraphicsContext3D::NEAREST; | 197 const GLint textureFilter = m_tiler->hasBorderTexels() ? GL_LINEAR :
GL_NEAREST; |
| 198 quadSink.append(CCTileDrawQuad::create(sharedQuadState, tileRect, ti
leOpaqueRect, tile->resourceId(), textureOffset, textureSize, textureFilter, con
tentsSwizzled(), leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA).PassAs<CCDraw
Quad>(), appendQuadsData); | 198 quadSink.append(CCTileDrawQuad::create(sharedQuadState, tileRect, ti
leOpaqueRect, tile->resourceId(), textureOffset, textureSize, textureFilter, con
tentsSwizzled(), leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA).PassAs<CCDraw
Quad>(), appendQuadsData); |
| 199 } | 199 } |
| 200 } | 200 } |
| 201 } | 201 } |
| 202 | 202 |
| 203 void CCTiledLayerImpl::setTilingData(const CCLayerTilingData& tiler) | 203 void CCTiledLayerImpl::setTilingData(const CCLayerTilingData& tiler) |
| 204 { | 204 { |
| 205 if (m_tiler) | 205 if (m_tiler) |
| 206 m_tiler->reset(); | 206 m_tiler->reset(); |
| 207 else | 207 else |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 { | 240 { |
| 241 m_tiler->reset(); | 241 m_tiler->reset(); |
| 242 } | 242 } |
| 243 | 243 |
| 244 const char* CCTiledLayerImpl::layerTypeAsString() const | 244 const char* CCTiledLayerImpl::layerTypeAsString() const |
| 245 { | 245 { |
| 246 return "ContentLayer"; | 246 return "ContentLayer"; |
| 247 } | 247 } |
| 248 | 248 |
| 249 } // namespace cc | 249 } // namespace cc |
| OLD | NEW |