| 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 29 matching lines...) Expand all Loading... |
| 40 SkFloatToScalar(rect.height())); | 40 SkFloatToScalar(rect.height())); |
| 41 } | 41 } |
| 42 | 42 |
| 43 RectF SkRectToRectF(const SkRect& rect) { | 43 RectF SkRectToRectF(const SkRect& rect) { |
| 44 return RectF(SkScalarToFloat(rect.x()), | 44 return RectF(SkScalarToFloat(rect.x()), |
| 45 SkScalarToFloat(rect.y()), | 45 SkScalarToFloat(rect.y()), |
| 46 SkScalarToFloat(rect.width()), | 46 SkScalarToFloat(rect.width()), |
| 47 SkScalarToFloat(rect.height())); | 47 SkScalarToFloat(rect.height())); |
| 48 } | 48 } |
| 49 | 49 |
| 50 SkSize SizeFToSkSize(const SizeF& size) { |
| 51 return SkSize::Make(SkFloatToScalar(size.width()), |
| 52 SkFloatToScalar(size.height())); |
| 53 } |
| 54 |
| 55 SizeF SkSizeToSizeF(const SkSize& size) { |
| 56 return SizeF(SkScalarToFloat(size.width()), SkScalarToFloat(size.height())); |
| 57 } |
| 58 |
| 50 void TransformToFlattenedSkMatrix(const gfx::Transform& transform, | 59 void TransformToFlattenedSkMatrix(const gfx::Transform& transform, |
| 51 SkMatrix* flattened) { | 60 SkMatrix* flattened) { |
| 52 // Convert from 4x4 to 3x3 by dropping the third row and column. | 61 // Convert from 4x4 to 3x3 by dropping the third row and column. |
| 53 flattened->set(0, SkMScalarToScalar(transform.matrix().get(0, 0))); | 62 flattened->set(0, SkMScalarToScalar(transform.matrix().get(0, 0))); |
| 54 flattened->set(1, SkMScalarToScalar(transform.matrix().get(0, 1))); | 63 flattened->set(1, SkMScalarToScalar(transform.matrix().get(0, 1))); |
| 55 flattened->set(2, SkMScalarToScalar(transform.matrix().get(0, 3))); | 64 flattened->set(2, SkMScalarToScalar(transform.matrix().get(0, 3))); |
| 56 flattened->set(3, SkMScalarToScalar(transform.matrix().get(1, 0))); | 65 flattened->set(3, SkMScalarToScalar(transform.matrix().get(1, 0))); |
| 57 flattened->set(4, SkMScalarToScalar(transform.matrix().get(1, 1))); | 66 flattened->set(4, SkMScalarToScalar(transform.matrix().get(1, 1))); |
| 58 flattened->set(5, SkMScalarToScalar(transform.matrix().get(1, 3))); | 67 flattened->set(5, SkMScalarToScalar(transform.matrix().get(1, 3))); |
| 59 flattened->set(6, SkMScalarToScalar(transform.matrix().get(3, 0))); | 68 flattened->set(6, SkMScalarToScalar(transform.matrix().get(3, 0))); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 } else { | 193 } else { |
| 185 rgba[i + 0] = SkGetPackedR32(pixel_in); | 194 rgba[i + 0] = SkGetPackedR32(pixel_in); |
| 186 rgba[i + 1] = SkGetPackedG32(pixel_in); | 195 rgba[i + 1] = SkGetPackedG32(pixel_in); |
| 187 rgba[i + 2] = SkGetPackedB32(pixel_in); | 196 rgba[i + 2] = SkGetPackedB32(pixel_in); |
| 188 rgba[i + 3] = alpha; | 197 rgba[i + 3] = alpha; |
| 189 } | 198 } |
| 190 } | 199 } |
| 191 } | 200 } |
| 192 | 201 |
| 193 } // namespace gfx | 202 } // namespace gfx |
| OLD | NEW |