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

Side by Side Diff: Source/platform/graphics/skia/NativeImageSkia.cpp

Issue 223673003: Improve computation of ctmScale{X,Y} in NativeImageSkia::drawPattern (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Drop trailing WS. Created 6 years, 8 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 | « LayoutTests/fast/transforms/mirror-transform-tiled-scaled-background-expected.html ('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 /* 1 /*
2 * Copyright (c) 2008, Google Inc. All rights reserved. 2 * Copyright (c) 2008, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 const FloatRect& destRect, 444 const FloatRect& destRect,
445 blink::WebBlendMode blendMode, 445 blink::WebBlendMode blendMode,
446 const IntSize& repeatSpacing) const 446 const IntSize& repeatSpacing) const
447 { 447 {
448 FloatRect normSrcRect = floatSrcRect; 448 FloatRect normSrcRect = floatSrcRect;
449 normSrcRect.intersect(FloatRect(0, 0, bitmap().width(), bitmap().height())); 449 normSrcRect.intersect(FloatRect(0, 0, bitmap().width(), bitmap().height()));
450 if (destRect.isEmpty() || normSrcRect.isEmpty()) 450 if (destRect.isEmpty() || normSrcRect.isEmpty())
451 return; // nothing to draw 451 return; // nothing to draw
452 452
453 SkMatrix totalMatrix = context->getTotalMatrix(); 453 SkMatrix totalMatrix = context->getTotalMatrix();
454 SkScalar ctmScaleX = totalMatrix.getScaleX(); 454 AffineTransform ctm = context->getCTM();
455 SkScalar ctmScaleY = totalMatrix.getScaleY(); 455 SkScalar ctmScaleX = ctm.xScale();
456 SkScalar ctmScaleY = ctm.yScale();
456 totalMatrix.preScale(scale.width(), scale.height()); 457 totalMatrix.preScale(scale.width(), scale.height());
457 458
458 // Figure out what size the bitmap will be in the destination. The 459 // Figure out what size the bitmap will be in the destination. The
459 // destination rect is the bounds of the pattern, we need to use the 460 // destination rect is the bounds of the pattern, we need to use the
460 // matrix to see how big it will be. 461 // matrix to see how big it will be.
461 SkRect destRectTarget; 462 SkRect destRectTarget;
462 totalMatrix.mapRect(&destRectTarget, normSrcRect); 463 totalMatrix.mapRect(&destRectTarget, normSrcRect);
463 464
464 float destBitmapWidth = SkScalarToFloat(destRectTarget.width()); 465 float destBitmapWidth = SkScalarToFloat(destRectTarget.width());
465 float destBitmapHeight = SkScalarToFloat(destRectTarget.height()); 466 float destBitmapHeight = SkScalarToFloat(destRectTarget.height());
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 SkIRect NativeImageSkia::ImageResourceInfo::rectInSubset(const SkIRect& otherSca ledImageSubset) 611 SkIRect NativeImageSkia::ImageResourceInfo::rectInSubset(const SkIRect& otherSca ledImageSubset)
611 { 612 {
612 if (!scaledImageSubset.contains(otherScaledImageSubset)) 613 if (!scaledImageSubset.contains(otherScaledImageSubset))
613 return SkIRect::MakeEmpty(); 614 return SkIRect::MakeEmpty();
614 SkIRect subsetRect = otherScaledImageSubset; 615 SkIRect subsetRect = otherScaledImageSubset;
615 subsetRect.offset(-scaledImageSubset.x(), -scaledImageSubset.y()); 616 subsetRect.offset(-scaledImageSubset.x(), -scaledImageSubset.y());
616 return subsetRect; 617 return subsetRect;
617 } 618 }
618 619
619 } // namespace WebCore 620 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/transforms/mirror-transform-tiled-scaled-background-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698