| 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 explicit SkiaPaintCanvas(SkiaPaintCanvas&& other); |
| 31 ~SkiaPaintCanvas(); | 32 ~SkiaPaintCanvas(); |
| 32 | 33 |
| 34 SkiaPaintCanvas& operator=(SkiaPaintCanvas&& other) = default; |
| 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 SkISize getBaseLayerSize() const override; | 41 SkISize getBaseLayerSize() const override; |
| 39 bool peekPixels(SkPixmap* pixmap) override; | |
| 40 bool readPixels(const SkImageInfo& dest_info, | 42 bool readPixels(const SkImageInfo& dest_info, |
| 41 void* dest_pixels, | 43 void* dest_pixels, |
| 42 size_t dest_row_bytes, | 44 size_t dest_row_bytes, |
| 43 int src_x, | 45 int src_x, |
| 44 int src_y) override; | 46 int src_y) override; |
| 45 bool readPixels(SkBitmap* bitmap, int src_x, int src_y) override; | 47 bool readPixels(SkBitmap* bitmap, int src_x, int src_y) override; |
| 46 bool readPixels(const SkIRect& srcRect, SkBitmap* bitmap) override; | 48 bool readPixels(const SkIRect& srcRect, SkBitmap* bitmap) override; |
| 47 bool writePixels(const SkImageInfo& info, | 49 bool writePixels(const SkImageInfo& info, |
| 48 const void* pixels, | 50 const void* pixels, |
| 49 size_t row_bytes, | 51 size_t row_bytes, |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 using PaintCanvas::clipRect; | 165 using PaintCanvas::clipRect; |
| 164 using PaintCanvas::clipRRect; | 166 using PaintCanvas::clipRRect; |
| 165 using PaintCanvas::clipPath; | 167 using PaintCanvas::clipPath; |
| 166 using PaintCanvas::drawBitmap; | 168 using PaintCanvas::drawBitmap; |
| 167 using PaintCanvas::drawColor; | 169 using PaintCanvas::drawColor; |
| 168 using PaintCanvas::drawImage; | 170 using PaintCanvas::drawImage; |
| 169 | 171 |
| 170 private: | 172 private: |
| 171 SkCanvas* canvas_; | 173 SkCanvas* canvas_; |
| 172 std::unique_ptr<SkCanvas> owned_; | 174 std::unique_ptr<SkCanvas> owned_; |
| 175 |
| 176 DISALLOW_COPY_AND_ASSIGN(SkiaPaintCanvas); |
| 173 }; | 177 }; |
| 174 | 178 |
| 175 } // namespace cc | 179 } // namespace cc |
| 176 | 180 |
| 177 #endif // CC_PAINT_SKIA_PAINT_CANVAS_H_ | 181 #endif // CC_PAINT_SKIA_PAINT_CANVAS_H_ |
| OLD | NEW |