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

Side by Side Diff: cc/software_renderer.cc

Issue 11361129: Don't invert contentsDeviceTransform twice when rendering render passes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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
« cc/gl_renderer.cc ('K') | « cc/gl_renderer.cc ('k') | no next file » | 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 "config.h" 5 #include "config.h"
6 6
7 #include "cc/software_renderer.h" 7 #include "cc/software_renderer.h"
8 8
9 #include "cc/debug_border_draw_quad.h" 9 #include "cc/debug_border_draw_quad.h"
10 #include "cc/render_pass_draw_quad.h" 10 #include "cc/render_pass_draw_quad.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 } 175 }
176 176
177 CRASH(); 177 CRASH();
178 return false; 178 return false;
179 } 179 }
180 180
181 void SoftwareRenderer::drawQuad(DrawingFrame& frame, const DrawQuad* quad) 181 void SoftwareRenderer::drawQuad(DrawingFrame& frame, const DrawQuad* quad)
182 { 182 {
183 WebTransformationMatrix quadRectMatrix; 183 WebTransformationMatrix quadRectMatrix;
184 quadRectTransform(&quadRectMatrix, quad->quadTransform(), quad->quadRect()); 184 quadRectTransform(&quadRectMatrix, quad->quadTransform(), quad->quadRect());
185 WebTransformationMatrix contentsDeviceTransform = (frame.windowMatrix * fram e.projectionMatrix * quadRectMatrix).to2dTransform(); 185 WebTransformationMatrix deviceMatrix = (frame.windowMatrix * frame.projectio nMatrix * quadRectMatrix).to2dTransform();
186 SkMatrix skDeviceMatrix; 186 SkMatrix skDeviceMatrix;
187 toSkMatrix(&skDeviceMatrix, contentsDeviceTransform); 187 toSkMatrix(&skDeviceMatrix, deviceMatrix);
188 m_skCurrentCanvas->setMatrix(skDeviceMatrix); 188 m_skCurrentCanvas->setMatrix(skDeviceMatrix);
189 189
190 m_skCurrentPaint.reset(); 190 m_skCurrentPaint.reset();
191 if (!isScaleAndTranslate(skDeviceMatrix)) { 191 if (!isScaleAndTranslate(skDeviceMatrix)) {
192 m_skCurrentPaint.setAntiAlias(true); 192 m_skCurrentPaint.setAntiAlias(true);
193 m_skCurrentPaint.setFilterBitmap(true); 193 m_skCurrentPaint.setFilterBitmap(true);
194 } 194 }
195 if (quad->needsBlending()) { 195 if (quad->needsBlending()) {
196 m_skCurrentPaint.setAlpha(quad->opacity() * 255); 196 m_skCurrentPaint.setAlpha(quad->opacity() * 255);
197 m_skCurrentPaint.setXfermodeMode(SkXfermode::kSrcOver_Mode); 197 m_skCurrentPaint.setXfermodeMode(SkXfermode::kSrcOver_Mode);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 if (!isSoftwareResource(quad->resourceId())) { 251 if (!isSoftwareResource(quad->resourceId())) {
252 drawUnsupportedQuad(frame, quad); 252 drawUnsupportedQuad(frame, quad);
253 return; 253 return;
254 } 254 }
255 255
256 // FIXME: Add support for non-premultiplied alpha. 256 // FIXME: Add support for non-premultiplied alpha.
257 ResourceProvider::ScopedReadLockSoftware lock(m_resourceProvider, quad->reso urceId()); 257 ResourceProvider::ScopedReadLockSoftware lock(m_resourceProvider, quad->reso urceId());
258 const SkBitmap* bitmap = lock.skBitmap(); 258 const SkBitmap* bitmap = lock.skBitmap();
259 gfx::RectF uvRect = gfx::ScaleRect(quad->uvRect(), bitmap->width(), bitmap-> height()); 259 gfx::RectF uvRect = gfx::ScaleRect(quad->uvRect(), bitmap->width(), bitmap-> height());
260 SkRect skUvRect = toSkRect(uvRect); 260 SkRect skUvRect = toSkRect(uvRect);
261
262 if (quad->flipped()) 261 if (quad->flipped())
263 m_skCurrentCanvas->scale(1, -1); 262 m_skCurrentCanvas->scale(1, -1);
264 m_skCurrentCanvas->drawBitmapRectToRect(*bitmap, &skUvRect, 263 m_skCurrentCanvas->drawBitmapRectToRect(*bitmap, &skUvRect,
265 toSkRect(quadVertexRect()), 264 toSkRect(quadVertexRect()),
266 &m_skCurrentPaint); 265 &m_skCurrentPaint);
267 } 266 }
268 267
269 void SoftwareRenderer::drawTileQuad(const DrawingFrame& frame, const TileDrawQua d* quad) 268 void SoftwareRenderer::drawTileQuad(const DrawingFrame& frame, const TileDrawQua d* quad)
270 { 269 {
271 DCHECK(isSoftwareResource(quad->resourceId())); 270 DCHECK(isSoftwareResource(quad->resourceId()));
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 } 363 }
365 364
366 void SoftwareRenderer::setVisible(bool visible) 365 void SoftwareRenderer::setVisible(bool visible)
367 { 366 {
368 if (m_visible == visible) 367 if (m_visible == visible)
369 return; 368 return;
370 m_visible = visible; 369 m_visible = visible;
371 } 370 }
372 371
373 } // namespace cc 372 } // namespace cc
OLDNEW
« cc/gl_renderer.cc ('K') | « cc/gl_renderer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698