blob: b25bfab56ac44f4e452fc32a786ae12f960672c1 [file] [log] [blame]
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/common/cursors/webcursor.h"
#include <windows.h>
#include "third_party/blink/public/platform/web_cursor_info.h"
#include "ui/gfx/icon_util.h"
namespace content {
ui::PlatformCursor WebCursor::GetPlatformCursor(const ui::Cursor& cursor) {
if (info_.type != blink::WebCursorInfo::kTypeCustom)
return LoadCursor(nullptr, IDC_ARROW);
if (platform_cursor_)
return platform_cursor_;
DCHECK_EQ(kN32_SkColorType, info_.custom_image.colorType());
platform_cursor_ = IconUtil::CreateCursorFromSkBitmap(info_.custom_image,
cursor.GetHotspot())
.release();
return platform_cursor_;
}
bool WebCursor::IsPlatformDataEqual(const WebCursor& other) const {
return true;
}
void WebCursor::CleanupPlatformData() {
if (platform_cursor_) {
DestroyIcon(platform_cursor_);
platform_cursor_ = nullptr;
}
}
void WebCursor::CopyPlatformData(const WebCursor& other) {
device_scale_factor_ = other.device_scale_factor_;
}
} // namespace content