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

Side by Side Diff: chrome/browser/android/vr_shell/textures/insecure_content_transient_texture.cc

Issue 2862283002: VR: Add initial URL bar element and texture. (Closed)
Patch Set: Drop anti-aliasing. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/android/vr_shell/textures/insecure_content_transient_te xture.h" 5 #include "chrome/browser/android/vr_shell/textures/insecure_content_transient_te xture.h"
6 6
7 #include "cc/paint/skia_paint_canvas.h" 7 #include "cc/paint/skia_paint_canvas.h"
8 #include "components/strings/grit/components_strings.h" 8 #include "components/strings/grit/components_strings.h"
9 #include "ui/base/l10n/l10n_util.h" 9 #include "ui/base/l10n/l10n_util.h"
10 #include "ui/gfx/canvas.h" 10 #include "ui/gfx/canvas.h"
(...skipping 13 matching lines...) Expand all
24 constexpr float kBorderFactor = 0.045; 24 constexpr float kBorderFactor = 0.045;
25 constexpr float kFontSizeFactor = 0.048; 25 constexpr float kFontSizeFactor = 0.048;
26 constexpr float kTextWidthFactor = 1.0 - 3 * kBorderFactor; 26 constexpr float kTextWidthFactor = 1.0 - 3 * kBorderFactor;
27 27
28 } // namespace 28 } // namespace
29 29
30 InsecureContentTransientTexture::InsecureContentTransientTexture() = default; 30 InsecureContentTransientTexture::InsecureContentTransientTexture() = default;
31 31
32 InsecureContentTransientTexture::~InsecureContentTransientTexture() = default; 32 InsecureContentTransientTexture::~InsecureContentTransientTexture() = default;
33 33
34 void InsecureContentTransientTexture::Draw(gfx::Canvas* canvas, 34 void InsecureContentTransientTexture::Draw(SkCanvas* sk_canvas,
35 const gfx::Size& texture_size) { 35 const gfx::Size& texture_size) {
36 cc::SkiaPaintCanvas paint_canvas(sk_canvas);
37 gfx::Canvas gfx_canvas(&paint_canvas, 1.0f);
38 gfx::Canvas* canvas = &gfx_canvas;
39
36 size_.set_width(texture_size.width()); 40 size_.set_width(texture_size.width());
37 int max_height = texture_size.height(); 41 int max_height = texture_size.height();
38 cc::PaintFlags flags; 42 cc::PaintFlags flags;
39 flags.setColor(kBackgroundColor); 43 flags.setColor(kBackgroundColor);
40 44
41 int text_flags = gfx::Canvas::TEXT_ALIGN_CENTER | gfx::Canvas::MULTI_LINE; 45 int text_flags = gfx::Canvas::TEXT_ALIGN_CENTER | gfx::Canvas::MULTI_LINE;
42 auto text = 46 auto text =
43 l10n_util::GetStringUTF16(IDS_PAGE_INFO_INSECURE_WEBVR_CONTENT_TRANSIENT); 47 l10n_util::GetStringUTF16(IDS_PAGE_INFO_INSECURE_WEBVR_CONTENT_TRANSIENT);
44 auto fonts = GetFontList(size_.width() * kFontSizeFactor, text); 48 auto fonts = GetFontList(size_.width() * kFontSizeFactor, text);
45 int text_width = size_.width() * kTextWidthFactor; 49 int text_width = size_.width() * kTextWidthFactor;
(...skipping 21 matching lines...) Expand all
67 gfx::Size InsecureContentTransientTexture::GetPreferredTextureSize( 71 gfx::Size InsecureContentTransientTexture::GetPreferredTextureSize(
68 int maximum_width) const { 72 int maximum_width) const {
69 return gfx::Size(maximum_width, maximum_width); 73 return gfx::Size(maximum_width, maximum_width);
70 } 74 }
71 75
72 gfx::SizeF InsecureContentTransientTexture::GetDrawnSize() const { 76 gfx::SizeF InsecureContentTransientTexture::GetDrawnSize() const {
73 return size_; 77 return size_;
74 } 78 }
75 79
76 } // namespace vr_shell 80 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698