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

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: Drop Skia dependencies 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
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..686299adae93aea07309309e2da20e9a22860cb6 100644
--- a/remoting/client/gl_render_layer.cc
+++ b/remoting/client/gl_render_layer.cc
@@ -7,7 +7,6 @@
#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 {
Sergey Ulanov 2016/07/21 19:28:48 nit: if you put this inside the remoting namespace
Yuwei 2016/07/21 19:53:04 Then they are out of the anonymous namespace? I'm
Sergey Ulanov 2016/07/21 20:14:15 namespace remoting { namespace { void foo() { /
Sergey Ulanov 2016/07/21 20:17:14 See https://google.github.io/styleguide/cppguide.h
Yuwei 2016/07/21 21:44:42 Done.
@@ -22,7 +21,7 @@ const float kVertices[] = {
0, 0, 0, 1, 1, 0, 1, 1};
const int kDefaultUpdateBufferCapacity =
- 2048 * 2048 * webrtc::DesktopFrame::kBytesPerPixel;
+ 2048 * 2048 * remoting::GlRenderLayer::kBytesPerPixelRGB32;
}
@@ -49,6 +48,8 @@ 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);
@@ -61,9 +62,9 @@ void PackDirtyRegion(uint8_t* dest,
int height,
int stride) {
for (int i = 0; i < height; i++) {
- memcpy(dest, source, width * webrtc::DesktopFrame::kBytesPerPixel);
+ memcpy(dest, source, width * GlRenderLayer::kBytesPerPixelRGB32);
source += stride;
- dest += webrtc::DesktopFrame::kBytesPerPixel * width;
+ dest += GlRenderLayer::kBytesPerPixelRGB32 * width;
}
}
@@ -79,22 +80,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 % kBytesPerPixelRGB32 == 0;
bool loosely_packed =
!stride_multiple_of_bytes_per_pixel ||
- (stride > 0 && stride != webrtc::DesktopFrame::kBytesPerPixel * width);
+ (stride > 0 && stride != kBytesPerPixelRGB32 * 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 / kBytesPerPixelRGB32);
} 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 * kBytesPerPixelRGB32;
if (update_buffer_size_ < required_size) {
if (required_size < kDefaultUpdateBufferCapacity) {
update_buffer_size_ = kDefaultUpdateBufferCapacity;
@@ -134,10 +133,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

Powered by Google App Engine
This is Rietveld 408576698