| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "services/ui/public/cpp/bitmap_uploader.h" | 5 #include "services/ui/public/cpp/bitmap_uploader.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 : window_(window), | 31 : window_(window), |
| 32 color_(g_transparent_color), | 32 color_(g_transparent_color), |
| 33 width_(0), | 33 width_(0), |
| 34 height_(0), | 34 height_(0), |
| 35 format_(BGRA), | 35 format_(BGRA), |
| 36 next_resource_id_(1u) {} | 36 next_resource_id_(1u) {} |
| 37 | 37 |
| 38 BitmapUploader::~BitmapUploader() { | 38 BitmapUploader::~BitmapUploader() { |
| 39 } | 39 } |
| 40 | 40 |
| 41 void BitmapUploader::Init(shell::Connector* connector) { | 41 void BitmapUploader::Init() { |
| 42 surface_ = window_->RequestSurface(mojom::SurfaceType::DEFAULT); | 42 surface_ = window_->RequestSurface(mojom::SurfaceType::DEFAULT); |
| 43 surface_->BindToThread(); | 43 surface_->BindToThread(); |
| 44 surface_->set_client(this); | 44 surface_->set_client(this); |
| 45 | 45 |
| 46 gles2_context_ = GLES2Context::CreateOffscreenContext( | 46 gles2_context_ = GLES2Context::CreateOffscreenContext(std::vector<int32_t>()); |
| 47 std::vector<int32_t>(), connector); | |
| 48 // CreateOffscreenContext() may return null. | 47 // CreateOffscreenContext() may return null. |
| 49 } | 48 } |
| 50 | 49 |
| 51 // Sets the color which is RGBA. | 50 // Sets the color which is RGBA. |
| 52 void BitmapUploader::SetColor(uint32_t color) { | 51 void BitmapUploader::SetColor(uint32_t color) { |
| 53 if (color_ == color) | 52 if (color_ == color) |
| 54 return; | 53 return; |
| 55 color_ = color; | 54 color_ = color; |
| 56 if (surface_) | 55 if (surface_) |
| 57 Upload(); | 56 Upload(); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 DCHECK_EQ(1, resource.count); | 193 DCHECK_EQ(1, resource.count); |
| 195 gl->WaitSyncTokenCHROMIUM(resource.sync_token.GetConstData()); | 194 gl->WaitSyncTokenCHROMIUM(resource.sync_token.GetConstData()); |
| 196 uint32_t texture_id = resource_to_texture_id_map_[resource.id]; | 195 uint32_t texture_id = resource_to_texture_id_map_[resource.id]; |
| 197 DCHECK_NE(0u, texture_id); | 196 DCHECK_NE(0u, texture_id); |
| 198 resource_to_texture_id_map_.erase(resource.id); | 197 resource_to_texture_id_map_.erase(resource.id); |
| 199 gl->DeleteTextures(1, &texture_id); | 198 gl->DeleteTextures(1, &texture_id); |
| 200 } | 199 } |
| 201 } | 200 } |
| 202 | 201 |
| 203 } // namespace ui | 202 } // namespace ui |
| OLD | NEW |