| OLD | NEW |
| 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 28 matching lines...) Expand all Loading... |
| 39 cc::SkiaPaintCanvas paint_canvas(sk_canvas); | 39 cc::SkiaPaintCanvas paint_canvas(sk_canvas); |
| 40 gfx::Canvas gfx_canvas(&paint_canvas, 1.0f); | 40 gfx::Canvas gfx_canvas(&paint_canvas, 1.0f); |
| 41 gfx::Canvas* canvas = &gfx_canvas; | 41 gfx::Canvas* canvas = &gfx_canvas; |
| 42 | 42 |
| 43 DCHECK(texture_size.height() * 4 == texture_size.width()); | 43 DCHECK(texture_size.height() * 4 == texture_size.width()); |
| 44 size_.set_height(texture_size.height()); | 44 size_.set_height(texture_size.height()); |
| 45 SkPaint paint; | 45 SkPaint paint; |
| 46 paint.setColor(kBackgroundColor); | 46 paint.setColor(kBackgroundColor); |
| 47 auto text = | 47 auto text = |
| 48 l10n_util::GetStringUTF16(IDS_PAGE_INFO_INSECURE_WEBVR_CONTENT_PERMANENT); | 48 l10n_util::GetStringUTF16(IDS_PAGE_INFO_INSECURE_WEBVR_CONTENT_PERMANENT); |
| 49 auto fonts = GetFontList(size_.height() * kFontSizeFactor, text); | 49 gfx::FontList fonts; |
| 50 GetFontList(size_.height() * kFontSizeFactor, text, &fonts); |
| 50 gfx::Rect text_size(0, kTextHeightFactor * size_.height()); | 51 gfx::Rect text_size(0, kTextHeightFactor * size_.height()); |
| 51 | 52 |
| 52 std::vector<std::unique_ptr<gfx::RenderText>> lines = | 53 std::vector<std::unique_ptr<gfx::RenderText>> lines = |
| 53 PrepareDrawStringRect(text, fonts, kForegroundColor, &text_size, | 54 PrepareDrawStringRect(text, fonts, kForegroundColor, &text_size, |
| 54 kTextAlignmentNone, kWrappingBehaviorNoWrap); | 55 kTextAlignmentNone, kWrappingBehaviorNoWrap); |
| 55 | 56 |
| 56 DCHECK_LE(text_size.width(), kTextWidthFactor * size_.height()); | 57 DCHECK_LE(text_size.width(), kTextWidthFactor * size_.height()); |
| 57 // Setting background size giving some extra lateral padding to the text. | 58 // Setting background size giving some extra lateral padding to the text. |
| 58 size_.set_width((5 * kBorderFactor + kIconSizeFactor) * size_.height() + | 59 size_.set_width((5 * kBorderFactor + kIconSizeFactor) * size_.height() + |
| 59 text_size.width()); | 60 text_size.width()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 85 // Ensuring height is a quarter of the width. | 86 // Ensuring height is a quarter of the width. |
| 86 int height = maximum_width / 4; | 87 int height = maximum_width / 4; |
| 87 return gfx::Size(height * 4, height); | 88 return gfx::Size(height * 4, height); |
| 88 } | 89 } |
| 89 | 90 |
| 90 gfx::SizeF InsecureContentPermanentTexture::GetDrawnSize() const { | 91 gfx::SizeF InsecureContentPermanentTexture::GetDrawnSize() const { |
| 91 return size_; | 92 return size_; |
| 92 } | 93 } |
| 93 | 94 |
| 94 } // namespace vr_shell | 95 } // namespace vr_shell |
| OLD | NEW |