| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef SKIA_EXT_CDL_PICTURE_H_ |
| 6 #define SKIA_EXT_CDL_PICTURE_H_ |
| 7 |
| 8 #include "cdl_common.h" |
| 9 |
| 10 #if CDL_ENABLED |
| 11 |
| 12 #include <stddef.h> |
| 13 #include <stdint.h> |
| 14 |
| 15 #include "base/compiler_specific.h" |
| 16 #include "cdl_canvas.h" |
| 17 #include "third_party/skia/include/core/SkCanvas.h" |
| 18 #include "third_party/skia/include/core/SkPicture.h" |
| 19 #include "third_party/skia/include/core/SkDrawable.h" |
| 20 |
| 21 class CdlPictureBuffer; |
| 22 |
| 23 class SK_API CdlPicture : public SkRefCnt { |
| 24 public: |
| 25 CdlPicture(sk_sp<CdlPictureBuffer> dl, |
| 26 SkRect cull_bounds, |
| 27 int start_offset, |
| 28 int end_offset); |
| 29 ~CdlPicture() override; |
| 30 |
| 31 void draw(CdlCanvas* canvas, |
| 32 const SkMatrix* matrix, |
| 33 const CdlPaint* paint) const; |
| 34 |
| 35 sk_sp<SkPicture> toSkPicture() const; |
| 36 int approximateOpCount() const { return 1; } |
| 37 void playback(CdlCanvas*, SkPicture::AbortCallback* = NULL) const; |
| 38 SkRect cullRect() const { return cull_bounds_; } |
| 39 uint32_t uniqueID() const; |
| 40 |
| 41 private: |
| 42 sk_sp<CdlPictureBuffer> picture_; |
| 43 SkRect cull_bounds_; |
| 44 int start_offset_; |
| 45 int end_offset_; |
| 46 mutable uint32_t unique_id_ = 0; |
| 47 }; |
| 48 |
| 49 inline sk_sp<SkPicture> ToSkPicture(CdlPicture* picture) { |
| 50 return picture->toSkPicture(); |
| 51 } |
| 52 |
| 53 inline sk_sp<const SkPicture> ToSkPicture(const CdlPicture* picture) { |
| 54 return picture->toSkPicture(); |
| 55 } |
| 56 |
| 57 #else |
| 58 |
| 59 #include "third_party/skia/include/core/SkPicture.h" |
| 60 |
| 61 inline sk_sp<SkPicture> ToSkPicture(CdlPicture* picture) { |
| 62 return sk_sp<SkPicture>(picture); |
| 63 } |
| 64 |
| 65 inline sk_sp<const SkPicture> ToSkPicture(const CdlPicture* picture) { |
| 66 return sk_sp<const SkPicture>(picture); |
| 67 } |
| 68 |
| 69 #endif // CDL_ENABLED |
| 70 |
| 71 #endif // SKIA_EXT_CDL_PICTURE_H_ |
| OLD | NEW |