OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2006, Google Inc. All rights reserved. | 2 * Copyright (c) 2006, 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 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 addCornerArc(&path, r, topLeft, 180); | 783 addCornerArc(&path, r, topLeft, 180); |
784 | 784 |
785 SkPaint paint; | 785 SkPaint paint; |
786 platformContext()->setupPaintForFilling(&paint); | 786 platformContext()->setupPaintForFilling(&paint); |
787 platformContext()->canvas()->drawPath(path, paint); | 787 platformContext()->canvas()->drawPath(path, paint); |
788 return fillRect(rect, color); | 788 return fillRect(rect, color); |
789 } | 789 } |
790 | 790 |
791 TransformationMatrix GraphicsContext::getCTM() const | 791 TransformationMatrix GraphicsContext::getCTM() const |
792 { | 792 { |
793 return platformContext()->canvas()->getTotalMatrix(); | 793 const SkMatrix& m = platformContext()->canvas()->getTotalMatrix(); |
| 794 return TransformationMatrix(SkScalarToDouble(m.getScaleX()), // a |
| 795 SkScalarToDouble(m.getSkewY()), // b |
| 796 SkScalarToDouble(m.getSkewX()), // c |
| 797 SkScalarToDouble(m.getScaleY()), // d |
| 798 SkScalarToDouble(m.getTranslateX()), // e |
| 799 SkScalarToDouble(m.getTranslateY())); // f |
794 } | 800 } |
795 | 801 |
796 FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& rect) | 802 FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& rect) |
797 { | 803 { |
798 // This logic is copied from GraphicsContextCG, eseidel 5/05/08 | 804 // This logic is copied from GraphicsContextCG, eseidel 5/05/08 |
799 | 805 |
800 // It is not enough just to round to pixels in device space. The rotation | 806 // It is not enough just to round to pixels in device space. The rotation |
801 // part of the affine transform matrix to device space can mess with this | 807 // part of the affine transform matrix to device space can mess with this |
802 // conversion if we have a rotating image like the hands of the world clock | 808 // conversion if we have a rotating image like the hands of the world clock |
803 // widget. We just need the scale, so we get the affine transform matrix and | 809 // widget. We just need the scale, so we get the affine transform matrix and |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1114 void GraphicsContext::translate(float w, float h) | 1120 void GraphicsContext::translate(float w, float h) |
1115 { | 1121 { |
1116 if (paintingDisabled()) | 1122 if (paintingDisabled()) |
1117 return; | 1123 return; |
1118 | 1124 |
1119 platformContext()->canvas()->translate(WebCoreFloatToSkScalar(w), | 1125 platformContext()->canvas()->translate(WebCoreFloatToSkScalar(w), |
1120 WebCoreFloatToSkScalar(h)); | 1126 WebCoreFloatToSkScalar(h)); |
1121 } | 1127 } |
1122 | 1128 |
1123 } // namespace WebCore | 1129 } // namespace WebCore |
OLD | NEW |