OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |