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

Unified Diff: skia/ext/cdl_picture.h

Issue 2523673004: [NOT FOR COMMIT] Fully replace SkCanvas uses.
Patch Set: Support Android build. Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « skia/ext/cdl_paint.cc ('k') | skia/ext/cdl_picture.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/cdl_picture.h
diff --git a/skia/ext/cdl_picture.h b/skia/ext/cdl_picture.h
new file mode 100644
index 0000000000000000000000000000000000000000..78e510ce1dc572df46bd9bb37c0b60a69c26bb27
--- /dev/null
+++ b/skia/ext/cdl_picture.h
@@ -0,0 +1,71 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SKIA_EXT_CDL_PICTURE_H_
+#define SKIA_EXT_CDL_PICTURE_H_
+
+#include "cdl_common.h"
+
+#if CDL_ENABLED
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "base/compiler_specific.h"
+#include "cdl_canvas.h"
+#include "third_party/skia/include/core/SkCanvas.h"
+#include "third_party/skia/include/core/SkPicture.h"
+#include "third_party/skia/include/core/SkDrawable.h"
+
+class CdlPictureBuffer;
+
+class SK_API CdlPicture : public SkRefCnt {
+ public:
+ CdlPicture(sk_sp<CdlPictureBuffer> dl,
+ SkRect cull_bounds,
+ int start_offset,
+ int end_offset);
+ ~CdlPicture() override;
+
+ void draw(CdlCanvas* canvas,
+ const SkMatrix* matrix,
+ const CdlPaint* paint) const;
+
+ sk_sp<SkPicture> toSkPicture() const;
+ int approximateOpCount() const { return 1; }
+ void playback(CdlCanvas*, SkPicture::AbortCallback* = NULL) const;
+ SkRect cullRect() const { return cull_bounds_; }
+ uint32_t uniqueID() const;
+
+ private:
+ sk_sp<CdlPictureBuffer> picture_;
+ SkRect cull_bounds_;
+ int start_offset_;
+ int end_offset_;
+ mutable uint32_t unique_id_ = 0;
+};
+
+inline sk_sp<SkPicture> ToSkPicture(CdlPicture* picture) {
+ return picture->toSkPicture();
+}
+
+inline sk_sp<const SkPicture> ToSkPicture(const CdlPicture* picture) {
+ return picture->toSkPicture();
+}
+
+#else
+
+#include "third_party/skia/include/core/SkPicture.h"
+
+inline sk_sp<SkPicture> ToSkPicture(CdlPicture* picture) {
+ return sk_sp<SkPicture>(picture);
+}
+
+inline sk_sp<const SkPicture> ToSkPicture(const CdlPicture* picture) {
+ return sk_sp<const SkPicture>(picture);
+}
+
+#endif // CDL_ENABLED
+
+#endif // SKIA_EXT_CDL_PICTURE_H_
« no previous file with comments | « skia/ext/cdl_paint.cc ('k') | skia/ext/cdl_picture.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698