| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "skia/ext/skia_utils_mac.h" | 5 #include "skia/ext/skia_utils_mac.h" |
| 6 | 6 |
| 7 #import <AppKit/AppKit.h> | 7 #import <AppKit/AppKit.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 return CGAffineTransformMake(matrix[SkMatrix::kMScaleX], | 131 return CGAffineTransformMake(matrix[SkMatrix::kMScaleX], |
| 132 matrix[SkMatrix::kMSkewY], | 132 matrix[SkMatrix::kMSkewY], |
| 133 matrix[SkMatrix::kMSkewX], | 133 matrix[SkMatrix::kMSkewX], |
| 134 matrix[SkMatrix::kMScaleY], | 134 matrix[SkMatrix::kMScaleY], |
| 135 matrix[SkMatrix::kMTransX], | 135 matrix[SkMatrix::kMTransX], |
| 136 matrix[SkMatrix::kMTransY]); | 136 matrix[SkMatrix::kMTransY]); |
| 137 } | 137 } |
| 138 | 138 |
| 139 SkRect CGRectToSkRect(const CGRect& rect) { | 139 SkRect CGRectToSkRect(const CGRect& rect) { |
| 140 SkRect sk_rect = { | 140 SkRect sk_rect = { |
| 141 rect.origin.x, | 141 rect.origin.x, rect.origin.y, CGRectGetMaxX(rect), CGRectGetMaxY(rect) |
| 142 rect.origin.y, | |
| 143 rect.origin.x + rect.size.width, | |
| 144 rect.origin.y + rect.size.height, | |
| 145 }; | 142 }; |
| 146 return sk_rect; | 143 return sk_rect; |
| 147 } | 144 } |
| 148 | 145 |
| 149 CGRect SkIRectToCGRect(const SkIRect& rect) { | 146 CGRect SkIRectToCGRect(const SkIRect& rect) { |
| 150 CGRect cg_rect = { | 147 CGRect cg_rect = { |
| 151 { rect.fLeft, rect.fTop }, | 148 { rect.fLeft, rect.fTop }, |
| 152 { rect.fRight - rect.fLeft, rect.fBottom - rect.fTop } | 149 { rect.fRight - rect.fLeft, rect.fBottom - rect.fTop } |
| 153 }; | 150 }; |
| 154 return cg_rect; | 151 return cg_rect; |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 // Apply content matrix. | 443 // Apply content matrix. |
| 447 SkMatrix skMatrix = canvas_->getTotalMatrix(); | 444 SkMatrix skMatrix = canvas_->getTotalMatrix(); |
| 448 skMatrix.postTranslate(-SkIntToScalar(pt.fX), -SkIntToScalar(pt.fY)); | 445 skMatrix.postTranslate(-SkIntToScalar(pt.fX), -SkIntToScalar(pt.fY)); |
| 449 CGAffineTransform affine = SkMatrixToCGAffineTransform(skMatrix); | 446 CGAffineTransform affine = SkMatrixToCGAffineTransform(skMatrix); |
| 450 CGContextConcatCTM(cgContext_, affine); | 447 CGContextConcatCTM(cgContext_, affine); |
| 451 | 448 |
| 452 return cgContext_; | 449 return cgContext_; |
| 453 } | 450 } |
| 454 | 451 |
| 455 } // namespace gfx | 452 } // namespace gfx |
| OLD | NEW |