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

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

Issue 2764633002: cc/paint: Remove cc::PaintSurface. (Closed)
Patch Set: more stuff 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
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_SKIA_PAINT_CANVAS_H_ 5 #ifndef CC_PAINT_SKIA_PAINT_CANVAS_H_
6 #define CC_PAINT_SKIA_PAINT_CANVAS_H_ 6 #define CC_PAINT_SKIA_PAINT_CANVAS_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "cc/paint/paint_canvas.h" 14 #include "cc/paint/paint_canvas.h"
15 #include "cc/paint/paint_flags.h" 15 #include "cc/paint/paint_flags.h"
16 #include "cc/paint/paint_record.h" 16 #include "cc/paint/paint_record.h"
17 #include "third_party/skia/include/core/SkCanvas.h" 17 #include "third_party/skia/include/core/SkCanvas.h"
18 18
19 namespace cc { 19 namespace cc {
20 20
21 class PaintFlags; 21 class PaintFlags;
22 22
23 // A PaintCanvas derived class that passes PaintCanvas APIs through to 23 // A PaintCanvas derived class that passes PaintCanvas APIs through to
24 // an SkCanvas. This is more efficient than recording to a PaintRecord 24 // an SkCanvas. This is more efficient than recording to a PaintRecord
25 // and then playing back to an SkCanvas. 25 // and then playing back to an SkCanvas.
26 class CC_PAINT_EXPORT SkiaPaintCanvas final : public PaintCanvas { 26 class CC_PAINT_EXPORT SkiaPaintCanvas final : public PaintCanvas {
27 public: 27 public:
28 // Creates a raster canvas with the memory for the pixels automatically
29 // allocated and zero-initialized. Returns null on failure.
30 static std::unique_ptr<SkiaPaintCanvas> CreateRasterZeroed(
31 const SkImageInfo& info);
32
28 explicit SkiaPaintCanvas(SkCanvas* canvas); 33 explicit SkiaPaintCanvas(SkCanvas* canvas);
29 explicit SkiaPaintCanvas(const SkBitmap& bitmap); 34 explicit SkiaPaintCanvas(const SkBitmap& bitmap);
30 explicit SkiaPaintCanvas(const SkBitmap& bitmap, const SkSurfaceProps& props); 35 explicit SkiaPaintCanvas(const SkBitmap& bitmap, const SkSurfaceProps& props);
31 ~SkiaPaintCanvas() override; 36 ~SkiaPaintCanvas() override;
32 37
33 SkMetaData& getMetaData() override; 38 SkMetaData& getMetaData() override;
34 SkImageInfo imageInfo() const override; 39 SkImageInfo imageInfo() const override;
35 40
36 void flush() override; 41 void flush() override;
37 42
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 using PaintCanvas::drawPicture; 166 using PaintCanvas::drawPicture;
162 167
163 private: 168 private:
164 SkCanvas* canvas_; 169 SkCanvas* canvas_;
165 std::unique_ptr<SkCanvas> owned_; 170 std::unique_ptr<SkCanvas> owned_;
166 }; 171 };
167 172
168 } // namespace cc 173 } // namespace cc
169 174
170 #endif // CC_PAINT_SKIA_PAINT_CANVAS_H_ 175 #endif // CC_PAINT_SKIA_PAINT_CANVAS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698