| 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 "ui/gfx/skia_util.h" | 5 #include "ui/gfx/skia_util.h" |
| 6 | 6 |
| 7 #include "third_party/skia/include/core/SkBitmap.h" | 7 #include "third_party/skia/include/core/SkBitmap.h" |
| 8 #include "third_party/skia/include/core/SkColorFilter.h" | 8 #include "third_party/skia/include/core/SkColorFilter.h" |
| 9 #include "third_party/skia/include/core/SkColorPriv.h" | 9 #include "third_party/skia/include/core/SkColorPriv.h" |
| 10 #include "third_party/skia/include/core/SkUnPreMultiply.h" | 10 #include "third_party/skia/include/core/SkUnPreMultiply.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 SkSize SizeFToSkSize(const SizeF& size) { | 51 SkSize SizeFToSkSize(const SizeF& size) { |
| 52 return SkSize::Make(SkFloatToScalar(size.width()), | 52 return SkSize::Make(SkFloatToScalar(size.width()), |
| 53 SkFloatToScalar(size.height())); | 53 SkFloatToScalar(size.height())); |
| 54 } | 54 } |
| 55 | 55 |
| 56 SizeF SkSizeToSizeF(const SkSize& size) { | 56 SizeF SkSizeToSizeF(const SkSize& size) { |
| 57 return SizeF(SkScalarToFloat(size.width()), SkScalarToFloat(size.height())); | 57 return SizeF(SkScalarToFloat(size.width()), SkScalarToFloat(size.height())); |
| 58 } | 58 } |
| 59 | 59 |
| 60 Size SkISizeToSize(const SkISize& size) { |
| 61 return Size(size.width(), size.height()); |
| 62 } |
| 63 |
| 60 void TransformToFlattenedSkMatrix(const gfx::Transform& transform, | 64 void TransformToFlattenedSkMatrix(const gfx::Transform& transform, |
| 61 SkMatrix* flattened) { | 65 SkMatrix* flattened) { |
| 62 // Convert from 4x4 to 3x3 by dropping the third row and column. | 66 // Convert from 4x4 to 3x3 by dropping the third row and column. |
| 63 flattened->set(0, SkMScalarToScalar(transform.matrix().get(0, 0))); | 67 flattened->set(0, SkMScalarToScalar(transform.matrix().get(0, 0))); |
| 64 flattened->set(1, SkMScalarToScalar(transform.matrix().get(0, 1))); | 68 flattened->set(1, SkMScalarToScalar(transform.matrix().get(0, 1))); |
| 65 flattened->set(2, SkMScalarToScalar(transform.matrix().get(0, 3))); | 69 flattened->set(2, SkMScalarToScalar(transform.matrix().get(0, 3))); |
| 66 flattened->set(3, SkMScalarToScalar(transform.matrix().get(1, 0))); | 70 flattened->set(3, SkMScalarToScalar(transform.matrix().get(1, 0))); |
| 67 flattened->set(4, SkMScalarToScalar(transform.matrix().get(1, 1))); | 71 flattened->set(4, SkMScalarToScalar(transform.matrix().get(1, 1))); |
| 68 flattened->set(5, SkMScalarToScalar(transform.matrix().get(1, 3))); | 72 flattened->set(5, SkMScalarToScalar(transform.matrix().get(1, 3))); |
| 69 flattened->set(6, SkMScalarToScalar(transform.matrix().get(3, 0))); | 73 flattened->set(6, SkMScalarToScalar(transform.matrix().get(3, 0))); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 } | 205 } |
| 202 | 206 |
| 203 void QuadFToSkPoints(const gfx::QuadF& quad, SkPoint points[4]) { | 207 void QuadFToSkPoints(const gfx::QuadF& quad, SkPoint points[4]) { |
| 204 points[0] = SkPoint::Make(quad.p1().x(), quad.p1().y()); | 208 points[0] = SkPoint::Make(quad.p1().x(), quad.p1().y()); |
| 205 points[1] = SkPoint::Make(quad.p2().x(), quad.p2().y()); | 209 points[1] = SkPoint::Make(quad.p2().x(), quad.p2().y()); |
| 206 points[2] = SkPoint::Make(quad.p3().x(), quad.p3().y()); | 210 points[2] = SkPoint::Make(quad.p3().x(), quad.p3().y()); |
| 207 points[3] = SkPoint::Make(quad.p4().x(), quad.p4().y()); | 211 points[3] = SkPoint::Make(quad.p4().x(), quad.p4().y()); |
| 208 } | 212 } |
| 209 | 213 |
| 210 } // namespace gfx | 214 } // namespace gfx |
| OLD | NEW |