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/gl_cursor_feedback_texture.h" |
6 | 6 |
7 #include "remoting/client/gl_render_layer.h" | 7 #include "remoting/client/gl_render_layer.h" |
8 | 8 |
9 namespace remoting { | 9 namespace remoting { |
10 | 10 |
11 namespace { | 11 namespace { |
12 | 12 |
13 const int kColorRingsCount = 4; | 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 {0, 0, 0, 0}, // transparent black | 20 {0x0, 0x0, 0x0, 0x7f}, // Black |
21 {0xff, 0xff, 0xff, 0xff}, // white | 21 {0x0, 0x0, 0x0, 0x7f}, // Black |
22 {0, 0, 0, 0xff}, // black | 22 {0xff, 0xff, 0xff, 0x7f}, // White |
23 {0, 0, 0, 0} // transparent black | 23 {0xff, 0xff, 0xff, 0x7f}, // White |
| 24 {0xff, 0xff, 0xff, 0} // Transparent White |
24 }; | 25 }; |
25 | 26 |
26 const float kFeedbackRadiusStops[kColorRingsCount] = {0.0f, 0.8f, 0.9f, 1.0f}; | 27 const float kFeedbackRadiusStops[kColorRingsCount] = |
| 28 {0.0f, 0.85f, 0.9f, 0.95f, 1.0f}; |
27 | 29 |
28 uint32_t GetColorByRadius(float radius) { | 30 uint32_t GetColorByRadius(float radius) { |
29 int ring_index = kColorRingsCount - 1; | 31 int ring_index = kColorRingsCount - 1; |
30 // Find first radius stop that is not smaller than current radius. | 32 // Find first radius stop that is not smaller than current radius. |
31 while (radius < kFeedbackRadiusStops[ring_index] && ring_index >= 0) { | 33 while (radius < kFeedbackRadiusStops[ring_index] && ring_index >= 0) { |
32 ring_index--; | 34 ring_index--; |
33 } | 35 } |
34 | 36 |
35 if (ring_index < 0) { | 37 if (ring_index < 0) { |
36 NOTREACHED(); | 38 NOTREACHED(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 100 |
99 GlCursorFeedbackTexture::GlCursorFeedbackTexture() { | 101 GlCursorFeedbackTexture::GlCursorFeedbackTexture() { |
100 texture_.resize(kTextureWidth * kTextureWidth * | 102 texture_.resize(kTextureWidth * kTextureWidth * |
101 GlRenderLayer::kBytesPerPixel); | 103 GlRenderLayer::kBytesPerPixel); |
102 FillFeedbackTexture(reinterpret_cast<uint32_t*>(texture_.data())); | 104 FillFeedbackTexture(reinterpret_cast<uint32_t*>(texture_.data())); |
103 } | 105 } |
104 | 106 |
105 GlCursorFeedbackTexture::~GlCursorFeedbackTexture() {} | 107 GlCursorFeedbackTexture::~GlCursorFeedbackTexture() {} |
106 | 108 |
107 } // namespace remoting | 109 } // namespace remoting |
OLD | NEW |