| OLD | NEW |
| 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" |
| 11 #include "cc/paint/paint_canvas.h" | |
| 12 #include "cc/paint/paint_export.h" | 11 #include "cc/paint/paint_export.h" |
| 12 #include "cc/paint/skia_paint_canvas.h" |
| 13 #include "third_party/skia/include/core/SkSurface.h" | 13 #include "third_party/skia/include/core/SkSurface.h" |
| 14 | 14 |
| 15 namespace cc { | 15 namespace cc { |
| 16 | 16 |
| 17 class CC_PAINT_EXPORT PaintSurface : public SkRefCntBase { | 17 class CC_PAINT_EXPORT PaintSurface : public SkRefCntBase { |
| 18 public: | 18 public: |
| 19 explicit PaintSurface(sk_sp<SkSurface> surface); | 19 explicit PaintSurface(sk_sp<SkSurface> surface); |
| 20 ~PaintSurface() override; | 20 ~PaintSurface() override; |
| 21 | 21 |
| 22 // TODO(enne): this interface matches SkSurface for simplicity. | 22 // TODO(enne): this interface matches SkSurface for simplicity. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 42 uint32_t generationID() { return surface_->generationID(); } | 42 uint32_t generationID() { return surface_->generationID(); } |
| 43 | 43 |
| 44 PaintCanvas* getCanvas() { | 44 PaintCanvas* getCanvas() { |
| 45 if (!canvas_.has_value()) | 45 if (!canvas_.has_value()) |
| 46 canvas_.emplace(surface_->getCanvas()); | 46 canvas_.emplace(surface_->getCanvas()); |
| 47 return &canvas_.value(); | 47 return &canvas_.value(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 const sk_sp<SkSurface> surface_; | 51 const sk_sp<SkSurface> surface_; |
| 52 base::Optional<PaintCanvas> canvas_; | 52 base::Optional<SkiaPaintCanvas> canvas_; |
| 53 | 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(PaintSurface); | 54 DISALLOW_COPY_AND_ASSIGN(PaintSurface); |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 } // namespace cc | 57 } // namespace cc |
| 58 | 58 |
| 59 #endif // CC_PAINT_PAINT_SURFACE_H_ | 59 #endif // CC_PAINT_PAINT_SURFACE_H_ |
| OLD | NEW |