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

Side by Side Diff: cc/paint/paint_surface.h

Issue 2743363006: Clean up cc/paint interfaces (Closed)
Patch Set: Fix PaintControllerTest v2 Created 3 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
« no previous file with comments | « cc/paint/paint_shader.h ('k') | cc/paint/skia_paint_canvas.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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 #ifndef CC_PAINT_PAINT_SURFACE_H_ 5 #ifndef CC_PAINT_PAINT_SURFACE_H_
6 #define CC_PAINT_PAINT_SURFACE_H_ 6 #define CC_PAINT_PAINT_SURFACE_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/optional.h" 10 #include "base/optional.h"
(...skipping 21 matching lines...) Expand all
32 static sk_sp<PaintSurface> MakeRasterN32Premul( 32 static sk_sp<PaintSurface> MakeRasterN32Premul(
33 int width, 33 int width,
34 int height, 34 int height,
35 const SkSurfaceProps* props = nullptr) { 35 const SkSurfaceProps* props = nullptr) {
36 sk_sp<SkSurface> s = SkSurface::MakeRasterN32Premul(width, height, props); 36 sk_sp<SkSurface> s = SkSurface::MakeRasterN32Premul(width, height, props);
37 return sk_make_sp<PaintSurface>(std::move(s)); 37 return sk_make_sp<PaintSurface>(std::move(s));
38 } 38 }
39 39
40 int width() const { return surface_->width(); } 40 int width() const { return surface_->width(); }
41 int height() const { return surface_->height(); } 41 int height() const { return surface_->height(); }
42 uint32_t generationID() { return surface_->generationID(); }
43 42
44 PaintCanvas* getCanvas() { 43 PaintCanvas* getCanvas() {
45 if (!canvas_.has_value()) 44 if (!canvas_.has_value())
46 canvas_.emplace(surface_->getCanvas()); 45 canvas_.emplace(surface_->getCanvas());
47 return &canvas_.value(); 46 return &canvas_.value();
48 } 47 }
49 48
50 private: 49 private:
51 const sk_sp<SkSurface> surface_; 50 const sk_sp<SkSurface> surface_;
52 base::Optional<SkiaPaintCanvas> canvas_; 51 base::Optional<SkiaPaintCanvas> canvas_;
53 52
54 DISALLOW_COPY_AND_ASSIGN(PaintSurface); 53 DISALLOW_COPY_AND_ASSIGN(PaintSurface);
55 }; 54 };
56 55
57 } // namespace cc 56 } // namespace cc
58 57
59 #endif // CC_PAINT_PAINT_SURFACE_H_ 58 #endif // CC_PAINT_PAINT_SURFACE_H_
OLDNEW
« no previous file with comments | « cc/paint/paint_shader.h ('k') | cc/paint/skia_paint_canvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698