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

Side by Side Diff: cc/software_renderer.cc

Issue 11783094: cc: Add point-based UV coordinate on TextureLayer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added unittest for clipped texture quad Created 7 years, 11 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
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/software_renderer.h" 5 #include "cc/software_renderer.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "cc/debug_border_draw_quad.h" 8 #include "cc/debug_border_draw_quad.h"
9 #include "cc/math_util.h" 9 #include "cc/math_util.h"
10 #include "cc/render_pass_draw_quad.h" 10 #include "cc/render_pass_draw_quad.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 void SoftwareRenderer::drawTextureQuad(const DrawingFrame& frame, const TextureD rawQuad* quad) 251 void SoftwareRenderer::drawTextureQuad(const DrawingFrame& frame, const TextureD rawQuad* quad)
252 { 252 {
253 if (!isSoftwareResource(quad->resource_id)) { 253 if (!isSoftwareResource(quad->resource_id)) {
254 drawUnsupportedQuad(frame, quad); 254 drawUnsupportedQuad(frame, quad);
255 return; 255 return;
256 } 256 }
257 257
258 // FIXME: Add support for non-premultiplied alpha. 258 // FIXME: Add support for non-premultiplied alpha.
259 ResourceProvider::ScopedReadLockSoftware lock(m_resourceProvider, quad->reso urce_id); 259 ResourceProvider::ScopedReadLockSoftware lock(m_resourceProvider, quad->reso urce_id);
260 const SkBitmap* bitmap = lock.skBitmap(); 260 const SkBitmap* bitmap = lock.skBitmap();
261 gfx::RectF uvRect = gfx::ScaleRect(quad->uv_rect, bitmap->width(), bitmap->h eight()); 261 gfx::RectF uvRect = gfx::ScaleRect(BoundingRect(quad->uv_top_left, quad->uv_ bottom_right),
danakj 2013/01/15 01:48:42 nit: gfx::BoundingRect
Jerome 2013/01/15 17:58:12 Done.
262 bitmap->width(),
263 bitmap->height());
262 SkRect skUvRect = gfx::RectFToSkRect(uvRect); 264 SkRect skUvRect = gfx::RectFToSkRect(uvRect);
263 if (quad->flipped) 265 if (quad->flipped)
264 m_skCurrentCanvas->scale(1, -1); 266 m_skCurrentCanvas->scale(1, -1);
265 m_skCurrentCanvas->drawBitmapRectToRect(*bitmap, &skUvRect, 267 m_skCurrentCanvas->drawBitmapRectToRect(*bitmap, &skUvRect,
266 gfx::RectFToSkRect(quadVertexRect()) , 268 gfx::RectFToSkRect(quadVertexRect()) ,
267 &m_skCurrentPaint); 269 &m_skCurrentPaint);
268 } 270 }
269 271
270 void SoftwareRenderer::drawTileQuad(const DrawingFrame& frame, const TileDrawQua d* quad) 272 void SoftwareRenderer::drawTileQuad(const DrawingFrame& frame, const TileDrawQua d* quad)
271 { 273 {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 } 371 }
370 372
371 void SoftwareRenderer::setVisible(bool visible) 373 void SoftwareRenderer::setVisible(bool visible)
372 { 374 {
373 if (m_visible == visible) 375 if (m_visible == visible)
374 return; 376 return;
375 m_visible = visible; 377 m_visible = visible;
376 } 378 }
377 379
378 } // namespace cc 380 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698