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

Side by Side Diff: skia/ext/skia_utils_win.cc

Issue 14079: Move skia_utils into the skia namespace. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years 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 | « skia/ext/skia_utils_win.h ('k') | skia/ext/vector_device.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "skia/ext/skia_utils_win.h" 5 #include "skia/ext/skia_utils_win.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "SkRect.h" 8 #include "SkRect.h"
9 #include "SkGradientShader.h" 9 #include "SkGradientShader.h"
10 10
11 namespace { 11 namespace {
12 12
13 COMPILE_ASSERT(offsetof(RECT, left) == offsetof(SkIRect, fLeft), o1); 13 COMPILE_ASSERT(offsetof(RECT, left) == offsetof(SkIRect, fLeft), o1);
14 COMPILE_ASSERT(offsetof(RECT, top) == offsetof(SkIRect, fTop), o2); 14 COMPILE_ASSERT(offsetof(RECT, top) == offsetof(SkIRect, fTop), o2);
15 COMPILE_ASSERT(offsetof(RECT, right) == offsetof(SkIRect, fRight), o3); 15 COMPILE_ASSERT(offsetof(RECT, right) == offsetof(SkIRect, fRight), o3);
16 COMPILE_ASSERT(offsetof(RECT, bottom) == offsetof(SkIRect, fBottom), o4); 16 COMPILE_ASSERT(offsetof(RECT, bottom) == offsetof(SkIRect, fBottom), o4);
17 COMPILE_ASSERT(sizeof(RECT().left) == sizeof(SkIRect().fLeft), o5); 17 COMPILE_ASSERT(sizeof(RECT().left) == sizeof(SkIRect().fLeft), o5);
18 COMPILE_ASSERT(sizeof(RECT().top) == sizeof(SkIRect().fTop), o6); 18 COMPILE_ASSERT(sizeof(RECT().top) == sizeof(SkIRect().fTop), o6);
19 COMPILE_ASSERT(sizeof(RECT().right) == sizeof(SkIRect().fRight), o7); 19 COMPILE_ASSERT(sizeof(RECT().right) == sizeof(SkIRect().fRight), o7);
20 COMPILE_ASSERT(sizeof(RECT().bottom) == sizeof(SkIRect().fBottom), o8); 20 COMPILE_ASSERT(sizeof(RECT().bottom) == sizeof(SkIRect().fBottom), o8);
21 COMPILE_ASSERT(sizeof(RECT) == sizeof(SkIRect), o9); 21 COMPILE_ASSERT(sizeof(RECT) == sizeof(SkIRect), o9);
22 22
23 } // namespace 23 } // namespace
24 24
25 namespace gfx { 25 namespace skia {
26 26
27 POINT SkPointToPOINT(const SkPoint& point) { 27 POINT SkPointToPOINT(const SkPoint& point) {
28 POINT win_point = { SkScalarRound(point.fX), SkScalarRound(point.fY) }; 28 POINT win_point = { SkScalarRound(point.fX), SkScalarRound(point.fY) };
29 return win_point; 29 return win_point;
30 } 30 }
31 31
32 SkRect RECTToSkRect(const RECT& rect) { 32 SkRect RECTToSkRect(const RECT& rect) {
33 SkRect sk_rect = { SkIntToScalar(rect.left), SkIntToScalar(rect.top), 33 SkRect sk_rect = { SkIntToScalar(rect.left), SkIntToScalar(rect.top),
34 SkIntToScalar(rect.right), SkIntToScalar(rect.bottom) }; 34 SkIntToScalar(rect.right), SkIntToScalar(rect.bottom) };
35 return sk_rect; 35 return sk_rect;
(...skipping 14 matching lines...) Expand all
50 // (SkColorGetX(color) * 255 / a) will have to be added in the conversion. 50 // (SkColorGetX(color) * 255 / a) will have to be added in the conversion.
51 DCHECK((0xFF == SkColorGetA(color)) || (0 == color)); 51 DCHECK((0xFF == SkColorGetA(color)) || (0 == color));
52 #ifndef _MSC_VER 52 #ifndef _MSC_VER
53 return RGB(SkColorGetR(color), SkColorGetG(color), SkColorGetB(color)); 53 return RGB(SkColorGetR(color), SkColorGetG(color), SkColorGetB(color));
54 #else 54 #else
55 // 0BGR = ((ARGB -> BGRA) >> 8) 55 // 0BGR = ((ARGB -> BGRA) >> 8)
56 return (_byteswap_ulong(color) >> 8); 56 return (_byteswap_ulong(color) >> 8);
57 #endif 57 #endif
58 } 58 }
59 59
60 } // namespace gfx 60 } // namespace skia
61 61
OLDNEW
« no previous file with comments | « skia/ext/skia_utils_win.h ('k') | skia/ext/vector_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698