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

Side by Side Diff: cc/quads/texture_draw_quad.cc

Issue 12676029: cc: Fix capitalization style in chromified files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « cc/quads/render_pass.h ('k') | cc/resources/bitmap_skpicture_content_layer_updater.h » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/quads/texture_draw_quad.h" 5 #include "cc/quads/texture_draw_quad.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/gfx/vector2d_f.h" 8 #include "ui/gfx/vector2d_f.h"
9 9
10 namespace cc { 10 namespace cc {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // Grab our scale and make sure it's positive. 84 // Grab our scale and make sure it's positive.
85 float x_scale = static_cast<float>(quadTransform().matrix().getDouble(0, 0)); 85 float x_scale = static_cast<float>(quadTransform().matrix().getDouble(0, 0));
86 float y_scale = static_cast<float>(quadTransform().matrix().getDouble(1, 1)); 86 float y_scale = static_cast<float>(quadTransform().matrix().getDouble(1, 1));
87 87
88 // Grab our offset. 88 // Grab our offset.
89 gfx::Vector2dF offset( 89 gfx::Vector2dF offset(
90 static_cast<float>(quadTransform().matrix().getDouble(0, 3)), 90 static_cast<float>(quadTransform().matrix().getDouble(0, 3)),
91 static_cast<float>(quadTransform().matrix().getDouble(1, 3))); 91 static_cast<float>(quadTransform().matrix().getDouble(1, 3)));
92 92
93 // Transform the rect by the scale and offset. 93 // Transform the rect by the scale and offset.
94 gfx::RectF rectF = rect; 94 gfx::RectF rect_f = rect;
95 rectF.Scale(x_scale, y_scale); 95 rect_f.Scale(x_scale, y_scale);
96 rectF += offset; 96 rect_f += offset;
97 97
98 // Perform clipping and check to see if the result is empty. 98 // Perform clipping and check to see if the result is empty.
99 gfx::RectF clippedRect = IntersectRects(rectF, clipRect()); 99 gfx::RectF clipped_rect = IntersectRects(rect_f, clipRect());
100 if (clippedRect.IsEmpty()) { 100 if (clipped_rect.IsEmpty()) {
101 rect = gfx::Rect(); 101 rect = gfx::Rect();
102 uv_top_left = gfx::PointF(); 102 uv_top_left = gfx::PointF();
103 uv_bottom_right = gfx::PointF(); 103 uv_bottom_right = gfx::PointF();
104 return true; 104 return true;
105 } 105 }
106 106
107 // Create a new uv-rect by clipping the old one to the new bounds. 107 // Create a new uv-rect by clipping the old one to the new bounds.
108 gfx::Vector2dF uv_scale(uv_bottom_right - uv_top_left); 108 gfx::Vector2dF uv_scale(uv_bottom_right - uv_top_left);
109 uv_scale.Scale(1.f / rectF.width(), 1.f / rectF.height()); 109 uv_scale.Scale(1.f / rect_f.width(), 1.f / rect_f.height());
110 uv_bottom_right = uv_top_left + 110 uv_bottom_right = uv_top_left +
111 gfx::ScaleVector2d( 111 gfx::ScaleVector2d(
112 clippedRect.bottom_right() - rectF.origin(), 112 clipped_rect.bottom_right() - rect_f.origin(),
113 uv_scale.x(), 113 uv_scale.x(),
114 uv_scale.y()); 114 uv_scale.y());
115 uv_top_left = uv_top_left + 115 uv_top_left = uv_top_left +
116 gfx::ScaleVector2d( 116 gfx::ScaleVector2d(
117 clippedRect.origin() - rectF.origin(), 117 clipped_rect.origin() - rect_f.origin(),
118 uv_scale.x(), 118 uv_scale.x(),
119 uv_scale.y()); 119 uv_scale.y());
120 120
121 // Indexing according to the quad vertex generation: 121 // Indexing according to the quad vertex generation:
122 // 1--2 122 // 1--2
123 // | | 123 // | |
124 // 0--3 124 // 0--3
125 if (vertex_opacity[0] != vertex_opacity[1] 125 if (vertex_opacity[0] != vertex_opacity[1]
126 || vertex_opacity[0] != vertex_opacity[2] 126 || vertex_opacity[0] != vertex_opacity[2]
127 || vertex_opacity[0] != vertex_opacity[3]) { 127 || vertex_opacity[0] != vertex_opacity[3]) {
128 const float x1 = (clippedRect.x() - rectF.x()) / rectF.width(); 128 const float x1 = (clipped_rect.x() - rect_f.x()) / rect_f.width();
129 const float y1 = (clippedRect.y() - rectF.y()) / rectF.height(); 129 const float y1 = (clipped_rect.y() - rect_f.y()) / rect_f.height();
130 const float x3 = (clippedRect.right() - rectF.x()) / rectF.width(); 130 const float x3 = (clipped_rect.right() - rect_f.x()) / rect_f.width();
131 const float y3 = (clippedRect.bottom() - rectF.y()) / rectF.height(); 131 const float y3 = (clipped_rect.bottom() - rect_f.y()) / rect_f.height();
132 const float x1y1 = x1 * vertex_opacity[2] + (1.0f - x1) * vertex_opacity[1]; 132 const float x1y1 = x1 * vertex_opacity[2] + (1.0f - x1) * vertex_opacity[1];
133 const float x1y3 = x1 * vertex_opacity[3] + (1.0f - x1) * vertex_opacity[0]; 133 const float x1y3 = x1 * vertex_opacity[3] + (1.0f - x1) * vertex_opacity[0];
134 const float x3y1 = x3 * vertex_opacity[2] + (1.0f - x3) * vertex_opacity[1]; 134 const float x3y1 = x3 * vertex_opacity[2] + (1.0f - x3) * vertex_opacity[1];
135 const float x3y3 = x3 * vertex_opacity[3] + (1.0f - x3) * vertex_opacity[0]; 135 const float x3y3 = x3 * vertex_opacity[3] + (1.0f - x3) * vertex_opacity[0];
136 vertex_opacity[0] = y3 * x1y3 + (1.0f - y3) * x1y1; 136 vertex_opacity[0] = y3 * x1y3 + (1.0f - y3) * x1y1;
137 vertex_opacity[1] = y1 * x1y3 + (1.0f - y1) * x1y1; 137 vertex_opacity[1] = y1 * x1y3 + (1.0f - y1) * x1y1;
138 vertex_opacity[2] = y1 * x3y3 + (1.0f - y1) * x3y1; 138 vertex_opacity[2] = y1 * x3y3 + (1.0f - y1) * x3y1;
139 vertex_opacity[3] = y3 * x3y3 + (1.0f - y3) * x3y1; 139 vertex_opacity[3] = y3 * x3y3 + (1.0f - y3) * x3y1;
140 } 140 }
141 141
142 // Move the clipped rectangle back into its space. 142 // Move the clipped rectangle back into its space.
143 clippedRect -= offset; 143 clipped_rect -= offset;
144 clippedRect.Scale(1.0f / x_scale, 1.0f / y_scale); 144 clipped_rect.Scale(1.0f / x_scale, 1.0f / y_scale);
145 rect = gfx::Rect(static_cast<int>(clippedRect.x() + 0.5f), 145 rect = gfx::Rect(static_cast<int>(clipped_rect.x() + 0.5f),
146 static_cast<int>(clippedRect.y() + 0.5f), 146 static_cast<int>(clipped_rect.y() + 0.5f),
147 static_cast<int>(clippedRect.width() + 0.5f), 147 static_cast<int>(clipped_rect.width() + 0.5f),
148 static_cast<int>(clippedRect.height() + 0.5f)); 148 static_cast<int>(clipped_rect.height() + 0.5f));
149 return true; 149 return true;
150 } 150 }
151 151
152 } // namespace cc 152 } // namespace cc
OLDNEW
« no previous file with comments | « cc/quads/render_pass.h ('k') | cc/resources/bitmap_skpicture_content_layer_updater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698