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

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

Issue 1855273002: Update new Surface callsites (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: software_output_device was indirectly including skia::refptr, switch to sk_sp<> Created 4 years, 8 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/heads_up_display_layer_impl.h ('k') | cc/layers/picture_image_layer_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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 if (hud_surface_) 172 if (hud_surface_)
173 canvas_size = hud_surface_->getCanvas()->getBaseLayerSize(); 173 canvas_size = hud_surface_->getCanvas()->getBaseLayerSize();
174 else 174 else
175 canvas_size.set(0, 0); 175 canvas_size.set(0, 0);
176 176
177 if (canvas_size.width() != internal_content_bounds_.width() || 177 if (canvas_size.width() != internal_content_bounds_.width() ||
178 canvas_size.height() != internal_content_bounds_.height() || 178 canvas_size.height() != internal_content_bounds_.height() ||
179 !hud_surface_) { 179 !hud_surface_) {
180 TRACE_EVENT0("cc", "ResizeHudCanvas"); 180 TRACE_EVENT0("cc", "ResizeHudCanvas");
181 181
182 hud_surface_ = skia::AdoptRef(SkSurface::NewRasterN32Premul( 182 hud_surface_ = SkSurface::MakeRasterN32Premul(
183 internal_content_bounds_.width(), internal_content_bounds_.height())); 183 internal_content_bounds_.width(), internal_content_bounds_.height());
184 } 184 }
185 185
186 UpdateHudContents(); 186 UpdateHudContents();
187 187
188 { 188 {
189 TRACE_EVENT0("cc", "DrawHudContents"); 189 TRACE_EVENT0("cc", "DrawHudContents");
190 hud_surface_->getCanvas()->clear(SkColorSetARGB(0, 0, 0, 0)); 190 hud_surface_->getCanvas()->clear(SkColorSetARGB(0, 0, 0, 0));
191 hud_surface_->getCanvas()->save(); 191 hud_surface_->getCanvas()->save();
192 hud_surface_->getCanvas()->scale(internal_contents_scale_, 192 hud_surface_->getCanvas()->scale(internal_contents_scale_,
193 internal_contents_scale_); 193 internal_contents_scale_);
194 194
195 DrawHudContents(hud_surface_->getCanvas()); 195 DrawHudContents(hud_surface_->getCanvas());
196 196
197 hud_surface_->getCanvas()->restore(); 197 hud_surface_->getCanvas()->restore();
198 } 198 }
199 199
200 TRACE_EVENT0("cc", "UploadHudTexture"); 200 TRACE_EVENT0("cc", "UploadHudTexture");
201 SkImageInfo info; 201 SkImageInfo info;
202 size_t row_bytes = 0; 202 size_t row_bytes = 0;
203 const void* pixels = hud_surface_->getCanvas()->peekPixels(&info, &row_bytes); 203 const void* pixels = hud_surface_->peekPixels(&info, &row_bytes);
204 DCHECK(pixels); 204 DCHECK(pixels);
205 DCHECK(info.colorType() == kN32_SkColorType); 205 DCHECK(info.colorType() == kN32_SkColorType);
206 resource_provider->CopyToResource(resources_.back()->id(), 206 resource_provider->CopyToResource(resources_.back()->id(),
207 static_cast<const uint8_t*>(pixels), 207 static_cast<const uint8_t*>(pixels),
208 internal_content_bounds_); 208 internal_content_bounds_);
209 resource_provider->GenerateSyncTokenForResource(resources_.back()->id()); 209 resource_provider->GenerateSyncTokenForResource(resources_.back()->id());
210 } 210 }
211 211
212 void HeadsUpDisplayLayerImpl::ReleaseResources() { 212 void HeadsUpDisplayLayerImpl::ReleaseResources() {
213 resources_.clear(); 213 resources_.clear();
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 return "cc::HeadsUpDisplayLayerImpl"; 808 return "cc::HeadsUpDisplayLayerImpl";
809 } 809 }
810 810
811 void HeadsUpDisplayLayerImpl::AsValueInto( 811 void HeadsUpDisplayLayerImpl::AsValueInto(
812 base::trace_event::TracedValue* dict) const { 812 base::trace_event::TracedValue* dict) const {
813 LayerImpl::AsValueInto(dict); 813 LayerImpl::AsValueInto(dict);
814 dict->SetString("layer_name", "Heads Up Display Layer"); 814 dict->SetString("layer_name", "Heads Up Display Layer");
815 } 815 }
816 816
817 } // namespace cc 817 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/heads_up_display_layer_impl.h ('k') | cc/layers/picture_image_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698