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

Unified Diff: chrome/browser/android/vr_shell/textures/ui_texture.h

Issue 2877673005: VR: Avoiding regeneration of RenderText objects for texture rendering (Closed)
Patch Set: removing unnecessary comment Created 3 years, 7 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/textures/ui_texture.h
diff --git a/chrome/browser/android/vr_shell/textures/ui_texture.h b/chrome/browser/android/vr_shell/textures/ui_texture.h
index f1529b3dd8ccc4de94ff1d78fe2854354c8f5a1e..28cc0541907b48fe32871765d5b73f20f1f56c87 100644
--- a/chrome/browser/android/vr_shell/textures/ui_texture.h
+++ b/chrome/browser/android/vr_shell/textures/ui_texture.h
@@ -6,21 +6,35 @@
#define CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_UI_TEXTURE_H_
#include <memory>
+#include <vector>
#include "base/strings/string16.h"
+#include "third_party/skia/include/core/SkColor.h"
+#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/geometry/size_f.h"
class SkCanvas;
namespace gfx {
+
class FontList;
+class RenderText;
+
} // namespace gfx
namespace vr_shell {
class UiTexture {
public:
+ enum {
+ // Flags to configure PrepareDrawStringRect
+ TEXT_ALIGN_LEFT = 1 << 0,
+ TEXT_ALIGN_CENTER = 1 << 1,
+ TEXT_ALIGN_RIGHT = 1 << 2,
+ MULTI_LINE = 1 << 3
+ };
+
UiTexture();
virtual ~UiTexture();
@@ -31,6 +45,19 @@ class UiTexture {
protected:
virtual void Draw(SkCanvas* canvas, const gfx::Size& texture_size) = 0;
+ // Prepares a set of RenderText objects with the given color and fonts.
+ // Attempts to fit the text within the provided size. |flags| specifies how
+ // the text should be rendered. If multiline is requested and provided height
+ // is 0, it will be set to the minimum needed to fit the whole text. If
+ // multiline is not requested and provided width is 0, it will be set to the
+ // minimum needed to fit the whole text.
+ static std::vector<std::unique_ptr<gfx::RenderText>> PrepareDrawStringRect(
+ const base::string16& text,
+ const gfx::FontList& font_list,
+ SkColor color,
+ gfx::Rect* bounds,
+ int flags);
+
static bool IsRTL();
static gfx::FontList GetDefaultFontList(int size);
static gfx::FontList GetFontList(int size, base::string16 text);

Powered by Google App Engine
This is Rietveld 408576698