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/scoped_cftyperef.h" | 10 #include "base/mac/scoped_cftyperef.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 hints:nil]; | 78 hints:nil]; |
79 } | 79 } |
80 | 80 |
81 [NSGraphicsContext restoreGraphicsState]; | 81 [NSGraphicsContext restoreGraphicsState]; |
82 | 82 |
83 return bitmap; | 83 return bitmap; |
84 } | 84 } |
85 | 85 |
86 } // namespace | 86 } // namespace |
87 | 87 |
88 namespace gfx { | 88 namespace skia { |
89 | 89 |
90 CGAffineTransform SkMatrixToCGAffineTransform(const SkMatrix& matrix) { | 90 CGAffineTransform SkMatrixToCGAffineTransform(const SkMatrix& matrix) { |
91 // CGAffineTransforms don't support perspective transforms, so make sure | 91 // CGAffineTransforms don't support perspective transforms, so make sure |
92 // we don't get those. | 92 // we don't get those. |
93 DCHECK(matrix[SkMatrix::kMPersp0] == 0.0f); | 93 DCHECK(matrix[SkMatrix::kMPersp0] == 0.0f); |
94 DCHECK(matrix[SkMatrix::kMPersp1] == 0.0f); | 94 DCHECK(matrix[SkMatrix::kMPersp1] == 0.0f); |
95 DCHECK(matrix[SkMatrix::kMPersp2] == 1.0f); | 95 DCHECK(matrix[SkMatrix::kMPersp2] == 1.0f); |
96 | 96 |
97 return CGAffineTransformMake(matrix[SkMatrix::kMScaleX], | 97 return CGAffineTransformMake(matrix[SkMatrix::kMScaleX], |
98 matrix[SkMatrix::kMSkewY], | 98 matrix[SkMatrix::kMSkewY], |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 | 459 |
460 CGContextConcatCTM(cgContext_, SkMatrixToCGAffineTransform(matrix)); | 460 CGContextConcatCTM(cgContext_, SkMatrixToCGAffineTransform(matrix)); |
461 | 461 |
462 return cgContext_; | 462 return cgContext_; |
463 } | 463 } |
464 | 464 |
465 bool SkiaBitLocker::hasEmptyClipRegion() const { | 465 bool SkiaBitLocker::hasEmptyClipRegion() const { |
466 return canvas_->isClipEmpty(); | 466 return canvas_->isClipEmpty(); |
467 } | 467 } |
468 | 468 |
469 } // namespace gfx | 469 } // namespace skia |
OLD | NEW |