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

Side by Side Diff: ui/ozone/demo/software_renderer.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 | « ui/gfx/render_text_unittest.cc ('k') | ui/ozone/platform/cast/surface_factory_cast.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/ozone/demo/software_renderer.h" 5 #include "ui/ozone/demo/software_renderer.h"
6 6
7 #include "base/trace_event/trace_event.h" 7 #include "base/trace_event/trace_event.h"
8 #include "third_party/skia/include/core/SkCanvas.h" 8 #include "third_party/skia/include/core/SkCanvas.h"
9 #include "third_party/skia/include/core/SkSurface.h" 9 #include "third_party/skia/include/core/SkSurface.h"
10 #include "ui/gfx/vsync_provider.h" 10 #include "ui/gfx/vsync_provider.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 vsync_provider_ = software_surface_->CreateVSyncProvider(); 42 vsync_provider_ = software_surface_->CreateVSyncProvider();
43 RenderFrame(); 43 RenderFrame();
44 return true; 44 return true;
45 } 45 }
46 46
47 void SoftwareRenderer::RenderFrame() { 47 void SoftwareRenderer::RenderFrame() {
48 TRACE_EVENT0("ozone", "SoftwareRenderer::RenderFrame"); 48 TRACE_EVENT0("ozone", "SoftwareRenderer::RenderFrame");
49 49
50 float fraction = NextFraction(); 50 float fraction = NextFraction();
51 51
52 skia::RefPtr<SkSurface> surface = software_surface_->GetSurface(); 52 sk_sp<SkSurface> surface = software_surface_->GetSurface();
53 53
54 SkColor color = 54 SkColor color =
55 SkColorSetARGB(0xff, 0, 0xff * fraction, 0xff * (1 - fraction)); 55 SkColorSetARGB(0xff, 0, 0xff * fraction, 0xff * (1 - fraction));
56 56
57 surface->getCanvas()->clear(color); 57 surface->getCanvas()->clear(color);
58 58
59 software_surface_->PresentCanvas(gfx::Rect(size_)); 59 software_surface_->PresentCanvas(gfx::Rect(size_));
60 60
61 if (vsync_provider_) { 61 if (vsync_provider_) {
62 vsync_provider_->GetVSyncParameters( 62 vsync_provider_->GetVSyncParameters(
63 base::Bind(&SoftwareRenderer::UpdateVSyncParameters, 63 base::Bind(&SoftwareRenderer::UpdateVSyncParameters,
64 weak_ptr_factory_.GetWeakPtr())); 64 weak_ptr_factory_.GetWeakPtr()));
65 } 65 }
66 66
67 timer_.Start(FROM_HERE, vsync_period_, this, &SoftwareRenderer::RenderFrame); 67 timer_.Start(FROM_HERE, vsync_period_, this, &SoftwareRenderer::RenderFrame);
68 } 68 }
69 69
70 void SoftwareRenderer::UpdateVSyncParameters(const base::TimeTicks timebase, 70 void SoftwareRenderer::UpdateVSyncParameters(const base::TimeTicks timebase,
71 const base::TimeDelta interval) { 71 const base::TimeDelta interval) {
72 vsync_period_ = interval; 72 vsync_period_ = interval;
73 } 73 }
74 74
75 } // namespace ui 75 } // namespace ui
OLDNEW
« no previous file with comments | « ui/gfx/render_text_unittest.cc ('k') | ui/ozone/platform/cast/surface_factory_cast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698