Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: ui/gfx/skia_util.h

Issue 11359172: ui: Remove implicit flooring in skia rect conversion methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make root window transform in tests produce an integer result Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gfx/rect_unittest.cc ('k') | ui/gfx/skia_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 RectF;
24 class ShadowValue; 25 class ShadowValue;
25 26
26 // Convert between Skia and gfx rect types. 27 // Convert between Skia and gfx rect types.
27 UI_EXPORT SkRect RectToSkRect(const Rect& rect); 28 UI_EXPORT SkRect RectToSkRect(const Rect& rect);
28 UI_EXPORT SkIRect RectToSkIRect(const Rect& rect); 29 UI_EXPORT SkIRect RectToSkIRect(const Rect& rect);
29 UI_EXPORT Rect SkRectToRect(const SkRect& rect);
30 UI_EXPORT Rect SkIRectToRect(const SkIRect& rect); 30 UI_EXPORT Rect SkIRectToRect(const SkIRect& rect);
31 UI_EXPORT SkRect RectFToSkRect(const RectF& rect);
32 UI_EXPORT RectF SkRectToRectF(const SkRect& rect);
31 33
32 // Creates a bitmap shader for the image rep with the image rep's scale factor. 34 // Creates a bitmap shader for the image rep with the image rep's scale factor.
33 // Sets the created shader's local matrix such that it displays the image rep at 35 // Sets the created shader's local matrix such that it displays the image rep at
34 // the correct scale factor. 36 // the correct scale factor.
35 // The shader's local matrix should not be changed after the shader is created. 37 // The shader's local matrix should not be changed after the shader is created.
36 // TODO(pkotwicz): Allow shader's local matrix to be changed after the shader 38 // TODO(pkotwicz): Allow shader's local matrix to be changed after the shader
37 // is created. 39 // is created.
38 // Example usage to avoid leaks: 40 // Example usage to avoid leaks:
39 // SkSafeUnref(paint.setShader(gfx::CreateImageRepShader(image_rep, 41 // SkSafeUnref(paint.setShader(gfx::CreateImageRepShader(image_rep,
40 // tile_mode, matrix))); 42 // tile_mode, matrix)));
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 int* accelerated_char_span); 81 int* accelerated_char_span);
80 82
81 // Converts Skia ARGB format pixels in |skia| to RGBA. 83 // Converts Skia ARGB format pixels in |skia| to RGBA.
82 UI_EXPORT void ConvertSkiaToRGBA(const unsigned char* skia, 84 UI_EXPORT void ConvertSkiaToRGBA(const unsigned char* skia,
83 int pixel_width, 85 int pixel_width,
84 unsigned char* rgba); 86 unsigned char* rgba);
85 87
86 } // namespace gfx 88 } // namespace gfx
87 89
88 #endif // UI_GFX_SKIA_UTIL_H_ 90 #endif // UI_GFX_SKIA_UTIL_H_
OLDNEW
« no previous file with comments | « ui/gfx/rect_unittest.cc ('k') | ui/gfx/skia_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698