2014-04-11 18:33:31 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2014 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
2014-04-01 16:24:06 +00:00
|
|
|
#ifndef SkRecords_DEFINED
|
|
|
|
#define SkRecords_DEFINED
|
|
|
|
|
|
|
|
#include "SkCanvas.h"
|
2015-02-06 16:36:15 +00:00
|
|
|
#include "SkDrawable.h"
|
2015-06-10 21:23:15 +00:00
|
|
|
#include "SkPathPriv.h"
|
2014-08-07 19:19:50 +00:00
|
|
|
#include "SkPicture.h"
|
2015-06-24 17:29:17 +00:00
|
|
|
#include "SkRSXform.h"
|
2014-08-21 15:53:26 +00:00
|
|
|
#include "SkTextBlob.h"
|
2014-08-07 19:19:50 +00:00
|
|
|
|
2014-08-21 15:53:26 +00:00
|
|
|
namespace SkRecords {
|
|
|
|
|
2014-04-01 16:24:06 +00:00
|
|
|
// A list of all the types of canvas calls we can record.
|
|
|
|
// Each of these is reified into a struct below.
|
|
|
|
//
|
|
|
|
// (We're using the macro-of-macro trick here to do several different things with the same list.)
|
|
|
|
//
|
|
|
|
// We leave this SK_RECORD_TYPES macro defined for use by code that wants to operate on SkRecords
|
|
|
|
// types polymorphically. (See SkRecord::Record::{visit,mutate} for an example.)
|
2014-05-07 22:59:38 +00:00
|
|
|
//
|
|
|
|
// Order doesn't technically matter here, but the compiler can generally generate better code if
|
|
|
|
// you keep them semantically grouped, especially the Draws. It's also nice to leave NoOp at 0.
|
2014-04-22 16:57:20 +00:00
|
|
|
#define SK_RECORD_TYPES(M) \
|
|
|
|
M(NoOp) \
|
|
|
|
M(Restore) \
|
|
|
|
M(Save) \
|
|
|
|
M(SaveLayer) \
|
|
|
|
M(SetMatrix) \
|
|
|
|
M(ClipPath) \
|
|
|
|
M(ClipRRect) \
|
|
|
|
M(ClipRect) \
|
|
|
|
M(ClipRegion) \
|
|
|
|
M(DrawBitmap) \
|
|
|
|
M(DrawBitmapNine) \
|
|
|
|
M(DrawBitmapRectToRect) \
|
2014-11-21 16:48:35 +00:00
|
|
|
M(DrawBitmapRectToRectBleed) \
|
2014-11-18 19:08:05 +00:00
|
|
|
M(DrawDrawable) \
|
2014-10-16 18:58:39 +00:00
|
|
|
M(DrawImage) \
|
|
|
|
M(DrawImageRect) \
|
2015-06-25 19:32:03 +00:00
|
|
|
M(DrawImageNine) \
|
2014-04-22 16:57:20 +00:00
|
|
|
M(DrawDRRect) \
|
|
|
|
M(DrawOval) \
|
|
|
|
M(DrawPaint) \
|
|
|
|
M(DrawPath) \
|
2014-08-07 14:49:53 +00:00
|
|
|
M(DrawPatch) \
|
2014-08-07 19:19:50 +00:00
|
|
|
M(DrawPicture) \
|
2014-04-22 16:57:20 +00:00
|
|
|
M(DrawPoints) \
|
|
|
|
M(DrawPosText) \
|
|
|
|
M(DrawPosTextH) \
|
2014-08-20 15:09:46 +00:00
|
|
|
M(DrawText) \
|
|
|
|
M(DrawTextOnPath) \
|
2014-04-22 16:57:20 +00:00
|
|
|
M(DrawRRect) \
|
|
|
|
M(DrawRect) \
|
|
|
|
M(DrawSprite) \
|
2014-09-04 21:12:44 +00:00
|
|
|
M(DrawTextBlob) \
|
2015-06-24 17:29:17 +00:00
|
|
|
M(DrawAtlas) \
|
2014-08-08 17:05:19 +00:00
|
|
|
M(DrawVertices)
|
2014-04-01 16:24:06 +00:00
|
|
|
|
|
|
|
// Defines SkRecords::Type, an enum of all record types.
|
|
|
|
#define ENUM(T) T##_Type,
|
|
|
|
enum Type { SK_RECORD_TYPES(ENUM) };
|
|
|
|
#undef ENUM
|
|
|
|
|
|
|
|
// Macros to make it easier to define a record for a draw call with 0 args, 1 args, 2 args, etc.
|
|
|
|
// These should be clearer when you look at their use below.
|
|
|
|
#define RECORD0(T) \
|
|
|
|
struct T { \
|
|
|
|
static const Type kType = T##_Type; \
|
|
|
|
};
|
|
|
|
|
|
|
|
// We try to be flexible about the types the constructors take. Instead of requring the exact type
|
|
|
|
// A here, we take any type Z which implicitly casts to A. This allows the delay_copy() trick to
|
|
|
|
// work, allowing the caller to decide whether to pass by value or by const&.
|
|
|
|
|
|
|
|
#define RECORD1(T, A, a) \
|
|
|
|
struct T { \
|
|
|
|
static const Type kType = T##_Type; \
|
2015-05-19 18:11:26 +00:00
|
|
|
T() {} \
|
2014-04-01 16:24:06 +00:00
|
|
|
template <typename Z> \
|
|
|
|
T(Z a) : a(a) {} \
|
|
|
|
A a; \
|
|
|
|
};
|
|
|
|
|
|
|
|
#define RECORD2(T, A, a, B, b) \
|
|
|
|
struct T { \
|
|
|
|
static const Type kType = T##_Type; \
|
2015-05-19 18:11:26 +00:00
|
|
|
T() {} \
|
2014-04-01 16:24:06 +00:00
|
|
|
template <typename Z, typename Y> \
|
|
|
|
T(Z a, Y b) : a(a), b(b) {} \
|
|
|
|
A a; B b; \
|
|
|
|
};
|
|
|
|
|
|
|
|
#define RECORD3(T, A, a, B, b, C, c) \
|
|
|
|
struct T { \
|
|
|
|
static const Type kType = T##_Type; \
|
2015-05-19 18:11:26 +00:00
|
|
|
T() {} \
|
2014-04-01 16:24:06 +00:00
|
|
|
template <typename Z, typename Y, typename X> \
|
|
|
|
T(Z a, Y b, X c) : a(a), b(b), c(c) {} \
|
|
|
|
A a; B b; C c; \
|
|
|
|
};
|
|
|
|
|
|
|
|
#define RECORD4(T, A, a, B, b, C, c, D, d) \
|
|
|
|
struct T { \
|
|
|
|
static const Type kType = T##_Type; \
|
2015-05-19 18:11:26 +00:00
|
|
|
T() {} \
|
2014-04-01 16:24:06 +00:00
|
|
|
template <typename Z, typename Y, typename X, typename W> \
|
|
|
|
T(Z a, Y b, X c, W d) : a(a), b(b), c(c), d(d) {} \
|
|
|
|
A a; B b; C c; D d; \
|
|
|
|
};
|
|
|
|
|
|
|
|
#define RECORD5(T, A, a, B, b, C, c, D, d, E, e) \
|
|
|
|
struct T { \
|
|
|
|
static const Type kType = T##_Type; \
|
2015-05-19 18:11:26 +00:00
|
|
|
T() {} \
|
2014-04-01 16:24:06 +00:00
|
|
|
template <typename Z, typename Y, typename X, typename W, typename V> \
|
|
|
|
T(Z a, Y b, X c, W d, V e) : a(a), b(b), c(c), d(d), e(e) {} \
|
|
|
|
A a; B b; C c; D d; E e; \
|
|
|
|
};
|
|
|
|
|
2015-06-24 17:29:17 +00:00
|
|
|
#define RECORD8(T, A, a, B, b, C, c, D, d, E, e, F, f, G, g, H, h) \
|
|
|
|
struct T { \
|
|
|
|
static const Type kType = T##_Type; \
|
|
|
|
T() {} \
|
|
|
|
template <typename Z, typename Y, typename X, typename W, typename V, typename U, typename S, typename R> \
|
|
|
|
T(Z a, Y b, X c, W d, V e, U f, S g, R h) : a(a), b(b), c(c), d(d), e(e), f(f), g(g), h(h) {} \
|
|
|
|
A a; B b; C c; D d; E e; F f; G g; H h; \
|
|
|
|
};
|
|
|
|
|
2014-09-18 18:16:31 +00:00
|
|
|
#define ACT_AS_PTR(ptr) \
|
|
|
|
operator T*() const { return ptr; } \
|
|
|
|
T* operator->() const { return ptr; }
|
2014-04-22 16:57:20 +00:00
|
|
|
|
2014-08-21 16:11:37 +00:00
|
|
|
template <typename T>
|
|
|
|
class RefBox : SkNoncopyable {
|
|
|
|
public:
|
2015-05-19 18:11:26 +00:00
|
|
|
RefBox() {}
|
2014-09-18 18:16:31 +00:00
|
|
|
RefBox(T* obj) : fObj(SkSafeRef(obj)) {}
|
|
|
|
~RefBox() { SkSafeUnref(fObj); }
|
2014-08-21 16:11:37 +00:00
|
|
|
|
|
|
|
ACT_AS_PTR(fObj);
|
|
|
|
|
|
|
|
private:
|
|
|
|
T* fObj;
|
|
|
|
};
|
|
|
|
|
2014-04-15 14:27:14 +00:00
|
|
|
// An Optional doesn't own the pointer's memory, but may need to destroy non-POD data.
|
|
|
|
template <typename T>
|
|
|
|
class Optional : SkNoncopyable {
|
|
|
|
public:
|
2015-05-19 18:11:26 +00:00
|
|
|
Optional() : fPtr(nullptr) {}
|
2014-04-15 14:27:14 +00:00
|
|
|
Optional(T* ptr) : fPtr(ptr) {}
|
|
|
|
~Optional() { if (fPtr) fPtr->~T(); }
|
|
|
|
|
2014-04-22 16:57:20 +00:00
|
|
|
ACT_AS_PTR(fPtr);
|
|
|
|
private:
|
|
|
|
T* fPtr;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Like Optional, but ptr must not be NULL.
|
|
|
|
template <typename T>
|
|
|
|
class Adopted : SkNoncopyable {
|
|
|
|
public:
|
|
|
|
Adopted(T* ptr) : fPtr(ptr) { SkASSERT(fPtr); }
|
2014-04-24 15:33:48 +00:00
|
|
|
Adopted(Adopted* source) {
|
|
|
|
// Transfer ownership from source to this.
|
|
|
|
fPtr = source->fPtr;
|
|
|
|
source->fPtr = NULL;
|
|
|
|
}
|
|
|
|
~Adopted() { if (fPtr) fPtr->~T(); }
|
2014-04-22 16:57:20 +00:00
|
|
|
|
|
|
|
ACT_AS_PTR(fPtr);
|
2014-04-15 14:27:14 +00:00
|
|
|
private:
|
|
|
|
T* fPtr;
|
|
|
|
};
|
|
|
|
|
|
|
|
// PODArray doesn't own the pointer's memory, and we assume the data is POD.
|
|
|
|
template <typename T>
|
2014-04-24 15:33:48 +00:00
|
|
|
class PODArray {
|
2014-04-15 14:27:14 +00:00
|
|
|
public:
|
2015-05-19 18:11:26 +00:00
|
|
|
PODArray() {}
|
2014-04-15 14:27:14 +00:00
|
|
|
PODArray(T* ptr) : fPtr(ptr) {}
|
2014-04-24 15:33:48 +00:00
|
|
|
// Default copy and assign.
|
2014-04-15 14:27:14 +00:00
|
|
|
|
2014-04-22 16:57:20 +00:00
|
|
|
ACT_AS_PTR(fPtr);
|
2014-04-15 14:27:14 +00:00
|
|
|
private:
|
|
|
|
T* fPtr;
|
|
|
|
};
|
|
|
|
|
2014-04-22 18:32:58 +00:00
|
|
|
#undef ACT_AS_PTR
|
|
|
|
|
2014-04-01 16:24:06 +00:00
|
|
|
// Like SkBitmap, but deep copies pixels if they're not immutable.
|
|
|
|
// Using this, we guarantee the immutability of all bitmaps we record.
|
2014-12-11 20:43:04 +00:00
|
|
|
class ImmutableBitmap : SkNoncopyable {
|
|
|
|
public:
|
2015-05-19 18:11:26 +00:00
|
|
|
ImmutableBitmap() {}
|
2014-04-01 16:24:06 +00:00
|
|
|
explicit ImmutableBitmap(const SkBitmap& bitmap) {
|
|
|
|
if (bitmap.isImmutable()) {
|
2014-12-11 20:43:04 +00:00
|
|
|
fBitmap = bitmap;
|
2014-04-01 16:24:06 +00:00
|
|
|
} else {
|
2014-12-11 20:43:04 +00:00
|
|
|
bitmap.copyTo(&fBitmap);
|
2014-04-01 16:24:06 +00:00
|
|
|
}
|
2014-12-11 20:43:04 +00:00
|
|
|
fBitmap.setImmutable();
|
2014-04-01 16:24:06 +00:00
|
|
|
}
|
2014-12-11 20:43:04 +00:00
|
|
|
|
|
|
|
int width() const { return fBitmap.width(); }
|
|
|
|
int height() const { return fBitmap.height(); }
|
|
|
|
|
|
|
|
// While the pixels are immutable, SkBitmap itself is not thread-safe, so return a copy.
|
|
|
|
SkBitmap shallowCopy() const { return fBitmap; }
|
|
|
|
private:
|
|
|
|
SkBitmap fBitmap;
|
2014-12-01 19:03:37 +00:00
|
|
|
};
|
2014-04-01 16:24:06 +00:00
|
|
|
|
2014-12-01 19:03:37 +00:00
|
|
|
// SkPath::getBounds() isn't thread safe unless we precache the bounds in a singlethreaded context.
|
2015-01-20 21:47:19 +00:00
|
|
|
// SkPath::cheapComputeDirection() is similar.
|
|
|
|
// Recording is a convenient time to cache these, or we can delay it to between record and playback.
|
|
|
|
struct PreCachedPath : public SkPath {
|
2015-05-19 18:11:26 +00:00
|
|
|
PreCachedPath() {}
|
2015-01-20 21:47:19 +00:00
|
|
|
explicit PreCachedPath(const SkPath& path) : SkPath(path) {
|
2014-12-01 19:03:37 +00:00
|
|
|
this->updateBoundsCache();
|
2015-06-15 19:27:20 +00:00
|
|
|
#if 0 // Disabled to see if we ever really race on this. It costs time, chromium:496982.
|
2015-06-10 21:23:15 +00:00
|
|
|
SkPathPriv::FirstDirection junk;
|
|
|
|
(void)SkPathPriv::CheapComputeFirstDirection(*this, &junk);
|
2015-06-15 19:27:20 +00:00
|
|
|
#endif
|
2014-12-01 19:03:37 +00:00
|
|
|
}
|
|
|
|
};
|
2014-04-01 16:24:06 +00:00
|
|
|
|
2014-12-01 19:03:37 +00:00
|
|
|
// Like SkPath::getBounds(), SkMatrix::getType() isn't thread safe unless we precache it.
|
|
|
|
// This may not cover all SkMatrices used by the picture (e.g. some could be hiding in a shader).
|
|
|
|
struct TypedMatrix : public SkMatrix {
|
2015-05-19 18:11:26 +00:00
|
|
|
TypedMatrix() {}
|
2014-12-01 19:03:37 +00:00
|
|
|
explicit TypedMatrix(const SkMatrix& matrix) : SkMatrix(matrix) {
|
|
|
|
(void)this->getType();
|
|
|
|
}
|
2014-04-01 16:24:06 +00:00
|
|
|
};
|
|
|
|
|
2014-04-22 16:57:20 +00:00
|
|
|
RECORD0(NoOp);
|
2014-04-01 16:24:06 +00:00
|
|
|
|
2014-12-01 19:03:37 +00:00
|
|
|
RECORD2(Restore, SkIRect, devBounds, TypedMatrix, matrix);
|
2014-06-30 14:13:28 +00:00
|
|
|
RECORD0(Save);
|
2014-04-15 14:27:14 +00:00
|
|
|
RECORD3(SaveLayer, Optional<SkRect>, bounds, Optional<SkPaint>, paint, SkCanvas::SaveFlags, flags);
|
2014-04-01 16:24:06 +00:00
|
|
|
|
2014-12-01 19:03:37 +00:00
|
|
|
RECORD1(SetMatrix, TypedMatrix, matrix);
|
2014-04-01 16:24:06 +00:00
|
|
|
|
2014-11-20 17:14:28 +00:00
|
|
|
struct RegionOpAndAA {
|
2015-05-19 18:11:26 +00:00
|
|
|
RegionOpAndAA() {}
|
2014-11-20 17:14:28 +00:00
|
|
|
RegionOpAndAA(SkRegion::Op op, bool aa) : op(op), aa(aa) {}
|
|
|
|
SkRegion::Op op : 31; // This really only needs to be 3, but there's no win today to do so.
|
|
|
|
unsigned aa : 1; // MSVC won't pack an enum with an bool, so we call this an unsigned.
|
|
|
|
};
|
|
|
|
SK_COMPILE_ASSERT(sizeof(RegionOpAndAA) == 4, RegionOpAndAASize);
|
|
|
|
|
2015-01-20 21:47:19 +00:00
|
|
|
RECORD3(ClipPath, SkIRect, devBounds, PreCachedPath, path, RegionOpAndAA, opAA);
|
|
|
|
RECORD3(ClipRRect, SkIRect, devBounds, SkRRect, rrect, RegionOpAndAA, opAA);
|
|
|
|
RECORD3(ClipRect, SkIRect, devBounds, SkRect, rect, RegionOpAndAA, opAA);
|
|
|
|
RECORD3(ClipRegion, SkIRect, devBounds, SkRegion, region, SkRegion::Op, op);
|
2014-04-01 16:24:06 +00:00
|
|
|
|
2014-05-07 22:59:38 +00:00
|
|
|
// While not strictly required, if you have an SkPaint, it's fastest to put it first.
|
|
|
|
RECORD4(DrawBitmap, Optional<SkPaint>, paint,
|
|
|
|
ImmutableBitmap, bitmap,
|
2014-04-15 14:27:14 +00:00
|
|
|
SkScalar, left,
|
2014-05-07 22:59:38 +00:00
|
|
|
SkScalar, top);
|
|
|
|
RECORD4(DrawBitmapNine, Optional<SkPaint>, paint,
|
|
|
|
ImmutableBitmap, bitmap,
|
2014-04-15 14:27:14 +00:00
|
|
|
SkIRect, center,
|
2014-05-07 22:59:38 +00:00
|
|
|
SkRect, dst);
|
2014-11-21 16:48:35 +00:00
|
|
|
RECORD4(DrawBitmapRectToRect, Optional<SkPaint>, paint,
|
2014-05-07 22:59:38 +00:00
|
|
|
ImmutableBitmap, bitmap,
|
2014-04-15 14:27:14 +00:00
|
|
|
Optional<SkRect>, src,
|
2014-11-21 16:48:35 +00:00
|
|
|
SkRect, dst);
|
|
|
|
RECORD4(DrawBitmapRectToRectBleed, Optional<SkPaint>, paint,
|
|
|
|
ImmutableBitmap, bitmap,
|
|
|
|
Optional<SkRect>, src,
|
|
|
|
SkRect, dst);
|
2014-05-07 22:59:38 +00:00
|
|
|
RECORD3(DrawDRRect, SkPaint, paint, SkRRect, outer, SkRRect, inner);
|
2014-11-18 19:08:05 +00:00
|
|
|
RECORD2(DrawDrawable, SkRect, worstCaseBounds, int32_t, index);
|
2014-10-16 18:58:39 +00:00
|
|
|
RECORD4(DrawImage, Optional<SkPaint>, paint,
|
|
|
|
RefBox<const SkImage>, image,
|
|
|
|
SkScalar, left,
|
|
|
|
SkScalar, top);
|
|
|
|
RECORD4(DrawImageRect, Optional<SkPaint>, paint,
|
|
|
|
RefBox<const SkImage>, image,
|
|
|
|
Optional<SkRect>, src,
|
|
|
|
SkRect, dst);
|
2015-06-25 19:32:03 +00:00
|
|
|
RECORD4(DrawImageNine, Optional<SkPaint>, paint,
|
|
|
|
RefBox<const SkImage>, image,
|
|
|
|
SkIRect, center,
|
|
|
|
SkRect, dst);
|
2014-05-07 22:59:38 +00:00
|
|
|
RECORD2(DrawOval, SkPaint, paint, SkRect, oval);
|
2014-04-01 16:24:06 +00:00
|
|
|
RECORD1(DrawPaint, SkPaint, paint);
|
2015-01-20 21:47:19 +00:00
|
|
|
RECORD2(DrawPath, SkPaint, paint, PreCachedPath, path);
|
2014-08-21 16:11:37 +00:00
|
|
|
RECORD3(DrawPicture, Optional<SkPaint>, paint,
|
|
|
|
RefBox<const SkPicture>, picture,
|
2014-12-01 19:03:37 +00:00
|
|
|
TypedMatrix, matrix);
|
2014-11-21 16:48:35 +00:00
|
|
|
RECORD4(DrawPoints, SkPaint, paint, SkCanvas::PointMode, mode, unsigned, count, SkPoint*, pts);
|
2014-05-07 22:59:38 +00:00
|
|
|
RECORD4(DrawPosText, SkPaint, paint,
|
|
|
|
PODArray<char>, text,
|
2014-04-15 14:27:14 +00:00
|
|
|
size_t, byteLength,
|
2014-05-07 22:59:38 +00:00
|
|
|
PODArray<SkPoint>, pos);
|
|
|
|
RECORD5(DrawPosTextH, SkPaint, paint,
|
|
|
|
PODArray<char>, text,
|
2014-11-21 16:48:35 +00:00
|
|
|
unsigned, byteLength,
|
|
|
|
SkScalar, y,
|
|
|
|
PODArray<SkScalar>, xpos);
|
2014-05-07 22:59:38 +00:00
|
|
|
RECORD2(DrawRRect, SkPaint, paint, SkRRect, rrect);
|
|
|
|
RECORD2(DrawRect, SkPaint, paint, SkRect, rect);
|
|
|
|
RECORD4(DrawSprite, Optional<SkPaint>, paint, ImmutableBitmap, bitmap, int, left, int, top);
|
|
|
|
RECORD5(DrawText, SkPaint, paint,
|
|
|
|
PODArray<char>, text,
|
2014-04-15 14:27:14 +00:00
|
|
|
size_t, byteLength,
|
|
|
|
SkScalar, x,
|
2014-05-07 22:59:38 +00:00
|
|
|
SkScalar, y);
|
2014-08-21 15:53:26 +00:00
|
|
|
RECORD4(DrawTextBlob, SkPaint, paint,
|
2014-08-21 16:11:37 +00:00
|
|
|
RefBox<const SkTextBlob>, blob,
|
2014-08-21 15:53:26 +00:00
|
|
|
SkScalar, x,
|
|
|
|
SkScalar, y);
|
2014-05-07 22:59:38 +00:00
|
|
|
RECORD5(DrawTextOnPath, SkPaint, paint,
|
|
|
|
PODArray<char>, text,
|
2014-04-01 16:24:06 +00:00
|
|
|
size_t, byteLength,
|
2015-01-20 21:47:19 +00:00
|
|
|
PreCachedPath, path,
|
2014-12-01 19:03:37 +00:00
|
|
|
TypedMatrix, matrix);
|
2014-04-01 16:24:06 +00:00
|
|
|
|
2014-09-18 18:16:31 +00:00
|
|
|
RECORD5(DrawPatch, SkPaint, paint,
|
|
|
|
PODArray<SkPoint>, cubics,
|
|
|
|
PODArray<SkColor>, colors,
|
|
|
|
PODArray<SkPoint>, texCoords,
|
|
|
|
RefBox<SkXfermode>, xmode);
|
|
|
|
|
2015-06-24 17:29:17 +00:00
|
|
|
RECORD8(DrawAtlas, Optional<SkPaint>, paint,
|
|
|
|
RefBox<const SkImage>, atlas,
|
|
|
|
PODArray<SkRSXform>, xforms,
|
|
|
|
PODArray<SkRect>, texs,
|
|
|
|
PODArray<SkColor>, colors,
|
|
|
|
int, count,
|
|
|
|
SkXfermode::Mode, mode,
|
|
|
|
Optional<SkRect>, cull);
|
|
|
|
|
2014-04-01 16:24:06 +00:00
|
|
|
// This guy is so ugly we just write it manually.
|
|
|
|
struct DrawVertices {
|
|
|
|
static const Type kType = DrawVertices_Type;
|
|
|
|
|
2014-05-07 22:59:38 +00:00
|
|
|
DrawVertices(const SkPaint& paint,
|
|
|
|
SkCanvas::VertexMode vmode,
|
2014-04-01 16:24:06 +00:00
|
|
|
int vertexCount,
|
|
|
|
SkPoint* vertices,
|
|
|
|
SkPoint* texs,
|
|
|
|
SkColor* colors,
|
|
|
|
SkXfermode* xmode,
|
|
|
|
uint16_t* indices,
|
2014-05-07 22:59:38 +00:00
|
|
|
int indexCount)
|
|
|
|
: paint(paint)
|
|
|
|
, vmode(vmode)
|
2014-04-01 16:24:06 +00:00
|
|
|
, vertexCount(vertexCount)
|
|
|
|
, vertices(vertices)
|
|
|
|
, texs(texs)
|
|
|
|
, colors(colors)
|
|
|
|
, xmode(SkSafeRef(xmode))
|
|
|
|
, indices(indices)
|
2014-05-07 22:59:38 +00:00
|
|
|
, indexCount(indexCount) {}
|
2014-04-01 16:24:06 +00:00
|
|
|
|
2014-05-07 22:59:38 +00:00
|
|
|
SkPaint paint;
|
2014-04-01 16:24:06 +00:00
|
|
|
SkCanvas::VertexMode vmode;
|
|
|
|
int vertexCount;
|
2014-04-15 14:27:14 +00:00
|
|
|
PODArray<SkPoint> vertices;
|
|
|
|
PODArray<SkPoint> texs;
|
|
|
|
PODArray<SkColor> colors;
|
2014-04-01 16:24:06 +00:00
|
|
|
SkAutoTUnref<SkXfermode> xmode;
|
2014-04-15 14:27:14 +00:00
|
|
|
PODArray<uint16_t> indices;
|
2014-04-01 16:24:06 +00:00
|
|
|
int indexCount;
|
|
|
|
};
|
2014-08-13 20:33:49 +00:00
|
|
|
|
2014-04-01 16:24:06 +00:00
|
|
|
#undef RECORD0
|
|
|
|
#undef RECORD1
|
|
|
|
#undef RECORD2
|
|
|
|
#undef RECORD3
|
|
|
|
#undef RECORD4
|
|
|
|
#undef RECORD5
|
2015-06-24 17:29:17 +00:00
|
|
|
#undef RECORD8
|
2014-04-01 16:24:06 +00:00
|
|
|
|
|
|
|
} // namespace SkRecords
|
|
|
|
|
|
|
|
#endif//SkRecords_DEFINED
|