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 #ifndef UI_GFX_SKIA_UTIL_H_ | 5 #ifndef UI_GFX_SKIA_UTIL_H_ |
6 #define UI_GFX_SKIA_UTIL_H_ | 6 #define UI_GFX_SKIA_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "skia/ext/refptr.h" | 11 #include "skia/ext/refptr.h" |
12 #include "third_party/skia/include/core/SkColor.h" | 12 #include "third_party/skia/include/core/SkColor.h" |
13 #include "third_party/skia/include/core/SkRect.h" | 13 #include "third_party/skia/include/core/SkRect.h" |
14 #include "third_party/skia/include/core/SkShader.h" | 14 #include "third_party/skia/include/core/SkShader.h" |
| 15 #include "ui/gfx/geometry/size.h" |
15 #include "ui/gfx/gfx_export.h" | 16 #include "ui/gfx/gfx_export.h" |
16 | 17 |
17 class SkBitmap; | 18 class SkBitmap; |
18 class SkDrawLooper; | 19 class SkDrawLooper; |
19 | 20 |
20 namespace gfx { | 21 namespace gfx { |
21 | 22 |
22 class ImageSkiaRep; | 23 class ImageSkiaRep; |
23 class Rect; | 24 class Rect; |
24 class RectF; | 25 class RectF; |
25 class ShadowValue; | 26 class ShadowValue; |
26 class Transform; | 27 class Transform; |
27 | 28 |
28 // Convert between Skia and gfx rect types. | 29 // Convert between Skia and gfx rect types. |
29 GFX_EXPORT SkRect RectToSkRect(const Rect& rect); | 30 GFX_EXPORT SkRect RectToSkRect(const Rect& rect); |
30 GFX_EXPORT SkIRect RectToSkIRect(const Rect& rect); | 31 GFX_EXPORT SkIRect RectToSkIRect(const Rect& rect); |
31 GFX_EXPORT Rect SkIRectToRect(const SkIRect& rect); | 32 GFX_EXPORT Rect SkIRectToRect(const SkIRect& rect); |
32 GFX_EXPORT SkRect RectFToSkRect(const RectF& rect); | 33 GFX_EXPORT SkRect RectFToSkRect(const RectF& rect); |
33 GFX_EXPORT RectF SkRectToRectF(const SkRect& rect); | 34 GFX_EXPORT RectF SkRectToRectF(const SkRect& rect); |
| 35 GFX_EXPORT SkSize SizeFToSkSize(const SizeF& size); |
| 36 GFX_EXPORT SizeF SkSizeToSizeF(const SkSize& size); |
34 | 37 |
35 GFX_EXPORT void TransformToFlattenedSkMatrix(const gfx::Transform& transform, | 38 GFX_EXPORT void TransformToFlattenedSkMatrix(const gfx::Transform& transform, |
36 SkMatrix* flattened); | 39 SkMatrix* flattened); |
37 | 40 |
38 // Creates a bitmap shader for the image rep with the image rep's scale factor. | 41 // Creates a bitmap shader for the image rep with the image rep's scale factor. |
39 // Sets the created shader's local matrix such that it displays the image rep at | 42 // Sets the created shader's local matrix such that it displays the image rep at |
40 // the correct scale factor. | 43 // the correct scale factor. |
41 // The shader's local matrix should not be changed after the shader is created. | 44 // The shader's local matrix should not be changed after the shader is created. |
42 // TODO(pkotwicz): Allow shader's local matrix to be changed after the shader | 45 // TODO(pkotwicz): Allow shader's local matrix to be changed after the shader |
43 // is created. | 46 // is created. |
(...skipping 28 matching lines...) Expand all Loading... |
72 const SkBitmap& bitmap2); | 75 const SkBitmap& bitmap2); |
73 | 76 |
74 // Converts Skia ARGB format pixels in |skia| to RGBA. | 77 // Converts Skia ARGB format pixels in |skia| to RGBA. |
75 GFX_EXPORT void ConvertSkiaToRGBA(const unsigned char* skia, | 78 GFX_EXPORT void ConvertSkiaToRGBA(const unsigned char* skia, |
76 int pixel_width, | 79 int pixel_width, |
77 unsigned char* rgba); | 80 unsigned char* rgba); |
78 | 81 |
79 } // namespace gfx | 82 } // namespace gfx |
80 | 83 |
81 #endif // UI_GFX_SKIA_UTIL_H_ | 84 #endif // UI_GFX_SKIA_UTIL_H_ |
OLD | NEW |