| 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 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 uint32_t GetColorByRadius(float radius) { | 28 uint32_t GetColorByRadius(float radius) { |
| 29 int ring_index = kColorRingsCount - 1; | 29 int ring_index = kColorRingsCount - 1; |
| 30 // Find first radius stop that is not smaller than current radius. | 30 // Find first radius stop that is not smaller than current radius. |
| 31 while (radius < kFeedbackRadiusStops[ring_index] && ring_index >= 0) { | 31 while (radius < kFeedbackRadiusStops[ring_index] && ring_index >= 0) { |
| 32 ring_index--; | 32 ring_index--; |
| 33 } | 33 } |
| 34 | 34 |
| 35 if (ring_index < 0) { | 35 if (ring_index < 0) { |
| 36 NOTREACHED(); | 36 NOTREACHED(); |
| 37 return -1; | 37 return 0; |
| 38 } | 38 } |
| 39 | 39 |
| 40 if (ring_index == kColorRingsCount - 1) { | 40 if (ring_index == kColorRingsCount - 1) { |
| 41 // Area outside the circle. Just use the outermost color. | 41 // Area outside the circle. Just use the outermost color. |
| 42 return *reinterpret_cast<const uint32_t*>(kFeedbackRingColors[ring_index]); | 42 return *reinterpret_cast<const uint32_t*>(kFeedbackRingColors[ring_index]); |
| 43 } | 43 } |
| 44 | 44 |
| 45 const uint8_t* first_color = kFeedbackRingColors[ring_index]; | 45 const uint8_t* first_color = kFeedbackRingColors[ring_index]; |
| 46 const uint8_t* second_color = kFeedbackRingColors[ring_index + 1]; | 46 const uint8_t* second_color = kFeedbackRingColors[ring_index + 1]; |
| 47 float first_radius = kFeedbackRadiusStops[ring_index]; | 47 float first_radius = kFeedbackRadiusStops[ring_index]; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 GlCursorFeedbackTexture::GlCursorFeedbackTexture() { | 99 GlCursorFeedbackTexture::GlCursorFeedbackTexture() { |
| 100 texture_.resize(kTextureWidth * kTextureWidth * | 100 texture_.resize(kTextureWidth * kTextureWidth * |
| 101 GlRenderLayer::kBytesPerPixel); | 101 GlRenderLayer::kBytesPerPixel); |
| 102 FillFeedbackTexture(reinterpret_cast<uint32_t*>(texture_.data())); | 102 FillFeedbackTexture(reinterpret_cast<uint32_t*>(texture_.data())); |
| 103 } | 103 } |
| 104 | 104 |
| 105 GlCursorFeedbackTexture::~GlCursorFeedbackTexture() {} | 105 GlCursorFeedbackTexture::~GlCursorFeedbackTexture() {} |
| 106 | 106 |
| 107 } // namespace remoting | 107 } // namespace remoting |
| OLD | NEW |