"$_include/c/sk_types.h",
"$_include/c/sk_xml.h",
"$_include/c/sk_svg.h",
+ "$_include/c/sk_vertices.h",
"$_include/c/gr_context.h",
"$_src/c/sk_bitmap.cpp",
"$_src/c/sk_canvas.cpp",
"$_src/c/sk_typeface.cpp",
"$_src/c/sk_xml.cpp",
"$_src/c/sk_svg.cpp",
+ "$_src/c/sk_vertices.cpp",
"$_src/c/sk_types_priv.h",
"$_src/c/gr_context.cpp",
]
if (is_win) {
skia_core_sources += [ "$_src/jumper/SkJumper_generated_win.S" ]
-} else {
+} else if (!is_tvos) {
skia_core_sources += [ "$_src/jumper/SkJumper_generated.S" ]
}
SK_C_API sk_pmcolor_t sk_bitmap_get_index8_color(sk_bitmap_t* cbitmap, int x, int y);
SK_C_API void sk_bitmap_set_pixel_color(sk_bitmap_t* cbitmap, int x, int y, sk_color_t color);
SK_C_API bool sk_bitmap_ready_to_draw(sk_bitmap_t* cbitmap);
-SK_C_API bool sk_bitmap_copy_pixels_to(sk_bitmap_t* cbitmap, void* const dst, size_t dstSize, size_t dstRowBytes, bool preserveDstPad);
SK_C_API bool sk_bitmap_copy(sk_bitmap_t* cbitmap, sk_bitmap_t* dst, sk_colortype_t ct);
SK_C_API bool sk_bitmap_can_copy_to(sk_bitmap_t* cbitmap, sk_colortype_t ct);
SK_C_API void sk_bitmap_lock_pixels(sk_bitmap_t* cbitmap);
SK_C_API bool sk_bitmap_install_pixels_with_pixmap(sk_bitmap_t* cbitmap, const sk_pixmap_t* cpixmap);
SK_C_API bool sk_bitmap_install_mask_pixels(sk_bitmap_t* cbitmap, const sk_mask_t* cmask);
SK_C_API bool sk_bitmap_try_alloc_pixels(sk_bitmap_t* cbitmap, const sk_imageinfo_t* requestedInfo, size_t rowBytes);
-SK_C_API bool sk_bitmap_try_alloc_pixels_with_color_table(sk_bitmap_t* cbitmap, const sk_imageinfo_t* requestedInfo, sk_pixelref_factory_t* factory, sk_colortable_t* ctable);
+SK_C_API bool sk_bitmap_try_alloc_pixels_with_color_table(sk_bitmap_t* cbitmap, const sk_imageinfo_t* requestedInfo, sk_colortable_t* ctable, uint32_t flags);
SK_C_API sk_colortable_t* sk_bitmap_get_colortable(sk_bitmap_t* cbitmap);
SK_C_API void sk_bitmap_set_pixels(sk_bitmap_t* cbitmap, void* pixels, sk_colortable_t* ctable);
SK_C_API bool sk_bitmap_peek_pixels(sk_bitmap_t* cbitmap, sk_pixmap_t* cpixmap);
SK_C_API void sk_canvas_draw_bitmap_lattice(sk_canvas_t* t, const sk_bitmap_t* bitmap, const sk_lattice_t* lattice, const sk_rect_t* dst, const sk_paint_t* paint);
SK_C_API void sk_canvas_draw_image_lattice(sk_canvas_t* t, const sk_image_t* image, const sk_lattice_t* lattice, const sk_rect_t* dst, const sk_paint_t* paint);
-SK_C_API void sk_canvas_draw_vertices(sk_canvas_t* ccanvas, sk_vertex_mode_t vmode, int vertexCount, const sk_point_t* vertices, const sk_point_t* texs, const sk_color_t* colors, sk_blendmode_t mode, const uint16_t* indices, int indexCount, const sk_paint_t* paint);
+SK_C_API void sk_canvas_draw_vertices(sk_canvas_t* ccanvas, sk_vertices_t* vertices, sk_blendmode_t mode, const sk_paint_t* paint);
SK_C_PLUS_PLUS_END_GUARD
SK_C_API bool sk_pixmap_encode_image(sk_wstream_t* dst, const sk_pixmap_t* src, sk_encoded_image_format_t encoder, int quality);
+SK_C_API bool sk_pixmap_read_pixels(const sk_pixmap_t* cpixmap, const sk_imageinfo_t* dstInfo, void* dstPixels, size_t dstRowBytes, int srcX, int srcY);
+
SK_C_PLUS_PLUS_END_GUARD
#endif
DISALLOW_SK_IMAGE_CACHING_HINT,
} sk_image_caching_hint_t;
+typedef enum {
+ ZERO_PIXELS_SK_BITMAP_ALLOC_FLAGS = 1 << 0,
+} sk_bitmap_allocflags_t;
+
typedef struct {
int16_t fTimeZoneMinutes;
uint16_t fYear;
typedef struct sk_3dview_t sk_3dview_t;
typedef enum {
- TRIANGLES_SK_VERTEX_MODE,
- TRIANGLE_STRIP_SK_VERTEX_MODE,
- TRIANGLE_FAN_SK_VERTEX_MODE,
-} sk_vertex_mode_t;
+ TRIANGLES_SK_VERTICES_VERTEX_MODE,
+ TRIANGLE_STRIP_SK_VERTICES_VERTEX_MODE,
+ TRIANGLE_FAN_SK_VERTICES_VERTEX_MODE,
+} sk_vertices_vertex_mode_t;
+
+typedef struct sk_vertices_t sk_vertices_t;
SK_C_PLUS_PLUS_END_GUARD
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
+// DO NOT USE -- FOR INTERNAL TESTING ONLY
+
+#ifndef sk_vertices_DEFINED
+#define sk_vertices_DEFINED
+
+#include "sk_types.h"
+
+SK_C_PLUS_PLUS_BEGIN_GUARD
+
+SK_C_API void sk_vertices_unref(sk_vertices_t* cvertices);
+SK_C_API sk_vertices_t* sk_vertices_make_copy(sk_vertices_vertex_mode_t vmode, int vertexCount, const sk_point_t* positions, const sk_point_t* texs, const sk_color_t* colors, int indexCount, const uint16_t* indices);
+
+SK_C_PLUS_PLUS_END_GUARD
+
+#endif
return AsBitmap(cbitmap)->readyToDraw();
}
-bool sk_bitmap_copy_pixels_to(sk_bitmap_t* cbitmap, void* const dst, size_t dstSize, size_t dstRowBytes, bool preserveDstPad)
-{
- return AsBitmap(cbitmap)->copyPixelsTo(dst, dstSize, dstRowBytes, preserveDstPad);
-}
-
bool sk_bitmap_copy(sk_bitmap_t* cbitmap, sk_bitmap_t* dst, sk_colortype_t ct)
{
return AsBitmap(cbitmap)->copyTo(AsBitmap(dst), (SkColorType)ct);
return bmp->tryAllocPixels(info, rowBytes);
}
-bool sk_bitmap_try_alloc_pixels_with_color_table(sk_bitmap_t* cbitmap, const sk_imageinfo_t* requestedInfo, sk_pixelref_factory_t* factory, sk_colortable_t* ctable)
+bool sk_bitmap_try_alloc_pixels_with_color_table(sk_bitmap_t* cbitmap, const sk_imageinfo_t* requestedInfo, sk_colortable_t* ctable, uint32_t flags)
{
SkBitmap* bmp = AsBitmap(cbitmap);
SkImageInfo info;
from_c(*requestedInfo, &info);
- return bmp->tryAllocPixels(info, AsPixelRefFactory(factory), AsColorTable(ctable));
+ return bmp->tryAllocPixels(info, sk_ref_sp(AsColorTable(ctable)), flags);
}
sk_colortable_t* sk_bitmap_get_colortable(sk_bitmap_t* cbitmap)
AsCanvas(ccanvas)->drawImageLattice(AsImage(image), AsLattice(*lattice), AsRect(*dst), AsPaint(paint));
}
-void sk_canvas_draw_vertices(sk_canvas_t* ccanvas, sk_vertex_mode_t vmode, int vertexCount, const sk_point_t* vertices, const sk_point_t* texs, const sk_color_t* colors, sk_blendmode_t mode, const uint16_t* indices, int indexCount, const sk_paint_t* paint) {
- AsCanvas(ccanvas)->drawVertices((SkCanvas::VertexMode)vmode, vertexCount, AsPoint(vertices), AsPoint(texs), colors, (SkBlendMode)mode, indices, indexCount, AsPaint(*paint));
+void sk_canvas_draw_vertices(sk_canvas_t* ccanvas, sk_vertices_t* vertices, sk_blendmode_t mode, const sk_paint_t* paint) {
+ AsCanvas(ccanvas)->drawVertices(AsVertices(vertices), (SkBlendMode)mode, AsPaint(*paint));
}
static_assert ((int)SkMatrix44::TypeMask::kAffine_Mask == (int)AFFINE_SK_MATRIX44_TYPE_MASK, ASSERT_MSG(SkMatrix44::TypeMask, sk_matrix44_type_mask_t));
static_assert ((int)SkMatrix44::TypeMask::kPerspective_Mask == (int)PERSPECTIVE_SK_MATRIX44_TYPE_MASK, ASSERT_MSG(SkMatrix44::TypeMask, sk_matrix44_type_mask_t));
-// sk_vertex_mode_t
-static_assert ((int)SkCanvas::VertexMode::kTriangles_VertexMode == (int)TRIANGLES_SK_VERTEX_MODE, ASSERT_MSG(SkCanvas::VertexMode, sk_vertex_mode_t));
-static_assert ((int)SkCanvas::VertexMode::kTriangleStrip_VertexMode == (int)TRIANGLE_STRIP_SK_VERTEX_MODE, ASSERT_MSG(SkCanvas::VertexMode, sk_vertex_mode_t));
-static_assert ((int)SkCanvas::VertexMode::kTriangleFan_VertexMode == (int)TRIANGLE_FAN_SK_VERTEX_MODE, ASSERT_MSG(SkCanvas::VertexMode, sk_vertex_mode_t));
+// sk_vertices_vertex_mode_t
+static_assert ((int)SkVertices::VertexMode::kTriangles_VertexMode == (int)TRIANGLES_SK_VERTICES_VERTEX_MODE, ASSERT_MSG(SkVertices::VertexMode, sk_vertices_vertex_mode_t));
+static_assert ((int)SkVertices::VertexMode::kTriangleStrip_VertexMode == (int)TRIANGLE_STRIP_SK_VERTICES_VERTEX_MODE, ASSERT_MSG(SkVertices::VertexMode, sk_vertices_vertex_mode_t));
+static_assert ((int)SkVertices::VertexMode::kTriangleFan_VertexMode == (int)TRIANGLE_FAN_SK_VERTICES_VERTEX_MODE, ASSERT_MSG(SkVertices::VertexMode, sk_vertices_vertex_mode_t));
// sk_image_caching_hint_t
static_assert ((int)SkImage::CachingHint::kAllow_CachingHint == (int)ALLOW_SK_IMAGE_CACHING_HINT, ASSERT_MSG(SkImage::CachingHint, sk_image_caching_hint_t));
static_assert ((int)SkImage::CachingHint::kDisallow_CachingHint == (int)DISALLOW_SK_IMAGE_CACHING_HINT, ASSERT_MSG(SkImage::CachingHint, sk_image_caching_hint_t));
+// sk_bitmap_allocflags_t
+static_assert ((int)SkBitmap::AllocFlags::kZeroPixels_AllocFlag == (int)ZERO_PIXELS_SK_BITMAP_ALLOC_FLAGS, ASSERT_MSG(SkBitmap::AllocFlags, sk_bitmap_allocflags_t));
+
#endif
{
return SkEncodeImage(AsWStream(dst), AsPixmap(*src), (SkEncodedImageFormat)encoder, quality);
}
+
+bool sk_pixmap_read_pixels(const sk_pixmap_t* cpixmap, const sk_imageinfo_t* dstInfo, void* dstPixels, size_t dstRowBytes, int srcX, int srcY)
+{
+ SkImageInfo info;
+ from_c(*dstInfo, &info);
+
+ return AsPixmap(cpixmap)->readPixels(info, dstPixels, dstRowBytes, srcX, srcY);
+}
sk_stream_asset_t* sk_dynamicmemorywstream_detach_as_stream(sk_wstream_dynamicmemorystream_t* cstream)
{
- return ToStreamAsset(AsDynamicMemoryWStream(cstream)->detachAsStream());
+ return ToStreamAsset(AsDynamicMemoryWStream(cstream)->detachAsStream().release());
}
sk_data_t* sk_dynamicmemorywstream_detach_as_data(sk_wstream_dynamicmemorystream_t* cstream)
return reinterpret_cast<const sk_colortable_t*>(p);
}
-static inline const SkPixelRefFactory* AsPixelRefFactory(const sk_pixelref_factory_t* p) {
- return reinterpret_cast<const SkPixelRefFactory*>(p);
-}
-
-static inline SkPixelRefFactory* AsPixelRefFactory(sk_pixelref_factory_t* p) {
- return reinterpret_cast<SkPixelRefFactory*>(p);
-}
-
-static inline sk_pixelref_factory_t* ToColorTable(SkPixelRefFactory* p) {
- return reinterpret_cast<sk_pixelref_factory_t*>(p);
-}
-
-static inline const sk_pixelref_factory_t* ToColorTable(const SkPixelRefFactory* p) {
- return reinterpret_cast<const sk_pixelref_factory_t*>(p);
-}
-
static inline sk_surface_t* ToSurface(SkSurface* p) {
return reinterpret_cast<sk_surface_t*>(p);
}
return reinterpret_cast<const sk_matrix44_t*>(p);
}
+static inline const SkVertices* AsVertices(const sk_vertices_t* p) {
+ return reinterpret_cast<const SkVertices*>(p);
+}
+
+static inline SkVertices* AsVertices(sk_vertices_t* p) {
+ return reinterpret_cast<SkVertices*>(p);
+}
+
+static inline sk_vertices_t* ToVertices(SkVertices* p) {
+ return reinterpret_cast<sk_vertices_t*>(p);
+}
+
+static inline const sk_vertices_t* ToVertices(const SkVertices* p) {
+ return reinterpret_cast<const sk_vertices_t*>(p);
+}
+
static inline void from_c(const sk_matrix_t* cmatrix, SkMatrix* matrix) {
matrix->setAll(
cmatrix->mat[0], cmatrix->mat[1], cmatrix->mat[2],
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkVertices.h"
+
+#include "sk_vertices.h"
+
+#include "sk_types_priv.h"
+
+void sk_vertices_unref(sk_vertices_t* cvertices) {
+ SkSafeUnref(AsVertices(cvertices));
+}
+
+sk_vertices_t* sk_vertices_make_copy(sk_vertices_vertex_mode_t vmode, int vertexCount, const sk_point_t* positions, const sk_point_t* texs, const sk_color_t* colors, int indexCount, const uint16_t* indices) {
+ return ToVertices(SkVertices::MakeCopy((SkVertices::VertexMode)vmode, vertexCount, AsPoint(positions), AsPoint(texs), colors, indexCount, indices).release());
+}
extern "C" {
-#if __has_feature(memory_sanitizer)
+#if __has_feature(memory_sanitizer) || defined(SK_BUILD_FOR_TVOS)
// We'll just run portable code.
#elif defined(__aarch64__)
// Translate SkRasterPipeline's StockStage enum to StageFn function pointers.
-#if __has_feature(memory_sanitizer)
+#if __has_feature(memory_sanitizer) || defined(SK_BUILD_FOR_TVOS)
// We'll just run portable code.
#elif defined(__aarch64__)
};
// While possible, build and run at full vector stride.
-#if __has_feature(memory_sanitizer)
+#if __has_feature(memory_sanitizer) || defined(SK_BUILD_FOR_TVOS)
// We'll just run portable code.
#elif defined(__aarch64__)