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

Unified Diff: remoting/client/gl_cursor.cc

Issue 2614443003: Moving the GL implementation details into a sub folder for client display. (Closed)
Patch Set: Adding deps restriction on r/c/display; Moving sys_opengl.h Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/client/gl_cursor.h ('k') | remoting/client/gl_cursor_feedback.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/gl_cursor.cc
diff --git a/remoting/client/gl_cursor.cc b/remoting/client/gl_cursor.cc
deleted file mode 100644
index 152923ad468d9607f2565ef69faa69e34e11148d..0000000000000000000000000000000000000000
--- a/remoting/client/gl_cursor.cc
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "remoting/client/gl_cursor.h"
-
-#include "remoting/base/util.h"
-#include "remoting/client/gl_canvas.h"
-#include "remoting/client/gl_math.h"
-#include "remoting/client/gl_render_layer.h"
-#include "remoting/client/gl_texture_ids.h"
-#include "remoting/proto/control.pb.h"
-#include "third_party/libyuv/include/libyuv/convert_argb.h"
-
-namespace remoting {
-
-namespace {
-const int kDefaultCursorDataSize = 32 * 32 * GlRenderLayer::kBytesPerPixel;
-} // namespace
-
-GlCursor::GlCursor() {}
-
-GlCursor::~GlCursor() {}
-
-void GlCursor::SetCursorShape(const protocol::CursorShapeInfo& cursor_shape) {
- int data_size = cursor_shape.width() * cursor_shape.height() *
- GlRenderLayer::kBytesPerPixel;
- if (current_cursor_data_size_ < data_size) {
- current_cursor_data_size_ =
- kDefaultCursorDataSize > data_size ? kDefaultCursorDataSize : data_size;
- current_cursor_data_.reset(new uint8_t[current_cursor_data_size_]);
- }
- int stride = cursor_shape.width() * GlRenderLayer::kBytesPerPixel;
- libyuv::ABGRToARGB(
- reinterpret_cast<const uint8_t*>(cursor_shape.data().data()), stride,
- current_cursor_data_.get(), stride, cursor_shape.width(),
- cursor_shape.height());
-
- bool size_changed = current_cursor_width_ != cursor_shape.width() ||
- current_cursor_height_ != cursor_shape.height();
-
- current_cursor_width_ = cursor_shape.width();
- current_cursor_height_ = cursor_shape.height();
- current_cursor_hotspot_x_ = cursor_shape.hotspot_x();
- current_cursor_hotspot_y_ = cursor_shape.hotspot_y();
-
- SetCurrentCursorShape(size_changed);
-
- SetCursorPosition(cursor_x_, cursor_y_);
-}
-
-void GlCursor::SetCursorPosition(float x, float y) {
- cursor_x_ = x;
- cursor_y_ = y;
- if (!current_cursor_data_) {
- return;
- }
- std::array<float, 8> positions;
- FillRectangleVertexPositions(
- x - current_cursor_hotspot_x_, y - current_cursor_hotspot_y_,
- current_cursor_width_, current_cursor_height_, &positions);
- if (layer_) {
- layer_->SetVertexPositions(positions);
- }
-}
-
-void GlCursor::SetCursorVisible(bool visible) {
- visible_ = visible;
-}
-
-void GlCursor::SetCanvas(GlCanvas* canvas) {
- if (!canvas) {
- layer_.reset();
- return;
- }
- layer_.reset(new GlRenderLayer(kGlCursorTextureId, canvas));
- if (current_cursor_data_) {
- SetCurrentCursorShape(true);
- }
- SetCursorPosition(cursor_x_, cursor_y_);
-}
-
-void GlCursor::Draw() {
- if (layer_ && current_cursor_data_ && visible_) {
- layer_->Draw(1.f);
- }
-}
-
-void GlCursor::SetCurrentCursorShape(bool size_changed) {
- if (layer_) {
- if (size_changed) {
- layer_->SetTexture(current_cursor_data_.get(), current_cursor_width_,
- current_cursor_height_, 0);
- } else {
- layer_->UpdateTexture(current_cursor_data_.get(), 0, 0,
- current_cursor_width_, current_cursor_width_, 0);
- }
- }
-}
-
-} // namespace remoting
« no previous file with comments | « remoting/client/gl_cursor.h ('k') | remoting/client/gl_cursor_feedback.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698