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

Unified Diff: chrome/browser/android/vr_shell/ui_scene.cc

Issue 2668093002: VrShell background implemented in JS. (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/vr_shell/ui_scene.cc
diff --git a/chrome/browser/android/vr_shell/ui_scene.cc b/chrome/browser/android/vr_shell/ui_scene.cc
index 0035c1c66973e504b1150178c143e827a1f2da8d..5c958d48f9f524bd4ec99717e3296330131ba0b3 100644
--- a/chrome/browser/android/vr_shell/ui_scene.cc
+++ b/chrome/browser/android/vr_shell/ui_scene.cc
@@ -51,6 +51,23 @@ void ParseVec3f(const base::DictionaryValue& dict, const std::string& key,
}
}
+void ParseColorf(const base::DictionaryValue& dict,
+ const std::string& key,
+ Colorf* output) {
+ const base::DictionaryValue* item_dict;
+ if (dict.GetDictionary(key, &item_dict)) {
+ double value;
+ CHECK(item_dict->GetDouble("r", &value));
+ output->r = value;
+ CHECK(item_dict->GetDouble("g", &value));
+ output->g = value;
+ CHECK(item_dict->GetDouble("b", &value));
+ output->b = value;
+ CHECK(item_dict->GetDouble("a", &value));
+ output->a = value;
+ }
+}
+
void ParseRotationAxisAngle(const base::DictionaryValue& dict,
const std::string& key, RotationAxisAngle* output) {
const base::DictionaryValue* item_dict;
@@ -387,7 +404,6 @@ void UiScene::ApplyDictToElement(const base::DictionaryValue& dict,
dict.GetBoolean("visible", &element->visible);
dict.GetBoolean("hitTestable", &element->hit_testable);
dict.GetBoolean("lockToFov", &element->lock_to_fov);
- ParseRecti(dict, "copyRect", &element->copy_rect);
Parse2DVec3f(dict, "size", &element->size);
ParseVec3f(dict, "scale", &element->scale);
ParseRotationAxisAngle(dict, "rotation", &element->rotation);
@@ -416,6 +432,28 @@ void UiScene::ApplyDictToElement(const base::DictionaryValue& dict,
reinterpret_cast<int*>(&element->y_anchoring))) {
CHECK_GE(element->parent_id, 0);
}
+
+ // Parse the element fill.
+ if (dict.GetInteger("fillType", reinterpret_cast<int*>(&element->fill))) {
+ switch (element->fill) {
+ case Fill::SPRITE:
+ ParseRecti(dict, "copyRect", &element->copy_rect);
+ break;
+ case Fill::OPAQUE_GRADIENT:
+ ParseColorf(dict, "edgeColor", &element->edge_color);
+ ParseColorf(dict, "centerColor", &element->center_color);
+ case Fill::GRID_GRADIENT:
+ ParseColorf(dict, "edgeColor", &element->edge_color);
+ ParseColorf(dict, "centerColor", &element->center_color);
+ int value;
+ dict.GetInteger("tileNumber", &value);
+ element->tile_number = value;
+ break;
+ default:
+ element->fill = Fill::NONE;
+ break;
+ }
+ }
}
} // namespace vr_shell

Powered by Google App Engine
This is Rietveld 408576698