Commit f47c6e53 authored by Christopher Grant's avatar Christopher Grant Committed by Commit Bot

VR: Make the common, UI and base portions of VR separate components

This change cleans up some baggage left over from the original splitting of UI out
of the common VR codebase, and makes native module work easier.

BUG=

Change-Id: I6c2935a4986023963a2cbc9535a97858016c30c9
Reviewed-on: https://chromium-review.googlesource.com/c/1393463Reviewed-by: default avatarIan Vollick <vollick@chromium.org>
Commit-Queue: Christopher Grant <cjgrant@chromium.org>
Cr-Commit-Position: refs/heads/master@{#619473}
parent bcff4822
......@@ -197,10 +197,7 @@ component("vr_ui") {
"//skia",
]
defines = [
"VR_IMPLEMENTATION",
"VR_UI_IMPLEMENTATION",
]
defines = [ "VR_UI_IMPLEMENTATION" ]
if (use_command_buffer) {
sources += [
......@@ -258,6 +255,7 @@ component("vr_common") {
"sounds_manager_audio_delegate.h",
"ui_factory.cc",
"ui_factory.h",
"vr_export.h",
"vr_web_contents_observer.cc",
"vr_web_contents_observer.h",
]
......@@ -317,10 +315,7 @@ component("vr_common") {
deps += [ "//services/ws/public/cpp/gpu" ]
}
defines = [
"VR_IMPLEMENTATION",
"VR_UI_IMPLEMENTATION",
]
defines = [ "VR_IMPLEMENTATION" ]
if (!use_command_buffer) {
sources += [
......@@ -333,7 +328,7 @@ component("vr_common") {
# vr_base contains common dependencies of vr_common and vr_ui. It exists because
# vr_ui must not depend on vr_common.
source_set("vr_base") {
component("vr_base") {
sources = [
"assets_component_update_status.h",
"assets_load_status.h",
......@@ -392,7 +387,7 @@ source_set("vr_base") {
"ui_support.h",
"ui_test_input.h",
"ui_unsupported_mode.h",
"vr_export.h",
"vr_base_export.h",
"vr_geometry_util.cc",
"vr_geometry_util.h",
"vr_gl_util.cc",
......@@ -404,10 +399,7 @@ source_set("vr_base") {
"keyboard_delegate_for_testing.h",
]
defines = [
"VR_IMPLEMENTATION",
"VR_UI_IMPLEMENTATION",
]
defines = [ "VR_BASE_IMPLEMENTATION" ]
public_deps = [
":vr_build_features",
......
......@@ -13,7 +13,7 @@
#include "base/memory/weak_ptr.h"
#include "base/version.h"
#include "chrome/browser/vr/assets_load_status.h"
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
namespace base {
class DictionaryValue;
......@@ -40,7 +40,7 @@ struct Assets;
// component will be made available on a different thread than the asset load
// request. Internally, the function calls will be posted on the main thread.
// The asset load may be performed on a worker thread.
class VR_EXPORT AssetsLoader {
class VR_BASE_EXPORT AssetsLoader {
public:
typedef base::OnceCallback<void(AssetsLoadStatus status,
std::unique_ptr<Assets> assets,
......
......@@ -11,7 +11,7 @@
#include "chrome/browser/vr/model/capturing_state_model.h"
#include "chrome/browser/vr/model/web_vr_model.h"
#include "chrome/browser/vr/ui_unsupported_mode.h"
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
#include "components/security_state/core/security_state.h"
namespace base {
......@@ -28,7 +28,7 @@ struct LocationBarState;
// The browser communicates state changes to the VR UI via this interface.
// A GL thread would also implement this interface to provide a convenient way
// to call these methods from the main thread.
class VR_EXPORT BrowserUiInterface {
class VR_BASE_EXPORT BrowserUiInterface {
public:
virtual ~BrowserUiInterface() {}
......
......@@ -8,7 +8,7 @@
#include <utility>
#include "chrome/browser/vr/gl_texture_location.h"
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
namespace vr {
......
......@@ -6,12 +6,12 @@
#define CHROME_BROWSER_VR_INPUT_EVENT_H_
#include "base/time/time.h"
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
#include "ui/gfx/geometry/point_f.h"
namespace vr {
class VR_EXPORT InputEvent {
class VR_BASE_EXPORT InputEvent {
public:
enum Type {
kTypeUndefined = -1,
......
......@@ -6,7 +6,7 @@
#define CHROME_BROWSER_VR_KEYBOARD_DELEGATE_H_
#include "base/memory/weak_ptr.h"
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
namespace gfx {
class Point3F;
......@@ -20,7 +20,7 @@ class KeyboardUiInterface;
struct CameraModel;
struct TextInputInfo;
class VR_EXPORT KeyboardDelegate {
class VR_BASE_EXPORT KeyboardDelegate {
public:
virtual ~KeyboardDelegate() {}
......
......@@ -11,6 +11,7 @@
#include "chrome/browser/vr/keyboard_delegate.h"
#include "chrome/browser/vr/model/text_input_info.h"
#include "chrome/browser/vr/ui_test_input.h"
#include "chrome/browser/vr/vr_base_export.h"
namespace gfx {
class Point3F;
......@@ -22,7 +23,7 @@ namespace vr {
class KeyboardUiInterface;
struct CameraModel;
class KeyboardDelegateForTesting : public KeyboardDelegate {
class VR_BASE_EXPORT KeyboardDelegateForTesting : public KeyboardDelegate {
public:
KeyboardDelegateForTesting();
~KeyboardDelegateForTesting() override;
......
......@@ -6,7 +6,7 @@
#define CHROME_BROWSER_VR_KEYBOARD_UI_INTERFACE_H_
#include "chrome/browser/vr/model/text_input_info.h"
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
namespace vr {
......@@ -14,7 +14,7 @@ namespace vr {
// that we have this interface to restrict the UI API to keyboard-specific
// callback functions because the keyboard delegate doesn't need access to all
// of the UI.
class VR_EXPORT KeyboardUiInterface {
class VR_BASE_EXPORT KeyboardUiInterface {
public:
virtual ~KeyboardUiInterface() {}
virtual void OnInputEdited(const EditedText& info) = 0;
......
......@@ -13,7 +13,7 @@
#include "chrome/browser/vr/assets_component_update_status.h"
#include "chrome/browser/vr/assets_load_status.h"
#include "chrome/browser/vr/mode.h"
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
namespace base {
class Version;
......@@ -24,7 +24,7 @@ namespace vr {
// Helper to collect VR UMA metrics.
//
// For thread-safety, all functions must be called in sequence.
class VR_EXPORT MetricsHelper {
class VR_BASE_EXPORT MetricsHelper {
public:
MetricsHelper();
~MetricsHelper();
......
......@@ -10,7 +10,7 @@
#include "base/time/time.h"
#include "chrome/browser/vr/mode.h"
#include "chrome/browser/vr/ui_browser_interface.h"
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
#include "content/public/browser/web_contents_observer.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
......@@ -147,7 +147,8 @@ class SessionTracker {
// metrics that require state monitoring, such as durations, but also tracks
// data we want attached to that, such as number of videos watched and how the
// session was started.
class VR_EXPORT SessionMetricsHelper : public content::WebContentsObserver {
class VR_BASE_EXPORT SessionMetricsHelper
: public content::WebContentsObserver {
public:
// Returns the SessionMetricsHelper singleton if it has been created for the
// WebContents.
......
......@@ -8,13 +8,13 @@
#include <memory>
#include "base/version.h"
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
class SkBitmap;
namespace vr {
struct VR_EXPORT Assets {
struct VR_BASE_EXPORT Assets {
Assets();
~Assets();
......
......@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_VR_MODEL_CAMERA_MODEL_H_
#define CHROME_BROWSER_VR_MODEL_CAMERA_MODEL_H_
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/transform.h"
......@@ -17,7 +17,7 @@ enum EyeType {
kRightEye,
};
struct VR_EXPORT CameraModel {
struct VR_BASE_EXPORT CameraModel {
EyeType eye_type;
gfx::Rect viewport;
gfx::Transform view_matrix;
......
......@@ -5,11 +5,11 @@
#ifndef CHROME_BROWSER_VR_MODEL_CAPTURING_STATE_MODEL_H_
#define CHROME_BROWSER_VR_MODEL_CAPTURING_STATE_MODEL_H_
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
namespace vr {
struct VR_EXPORT CapturingStateModel {
struct VR_BASE_EXPORT CapturingStateModel {
bool audio_capture_enabled = false;
bool video_capture_enabled = false;
bool screen_capture_enabled = false;
......
......@@ -6,7 +6,7 @@
#define CHROME_BROWSER_VR_MODEL_CONTROLLER_MODEL_H_
#include "base/time/time.h"
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
#include "ui/gfx/geometry/point3_f.h"
#include "ui/gfx/transform.h"
......@@ -16,7 +16,7 @@ namespace vr {
// platform-specific VR subsystem (e.g., GVR). It is used by both the
// UiInputManager (for generating gestures), and by the UI for rendering the
// controller.
struct VR_EXPORT ControllerModel {
struct VR_BASE_EXPORT ControllerModel {
enum ButtonState {
kUp,
kDown,
......
......@@ -6,12 +6,12 @@
#define CHROME_BROWSER_VR_MODEL_HOSTED_PLATFORM_UI_H_
#include "chrome/browser/vr/platform_ui_input_delegate.h"
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
#include "ui/gfx/geometry/rect_f.h"
namespace vr {
typedef PlatformUiInputDelegate* PlatformUiInputDelegatePtr;
struct VR_EXPORT HostedPlatformUi {
struct VR_BASE_EXPORT HostedPlatformUi {
bool hosted_ui_enabled = false;
PlatformUiInputDelegatePtr delegate = nullptr;
unsigned int texture_id = 0;
......
......@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_VR_MODEL_LOCATION_BAR_STATE_H_
#define CHROME_BROWSER_VR_MODEL_LOCATION_BAR_STATE_H_
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
#include "components/security_state/core/security_state.h"
#include "url/gurl.h"
......@@ -16,7 +16,7 @@ struct VectorIcon;
namespace vr {
// Passes information obtained from LocationBarModel to the VR UI framework.
struct VR_EXPORT LocationBarState {
struct VR_BASE_EXPORT LocationBarState {
public:
LocationBarState();
LocationBarState(const GURL& url,
......
......@@ -6,13 +6,13 @@
#define CHROME_BROWSER_VR_MODEL_OMNIBOX_SUGGESTIONS_H_
#include "base/strings/string16.h"
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
#include "components/omnibox/browser/autocomplete_match.h"
#include "url/gurl.h"
namespace vr {
struct VR_EXPORT Autocompletion {
struct VR_BASE_EXPORT Autocompletion {
Autocompletion();
Autocompletion(const base::string16& new_input,
const base::string16& new_suffix);
......@@ -28,7 +28,7 @@ struct VR_EXPORT Autocompletion {
base::string16 suffix;
};
struct VR_EXPORT OmniboxSuggestion {
struct VR_BASE_EXPORT OmniboxSuggestion {
OmniboxSuggestion();
OmniboxSuggestion(const base::string16& new_contents,
......@@ -53,7 +53,7 @@ struct VR_EXPORT OmniboxSuggestion {
Autocompletion autocompletion;
};
struct VR_EXPORT OmniboxSuggestions {
struct VR_BASE_EXPORT OmniboxSuggestions {
OmniboxSuggestions();
~OmniboxSuggestions();
......@@ -62,7 +62,7 @@ struct VR_EXPORT OmniboxSuggestions {
// This struct contains the minimal set of information required to construct an
// AutocompleteInput on VR's behalf.
struct VR_EXPORT AutocompleteRequest {
struct VR_BASE_EXPORT AutocompleteRequest {
base::string16 text;
size_t cursor_position = 0;
bool prevent_inline_autocomplete = false;
......@@ -77,7 +77,7 @@ struct VR_EXPORT AutocompleteRequest {
};
// This struct represents the current request to the AutocompleteController.
struct VR_EXPORT AutocompleteStatus {
struct VR_BASE_EXPORT AutocompleteStatus {
bool active = false;
base::string16 input;
......
......@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_VR_MODEL_RETICLE_MODEL_H_
#define CHROME_BROWSER_VR_MODEL_RETICLE_MODEL_H_
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
#include "ui/gfx/geometry/point3_f.h"
namespace vr {
......@@ -19,7 +19,7 @@ enum CursorType {
// controller's laser. It is computed by the UiInputManager and is used by the
// input manager in the production of gestures as well as by the Reticle element
// in the scene.
struct VR_EXPORT ReticleModel {
struct VR_BASE_EXPORT ReticleModel {
gfx::Point3F target_point;
gfx::PointF target_local_point;
int target_element_id = 0;
......
......@@ -6,11 +6,11 @@
#define CHROME_BROWSER_VR_MODEL_SPEECH_RECOGNITION_MODEL_H_
#include "base/strings/string16.h"
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
namespace vr {
struct VR_EXPORT SpeechRecognitionModel {
struct VR_BASE_EXPORT SpeechRecognitionModel {
int speech_recognition_state = 0;
bool has_or_can_request_audio_permission = true;
base::string16 recognition_result;
......
......@@ -11,12 +11,12 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/vr/text_edit_action.h"
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
namespace vr {
// Represents the state of an editable text field.
struct VR_EXPORT TextInputInfo {
struct VR_BASE_EXPORT TextInputInfo {
public:
TextInputInfo();
explicit TextInputInfo(base::string16 t);
......@@ -65,7 +65,7 @@ struct VR_EXPORT TextInputInfo {
// A superset of TextInputInfo, consisting of a current and previous text field
// state. A keyboard can return this structure, allowing clients to derive
// deltas in keyboard state.
struct VR_EXPORT EditedText {
struct VR_BASE_EXPORT EditedText {
public:
EditedText();
EditedText(const EditedText& other);
......
......@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_VR_MODEL_WEB_VR_MODEL_H_
#define CHROME_BROWSER_VR_MODEL_WEB_VR_MODEL_H_
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
namespace vr {
......@@ -35,7 +35,7 @@ enum class ExternalPromptNotificationType {
kPromptBluetooth,
};
struct VR_EXPORT WebVrModel {
struct VR_BASE_EXPORT WebVrModel {
WebVrState state = kWebVrNoTimeoutPending;
bool has_received_permissions = false;
bool showing_hosted_ui = false;
......
......@@ -15,7 +15,7 @@
#include "chrome/browser/vr/macros.h"
#include "chrome/browser/vr/model/text_input_info.h"
#include "chrome/browser/vr/text_edit_action.h"
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
#include "ui/gfx/geometry/size.h"
namespace base {
......@@ -32,7 +32,7 @@ class PlatformInputHandler;
// This class is responsible for processing all events and gestures for
// PlatformUiElement.
class VR_EXPORT PlatformUiInputDelegate {
class VR_BASE_EXPORT PlatformUiInputDelegate {
public:
PlatformUiInputDelegate();
explicit PlatformUiInputDelegate(PlatformInputHandler* input_handler);
......
......@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_VR_POSE_UTIL_H_
#define CHROME_BROWSER_VR_POSE_UTIL_H_
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
#include "ui/gfx/geometry/vector3d_f.h"
namespace gfx {
......@@ -15,10 +15,10 @@ class Transform;
namespace vr {
// Provides the direction the head is looking towards as a 3x1 unit vector.
VR_EXPORT gfx::Vector3dF GetForwardVector(const gfx::Transform& head_pose);
VR_BASE_EXPORT gfx::Vector3dF GetForwardVector(const gfx::Transform& head_pose);
// Returns a vector heading upward from the viewer's head.
VR_EXPORT gfx::Vector3dF GetUpVector(const gfx::Transform& head_pose);
VR_BASE_EXPORT gfx::Vector3dF GetUpVector(const gfx::Transform& head_pose);
} // namespace vr
......
......@@ -6,14 +6,14 @@
#define CHROME_BROWSER_VR_RENDER_INFO_H_
#include "chrome/browser/vr/model/camera_model.h"
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
#include "ui/gfx/transform.h"
namespace vr {
// Provides information for rendering such as the viewport and view/projection
// matrix.
struct VR_EXPORT RenderInfo {
struct VR_BASE_EXPORT RenderInfo {
gfx::Transform head_pose;
CameraModel left_eye_model;
CameraModel right_eye_model;
......
......@@ -8,11 +8,11 @@
#include <utility>
#include "chrome/browser/vr/gl_texture_location.h"
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
namespace vr {
class VR_EXPORT SchedulerUiInterface {
class VR_BASE_EXPORT SchedulerUiInterface {
public:
virtual ~SchedulerUiInterface() {}
......
......@@ -11,7 +11,7 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/timer/timer.h"
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
namespace content {
class SpeechRecognitionManager;
......@@ -90,7 +90,7 @@ class IOBrowserUIInterface {
// SpeechRecognizer is a wrapper around the speech recognition engine that
// simplifies its use from the UI thread. This class handles all setup/shutdown,
// collection of results, error cases, and threading.
class VR_EXPORT SpeechRecognizer : public IOBrowserUIInterface {
class VR_BASE_EXPORT SpeechRecognizer : public IOBrowserUIInterface {
public:
// |shared_url_loader_factory_info| must be for a creating a
// SharedURLLoaderFactory that can be used on the IO Thread.
......
......@@ -8,7 +8,7 @@
#include <vector>
#include "base/strings/string16.h"
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
namespace vr {
......@@ -20,7 +20,7 @@ enum TextEditActionType {
DELETE_TEXT,
};
class VR_EXPORT TextEditAction {
class VR_BASE_EXPORT TextEditAction {
public:
explicit TextEditAction(TextEditActionType type);
TextEditAction(TextEditActionType type,
......
......@@ -7,13 +7,13 @@
#include "base/callback.h"
#include "base/macros.h"
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
namespace vr {
struct TextInputInfo;
class VR_EXPORT TextInputDelegate {
class VR_BASE_EXPORT TextInputDelegate {
public:
TextInputDelegate();
virtual ~TextInputDelegate();
......
......@@ -8,7 +8,7 @@
#include "chrome/browser/vr/exit_vr_prompt_choice.h"
#include "chrome/browser/vr/model/omnibox_suggestions.h"
#include "chrome/browser/vr/ui_unsupported_mode.h"
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
#include "ui/gfx/geometry/size_f.h"
#include "url/gurl.h"
......@@ -23,7 +23,7 @@ enum NavigationMethod {
// An interface for the VR UI to communicate with VrShell. Many of the functions
// in this interface are proxies to methods on VrShell.
class VR_EXPORT UiBrowserInterface {
class VR_BASE_EXPORT UiBrowserInterface {
public:
virtual ~UiBrowserInterface() = default;
......
......@@ -5,13 +5,13 @@
#ifndef CHROME_BROWSER_VR_UI_INITIAL_STATE_H_
#define CHROME_BROWSER_VR_UI_INITIAL_STATE_H_
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
namespace vr {
// This class describes the initial state of a UI, and may be used by a UI
// instances owner to specify a custom state on startup.
struct VR_EXPORT UiInitialState {
struct VR_BASE_EXPORT UiInitialState {
UiInitialState();
UiInitialState(const UiInitialState& other);
bool in_web_vr = false;
......
......@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_VR_UI_SUPPORT_H_
#define CHROME_BROWSER_VR_UI_SUPPORT_H_
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
#include "components/url_formatter/url_formatter.h"
#include "third_party/icu/source/common/unicode/uchar.h"
#include "third_party/icu/source/common/unicode/uscript.h"
......@@ -20,10 +20,10 @@ namespace vr {
// must supply wrappers for use by the module. For libraries that require only
// one or two methods, it's more efficient to make wrappers.
VR_EXPORT UScriptCode UScriptGetScript(UChar32 codepoint, UErrorCode* err);
VR_BASE_EXPORT UScriptCode UScriptGetScript(UChar32 codepoint, UErrorCode* err);
VR_EXPORT base::string16 FormatUrlForVr(const GURL& gurl,
url::Parsed* new_parsed);
VR_BASE_EXPORT base::string16 FormatUrlForVr(const GURL& gurl,
url::Parsed* new_parsed);
} // namespace vr
......
// Copyright (c) 2018 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.
#ifndef CHROME_BROWSER_VR_VR_BASE_EXPORT_H_
#define CHROME_BROWSER_VR_VR_BASE_EXPORT_H_
#if defined(COMPONENT_BUILD)
#if defined(WIN32)
#if defined(VR_BASE_IMPLEMENTATION)
#define VR_BASE_EXPORT __declspec(dllexport)
#else
#define VR_BASE_EXPORT __declspec(dllimport)
#endif // defined(VR_BASE_IMPLEMENTATION)
#else // defined(WIN32)
#if defined(VR_BASE_IMPLEMENTATION)
#define VR_BASE_EXPORT __attribute__((visibility("default")))
#else
#define VR_BASE_EXPORT
#endif // defined(VR_BASE_IMPLEMENTATION)
#endif
#else // defined(COMPONENT_BUILD)
#define VR_BASE_EXPORT
#endif
#endif // CHROME_BROWSER_VR_VR_BASE_EXPORT_H_
......@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_VR_VR_GEOMETRY_UTIL_H_
#define CHROME_BROWSER_VR_VR_GEOMETRY_UTIL_H_
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
#include "ui/gfx/geometry/rect.h"
namespace gfx {
......@@ -17,14 +17,15 @@ class Transform;
namespace vr {
VR_EXPORT gfx::Rect CalculatePixelSpaceRect(const gfx::Size& texture_size,
const gfx::RectF& texture_rect);
VR_BASE_EXPORT gfx::Rect CalculatePixelSpaceRect(
const gfx::Size& texture_size,
const gfx::RectF& texture_rect);
// Returns the normalized size of the element projected into screen space.
// If (1, 1) the element fills the entire buffer.
VR_EXPORT gfx::SizeF CalculateScreenSize(const gfx::Transform& proj_matrix,
float distance,
const gfx::SizeF& size);
VR_BASE_EXPORT gfx::SizeF CalculateScreenSize(const gfx::Transform& proj_matrix,
float distance,
const gfx::SizeF& size);
} // namespace vr
......
......@@ -9,7 +9,7 @@
#include <string>
#include "chrome/browser/vr/gl_bindings.h"
#include "chrome/browser/vr/vr_export.h"
#include "chrome/browser/vr/vr_base_export.h"
#include "third_party/skia/include/core/SkColor.h"
#define SHADER(Src) "#version 100\n" #Src
......@@ -23,27 +23,28 @@ class Transform;
namespace vr {
VR_EXPORT std::array<float, 16> MatrixToGLArray(const gfx::Transform& matrix);
VR_BASE_EXPORT std::array<float, 16> MatrixToGLArray(
const gfx::Transform& matrix);
// Compile a shader.
VR_EXPORT GLuint CompileShader(GLenum shader_type,
const GLchar* shader_source,
std::string& error);
VR_BASE_EXPORT GLuint CompileShader(GLenum shader_type,
const GLchar* shader_source,
std::string& error);
// Compile and link a program.
VR_EXPORT GLuint CreateAndLinkProgram(GLuint vertex_shader_handle,
GLuint fragment_shader_handle,
std::string& error);
VR_BASE_EXPORT GLuint CreateAndLinkProgram(GLuint vertex_shader_handle,
GLuint fragment_shader_handle,
std::string& error);
// Sets default texture parameters given a texture type.
VR_EXPORT void SetTexParameters(GLenum texture_type);
VR_BASE_EXPORT void SetTexParameters(GLenum texture_type);
// Sets color uniforms given an SkColor.
VR_EXPORT void SetColorUniform(GLuint handle, SkColor c);
VR_BASE_EXPORT void SetColorUniform(GLuint handle, SkColor c);
// Sets color uniforms (but not alpha) given an SkColor. The alpha is assumed to
// be 1.0 in this case.
VR_EXPORT void SetOpaqueColorUniform(GLuint handle, SkColor c);
VR_BASE_EXPORT void SetOpaqueColorUniform(GLuint handle, SkColor c);
} // namespace vr
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment