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

Side by Side Diff: ui/ozone/demo/software_renderer.cc

Issue 2011713003: Roll skia to 8cc209111876b7c78b5ec577c9221d8ed5e21024 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 6 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/transform.h ('k') | ui/ozone/platform/drm/gpu/drm_buffer.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 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 "third_party/skia/include/core/SkCanvas.h" 7 #include "third_party/skia/include/core/SkCanvas.h"
8 #include "third_party/skia/include/core/SkSurface.h" 8 #include "third_party/skia/include/core/SkSurface.h"
9 #include "ui/gfx/vsync_provider.h" 9 #include "ui/gfx/vsync_provider.h"
10 #include "ui/ozone/public/ozone_platform.h" 10 #include "ui/ozone/public/ozone_platform.h"
(...skipping 28 matching lines...) Expand all
39 39
40 software_surface_->ResizeCanvas(size_); 40 software_surface_->ResizeCanvas(size_);
41 vsync_provider_ = software_surface_->CreateVSyncProvider(); 41 vsync_provider_ = software_surface_->CreateVSyncProvider();
42 RenderFrame(); 42 RenderFrame();
43 return true; 43 return true;
44 } 44 }
45 45
46 void SoftwareRenderer::RenderFrame() { 46 void SoftwareRenderer::RenderFrame() {
47 float fraction = NextFraction(); 47 float fraction = NextFraction();
48 48
49 skia::RefPtr<SkSurface> surface = software_surface_->GetSurface(); 49 sk_sp<SkSurface> surface = software_surface_->GetSurface();
50 50
51 SkColor color = 51 SkColor color =
52 SkColorSetARGB(0xff, 0, 0xff * fraction, 0xff * (1 - fraction)); 52 SkColorSetARGB(0xff, 0, 0xff * fraction, 0xff * (1 - fraction));
53 53
54 surface->getCanvas()->clear(color); 54 surface->getCanvas()->clear(color);
55 55
56 software_surface_->PresentCanvas(gfx::Rect(size_)); 56 software_surface_->PresentCanvas(gfx::Rect(size_));
57 57
58 if (vsync_provider_) { 58 if (vsync_provider_) {
59 vsync_provider_->GetVSyncParameters( 59 vsync_provider_->GetVSyncParameters(
60 base::Bind(&SoftwareRenderer::UpdateVSyncParameters, 60 base::Bind(&SoftwareRenderer::UpdateVSyncParameters,
61 weak_ptr_factory_.GetWeakPtr())); 61 weak_ptr_factory_.GetWeakPtr()));
62 } 62 }
63 63
64 timer_.Start(FROM_HERE, vsync_period_, this, &SoftwareRenderer::RenderFrame); 64 timer_.Start(FROM_HERE, vsync_period_, this, &SoftwareRenderer::RenderFrame);
65 } 65 }
66 66
67 void SoftwareRenderer::UpdateVSyncParameters(const base::TimeTicks timebase, 67 void SoftwareRenderer::UpdateVSyncParameters(const base::TimeTicks timebase,
68 const base::TimeDelta interval) { 68 const base::TimeDelta interval) {
69 vsync_period_ = interval; 69 vsync_period_ = interval;
70 } 70 }
71 71
72 } // namespace ui 72 } // namespace ui
OLDNEW
« no previous file with comments | « ui/gfx/transform.h ('k') | ui/ozone/platform/drm/gpu/drm_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698