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

Side by Side Diff: Source/core/html/HTMLCanvasElement.cpp

Issue 74533004: Make HTMLCanvasElement::convertLogicalToDevice() clamp float to integer. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 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
« no previous file with comments | « no previous file | 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 /* 1 /*
2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 if (!m_context || !m_context->is3d()) 399 if (!m_context || !m_context->is3d())
400 return 0; 400 return 0;
401 401
402 WebGLRenderingContext* ctx = static_cast<WebGLRenderingContext*>(m_context.g et()); 402 WebGLRenderingContext* ctx = static_cast<WebGLRenderingContext*>(m_context.g et());
403 403
404 return ctx->paintRenderingResultsToImageData(); 404 return ctx->paintRenderingResultsToImageData();
405 } 405 }
406 406
407 IntSize HTMLCanvasElement::convertLogicalToDevice(const IntSize& logicalSize) co nst 407 IntSize HTMLCanvasElement::convertLogicalToDevice(const IntSize& logicalSize) co nst
408 { 408 {
409 float width = ceilf(logicalSize.width() * m_deviceScaleFactor); 409 FloatSize deviceSize = logicalSize * m_deviceScaleFactor;
410 float height = ceilf(logicalSize.height() * m_deviceScaleFactor); 410 return expandedIntSize(deviceSize);
411 return IntSize(width, height);
412 } 411 }
413 412
414 SecurityOrigin* HTMLCanvasElement::securityOrigin() const 413 SecurityOrigin* HTMLCanvasElement::securityOrigin() const
415 { 414 {
416 return document().securityOrigin(); 415 return document().securityOrigin();
417 } 416 }
418 417
419 StyleResolver* HTMLCanvasElement::styleResolver() 418 StyleResolver* HTMLCanvasElement::styleResolver()
420 { 419 {
421 return document().styleResolver(); 420 return document().styleResolver();
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 ASSERT(m_hasCreatedImageBuffer); 548 ASSERT(m_hasCreatedImageBuffer);
550 IntSize unscaledSize = size(); 549 IntSize unscaledSize = size();
551 IntSize size = convertLogicalToDevice(unscaledSize); 550 IntSize size = convertLogicalToDevice(unscaledSize);
552 AffineTransform transform; 551 AffineTransform transform;
553 if (size.width() && size.height()) 552 if (size.width() && size.height())
554 transform.scaleNonUniform(size.width() / unscaledSize.width(), size.heig ht() / unscaledSize.height()); 553 transform.scaleNonUniform(size.width() / unscaledSize.width(), size.heig ht() / unscaledSize.height());
555 return m_imageBuffer->baseTransform() * transform; 554 return m_imageBuffer->baseTransform() * transform;
556 } 555 }
557 556
558 } 557 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698