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/base/ui_export.h" | 15 #include "ui/base/ui_export.h" |
16 | 16 |
17 class SkBitmap; | 17 class SkBitmap; |
18 class SkDrawLooper; | 18 class SkDrawLooper; |
19 | 19 |
20 namespace gfx { | 20 namespace gfx { |
21 | 21 |
22 class ImageSkiaRep; | 22 class ImageSkiaRep; |
23 class Rect; | 23 class Rect; |
24 class RectF; | 24 class RectF; |
25 class ShadowValue; | 25 class ShadowValue; |
| 26 class Transform; |
26 | 27 |
27 // Convert between Skia and gfx rect types. | 28 // Convert between Skia and gfx rect types. |
28 UI_EXPORT SkRect RectToSkRect(const Rect& rect); | 29 UI_EXPORT SkRect RectToSkRect(const Rect& rect); |
29 UI_EXPORT SkIRect RectToSkIRect(const Rect& rect); | 30 UI_EXPORT SkIRect RectToSkIRect(const Rect& rect); |
30 UI_EXPORT Rect SkIRectToRect(const SkIRect& rect); | 31 UI_EXPORT Rect SkIRectToRect(const SkIRect& rect); |
31 UI_EXPORT SkRect RectFToSkRect(const RectF& rect); | 32 UI_EXPORT SkRect RectFToSkRect(const RectF& rect); |
32 UI_EXPORT RectF SkRectToRectF(const SkRect& rect); | 33 UI_EXPORT RectF SkRectToRectF(const SkRect& rect); |
33 | 34 |
| 35 UI_EXPORT void TransformToFlattenedSkMatrix(const gfx::Transform& transform, |
| 36 SkMatrix* flattened); |
| 37 |
34 // Creates a bitmap shader for the image rep with the image rep's scale factor. | 38 // Creates a bitmap shader for the image rep with the image rep's scale factor. |
35 // Sets the created shader's local matrix such that it displays the image rep at | 39 // Sets the created shader's local matrix such that it displays the image rep at |
36 // the correct scale factor. | 40 // the correct scale factor. |
37 // The shader's local matrix should not be changed after the shader is created. | 41 // The shader's local matrix should not be changed after the shader is created. |
38 // TODO(pkotwicz): Allow shader's local matrix to be changed after the shader | 42 // TODO(pkotwicz): Allow shader's local matrix to be changed after the shader |
39 // is created. | 43 // is created. |
40 // | 44 // |
41 UI_EXPORT skia::RefPtr<SkShader> CreateImageRepShader( | 45 UI_EXPORT skia::RefPtr<SkShader> CreateImageRepShader( |
42 const gfx::ImageSkiaRep& image_rep, | 46 const gfx::ImageSkiaRep& image_rep, |
43 SkShader::TileMode tile_mode, | 47 SkShader::TileMode tile_mode, |
(...skipping 17 matching lines...) Expand all Loading... |
61 const SkBitmap& bitmap2); | 65 const SkBitmap& bitmap2); |
62 | 66 |
63 // Converts Skia ARGB format pixels in |skia| to RGBA. | 67 // Converts Skia ARGB format pixels in |skia| to RGBA. |
64 UI_EXPORT void ConvertSkiaToRGBA(const unsigned char* skia, | 68 UI_EXPORT void ConvertSkiaToRGBA(const unsigned char* skia, |
65 int pixel_width, | 69 int pixel_width, |
66 unsigned char* rgba); | 70 unsigned char* rgba); |
67 | 71 |
68 } // namespace gfx | 72 } // namespace gfx |
69 | 73 |
70 #endif // UI_GFX_SKIA_UTIL_H_ | 74 #endif // UI_GFX_SKIA_UTIL_H_ |
OLD | NEW |