Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(380)

Side by Side Diff: cc/output/gl_renderer.cc

Issue 973223002: cc: Scale checkerboard quads by the device scale factor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: checkerboardscale: fixwindowsbuild Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/layers/tiled_layer_impl.cc ('k') | cc/output/overlay_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 =
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
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
OLDNEW
« no previous file with comments | « cc/layers/tiled_layer_impl.cc ('k') | cc/output/overlay_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698