OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/resources/prioritized_resource.h" | 5 #include "cc/resources/prioritized_resource.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "cc/resources/platform_color.h" | 9 #include "cc/resources/platform_color.h" |
10 #include "cc/resources/prioritized_resource_manager.h" | 10 #include "cc/resources/prioritized_resource_manager.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 void PrioritizedResource::AcquireBackingTexture( | 70 void PrioritizedResource::AcquireBackingTexture( |
71 ResourceProvider* resource_provider) { | 71 ResourceProvider* resource_provider) { |
72 DCHECK(is_above_priority_cutoff_); | 72 DCHECK(is_above_priority_cutoff_); |
73 if (is_above_priority_cutoff_) | 73 if (is_above_priority_cutoff_) |
74 manager_->AcquireBackingTextureIfNeeded(this, resource_provider); | 74 manager_->AcquireBackingTextureIfNeeded(this, resource_provider); |
75 } | 75 } |
76 | 76 |
77 void PrioritizedResource::SetPixels(ResourceProvider* resource_provider, | 77 void PrioritizedResource::SetPixels(ResourceProvider* resource_provider, |
78 const uint8_t* image, | 78 const uint8_t* image, |
79 gfx::Rect image_rect, | 79 const gfx::Rect& image_rect, |
80 gfx::Rect source_rect, | 80 const gfx::Rect& source_rect, |
81 gfx::Vector2d dest_offset) { | 81 gfx::Vector2d dest_offset) { |
82 DCHECK(is_above_priority_cutoff_); | 82 DCHECK(is_above_priority_cutoff_); |
83 if (is_above_priority_cutoff_) | 83 if (is_above_priority_cutoff_) |
84 AcquireBackingTexture(resource_provider); | 84 AcquireBackingTexture(resource_provider); |
85 DCHECK(backing_); | 85 DCHECK(backing_); |
86 resource_provider->SetPixels( | 86 resource_provider->SetPixels( |
87 resource_id(), image, image_rect, source_rect, dest_offset); | 87 resource_id(), image, image_rect, source_rect, dest_offset); |
88 | 88 |
89 // The component order may be bgra if we uploaded bgra pixels to rgba | 89 // The component order may be bgra if we uploaded bgra pixels to rgba |
90 // texture. Mark contents as swizzled if image component order is | 90 // texture. Mark contents as swizzled if image component order is |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 manager_->ReturnBackingTexture(this); | 192 manager_->ReturnBackingTexture(this); |
193 } | 193 } |
194 | 194 |
195 const Proxy* PrioritizedResource::Backing::proxy() const { | 195 const Proxy* PrioritizedResource::Backing::proxy() const { |
196 if (!owner_ || !owner_->resource_manager()) | 196 if (!owner_ || !owner_->resource_manager()) |
197 return NULL; | 197 return NULL; |
198 return owner_->resource_manager()->ProxyForDebug(); | 198 return owner_->resource_manager()->ProxyForDebug(); |
199 } | 199 } |
200 | 200 |
201 } // namespace cc | 201 } // namespace cc |
OLD | NEW |