| 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/url_bar_texture.h" | 5 #include "chrome/browser/android/vr_shell/textures/url_bar_texture.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "cc/paint/skia_paint_canvas.h" | 8 #include "cc/paint/skia_paint_canvas.h" |
| 9 #include "components/security_state/core/security_state.h" | 9 #include "components/security_state/core/security_state.h" |
| 10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 if (&getSecurityIcon(security_level_) != &getSecurityIcon(level)) | 71 if (&getSecurityIcon(security_level_) != &getSecurityIcon(level)) |
| 72 dirty_ = true; | 72 dirty_ = true; |
| 73 security_level_ = level; | 73 security_level_ = level; |
| 74 } | 74 } |
| 75 | 75 |
| 76 float UrlBarTexture::ToPixels(float meters) const { | 76 float UrlBarTexture::ToPixels(float meters) const { |
| 77 return meters * size_.width() / kWidth; | 77 return meters * size_.width() / kWidth; |
| 78 } | 78 } |
| 79 | 79 |
| 80 void UrlBarTexture::Draw(SkCanvas* canvas, const gfx::Size& texture_size) { | 80 void UrlBarTexture::Draw(SkCanvas* canvas, const gfx::Size& texture_size) { |
| 81 dirty_ = false; |
| 82 |
| 81 size_.set_height(texture_size.height()); | 83 size_.set_height(texture_size.height()); |
| 82 size_.set_width(texture_size.width()); | 84 size_.set_width(texture_size.width()); |
| 83 | 85 |
| 84 canvas->save(); | 86 canvas->save(); |
| 85 canvas->scale(size_.width() / kWidth, size_.width() / kWidth); | 87 canvas->scale(size_.width() / kWidth, size_.width() / kWidth); |
| 86 | 88 |
| 87 // Make a gfx canvas to support utility drawing methods. | 89 // Make a gfx canvas to support utility drawing methods. |
| 88 cc::SkiaPaintCanvas paint_canvas(canvas); | 90 cc::SkiaPaintCanvas paint_canvas(canvas); |
| 89 gfx::Canvas gfx_canvas(&paint_canvas, 1.0f); | 91 gfx::Canvas gfx_canvas(&paint_canvas, 1.0f); |
| 90 | 92 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 return size_; | 161 return size_; |
| 160 } | 162 } |
| 161 | 163 |
| 162 bool UrlBarTexture::SetDrawFlags(int draw_flags) { | 164 bool UrlBarTexture::SetDrawFlags(int draw_flags) { |
| 163 if (draw_flags != GetDrawFlags()) | 165 if (draw_flags != GetDrawFlags()) |
| 164 dirty_ = true; | 166 dirty_ = true; |
| 165 return UiTexture::SetDrawFlags(draw_flags); | 167 return UiTexture::SetDrawFlags(draw_flags); |
| 166 } | 168 } |
| 167 | 169 |
| 168 } // namespace vr_shell | 170 } // namespace vr_shell |
| OLD | NEW |