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 "components/bitmap_uploader/bitmap_uploader.h" | 5 #include "components/bitmap_uploader/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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 if (color_ == color) | 64 if (color_ == color) |
65 return; | 65 return; |
66 color_ = color; | 66 color_ = color; |
67 if (surface_) | 67 if (surface_) |
68 Upload(); | 68 Upload(); |
69 } | 69 } |
70 | 70 |
71 // Sets a bitmap. | 71 // Sets a bitmap. |
72 void BitmapUploader::SetBitmap(int width, | 72 void BitmapUploader::SetBitmap(int width, |
73 int height, | 73 int height, |
74 scoped_ptr<std::vector<unsigned char>> data, | 74 std::unique_ptr<std::vector<unsigned char>> data, |
75 Format format) { | 75 Format format) { |
76 width_ = width; | 76 width_ = width; |
77 height_ = height; | 77 height_ = height; |
78 bitmap_ = std::move(data); | 78 bitmap_ = std::move(data); |
79 format_ = format; | 79 format_ = format; |
80 if (surface_) | 80 if (surface_) |
81 Upload(); | 81 Upload(); |
82 } | 82 } |
83 | 83 |
84 void BitmapUploader::Upload() { | 84 void BitmapUploader::Upload() { |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 glWaitSyncTokenCHROMIUM( | 242 glWaitSyncTokenCHROMIUM( |
243 resource->sync_token.GetConstData()); | 243 resource->sync_token.GetConstData()); |
244 uint32_t texture_id = resource_to_texture_id_map_[resource->id]; | 244 uint32_t texture_id = resource_to_texture_id_map_[resource->id]; |
245 DCHECK_NE(0u, texture_id); | 245 DCHECK_NE(0u, texture_id); |
246 resource_to_texture_id_map_.erase(resource->id); | 246 resource_to_texture_id_map_.erase(resource->id); |
247 glDeleteTextures(1, &texture_id); | 247 glDeleteTextures(1, &texture_id); |
248 } | 248 } |
249 } | 249 } |
250 | 250 |
251 } // namespace bitmap_uploader | 251 } // namespace bitmap_uploader |
OLD | NEW |