forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SkottieTextPropertyValue to skottie rendering pipeline.
Why: ChromeOS needs text in its animations, and the text is dynamic. This just adds a class that will get plumbed through the rendering pipeline in Chromium. It will get serialized and used in subsequent CLs. Bug: b:217271404 Cq-Include-Trybots: luci.chrome.try:linux-chromeos-chrome Change-Id: I641ba35248a5c7c6213e84b4ad9549da0f9bc71d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3472552 Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Eric Sum <esum@google.com> Cr-Commit-Position: refs/heads/main@{#973141}
- Loading branch information
Showing
10 changed files
with
253 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright 2022 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 "cc/paint/skottie_text_property_value.h" | ||
|
||
#include <utility> | ||
|
||
#include "base/hash/hash.h" | ||
|
||
namespace cc { | ||
|
||
SkottieTextPropertyValue::SkottieTextPropertyValue(std::string text) { | ||
SetText(std::move(text)); | ||
} | ||
|
||
SkottieTextPropertyValue::SkottieTextPropertyValue( | ||
const SkottieTextPropertyValue& other) = default; | ||
|
||
SkottieTextPropertyValue& SkottieTextPropertyValue::operator=( | ||
const SkottieTextPropertyValue& other) = default; | ||
|
||
SkottieTextPropertyValue::~SkottieTextPropertyValue() = default; | ||
|
||
bool SkottieTextPropertyValue::operator==( | ||
const SkottieTextPropertyValue& other) const { | ||
return text_hash_ == other.text_hash_; | ||
} | ||
|
||
bool SkottieTextPropertyValue::operator!=( | ||
const SkottieTextPropertyValue& other) const { | ||
return !(*this == other); | ||
} | ||
|
||
void SkottieTextPropertyValue::SetText(std::string text) { | ||
size_t incoming_text_hash = base::FastHash(text); | ||
if (incoming_text_hash == text_hash_) | ||
return; | ||
text_hash_ = incoming_text_hash; | ||
text_ = base::RefCountedString::TakeString(&text); | ||
} | ||
|
||
} // namespace cc |
Oops, something went wrong.