1 #include "SkProxyCanvas.h"
2
SkProxyCanvas(SkCanvas * proxy)3 SkProxyCanvas::SkProxyCanvas(SkCanvas* proxy) : fProxy(proxy) {
4 SkSafeRef(fProxy);
5 }
6
~SkProxyCanvas()7 SkProxyCanvas::~SkProxyCanvas() {
8 SkSafeUnref(fProxy);
9 }
10
setProxy(SkCanvas * proxy)11 void SkProxyCanvas::setProxy(SkCanvas* proxy) {
12 SkRefCnt_SafeAssign(fProxy, proxy);
13 }
14
15 ///////////////////////////////// Overrides ///////////
16
save(SaveFlags flags)17 int SkProxyCanvas::save(SaveFlags flags) {
18 return fProxy->save(flags);
19 }
20
saveLayer(const SkRect * bounds,const SkPaint * paint,SaveFlags flags)21 int SkProxyCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint,
22 SaveFlags flags) {
23 return fProxy->saveLayer(bounds, paint, flags);
24 }
25
restore()26 void SkProxyCanvas::restore() {
27 fProxy->restore();
28 }
29
translate(SkScalar dx,SkScalar dy)30 bool SkProxyCanvas::translate(SkScalar dx, SkScalar dy) {
31 return fProxy->translate(dx, dy);
32 }
33
scale(SkScalar sx,SkScalar sy)34 bool SkProxyCanvas::scale(SkScalar sx, SkScalar sy) {
35 return fProxy->scale(sx, sy);
36 }
37
rotate(SkScalar degrees)38 bool SkProxyCanvas::rotate(SkScalar degrees) {
39 return fProxy->rotate(degrees);
40 }
41
skew(SkScalar sx,SkScalar sy)42 bool SkProxyCanvas::skew(SkScalar sx, SkScalar sy) {
43 return fProxy->skew(sx, sy);
44 }
45
concat(const SkMatrix & matrix)46 bool SkProxyCanvas::concat(const SkMatrix& matrix) {
47 return fProxy->concat(matrix);
48 }
49
setMatrix(const SkMatrix & matrix)50 void SkProxyCanvas::setMatrix(const SkMatrix& matrix) {
51 fProxy->setMatrix(matrix);
52 }
53
clipRect(const SkRect & rect,SkRegion::Op op)54 bool SkProxyCanvas::clipRect(const SkRect& rect, SkRegion::Op op) {
55 return fProxy->clipRect(rect, op);
56 }
57
clipPath(const SkPath & path,SkRegion::Op op)58 bool SkProxyCanvas::clipPath(const SkPath& path, SkRegion::Op op) {
59 return fProxy->clipPath(path, op);
60 }
61
clipRegion(const SkRegion & deviceRgn,SkRegion::Op op)62 bool SkProxyCanvas::clipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
63 return fProxy->clipRegion(deviceRgn, op);
64 }
65
drawPaint(const SkPaint & paint)66 void SkProxyCanvas::drawPaint(const SkPaint& paint) {
67 fProxy->drawPaint(paint);
68 }
69
drawPoints(PointMode mode,size_t count,const SkPoint pts[],const SkPaint & paint)70 void SkProxyCanvas::drawPoints(PointMode mode, size_t count,
71 const SkPoint pts[], const SkPaint& paint) {
72 fProxy->drawPoints(mode, count, pts, paint);
73 }
74
drawRect(const SkRect & rect,const SkPaint & paint)75 void SkProxyCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
76 fProxy->drawRect(rect, paint);
77 }
78
drawPath(const SkPath & path,const SkPaint & paint)79 void SkProxyCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
80 fProxy->drawPath(path, paint);
81 }
82
drawBitmap(const SkBitmap & bitmap,SkScalar x,SkScalar y,const SkPaint * paint)83 void SkProxyCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y,
84 const SkPaint* paint) {
85 fProxy->drawBitmap(bitmap, x, y, paint);
86 }
87
drawBitmapRect(const SkBitmap & bitmap,const SkIRect * src,const SkRect & dst,const SkPaint * paint)88 void SkProxyCanvas::drawBitmapRect(const SkBitmap& bitmap, const SkIRect* src,
89 const SkRect& dst, const SkPaint* paint) {
90 fProxy->drawBitmapRect(bitmap, src, dst, paint);
91 }
92
drawBitmapMatrix(const SkBitmap & bitmap,const SkMatrix & m,const SkPaint * paint)93 void SkProxyCanvas::drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m,
94 const SkPaint* paint) {
95 fProxy->drawBitmapMatrix(bitmap, m, paint);
96 }
97
drawSprite(const SkBitmap & bitmap,int x,int y,const SkPaint * paint)98 void SkProxyCanvas::drawSprite(const SkBitmap& bitmap, int x, int y,
99 const SkPaint* paint) {
100 fProxy->drawSprite(bitmap, x, y, paint);
101 }
102
drawText(const void * text,size_t byteLength,SkScalar x,SkScalar y,const SkPaint & paint)103 void SkProxyCanvas::drawText(const void* text, size_t byteLength, SkScalar x,
104 SkScalar y, const SkPaint& paint) {
105 fProxy->drawText(text, byteLength, x, y, paint);
106 }
107
drawPosText(const void * text,size_t byteLength,const SkPoint pos[],const SkPaint & paint)108 void SkProxyCanvas::drawPosText(const void* text, size_t byteLength,
109 const SkPoint pos[], const SkPaint& paint) {
110 fProxy->drawPosText(text, byteLength, pos, paint);
111 }
112
drawPosTextH(const void * text,size_t byteLength,const SkScalar xpos[],SkScalar constY,const SkPaint & paint)113 void SkProxyCanvas::drawPosTextH(const void* text, size_t byteLength,
114 const SkScalar xpos[], SkScalar constY,
115 const SkPaint& paint) {
116 fProxy->drawPosTextH(text, byteLength, xpos, constY, paint);
117 }
118
drawTextOnPath(const void * text,size_t byteLength,const SkPath & path,const SkMatrix * matrix,const SkPaint & paint)119 void SkProxyCanvas::drawTextOnPath(const void* text, size_t byteLength,
120 const SkPath& path, const SkMatrix* matrix,
121 const SkPaint& paint) {
122 fProxy->drawTextOnPath(text, byteLength, path, matrix, paint);
123 }
124
drawPicture(SkPicture & picture)125 void SkProxyCanvas::drawPicture(SkPicture& picture) {
126 fProxy->drawPicture(picture);
127 }
128
drawShape(SkShape * shape)129 void SkProxyCanvas::drawShape(SkShape* shape) {
130 fProxy->drawShape(shape);
131 }
132
drawVertices(VertexMode vmode,int vertexCount,const SkPoint vertices[],const SkPoint texs[],const SkColor colors[],SkXfermode * xmode,const uint16_t indices[],int indexCount,const SkPaint & paint)133 void SkProxyCanvas::drawVertices(VertexMode vmode, int vertexCount,
134 const SkPoint vertices[], const SkPoint texs[],
135 const SkColor colors[], SkXfermode* xmode,
136 const uint16_t indices[], int indexCount,
137 const SkPaint& paint) {
138 fProxy->drawVertices(vmode, vertexCount, vertices, texs, colors,
139 xmode, indices, indexCount, paint);
140 }
141
drawData(const void * data,size_t length)142 void SkProxyCanvas::drawData(const void* data, size_t length) {
143 fProxy->drawData(data, length);
144 }
145
setBounder(SkBounder * bounder)146 SkBounder* SkProxyCanvas::setBounder(SkBounder* bounder) {
147 return fProxy->setBounder(bounder);
148 }
149
setDrawFilter(SkDrawFilter * filter)150 SkDrawFilter* SkProxyCanvas::setDrawFilter(SkDrawFilter* filter) {
151 return fProxy->setDrawFilter(filter);
152 }
153
createDevice(SkBitmap::Config config,int width,int height,bool isOpaque,bool isForLayer)154 SkDevice* SkProxyCanvas::createDevice(SkBitmap::Config config, int width, int height,
155 bool isOpaque, bool isForLayer) {
156 return fProxy->createDevice(config, width, height, isOpaque, isForLayer);
157 }
158
159