Chromium Code Reviews| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 | 218 |
| 219 void QuadFToSkPoints(const gfx::QuadF& quad, SkPoint points[4]) { | 219 void QuadFToSkPoints(const gfx::QuadF& quad, SkPoint points[4]) { |
| 220 points[0] = PointFToSkPoint(quad.p1()); | 220 points[0] = PointFToSkPoint(quad.p1()); |
| 221 points[1] = PointFToSkPoint(quad.p2()); | 221 points[1] = PointFToSkPoint(quad.p2()); |
| 222 points[2] = PointFToSkPoint(quad.p3()); | 222 points[2] = PointFToSkPoint(quad.p3()); |
| 223 points[3] = PointFToSkPoint(quad.p4()); | 223 points[3] = PointFToSkPoint(quad.p4()); |
| 224 } | 224 } |
| 225 | 225 |
| 226 bool ExtractScale(const SkMatrix& matrix, SkSize* scale) { | |
| 227 *scale = SkSize::Make(matrix.getScaleX(), matrix.getScaleY()); | |
| 228 if (matrix.getType() & SkMatrix::kAffine_Mask) { | |
| 229 if (!matrix.decomposeScale(scale)) { | |
| 230 scale->set(1.f, 1.f); | |
| 231 return false; | |
| 232 } | |
| 233 } | |
| 234 return true; | |
| 235 } | |
| 236 | |
| 237 SkRect MapRect(const SkMatrix& matrix, const SkRect& src) { | |
|
danakj
2015/12/03 00:12:35
I question why you're using an SkMatrix and not a
| |
| 238 SkRect dst; | |
| 239 matrix.mapRect(&dst, src); | |
| 240 return dst; | |
| 241 } | |
| 242 | |
| 226 } // namespace gfx | 243 } // namespace gfx |
| OLD | NEW |