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

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: fixed unittest and abreviations 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::PointF uv_top_left = gfx::ScalePoint(quad->uv_top_left, bitmap->width() , bitmap->height());
danakj 2013/01/11 02:21:51 you could use BoundingRect here and keep the rest
Jerome 2013/01/11 18:00:01 Done.
262 SkRect skUvRect = gfx::RectFToSkRect(uvRect); 262 gfx::PointF uv_bottom_right = gfx::ScalePoint(quad->uv_bottom_right, bitmap- >width(), bitmap->height());
263 SkRect skUvRect = SkRect::MakeXYWH(SkFloatToScalar(uv_top_left.x()),
264 SkFloatToScalar(uv_top_left.y()),
265 SkFloatToScalar(uv_bottom_right.x() - uv_ top_left.x()),
266 SkFloatToScalar(uv_bottom_right.y() - uv_ top_left.y()));
263 if (quad->flipped) 267 if (quad->flipped)
264 m_skCurrentCanvas->scale(1, -1); 268 m_skCurrentCanvas->scale(1, -1);
265 m_skCurrentCanvas->drawBitmapRectToRect(*bitmap, &skUvRect, 269 m_skCurrentCanvas->drawBitmapRectToRect(*bitmap, &skUvRect,
266 gfx::RectFToSkRect(quadVertexRect()) , 270 gfx::RectFToSkRect(quadVertexRect()) ,
267 &m_skCurrentPaint); 271 &m_skCurrentPaint);
268 } 272 }
269 273
270 void SoftwareRenderer::drawTileQuad(const DrawingFrame& frame, const TileDrawQua d* quad) 274 void SoftwareRenderer::drawTileQuad(const DrawingFrame& frame, const TileDrawQua d* quad)
271 { 275 {
272 DCHECK(isSoftwareResource(quad->resource_id)); 276 DCHECK(isSoftwareResource(quad->resource_id));
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 } 373 }
370 374
371 void SoftwareRenderer::setVisible(bool visible) 375 void SoftwareRenderer::setVisible(bool visible)
372 { 376 {
373 if (m_visible == visible) 377 if (m_visible == visible)
374 return; 378 return;
375 m_visible = visible; 379 m_visible = visible;
376 } 380 }
377 381
378 } // namespace cc 382 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698