Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: remoting/client/gl_cursor_feedback_texture.cc

Issue 2196493002: [Chromoting] Unit Tests for GlRenderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't draw when canvas is not set Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/client/gl_cursor.h ('k') | remoting/client/gl_render_layer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « remoting/client/gl_cursor.h ('k') | remoting/client/gl_render_layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698