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

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

Issue 197883017: SkColorType instead of (deprecated) SkBitmap::Config (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments from #5 Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | cc/layers/nine_patch_layer_impl_unittest.cc » ('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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 hud_canvas_->clear(SkColorSetARGB(0, 0, 0, 0)); 163 hud_canvas_->clear(SkColorSetARGB(0, 0, 0, 0));
164 hud_canvas_->save(); 164 hud_canvas_->save();
165 hud_canvas_->scale(contents_scale_x(), contents_scale_y()); 165 hud_canvas_->scale(contents_scale_x(), contents_scale_y());
166 166
167 DrawHudContents(hud_canvas_.get()); 167 DrawHudContents(hud_canvas_.get());
168 168
169 hud_canvas_->restore(); 169 hud_canvas_->restore();
170 } 170 }
171 171
172 TRACE_EVENT0("cc", "UploadHudTexture"); 172 TRACE_EVENT0("cc", "UploadHudTexture");
173 const SkBitmap* bitmap = &hud_canvas_->getDevice()->accessBitmap(false); 173 SkImageInfo info;
174 SkAutoLockPixels locker(*bitmap); 174 size_t row_bytes = 0;
175 175 const void* pixels = hud_canvas_->peekPixels(&info, &row_bytes);
176 DCHECK(pixels);
176 gfx::Rect content_rect(content_bounds()); 177 gfx::Rect content_rect(content_bounds());
177 DCHECK(bitmap->config() == SkBitmap::kARGB_8888_Config); 178 DCHECK(info.colorType() == kPMColor_SkColorType);
178 resource_provider->SetPixels(hud_resource_->id(), 179 resource_provider->SetPixels(hud_resource_->id(),
179 static_cast<const uint8_t*>(bitmap->getPixels()), 180 static_cast<const uint8_t*>(pixels),
180 content_rect, 181 content_rect,
181 content_rect, 182 content_rect,
182 gfx::Vector2d()); 183 gfx::Vector2d());
183 } 184 }
184 185
185 void HeadsUpDisplayLayerImpl::ReleaseResources() { hud_resource_.reset(); } 186 void HeadsUpDisplayLayerImpl::ReleaseResources() { hud_resource_.reset(); }
186 187
187 void HeadsUpDisplayLayerImpl::UpdateHudContents() { 188 void HeadsUpDisplayLayerImpl::UpdateHudContents() {
188 const LayerTreeDebugState& debug_state = layer_tree_impl()->debug_state(); 189 const LayerTreeDebugState& debug_state = layer_tree_impl()->debug_state();
189 190
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 const char* HeadsUpDisplayLayerImpl::LayerTypeAsString() const { 746 const char* HeadsUpDisplayLayerImpl::LayerTypeAsString() const {
746 return "cc::HeadsUpDisplayLayerImpl"; 747 return "cc::HeadsUpDisplayLayerImpl";
747 } 748 }
748 749
749 void HeadsUpDisplayLayerImpl::AsValueInto(base::DictionaryValue* dict) const { 750 void HeadsUpDisplayLayerImpl::AsValueInto(base::DictionaryValue* dict) const {
750 LayerImpl::AsValueInto(dict); 751 LayerImpl::AsValueInto(dict);
751 dict->SetString("layer_name", "Heads Up Display Layer"); 752 dict->SetString("layer_name", "Heads Up Display Layer");
752 } 753 }
753 754
754 } // namespace cc 755 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layers/nine_patch_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698