OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "gpu/command_buffer/service/common_decoder.h" | 5 #include "gpu/command_buffer/service/common_decoder.h" |
6 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 6 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
7 | 7 |
8 namespace gpu { | 8 namespace gpu { |
9 | 9 |
10 CommonDecoder::Bucket::Bucket() : size_(0) {} | 10 CommonDecoder::Bucket::Bucket() : size_(0) {} |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 if (end > buffer.size || end < offset) { | 71 if (end > buffer.size || end < offset) { |
72 return NULL; | 72 return NULL; |
73 } | 73 } |
74 return static_cast<int8*>(buffer.ptr) + offset; | 74 return static_cast<int8*>(buffer.ptr) + offset; |
75 } | 75 } |
76 | 76 |
77 Buffer CommonDecoder::GetSharedMemoryBuffer(unsigned int shm_id) { | 77 Buffer CommonDecoder::GetSharedMemoryBuffer(unsigned int shm_id) { |
78 return engine_->GetSharedMemoryBuffer(shm_id); | 78 return engine_->GetSharedMemoryBuffer(shm_id); |
79 } | 79 } |
80 | 80 |
| 81 gfx::GLImage* CommonDecoder::GetImage(int32 image_id) { |
| 82 return engine_->GetImage(image_id); |
| 83 } |
| 84 |
81 const char* CommonDecoder::GetCommonCommandName( | 85 const char* CommonDecoder::GetCommonCommandName( |
82 cmd::CommandId command_id) const { | 86 cmd::CommandId command_id) const { |
83 return cmd::GetCommandName(command_id); | 87 return cmd::GetCommandName(command_id); |
84 } | 88 } |
85 | 89 |
86 CommonDecoder::Bucket* CommonDecoder::GetBucket(uint32 bucket_id) const { | 90 CommonDecoder::Bucket* CommonDecoder::GetBucket(uint32 bucket_id) const { |
87 BucketMap::const_iterator iter(buckets_.find(bucket_id)); | 91 BucketMap::const_iterator iter(buckets_.find(bucket_id)); |
88 return iter != buckets_.end() ? &(*iter->second) : NULL; | 92 return iter != buckets_.end() ? &(*iter->second) : NULL; |
89 } | 93 } |
90 | 94 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 } | 287 } |
284 const void* src = bucket->GetData(offset, size); | 288 const void* src = bucket->GetData(offset, size); |
285 if (!src) { | 289 if (!src) { |
286 return error::kInvalidArguments; | 290 return error::kInvalidArguments; |
287 } | 291 } |
288 memcpy(data, src, size); | 292 memcpy(data, src, size); |
289 return error::kNoError; | 293 return error::kNoError; |
290 } | 294 } |
291 | 295 |
292 } // namespace gpu | 296 } // namespace gpu |
OLD | NEW |