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

Side by Side Diff: cc/layers/heads_up_display_layer_impl.cc

Issue 951673002: Revert "Pull chromium at 2c3ffb2355a27c32f45e508ef861416b820c823b" (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « cc/layers/content_layer.cc ('k') | cc/layers/layer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/layers/heads_up_display_layer_impl.h" 5 #include "cc/layers/heads_up_display_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 ++it) { 90 ++it) {
91 if (!resource_provider->InUseByConsumer((*it)->id())) { 91 if (!resource_provider->InUseByConsumer((*it)->id())) {
92 resources_.swap(it, resources_.end() - 1); 92 resources_.swap(it, resources_.end() - 1);
93 return; 93 return;
94 } 94 }
95 } 95 }
96 96
97 scoped_ptr<ScopedResource> resource = 97 scoped_ptr<ScopedResource> resource =
98 ScopedResource::Create(resource_provider); 98 ScopedResource::Create(resource_provider);
99 resource->Allocate(internal_content_bounds_, 99 resource->Allocate(internal_content_bounds_,
100 ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888); 100 ResourceProvider::TextureHintImmutable, RGBA_8888);
101 resources_.push_back(resource.Pass()); 101 resources_.push_back(resource.Pass());
102 } 102 }
103 103
104 class ResourceSizeIsEqualTo { 104 class ResourceSizeIsEqualTo {
105 public: 105 public:
106 explicit ResourceSizeIsEqualTo(const gfx::Size& size_) 106 explicit ResourceSizeIsEqualTo(const gfx::Size& size_)
107 : compare_size_(size_) {} 107 : compare_size_(size_) {}
108 108
109 bool operator()(const ScopedResource* resource) { 109 bool operator()(const ScopedResource* resource) {
110 return resource->size() == compare_size_; 110 return resource->size() == compare_size_;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 DrawHudContents(hud_surface_->getCanvas()); 203 DrawHudContents(hud_surface_->getCanvas());
204 204
205 hud_surface_->getCanvas()->restore(); 205 hud_surface_->getCanvas()->restore();
206 } 206 }
207 207
208 TRACE_EVENT0("cc", "UploadHudTexture"); 208 TRACE_EVENT0("cc", "UploadHudTexture");
209 SkImageInfo info; 209 SkImageInfo info;
210 size_t row_bytes = 0; 210 size_t row_bytes = 0;
211 const void* pixels = hud_surface_->getCanvas()->peekPixels(&info, &row_bytes); 211 const void* pixels = hud_surface_->getCanvas()->peekPixels(&info, &row_bytes);
212 DCHECK(pixels); 212 DCHECK(pixels);
213 gfx::Rect content_rect(internal_content_bounds_);
213 DCHECK(info.colorType() == kN32_SkColorType); 214 DCHECK(info.colorType() == kN32_SkColorType);
214 resource_provider->CopyToResource(resources_.back()->id(), 215 resource_provider->SetPixels(resources_.back()->id(),
215 static_cast<const uint8_t*>(pixels), 216 static_cast<const uint8_t*>(pixels),
216 internal_content_bounds_); 217 content_rect,
218 content_rect,
219 gfx::Vector2d());
217 } 220 }
218 221
219 void HeadsUpDisplayLayerImpl::ReleaseResources() { 222 void HeadsUpDisplayLayerImpl::ReleaseResources() {
220 resources_.clear(); 223 resources_.clear();
221 } 224 }
222 225
223 void HeadsUpDisplayLayerImpl::UpdateHudContents() { 226 void HeadsUpDisplayLayerImpl::UpdateHudContents() {
224 const LayerTreeDebugState& debug_state = layer_tree_impl()->debug_state(); 227 const LayerTreeDebugState& debug_state = layer_tree_impl()->debug_state();
225 228
226 // Don't update numbers every frame so text is readable. 229 // Don't update numbers every frame so text is readable.
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 return "cc::HeadsUpDisplayLayerImpl"; 835 return "cc::HeadsUpDisplayLayerImpl";
833 } 836 }
834 837
835 void HeadsUpDisplayLayerImpl::AsValueInto( 838 void HeadsUpDisplayLayerImpl::AsValueInto(
836 base::trace_event::TracedValue* dict) const { 839 base::trace_event::TracedValue* dict) const {
837 LayerImpl::AsValueInto(dict); 840 LayerImpl::AsValueInto(dict);
838 dict->SetString("layer_name", "Heads Up Display Layer"); 841 dict->SetString("layer_name", "Heads Up Display Layer");
839 } 842 }
840 843
841 } // namespace cc 844 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/content_layer.cc ('k') | cc/layers/layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698