OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "remoting/client/gl_cursor_feedback_texture.h" | 5 #include "remoting/client/display/gl_cursor_feedback_texture.h" |
6 | 6 |
7 #include "remoting/client/gl_render_layer.h" | 7 #include "remoting/client/display/gl_render_layer.h" |
8 | 8 |
9 namespace remoting { | 9 namespace remoting { |
10 | 10 |
11 namespace { | 11 namespace { |
12 | 12 |
13 const int kColorRingsCount = 5; | 13 const int kColorRingsCount = 5; |
14 const int kFeedbackTexturePixelDiameter = 512; | 14 const int kFeedbackTexturePixelDiameter = 512; |
15 const int kFeedbackTexturePixelRadius = kFeedbackTexturePixelDiameter / 2; | 15 const int kFeedbackTexturePixelRadius = kFeedbackTexturePixelDiameter / 2; |
16 | 16 |
17 // RGBA8888 colors. From inside to outside. | 17 // RGBA8888 colors. From inside to outside. |
18 const uint8_t kFeedbackRingColors[kColorRingsCount] | 18 const uint8_t kFeedbackRingColors[kColorRingsCount] |
19 [GlRenderLayer::kBytesPerPixel] = { | 19 [GlRenderLayer::kBytesPerPixel] = { |
20 {0x0, 0x0, 0x0, 0x7f}, // Black | 20 {0x0, 0x0, 0x0, 0x7f}, // Black |
21 {0x0, 0x0, 0x0, 0x7f}, // Black | 21 {0x0, 0x0, 0x0, 0x7f}, // Black |
22 {0xff, 0xff, 0xff, 0x7f}, // White | 22 {0xff, 0xff, 0xff, 0x7f}, // White |
23 {0xff, 0xff, 0xff, 0x7f}, // White | 23 {0xff, 0xff, 0xff, 0x7f}, // White |
24 {0xff, 0xff, 0xff, 0} // Transparent White | 24 {0xff, 0xff, 0xff, 0} // Transparent White |
25 }; | 25 }; |
26 | 26 |
27 const float kFeedbackRadiusStops[kColorRingsCount] = | 27 const float kFeedbackRadiusStops[kColorRingsCount] = {0.0f, 0.85f, 0.9f, 0.95f, |
28 {0.0f, 0.85f, 0.9f, 0.95f, 1.0f}; | 28 1.0f}; |
29 | 29 |
30 uint32_t GetColorByRadius(float radius) { | 30 uint32_t GetColorByRadius(float radius) { |
31 int ring_index = kColorRingsCount - 1; | 31 int ring_index = kColorRingsCount - 1; |
32 // Find first radius stop that is not smaller than current radius. | 32 // Find first radius stop that is not smaller than current radius. |
33 while (radius < kFeedbackRadiusStops[ring_index] && ring_index >= 0) { | 33 while (radius < kFeedbackRadiusStops[ring_index] && ring_index >= 0) { |
34 ring_index--; | 34 ring_index--; |
35 } | 35 } |
36 | 36 |
37 if (ring_index < 0) { | 37 if (ring_index < 0) { |
38 NOTREACHED(); | 38 NOTREACHED(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 GlCursorFeedbackTexture::GlCursorFeedbackTexture() { | 101 GlCursorFeedbackTexture::GlCursorFeedbackTexture() { |
102 texture_.resize(kTextureWidth * kTextureWidth * | 102 texture_.resize(kTextureWidth * kTextureWidth * |
103 GlRenderLayer::kBytesPerPixel); | 103 GlRenderLayer::kBytesPerPixel); |
104 FillFeedbackTexture(reinterpret_cast<uint32_t*>(texture_.data())); | 104 FillFeedbackTexture(reinterpret_cast<uint32_t*>(texture_.data())); |
105 } | 105 } |
106 | 106 |
107 GlCursorFeedbackTexture::~GlCursorFeedbackTexture() {} | 107 GlCursorFeedbackTexture::~GlCursorFeedbackTexture() {} |
108 | 108 |
109 } // namespace remoting | 109 } // namespace remoting |
OLD | NEW |