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

Unified Diff: skia/ext/cdl_shader.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_picture_recording_canvas.cc ('k') | skia/ext/cdl_shader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/cdl_shader.h
diff --git a/skia/ext/cdl_shader.h b/skia/ext/cdl_shader.h
new file mode 100644
index 0000000000000000000000000000000000000000..8295a5b63181d8c7cf75c429ed4aea274c9e694d
--- /dev/null
+++ b/skia/ext/cdl_shader.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SKIA_EXT_CDL_SHADER_H_
+#define SKIA_EXT_CDL_SHADER_H_
+
+#include "cdl_common.h"
+
+#if CDL_ENABLED
+
+#include "third_party/skia/include/core/SkMatrix.h"
+#include "third_party/skia/include/core/SkRefCnt.h"
+#include "third_party/skia/include/core/SkShader.h"
+
+class CdlPicture;
+
+class SK_API CdlShader : public SkRefCnt {
+ public:
+ CdlShader(const SkMatrix* local_matrix = NULL);
+ ~CdlShader() override;
+
+ static sk_sp<CdlShader> WrapSkShader(sk_sp<SkShader> shader);
+
+ static sk_sp<CdlShader> MakeImageShader(sk_sp<SkImage>,
+ SkShader::TileMode tx,
+ SkShader::TileMode ty,
+ const SkMatrix* local_matrix);
+
+ static sk_sp<CdlShader> MakePictureShader(sk_sp<CdlPicture> picture,
+ SkShader::TileMode tmx,
+ SkShader::TileMode tmy,
+ const SkMatrix* local_matrix,
+ const SkRect* tile);
+
+ const SkMatrix& getLocalMatrix() const { return local_matrix_; }
+
+ virtual sk_sp<SkShader> createSkShader() = 0;
+ virtual bool isOpaque() const;
+
+ private:
+ SkMatrix local_matrix_;
+};
+
+inline SK_API sk_sp<CdlShader> WrapSkShader(sk_sp<SkShader> shader) {
+ return CdlShader::WrapSkShader(shader);
+}
+
+inline SK_API sk_sp<CdlShader> MakeCdlImageShader(sk_sp<SkImage> image,
+ SkShader::TileMode tx,
+ SkShader::TileMode ty,
+ const SkMatrix* local_matrix) {
+ return CdlShader::MakeImageShader(image, tx, ty, local_matrix);
+}
+
+#else // CDL_ENABLED
+
+#include "third_party/skia/include/core/SkImage.h"
+#include "third_party/skia/include/core/SkShader.h"
+
+inline SK_API sk_sp<CdlShader> WrapSkShader(sk_sp<SkShader> shader) {
+ return shader;
+}
+
+inline SK_API sk_sp<CdlShader> MakeCdlImageShader(sk_sp<SkImage> image,
+ SkShader::TileMode tx,
+ SkShader::TileMode ty,
+ const SkMatrix* local_matrix) {
+ return image->makeShader(tx, ty, local_matrix);
+}
+
+#endif // CDL_ENABLED
+
+#endif // SKIA_EXT_CDL_SHADER_H_
« no previous file with comments | « skia/ext/cdl_picture_recording_canvas.cc ('k') | skia/ext/cdl_shader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698