1
2 /*
3 * Copyright 2011 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8 #include "SkProxyCanvas.h"
9
SkProxyCanvas(SkCanvas * proxy)10 SkProxyCanvas::SkProxyCanvas(SkCanvas* proxy) : fProxy(proxy) {
11 SkSafeRef(fProxy);
12 }
13
~SkProxyCanvas()14 SkProxyCanvas::~SkProxyCanvas() {
15 SkSafeUnref(fProxy);
16 }
17
setProxy(SkCanvas * proxy)18 void SkProxyCanvas::setProxy(SkCanvas* proxy) {
19 SkRefCnt_SafeAssign(fProxy, proxy);
20 }
21
22 ///////////////////////////////// Overrides ///////////
23
save(SaveFlags flags)24 int SkProxyCanvas::save(SaveFlags flags) {
25 return fProxy->save(flags);
26 }
27
saveLayer(const SkRect * bounds,const SkPaint * paint,SaveFlags flags)28 int SkProxyCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint,
29 SaveFlags flags) {
30 return fProxy->saveLayer(bounds, paint, flags);
31 }
32
restore()33 void SkProxyCanvas::restore() {
34 fProxy->restore();
35 }
36
translate(SkScalar dx,SkScalar dy)37 bool SkProxyCanvas::translate(SkScalar dx, SkScalar dy) {
38 return fProxy->translate(dx, dy);
39 }
40
scale(SkScalar sx,SkScalar sy)41 bool SkProxyCanvas::scale(SkScalar sx, SkScalar sy) {
42 return fProxy->scale(sx, sy);
43 }
44
rotate(SkScalar degrees)45 bool SkProxyCanvas::rotate(SkScalar degrees) {
46 return fProxy->rotate(degrees);
47 }
48
skew(SkScalar sx,SkScalar sy)49 bool SkProxyCanvas::skew(SkScalar sx, SkScalar sy) {
50 return fProxy->skew(sx, sy);
51 }
52
concat(const SkMatrix & matrix)53 bool SkProxyCanvas::concat(const SkMatrix& matrix) {
54 return fProxy->concat(matrix);
55 }
56
setMatrix(const SkMatrix & matrix)57 void SkProxyCanvas::setMatrix(const SkMatrix& matrix) {
58 fProxy->setMatrix(matrix);
59 }
60
clipRect(const SkRect & rect,SkRegion::Op op,bool doAA)61 bool SkProxyCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
62 return fProxy->clipRect(rect, op, doAA);
63 }
64
clipRRect(const SkRRect & rrect,SkRegion::Op op,bool doAA)65 bool SkProxyCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) {
66 return fProxy->clipRRect(rrect, op, doAA);
67 }
68
clipPath(const SkPath & path,SkRegion::Op op,bool doAA)69 bool SkProxyCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) {
70 return fProxy->clipPath(path, op, doAA);
71 }
72
clipRegion(const SkRegion & deviceRgn,SkRegion::Op op)73 bool SkProxyCanvas::clipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
74 return fProxy->clipRegion(deviceRgn, op);
75 }
76
drawPaint(const SkPaint & paint)77 void SkProxyCanvas::drawPaint(const SkPaint& paint) {
78 fProxy->drawPaint(paint);
79 }
80
drawPoints(PointMode mode,size_t count,const SkPoint pts[],const SkPaint & paint)81 void SkProxyCanvas::drawPoints(PointMode mode, size_t count,
82 const SkPoint pts[], const SkPaint& paint) {
83 fProxy->drawPoints(mode, count, pts, paint);
84 }
85
drawOval(const SkRect & rect,const SkPaint & paint)86 void SkProxyCanvas::drawOval(const SkRect& rect, const SkPaint& paint) {
87 fProxy->drawOval(rect, paint);
88 }
89
drawRect(const SkRect & rect,const SkPaint & paint)90 void SkProxyCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
91 fProxy->drawRect(rect, paint);
92 }
93
drawRRect(const SkRRect & rrect,const SkPaint & paint)94 void SkProxyCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
95 fProxy->drawRRect(rrect, paint);
96 }
97
drawPath(const SkPath & path,const SkPaint & paint)98 void SkProxyCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
99 fProxy->drawPath(path, paint);
100 }
101
drawBitmap(const SkBitmap & bitmap,SkScalar x,SkScalar y,const SkPaint * paint)102 void SkProxyCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y,
103 const SkPaint* paint) {
104 fProxy->drawBitmap(bitmap, x, y, paint);
105 }
106
drawBitmapRectToRect(const SkBitmap & bitmap,const SkRect * src,const SkRect & dst,const SkPaint * paint,DrawBitmapRectFlags flags)107 void SkProxyCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
108 const SkRect& dst, const SkPaint* paint,
109 DrawBitmapRectFlags flags) {
110 fProxy->drawBitmapRectToRect(bitmap, src, dst, paint, flags);
111 }
112
drawBitmapMatrix(const SkBitmap & bitmap,const SkMatrix & m,const SkPaint * paint)113 void SkProxyCanvas::drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m,
114 const SkPaint* paint) {
115 fProxy->drawBitmapMatrix(bitmap, m, paint);
116 }
117
drawSprite(const SkBitmap & bitmap,int x,int y,const SkPaint * paint)118 void SkProxyCanvas::drawSprite(const SkBitmap& bitmap, int x, int y,
119 const SkPaint* paint) {
120 fProxy->drawSprite(bitmap, x, y, paint);
121 }
122
drawText(const void * text,size_t byteLength,SkScalar x,SkScalar y,const SkPaint & paint)123 void SkProxyCanvas::drawText(const void* text, size_t byteLength, SkScalar x,
124 SkScalar y, const SkPaint& paint) {
125 fProxy->drawText(text, byteLength, x, y, paint);
126 }
127
drawPosText(const void * text,size_t byteLength,const SkPoint pos[],const SkPaint & paint)128 void SkProxyCanvas::drawPosText(const void* text, size_t byteLength,
129 const SkPoint pos[], const SkPaint& paint) {
130 fProxy->drawPosText(text, byteLength, pos, paint);
131 }
132
drawPosTextH(const void * text,size_t byteLength,const SkScalar xpos[],SkScalar constY,const SkPaint & paint)133 void SkProxyCanvas::drawPosTextH(const void* text, size_t byteLength,
134 const SkScalar xpos[], SkScalar constY,
135 const SkPaint& paint) {
136 fProxy->drawPosTextH(text, byteLength, xpos, constY, paint);
137 }
138
drawTextOnPath(const void * text,size_t byteLength,const SkPath & path,const SkMatrix * matrix,const SkPaint & paint)139 void SkProxyCanvas::drawTextOnPath(const void* text, size_t byteLength,
140 const SkPath& path, const SkMatrix* matrix,
141 const SkPaint& paint) {
142 fProxy->drawTextOnPath(text, byteLength, path, matrix, paint);
143 }
144
drawPicture(SkPicture & picture)145 void SkProxyCanvas::drawPicture(SkPicture& picture) {
146 fProxy->drawPicture(picture);
147 }
148
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)149 void SkProxyCanvas::drawVertices(VertexMode vmode, int vertexCount,
150 const SkPoint vertices[], const SkPoint texs[],
151 const SkColor colors[], SkXfermode* xmode,
152 const uint16_t indices[], int indexCount,
153 const SkPaint& paint) {
154 fProxy->drawVertices(vmode, vertexCount, vertices, texs, colors,
155 xmode, indices, indexCount, paint);
156 }
157
drawData(const void * data,size_t length)158 void SkProxyCanvas::drawData(const void* data, size_t length) {
159 fProxy->drawData(data, length);
160 }
161
beginCommentGroup(const char * description)162 void SkProxyCanvas::beginCommentGroup(const char* description) {
163 fProxy->beginCommentGroup(description);
164 }
165
addComment(const char * kywd,const char * value)166 void SkProxyCanvas::addComment(const char* kywd, const char* value) {
167 fProxy->addComment(kywd, value);
168 }
169
endCommentGroup()170 void SkProxyCanvas::endCommentGroup() {
171 fProxy->endCommentGroup();
172 }
173
setBounder(SkBounder * bounder)174 SkBounder* SkProxyCanvas::setBounder(SkBounder* bounder) {
175 return fProxy->setBounder(bounder);
176 }
177
setDrawFilter(SkDrawFilter * filter)178 SkDrawFilter* SkProxyCanvas::setDrawFilter(SkDrawFilter* filter) {
179 return fProxy->setDrawFilter(filter);
180 }
181