| Index: skia/ext/skia_utils_win.cc
|
| ===================================================================
|
| --- skia/ext/skia_utils_win.cc (revision 6142)
|
| +++ skia/ext/skia_utils_win.cc (working copy)
|
| @@ -2,18 +2,27 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "base/gfx/skia_utils.h"
|
| +#include <windows.h>
|
|
|
| -#include "base/logging.h"
|
| +#include "skia/ext/skia_utils_win.h"
|
| +
|
| #include "SkRect.h"
|
| #include "SkGradientShader.h"
|
|
|
| namespace {
|
|
|
| -COMPILE_ASSERT(offsetof(RECT, left) == offsetof(SkIRect, fLeft), o1);
|
| -COMPILE_ASSERT(offsetof(RECT, top) == offsetof(SkIRect, fTop), o2);
|
| -COMPILE_ASSERT(offsetof(RECT, right) == offsetof(SkIRect, fRight), o3);
|
| -COMPILE_ASSERT(offsetof(RECT, bottom) == offsetof(SkIRect, fBottom), o4);
|
| +// Compiler assert from base/logging.h
|
| +template <bool>
|
| +struct CompileAssert {
|
| +};
|
| +#undef COMPILE_ASSERT
|
| +#define COMPILE_ASSERT(expr, msg) \
|
| + typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
|
| +
|
| +COMPILE_ASSERT(SK_OFFSETOF(RECT, left) == SK_OFFSETOF(SkIRect, fLeft), o1);
|
| +COMPILE_ASSERT(SK_OFFSETOF(RECT, top) == SK_OFFSETOF(SkIRect, fTop), o2);
|
| +COMPILE_ASSERT(SK_OFFSETOF(RECT, right) == SK_OFFSETOF(SkIRect, fRight), o3);
|
| +COMPILE_ASSERT(SK_OFFSETOF(RECT, bottom) == SK_OFFSETOF(SkIRect, fBottom), o4);
|
| COMPILE_ASSERT(sizeof(RECT().left) == sizeof(SkIRect().fLeft), o5);
|
| COMPILE_ASSERT(sizeof(RECT().top) == sizeof(SkIRect().fTop), o6);
|
| COMPILE_ASSERT(sizeof(RECT().right) == sizeof(SkIRect().fRight), o7);
|
| @@ -22,7 +31,7 @@
|
|
|
| } // namespace
|
|
|
| -namespace gfx {
|
| +namespace skia {
|
|
|
| POINT SkPointToPOINT(const SkPoint& point) {
|
| POINT win_point = { SkScalarRound(point.fX), SkScalarRound(point.fY) };
|
| @@ -35,41 +44,16 @@
|
| return sk_rect;
|
| }
|
|
|
| -SkShader* CreateGradientShader(int start_point,
|
| - int end_point,
|
| - SkColor start_color,
|
| - SkColor end_color) {
|
| - SkColor grad_colors[2] = { start_color, end_color};
|
| - SkPoint grad_points[2];
|
| - grad_points[0].set(SkIntToScalar(0), SkIntToScalar(start_point));
|
| - grad_points[1].set(SkIntToScalar(0), SkIntToScalar(end_point));
|
| -
|
| - return SkGradientShader::CreateLinear(
|
| - grad_points, grad_colors, NULL, 2, SkShader::kRepeat_TileMode);
|
| -}
|
| -
|
| -
|
| SkColor COLORREFToSkColor(COLORREF color) {
|
| -#ifndef _MSC_VER
|
| return SkColorSetRGB(GetRValue(color), GetGValue(color), GetBValue(color));
|
| -#else
|
| - // ARGB = 0xFF000000 | ((0BGR -> RGB0) >> 8)
|
| - return 0xFF000000u | (_byteswap_ulong(color) >> 8);
|
| -#endif
|
| }
|
|
|
| COLORREF SkColorToCOLORREF(SkColor color) {
|
| // Currently, Alpha is always 255 or the color is 0 so there is no need to
|
| - // demultiply the channels. If this DCHECK() is ever hit, the full
|
| - // (SkColorGetX(color) * 255 / a) will have to be added in the conversion.
|
| - DCHECK((0xFF == SkColorGetA(color)) || (0 == color));
|
| -#ifndef _MSC_VER
|
| + // demultiply the channels. If this is needed, (SkColorGetX(color) * 255 / a)
|
| + // will have to be added in the conversion.
|
| return RGB(SkColorGetR(color), SkColorGetG(color), SkColorGetB(color));
|
| -#else
|
| - // 0BGR = ((ARGB -> BGRA) >> 8)
|
| - return (_byteswap_ulong(color) >> 8);
|
| -#endif
|
| }
|
|
|
| -} // namespace gfx
|
| +} // namespace skia
|
|
|
|
|
| Property changes on: skia\ext\skia_utils_win.cc
|
| ___________________________________________________________________
|
| Added: svn:mergeinfo
|
| Merged /branches/chrome_webkit_merge_branch/base/gfx/skia_utils.cc:r69-2775
|
|
|
|
|
|
|