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

Side by Side Diff: chrome/browser/android/vr_shell/textures/insecure_content_permanent_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_permanent_te xture.h" 5 #include "chrome/browser/android/vr_shell/textures/insecure_content_permanent_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 15 matching lines...) Expand all
26 constexpr float kFontSizeFactor = 0.40; 26 constexpr float kFontSizeFactor = 0.40;
27 constexpr float kTextHeightFactor = 1.0 - 2 * kBorderFactor; 27 constexpr float kTextHeightFactor = 1.0 - 2 * kBorderFactor;
28 constexpr float kTextWidthFactor = 4.0 - 3 * kBorderFactor - kIconSizeFactor; 28 constexpr float kTextWidthFactor = 4.0 - 3 * kBorderFactor - kIconSizeFactor;
29 29
30 } // namespace 30 } // namespace
31 31
32 InsecureContentPermanentTexture::InsecureContentPermanentTexture() = default; 32 InsecureContentPermanentTexture::InsecureContentPermanentTexture() = default;
33 33
34 InsecureContentPermanentTexture::~InsecureContentPermanentTexture() = default; 34 InsecureContentPermanentTexture::~InsecureContentPermanentTexture() = default;
35 35
36 void InsecureContentPermanentTexture::Draw(gfx::Canvas* canvas, 36 void InsecureContentPermanentTexture::Draw(SkCanvas* sk_canvas,
37 const gfx::Size& texture_size) { 37 const gfx::Size& texture_size) {
38 cc::SkiaPaintCanvas paint_canvas(sk_canvas);
39 gfx::Canvas gfx_canvas(&paint_canvas, 1.0f);
40 gfx::Canvas* canvas = &gfx_canvas;
41
38 DCHECK(texture_size.height() * 4 == texture_size.width()); 42 DCHECK(texture_size.height() * 4 == texture_size.width());
39 size_.set_height(texture_size.height()); 43 size_.set_height(texture_size.height());
40 int max_width = texture_size.width(); 44 int max_width = texture_size.width();
41 cc::PaintFlags flags; 45 cc::PaintFlags flags;
42 flags.setColor(kBackgroundColor); 46 flags.setColor(kBackgroundColor);
43 47
44 int text_flags = gfx::Canvas::TEXT_ALIGN_CENTER | gfx::Canvas::NO_ELLIPSIS; 48 int text_flags = gfx::Canvas::TEXT_ALIGN_CENTER | gfx::Canvas::NO_ELLIPSIS;
45 auto text = 49 auto text =
46 l10n_util::GetStringUTF16(IDS_PAGE_INFO_INSECURE_WEBVR_CONTENT_PERMANENT); 50 l10n_util::GetStringUTF16(IDS_PAGE_INFO_INSECURE_WEBVR_CONTENT_PERMANENT);
47 auto fonts = GetFontList(size_.height() * kFontSizeFactor, text); 51 auto fonts = GetFontList(size_.height() * kFontSizeFactor, text);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // Ensuring height is a quarter of the width. 88 // Ensuring height is a quarter of the width.
85 int height = maximum_width / 4; 89 int height = maximum_width / 4;
86 return gfx::Size(height * 4, height); 90 return gfx::Size(height * 4, height);
87 } 91 }
88 92
89 gfx::SizeF InsecureContentPermanentTexture::GetDrawnSize() const { 93 gfx::SizeF InsecureContentPermanentTexture::GetDrawnSize() const {
90 return size_; 94 return size_;
91 } 95 }
92 96
93 } // namespace vr_shell 97 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698