| 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 "base/string16.h" | 11 #include "base/string16.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 ShadowValue; | 24 class ShadowValue; |
| 25 | 25 |
| 26 // Convert between Skia and gfx rect types. | 26 // Convert between Skia and gfx rect types. |
| 27 UI_EXPORT SkRect RectToSkRect(const gfx::Rect& rect); | 27 UI_EXPORT SkRect RectToSkRect(const Rect& rect); |
| 28 UI_EXPORT SkIRect RectToSkIRect(const gfx::Rect& rect); | 28 UI_EXPORT SkIRect RectToSkIRect(const Rect& rect); |
| 29 UI_EXPORT gfx::Rect SkRectToRect(const SkRect& rect); | 29 UI_EXPORT Rect SkRectToRect(const SkRect& rect); |
| 30 UI_EXPORT Rect SkIRectToRect(const SkIRect& rect); |
| 30 | 31 |
| 31 // Creates a bitmap shader for the image rep with the image rep's scale factor. | 32 // Creates a bitmap shader for the image rep with the image rep's scale factor. |
| 32 // Sets the created shader's local matrix such that it displays the image rep at | 33 // Sets the created shader's local matrix such that it displays the image rep at |
| 33 // the correct scale factor. | 34 // the correct scale factor. |
| 34 // The shader's local matrix should not be changed after the shader is created. | 35 // The shader's local matrix should not be changed after the shader is created. |
| 35 // TODO(pkotwicz): Allow shader's local matrix to be changed after the shader | 36 // TODO(pkotwicz): Allow shader's local matrix to be changed after the shader |
| 36 // is created. | 37 // is created. |
| 37 // Example usage to avoid leaks: | 38 // Example usage to avoid leaks: |
| 38 // SkSafeUnref(paint.setShader(gfx::CreateImageRepShader(image_rep, | 39 // SkSafeUnref(paint.setShader(gfx::CreateImageRepShader(image_rep, |
| 39 // tile_mode, matrix))); | 40 // tile_mode, matrix))); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 int* accelerated_char_span); | 79 int* accelerated_char_span); |
| 79 | 80 |
| 80 // Converts Skia ARGB format pixels in |skia| to RGBA. | 81 // Converts Skia ARGB format pixels in |skia| to RGBA. |
| 81 UI_EXPORT void ConvertSkiaToRGBA(const unsigned char* skia, | 82 UI_EXPORT void ConvertSkiaToRGBA(const unsigned char* skia, |
| 82 int pixel_width, | 83 int pixel_width, |
| 83 unsigned char* rgba); | 84 unsigned char* rgba); |
| 84 | 85 |
| 85 } // namespace gfx | 86 } // namespace gfx |
| 86 | 87 |
| 87 #endif // UI_GFX_SKIA_UTIL_H_ | 88 #endif // UI_GFX_SKIA_UTIL_H_ |
| OLD | NEW |