Skip to content

Commit

Permalink
[vr] Update assets to 1.1 and use in testapp
Browse files Browse the repository at this point in the history
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:closure_compilation;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I4e5a215ac18caa8344ae0ef463e2b08f1e7f60ab
Reviewed-on: https://chromium-review.googlesource.com/857336
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Christopher Grant <cjgrant@chromium.org>
Commit-Queue: Tibor Goldschwendt <tiborg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#528045}
  • Loading branch information
Tibor Goldschwendt authored and Commit Bot committed Jan 9, 2018
1 parent 97ace81 commit 03243ed
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ vs-chromium-project.txt
/chrome/browser/resources/media_router_internal/
/chrome/browser/resources/settings_internal/
/chrome/browser/resources/software_rendering_list
/chrome/browser/resources/vr/assets/background.png
/chrome/browser/resources/vr/assets/*.png
/chrome/browser/spellchecker/internal
/chrome/browser_tests_run.xml
/chrome/chrome_run.xml
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/resources/vr/assets/VERSION
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
MAJOR=1
MINOR=0
MINOR=1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c1b57e2c6ec42143ad07e917e9140bc39d6168ac
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
99e3607a70c1fe5b0b0fa976fc4457883cb78318
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fe34b06777cde3332f6734ff0e96010f2b14aa5f
21 changes: 14 additions & 7 deletions chrome/browser/vr/testapp/vr_test_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ void RotateToward(const gfx::Vector3dF& fwd, gfx::Transform* transform) {
transform->PreconcatTransform(gfx::Transform(quat));
}

bool LoadPng(int resource_id, std::unique_ptr<SkBitmap>* out_image) {
base::StringPiece data =
ui::ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id);
*out_image = base::MakeUnique<SkBitmap>();
return gfx::PNGCodec::Decode(
reinterpret_cast<const unsigned char*>(data.data()), data.size(),
out_image->get());
}

} // namespace

VrTestContext::VrTestContext() : view_scale_factor_(kDefaultViewScaleFactor) {
Expand Down Expand Up @@ -509,14 +518,12 @@ void VrTestContext::CycleOrigin() {
void VrTestContext::LoadAssets() {
base::Version assets_component_version(VR_ASSETS_COMPONENT_VERSION);
#if defined(GOOGLE_CHROME_BUILD)
base::StringPiece data =
ui::ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_VR_BACKGROUND_IMAGE);
auto assets = base::MakeUnique<Assets>();
assets->background = base::MakeUnique<SkBitmap>();
if (!gfx::PNGCodec::Decode(
reinterpret_cast<const unsigned char*>(data.data()), data.size(),
assets->background.get())) {
if (!(LoadPng(IDR_VR_BACKGROUND_IMAGE, &assets->background) &&
LoadPng(IDR_VR_NORMAL_GRADIENT_IMAGE, &assets->normal_gradient) &&
LoadPng(IDR_VR_INCOGNITO_GRADIENT_IMAGE, &assets->incognito_gradient) &&
LoadPng(IDR_VR_FULLSCREEN_GRADIENT_IMAGE,
&assets->fullscreen_gradient))) {
ui_->OnAssetsLoaded(AssetsLoadStatus::kInvalidContent, nullptr,
assets_component_version);
return;
Expand Down
3 changes: 3 additions & 0 deletions chrome/browser/vr/testapp/vr_testapp_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
<includes>
<if expr="background_image_available">
<include name="IDR_VR_BACKGROUND_IMAGE" file="../../resources/vr/assets/background.png" type="BINDATA" />
<include name="IDR_VR_NORMAL_GRADIENT_IMAGE" file="../../resources/vr/assets/normal_gradient.png" type="BINDATA" />
<include name="IDR_VR_INCOGNITO_GRADIENT_IMAGE" file="../../resources/vr/assets/incognito_gradient.png" type="BINDATA" />
<include name="IDR_VR_FULLSCREEN_GRADIENT_IMAGE" file="../../resources/vr/assets/fullscreen_gradient.png" type="BINDATA" />
</if>
</includes>
</release>
Expand Down

0 comments on commit 03243ed

Please sign in to comment.