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 #include "cc/output/gl_renderer.h" | 5 #include "cc/output/gl_renderer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
552 SetUseProgram(program->program()); | 552 SetUseProgram(program->program()); |
553 | 553 |
554 SkColor color = quad->color; | 554 SkColor color = quad->color; |
555 GLC(gl_, | 555 GLC(gl_, |
556 gl_->Uniform4f(program->fragment_shader().color_location(), | 556 gl_->Uniform4f(program->fragment_shader().color_location(), |
557 SkColorGetR(color) * (1.0f / 255.0f), | 557 SkColorGetR(color) * (1.0f / 255.0f), |
558 SkColorGetG(color) * (1.0f / 255.0f), | 558 SkColorGetG(color) * (1.0f / 255.0f), |
559 SkColorGetB(color) * (1.0f / 255.0f), | 559 SkColorGetB(color) * (1.0f / 255.0f), |
560 1)); | 560 1)); |
561 | 561 |
562 const int checkerboard_width = 16; | 562 const int kCheckerboardWidth = 16; |
563 float frequency = 1.0f / checkerboard_width; | 563 float frequency = 1.0f / kCheckerboardWidth; |
564 | 564 |
565 gfx::Rect tile_rect = quad->rect; | 565 gfx::Rect tile_rect = quad->rect; |
566 float tex_offset_x = tile_rect.x() % checkerboard_width; | 566 float tex_offset_x = |
567 float tex_offset_y = tile_rect.y() % checkerboard_width; | 567 static_cast<int>(tile_rect.x() / quad->scale) % kCheckerboardWidth; |
568 float tex_scale_x = tile_rect.width(); | 568 float tex_offset_y = |
vmpstr
2015/03/04 00:53:56
Should the type of this be int as well?
danakj
2015/03/04 17:06:57
It gets converted to a float when passed to Unifor
| |
569 float tex_scale_y = tile_rect.height(); | 569 static_cast<int>(tile_rect.y() / quad->scale) % kCheckerboardWidth; |
570 float tex_scale_x = tile_rect.width() / quad->scale; | |
571 float tex_scale_y = tile_rect.height() / quad->scale; | |
570 GLC(gl_, | 572 GLC(gl_, |
571 gl_->Uniform4f(program->fragment_shader().tex_transform_location(), | 573 gl_->Uniform4f(program->fragment_shader().tex_transform_location(), |
572 tex_offset_x, | 574 tex_offset_x, |
573 tex_offset_y, | 575 tex_offset_y, |
574 tex_scale_x, | 576 tex_scale_x, |
575 tex_scale_y)); | 577 tex_scale_y)); |
576 | 578 |
577 GLC(gl_, | 579 GLC(gl_, |
578 gl_->Uniform1f(program->fragment_shader().frequency_location(), | 580 gl_->Uniform1f(program->fragment_shader().frequency_location(), |
579 frequency)); | 581 frequency)); |
(...skipping 2675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3255 context_support_->ScheduleOverlayPlane( | 3257 context_support_->ScheduleOverlayPlane( |
3256 overlay.plane_z_order, | 3258 overlay.plane_z_order, |
3257 overlay.transform, | 3259 overlay.transform, |
3258 pending_overlay_resources_.back()->texture_id(), | 3260 pending_overlay_resources_.back()->texture_id(), |
3259 overlay.display_rect, | 3261 overlay.display_rect, |
3260 overlay.uv_rect); | 3262 overlay.uv_rect); |
3261 } | 3263 } |
3262 } | 3264 } |
3263 | 3265 |
3264 } // namespace cc | 3266 } // namespace cc |
OLD | NEW |