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

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

Issue 2011713003: Roll skia to 8cc209111876b7c78b5ec577c9221d8ed5e21024 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 7 months 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
« no previous file with comments | « skia/ext/skia_utils_win.h ('k') | skia/skia_gn_files.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "skia/ext/skia_utils_win.h"
6
7 #include <stddef.h>
8 #include <windows.h>
9
10 #include "third_party/skia/include/core/SkRect.h"
11 #include "third_party/skia/include/core/SkTypes.h"
12 #include "third_party/skia/include/effects/SkGradientShader.h"
13
14 namespace {
15
16 SK_COMPILE_ASSERT(offsetof(RECT, left) == offsetof(SkIRect, fLeft), o1);
17 SK_COMPILE_ASSERT(offsetof(RECT, top) == offsetof(SkIRect, fTop), o2);
18 SK_COMPILE_ASSERT(offsetof(RECT, right) == offsetof(SkIRect, fRight), o3);
19 SK_COMPILE_ASSERT(offsetof(RECT, bottom) == offsetof(SkIRect, fBottom), o4);
20 SK_COMPILE_ASSERT(sizeof(RECT().left) == sizeof(SkIRect().fLeft), o5);
21 SK_COMPILE_ASSERT(sizeof(RECT().top) == sizeof(SkIRect().fTop), o6);
22 SK_COMPILE_ASSERT(sizeof(RECT().right) == sizeof(SkIRect().fRight), o7);
23 SK_COMPILE_ASSERT(sizeof(RECT().bottom) == sizeof(SkIRect().fBottom), o8);
24 SK_COMPILE_ASSERT(sizeof(RECT) == sizeof(SkIRect), o9);
25
26 } // namespace
27
28 namespace skia {
29
30 POINT SkPointToPOINT(const SkPoint& point) {
31 POINT win_point = {
32 SkScalarRoundToInt(point.fX), SkScalarRoundToInt(point.fY)
33 };
34 return win_point;
35 }
36
37 SkRect RECTToSkRect(const RECT& rect) {
38 SkRect sk_rect = { SkIntToScalar(rect.left), SkIntToScalar(rect.top),
39 SkIntToScalar(rect.right), SkIntToScalar(rect.bottom) };
40 return sk_rect;
41 }
42
43 SkColor COLORREFToSkColor(COLORREF color) {
44 #ifndef _MSC_VER
45 return SkColorSetRGB(GetRValue(color), GetGValue(color), GetBValue(color));
46 #else
47 // ARGB = 0xFF000000 | ((0BGR -> RGB0) >> 8)
48 return 0xFF000000u | (_byteswap_ulong(color) >> 8);
49 #endif
50 }
51
52 COLORREF SkColorToCOLORREF(SkColor color) {
53 #ifndef _MSC_VER
54 return RGB(SkColorGetR(color), SkColorGetG(color), SkColorGetB(color));
55 #else
56 // 0BGR = ((ARGB -> BGRA) >> 8)
57 return (_byteswap_ulong(color) >> 8);
58 #endif
59 }
60
61 } // namespace skia
62
OLDNEW
« no previous file with comments | « skia/ext/skia_utils_win.h ('k') | skia/skia_gn_files.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698