OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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 | 5 |
6 #include "config.h" | 6 #include "config.h" |
7 | 7 |
8 #if USE(ACCELERATED_COMPOSITING) | 8 #if USE(ACCELERATED_COMPOSITING) |
9 #include "CCRendererGL.h" | 9 #include "CCRendererGL.h" |
10 | 10 |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 280 |
281 void CCRendererGL::drawCheckerboardQuad(const DrawingFrame& frame, const CCCheck
erboardDrawQuad* quad) | 281 void CCRendererGL::drawCheckerboardQuad(const DrawingFrame& frame, const CCCheck
erboardDrawQuad* quad) |
282 { | 282 { |
283 const TileCheckerboardProgram* program = tileCheckerboardProgram(); | 283 const TileCheckerboardProgram* program = tileCheckerboardProgram(); |
284 ASSERT(program && program->initialized()); | 284 ASSERT(program && program->initialized()); |
285 GLC(context(), context()->useProgram(program->program())); | 285 GLC(context(), context()->useProgram(program->program())); |
286 | 286 |
287 SkColor color = quad->color(); | 287 SkColor color = quad->color(); |
288 GLC(context(), context()->uniform4f(program->fragmentShader().colorLocation(
), SkColorGetR(color) / 255.0, SkColorGetG(color) / 255.0, SkColorGetB(color) /
255.0, 1)); | 288 GLC(context(), context()->uniform4f(program->fragmentShader().colorLocation(
), SkColorGetR(color) / 255.0, SkColorGetG(color) / 255.0, SkColorGetB(color) /
255.0, 1)); |
289 | 289 |
| 290 const int checkerboardWidth = 16; |
| 291 float frequency = 1.0 / checkerboardWidth; |
| 292 |
290 IntRect tileRect = quad->quadRect(); | 293 IntRect tileRect = quad->quadRect(); |
291 float texOffsetX = tileRect.x(); | 294 float texOffsetX = tileRect.x() % checkerboardWidth; |
292 float texOffsetY = tileRect.y(); | 295 float texOffsetY = tileRect.y() % checkerboardWidth; |
293 float texScaleX = tileRect.width(); | 296 float texScaleX = tileRect.width(); |
294 float texScaleY = tileRect.height(); | 297 float texScaleY = tileRect.height(); |
295 GLC(context(), context()->uniform4f(program->fragmentShader().texTransformLo
cation(), texOffsetX, texOffsetY, texScaleX, texScaleY)); | 298 GLC(context(), context()->uniform4f(program->fragmentShader().texTransformLo
cation(), texOffsetX, texOffsetY, texScaleX, texScaleY)); |
296 | 299 |
297 const int checkerboardWidth = 16; | |
298 float frequency = 1.0 / checkerboardWidth; | |
299 | |
300 GLC(context(), context()->uniform1f(program->fragmentShader().frequencyLocat
ion(), frequency)); | 300 GLC(context(), context()->uniform1f(program->fragmentShader().frequencyLocat
ion(), frequency)); |
301 | 301 |
302 setShaderOpacity(quad->opacity(), program->fragmentShader().alphaLocation())
; | 302 setShaderOpacity(quad->opacity(), program->fragmentShader().alphaLocation())
; |
303 drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), program->ve
rtexShader().matrixLocation()); | 303 drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), program->ve
rtexShader().matrixLocation()); |
304 } | 304 } |
305 | 305 |
306 void CCRendererGL::drawDebugBorderQuad(const DrawingFrame& frame, const CCDebugB
orderDrawQuad* quad) | 306 void CCRendererGL::drawDebugBorderQuad(const DrawingFrame& frame, const CCDebugB
orderDrawQuad* quad) |
307 { | 307 { |
308 static float glMatrix[16]; | 308 static float glMatrix[16]; |
309 const SolidColorProgram* program = solidColorProgram(); | 309 const SolidColorProgram* program = solidColorProgram(); |
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1521 } | 1521 } |
1522 | 1522 |
1523 bool CCRendererGL::isContextLost() | 1523 bool CCRendererGL::isContextLost() |
1524 { | 1524 { |
1525 return (m_context->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERRO
R); | 1525 return (m_context->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERRO
R); |
1526 } | 1526 } |
1527 | 1527 |
1528 } // namespace cc | 1528 } // namespace cc |
1529 | 1529 |
1530 #endif // USE(ACCELERATED_COMPOSITING) | 1530 #endif // USE(ACCELERATED_COMPOSITING) |
OLD | NEW |