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

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

Issue 1144523003: Rename cc::ResourceProvider::ResourceId to cc::ResourceId and move it to its own file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 always_clear = true; 439 always_clear = true;
440 #endif 440 #endif
441 if (always_clear || frame->current_render_pass->has_transparent_background) { 441 if (always_clear || frame->current_render_pass->has_transparent_background) {
442 GLbitfield clear_bits = GL_COLOR_BUFFER_BIT; 442 GLbitfield clear_bits = GL_COLOR_BUFFER_BIT;
443 if (always_clear) 443 if (always_clear)
444 clear_bits |= GL_STENCIL_BUFFER_BIT; 444 clear_bits |= GL_STENCIL_BUFFER_BIT;
445 gl_->Clear(clear_bits); 445 gl_->Clear(clear_bits);
446 } 446 }
447 } 447 }
448 448
449 static ResourceProvider::ResourceId WaitOnResourceSyncPoints( 449 static ResourceId WaitOnResourceSyncPoints(ResourceProvider* resource_provider,
450 ResourceProvider* resource_provider, 450 ResourceId resource_id) {
451 ResourceProvider::ResourceId resource_id) {
452 resource_provider->WaitSyncPointIfNeeded(resource_id); 451 resource_provider->WaitSyncPointIfNeeded(resource_id);
453 return resource_id; 452 return resource_id;
454 } 453 }
455 454
456 void GLRenderer::BeginDrawingFrame(DrawingFrame* frame) { 455 void GLRenderer::BeginDrawingFrame(DrawingFrame* frame) {
457 TRACE_EVENT0("cc", "GLRenderer::BeginDrawingFrame"); 456 TRACE_EVENT0("cc", "GLRenderer::BeginDrawingFrame");
458 457
459 scoped_refptr<ResourceProvider::Fence> read_lock_fence; 458 scoped_refptr<ResourceProvider::Fence> read_lock_fence;
460 if (use_sync_query_) { 459 if (use_sync_query_) {
461 // Block until oldest sync query has passed if the number of pending queries 460 // Block until oldest sync query has passed if the number of pending queries
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1628 } 1627 }
1629 1628
1630 void GLRenderer::DrawTileQuad(const DrawingFrame* frame, 1629 void GLRenderer::DrawTileQuad(const DrawingFrame* frame,
1631 const TileDrawQuad* quad, 1630 const TileDrawQuad* quad,
1632 const gfx::QuadF* clip_region) { 1631 const gfx::QuadF* clip_region) {
1633 DrawContentQuad(frame, quad, quad->resource_id, clip_region); 1632 DrawContentQuad(frame, quad, quad->resource_id, clip_region);
1634 } 1633 }
1635 1634
1636 void GLRenderer::DrawContentQuad(const DrawingFrame* frame, 1635 void GLRenderer::DrawContentQuad(const DrawingFrame* frame,
1637 const ContentDrawQuadBase* quad, 1636 const ContentDrawQuadBase* quad,
1638 ResourceProvider::ResourceId resource_id, 1637 ResourceId resource_id,
1639 const gfx::QuadF* clip_region) { 1638 const gfx::QuadF* clip_region) {
1640 gfx::Transform device_transform = 1639 gfx::Transform device_transform =
1641 frame->window_matrix * frame->projection_matrix * quad->quadTransform(); 1640 frame->window_matrix * frame->projection_matrix * quad->quadTransform();
1642 device_transform.FlattenTo2d(); 1641 device_transform.FlattenTo2d();
1643 1642
1644 bool use_aa = settings_->allow_antialiasing && 1643 bool use_aa = settings_->allow_antialiasing &&
1645 ShouldAntialiasQuad(device_transform, quad, false); 1644 ShouldAntialiasQuad(device_transform, quad, false);
1646 1645
1647 // TODO(timav): simplify coordinate transformations in DrawContentQuadAA 1646 // TODO(timav): simplify coordinate transformations in DrawContentQuadAA
1648 // similar to the way DrawContentQuadNoAA works and then consider 1647 // similar to the way DrawContentQuadNoAA works and then consider
1649 // combining DrawContentQuadAA and DrawContentQuadNoAA into one method. 1648 // combining DrawContentQuadAA and DrawContentQuadNoAA into one method.
1650 if (use_aa) 1649 if (use_aa)
1651 DrawContentQuadAA(frame, quad, resource_id, device_transform, clip_region); 1650 DrawContentQuadAA(frame, quad, resource_id, device_transform, clip_region);
1652 else 1651 else
1653 DrawContentQuadNoAA(frame, quad, resource_id, clip_region); 1652 DrawContentQuadNoAA(frame, quad, resource_id, clip_region);
1654 } 1653 }
1655 1654
1656 void GLRenderer::DrawContentQuadAA(const DrawingFrame* frame, 1655 void GLRenderer::DrawContentQuadAA(const DrawingFrame* frame,
1657 const ContentDrawQuadBase* quad, 1656 const ContentDrawQuadBase* quad,
1658 ResourceProvider::ResourceId resource_id, 1657 ResourceId resource_id,
1659 const gfx::Transform& device_transform, 1658 const gfx::Transform& device_transform,
1660 const gfx::QuadF* clip_region) { 1659 const gfx::QuadF* clip_region) {
1661 if (!device_transform.IsInvertible()) 1660 if (!device_transform.IsInvertible())
1662 return; 1661 return;
1663 1662
1664 gfx::Rect tile_rect = quad->visible_rect; 1663 gfx::Rect tile_rect = quad->visible_rect;
1665 1664
1666 gfx::RectF tex_coord_rect = MathUtil::ScaleRectProportional( 1665 gfx::RectF tex_coord_rect = MathUtil::ScaleRectProportional(
1667 quad->tex_coord_rect, quad->rect, tile_rect); 1666 quad->tex_coord_rect, quad->rect, tile_rect);
1668 float tex_to_geom_scale_x = quad->rect.width() / quad->tex_coord_rect.width(); 1667 float tex_to_geom_scale_x = quad->rect.width() / quad->tex_coord_rect.width();
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1768 // it. This is why this centered rect is used and not the original quad_rect. 1767 // it. This is why this centered rect is used and not the original quad_rect.
1769 gfx::RectF centered_rect( 1768 gfx::RectF centered_rect(
1770 gfx::PointF(-0.5f * tile_rect.width(), -0.5f * tile_rect.height()), 1769 gfx::PointF(-0.5f * tile_rect.width(), -0.5f * tile_rect.height()),
1771 tile_rect.size()); 1770 tile_rect.size());
1772 DrawQuadGeometry( 1771 DrawQuadGeometry(
1773 frame, quad->quadTransform(), centered_rect, uniforms.matrix_location); 1772 frame, quad->quadTransform(), centered_rect, uniforms.matrix_location);
1774 } 1773 }
1775 1774
1776 void GLRenderer::DrawContentQuadNoAA(const DrawingFrame* frame, 1775 void GLRenderer::DrawContentQuadNoAA(const DrawingFrame* frame,
1777 const ContentDrawQuadBase* quad, 1776 const ContentDrawQuadBase* quad,
1778 ResourceProvider::ResourceId resource_id, 1777 ResourceId resource_id,
1779 const gfx::QuadF* clip_region) { 1778 const gfx::QuadF* clip_region) {
1780 gfx::RectF tex_coord_rect = MathUtil::ScaleRectProportional( 1779 gfx::RectF tex_coord_rect = MathUtil::ScaleRectProportional(
1781 quad->tex_coord_rect, quad->rect, quad->visible_rect); 1780 quad->tex_coord_rect, quad->rect, quad->visible_rect);
1782 float tex_to_geom_scale_x = quad->rect.width() / quad->tex_coord_rect.width(); 1781 float tex_to_geom_scale_x = quad->rect.width() / quad->tex_coord_rect.width();
1783 float tex_to_geom_scale_y = 1782 float tex_to_geom_scale_y =
1784 quad->rect.height() / quad->tex_coord_rect.height(); 1783 quad->rect.height() / quad->tex_coord_rect.height();
1785 1784
1786 bool scaled = (tex_to_geom_scale_x != 1.f || tex_to_geom_scale_y != 1.f); 1785 bool scaled = (tex_to_geom_scale_x != 1.f || tex_to_geom_scale_y != 1.f);
1787 GLenum filter = 1786 GLenum filter =
1788 (scaled || !quad->quadTransform().IsIdentityOrIntegerTranslation()) && 1787 (scaled || !quad->quadTransform().IsIdentityOrIntegerTranslation()) &&
(...skipping 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after
3501 context_support_->ScheduleOverlayPlane( 3500 context_support_->ScheduleOverlayPlane(
3502 overlay.plane_z_order, 3501 overlay.plane_z_order,
3503 overlay.transform, 3502 overlay.transform,
3504 pending_overlay_resources_.back()->texture_id(), 3503 pending_overlay_resources_.back()->texture_id(),
3505 ToNearestRect(overlay.display_rect), 3504 ToNearestRect(overlay.display_rect),
3506 overlay.uv_rect); 3505 overlay.uv_rect);
3507 } 3506 }
3508 } 3507 }
3509 3508
3510 } // namespace cc 3509 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698