| 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_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" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 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 explicit SkiaPaintCanvas(SkCanvas* canvas); | 28 explicit SkiaPaintCanvas(SkCanvas* canvas); |
| 29 explicit SkiaPaintCanvas(const SkBitmap& bitmap); | 29 explicit SkiaPaintCanvas(const SkBitmap& bitmap); |
| 30 explicit SkiaPaintCanvas(const SkBitmap& bitmap, const SkSurfaceProps& props); | 30 explicit SkiaPaintCanvas(const SkBitmap& bitmap, const SkSurfaceProps& props); |
| 31 // If |target_color_space| is non-nullptr, then this will wrap |canvas| in a |
| 32 // SkColorSpaceXformCanvas. |
| 33 SkiaPaintCanvas(SkCanvas* canvas, sk_sp<SkColorSpace> target_color_space); |
| 31 ~SkiaPaintCanvas() override; | 34 ~SkiaPaintCanvas() override; |
| 32 | 35 |
| 33 SkMetaData& getMetaData() override; | 36 SkMetaData& getMetaData() override; |
| 34 SkImageInfo imageInfo() const override; | 37 SkImageInfo imageInfo() const override; |
| 35 | 38 |
| 36 void flush() override; | 39 void flush() override; |
| 37 | 40 |
| 38 int save() override; | 41 int save() override; |
| 39 int saveLayer(const SkRect* bounds, const PaintFlags* flags) override; | 42 int saveLayer(const SkRect* bounds, const PaintFlags* flags) override; |
| 40 int saveLayerAlpha(const SkRect* bounds, uint8_t alpha) override; | 43 int saveLayerAlpha(const SkRect* bounds, uint8_t alpha) override; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // Don't shadow non-virtual helper functions. | 135 // Don't shadow non-virtual helper functions. |
| 133 using PaintCanvas::clipRect; | 136 using PaintCanvas::clipRect; |
| 134 using PaintCanvas::clipRRect; | 137 using PaintCanvas::clipRRect; |
| 135 using PaintCanvas::clipPath; | 138 using PaintCanvas::clipPath; |
| 136 using PaintCanvas::drawBitmap; | 139 using PaintCanvas::drawBitmap; |
| 137 using PaintCanvas::drawColor; | 140 using PaintCanvas::drawColor; |
| 138 using PaintCanvas::drawImage; | 141 using PaintCanvas::drawImage; |
| 139 using PaintCanvas::drawPicture; | 142 using PaintCanvas::drawPicture; |
| 140 | 143 |
| 141 private: | 144 private: |
| 145 void WrapCanvasInColorSpaceXformCanvas( |
| 146 sk_sp<SkColorSpace> target_color_space); |
| 142 SkCanvas* canvas_; | 147 SkCanvas* canvas_; |
| 143 std::unique_ptr<SkCanvas> owned_; | 148 std::unique_ptr<SkCanvas> owned_; |
| 149 std::unique_ptr<SkCanvas> color_space_xform_canvas_; |
| 144 | 150 |
| 145 DISALLOW_COPY_AND_ASSIGN(SkiaPaintCanvas); | 151 DISALLOW_COPY_AND_ASSIGN(SkiaPaintCanvas); |
| 146 }; | 152 }; |
| 147 | 153 |
| 148 } // namespace cc | 154 } // namespace cc |
| 149 | 155 |
| 150 #endif // CC_PAINT_SKIA_PAINT_CANVAS_H_ | 156 #endif // CC_PAINT_SKIA_PAINT_CANVAS_H_ |
| OLD | NEW |