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

Unified Diff: remoting/client/gl_render_layer.cc

Issue 2148743005: [Remoting Android] Cursor & Cursor Feedback for OpenGL Renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reviewer's Feedback Created 4 years, 5 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_render_layer.h ('k') | remoting/remoting_client.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/gl_render_layer.cc
diff --git a/remoting/client/gl_render_layer.cc b/remoting/client/gl_render_layer.cc
index 836bcb96e55b86dc4962ae533f565544b064e7a6..4c19199dcb39bf61b16ea162a5a33500543fb1f9 100644
--- a/remoting/client/gl_render_layer.cc
+++ b/remoting/client/gl_render_layer.cc
@@ -7,7 +7,9 @@
#include "base/logging.h"
#include "remoting/client/gl_canvas.h"
#include "remoting/client/gl_helpers.h"
-#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
+
+
+namespace remoting {
namespace {
@@ -22,11 +24,21 @@ const float kVertices[] = {
0, 0, 0, 1, 1, 0, 1, 1};
const int kDefaultUpdateBufferCapacity =
- 2048 * 2048 * webrtc::DesktopFrame::kBytesPerPixel;
+ 2048 * 2048 * GlRenderLayer::kBytesPerPixel;
+void PackDirtyRegion(uint8_t* dest,
+ const uint8_t* source,
+ int width,
+ int height,
+ int stride) {
+ for (int i = 0; i < height; i++) {
+ memcpy(dest, source, width * GlRenderLayer::kBytesPerPixel);
+ source += stride;
+ dest += GlRenderLayer::kBytesPerPixel * width;
+ }
}
-namespace remoting {
+} // namespace
GlRenderLayer::GlRenderLayer(int texture_id, GlCanvas* canvas)
: texture_id_(texture_id), canvas_(canvas) {
@@ -49,24 +61,14 @@ void GlRenderLayer::SetTexture(const uint8_t* texture, int width, int height) {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA,
GL_UNSIGNED_BYTE, texture);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, 0);
}
-void PackDirtyRegion(uint8_t* dest,
- const uint8_t* source,
- int width,
- int height,
- int stride) {
- for (int i = 0; i < height; i++) {
- memcpy(dest, source, width * webrtc::DesktopFrame::kBytesPerPixel);
- source += stride;
- dest += webrtc::DesktopFrame::kBytesPerPixel * width;
- }
-}
-
void GlRenderLayer::UpdateTexture(const uint8_t* subtexture,
int offset_x,
int offset_y,
@@ -79,22 +81,20 @@ void GlRenderLayer::UpdateTexture(const uint8_t* subtexture,
glActiveTexture(GL_TEXTURE0 + texture_id_);
glBindTexture(GL_TEXTURE_2D, texture_handle_);
- bool stride_multiple_of_bytes_per_pixel =
- stride % webrtc::DesktopFrame::kBytesPerPixel == 0;
+ bool stride_multiple_of_bytes_per_pixel = stride % kBytesPerPixel == 0;
bool loosely_packed =
!stride_multiple_of_bytes_per_pixel ||
- (stride > 0 && stride != webrtc::DesktopFrame::kBytesPerPixel * width);
+ (stride > 0 && stride != kBytesPerPixel * width);
const void* buffer_to_update = subtexture;
if (loosely_packed) {
if (stride_multiple_of_bytes_per_pixel && canvas_->GetGlVersion() >= 3) {
- glPixelStorei(GL_UNPACK_ROW_LENGTH,
- stride / webrtc::DesktopFrame::kBytesPerPixel);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, stride / kBytesPerPixel);
} else {
// Doesn't support GL_UNPACK_ROW_LENGTH or stride not multiple of
// kBytesPerPixel. Manually pack the data.
- int required_size = width * height * webrtc::DesktopFrame::kBytesPerPixel;
+ int required_size = width * height * kBytesPerPixel;
if (update_buffer_size_ < required_size) {
if (required_size < kDefaultUpdateBufferCapacity) {
update_buffer_size_ = kDefaultUpdateBufferCapacity;
@@ -134,10 +134,11 @@ void GlRenderLayer::SetTextureVisibleArea(
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
-void GlRenderLayer::Draw() {
+void GlRenderLayer::Draw(float alpha_multiplier) {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(texture_set_);
- canvas_->DrawTexture(texture_id_, texture_handle_, buffer_handle_);
+ canvas_->DrawTexture(texture_id_, texture_handle_, buffer_handle_,
+ alpha_multiplier);
}
} // namespace remoting
« no previous file with comments | « remoting/client/gl_render_layer.h ('k') | remoting/remoting_client.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698