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