blob: 053a75775c7ea882b5f093d5a0c9fa6bf4552a56 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
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 */
reed@android.com8a1c16f2008-12-17 15:59:43 +00008#include "SkProxyCanvas.h"
9
10SkProxyCanvas::SkProxyCanvas(SkCanvas* proxy) : fProxy(proxy) {
reed@google.com82065d62011-02-07 15:30:46 +000011 SkSafeRef(fProxy);
reed@android.com8a1c16f2008-12-17 15:59:43 +000012}
13
14SkProxyCanvas::~SkProxyCanvas() {
reed@google.com82065d62011-02-07 15:30:46 +000015 SkSafeUnref(fProxy);
reed@android.com8a1c16f2008-12-17 15:59:43 +000016}
reed@google.com82065d62011-02-07 15:30:46 +000017
reed@android.com8a1c16f2008-12-17 15:59:43 +000018void SkProxyCanvas::setProxy(SkCanvas* proxy) {
19 SkRefCnt_SafeAssign(fProxy, proxy);
20}
21
22///////////////////////////////// Overrides ///////////
23
reed@android.com8a1c16f2008-12-17 15:59:43 +000024int SkProxyCanvas::save(SaveFlags flags) {
25 return fProxy->save(flags);
26}
27
28int SkProxyCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint,
29 SaveFlags flags) {
30 return fProxy->saveLayer(bounds, paint, flags);
31}
32
33void SkProxyCanvas::restore() {
34 fProxy->restore();
35}
36
37bool SkProxyCanvas::translate(SkScalar dx, SkScalar dy) {
38 return fProxy->translate(dx, dy);
39}
40
41bool SkProxyCanvas::scale(SkScalar sx, SkScalar sy) {
42 return fProxy->scale(sx, sy);
43}
44
45bool SkProxyCanvas::rotate(SkScalar degrees) {
46 return fProxy->rotate(degrees);
47}
48
49bool SkProxyCanvas::skew(SkScalar sx, SkScalar sy) {
50 return fProxy->skew(sx, sy);
51}
52
53bool SkProxyCanvas::concat(const SkMatrix& matrix) {
54 return fProxy->concat(matrix);
55}
56
57void SkProxyCanvas::setMatrix(const SkMatrix& matrix) {
58 fProxy->setMatrix(matrix);
59}
60
reed@google.com071eef92011-10-12 11:52:53 +000061bool SkProxyCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
62 return fProxy->clipRect(rect, op, doAA);
reed@android.com8a1c16f2008-12-17 15:59:43 +000063}
64
reed@google.com4ed0fb72012-12-12 20:48:18 +000065bool SkProxyCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) {
66 return fProxy->clipRRect(rrect, op, doAA);
67}
68
reed@google.com071eef92011-10-12 11:52:53 +000069bool SkProxyCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) {
70 return fProxy->clipPath(path, op, doAA);
reed@android.com8a1c16f2008-12-17 15:59:43 +000071}
72
73bool SkProxyCanvas::clipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
74 return fProxy->clipRegion(deviceRgn, op);
75}
76
77void SkProxyCanvas::drawPaint(const SkPaint& paint) {
78 fProxy->drawPaint(paint);
79}
80
81void SkProxyCanvas::drawPoints(PointMode mode, size_t count,
82 const SkPoint pts[], const SkPaint& paint) {
83 fProxy->drawPoints(mode, count, pts, paint);
84}
85
reed@google.com4ed0fb72012-12-12 20:48:18 +000086void SkProxyCanvas::drawOval(const SkRect& rect, const SkPaint& paint) {
87 fProxy->drawOval(rect, paint);
88}
89
reed@android.com8a1c16f2008-12-17 15:59:43 +000090void SkProxyCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
91 fProxy->drawRect(rect, paint);
92}
93
reed@google.com4ed0fb72012-12-12 20:48:18 +000094void SkProxyCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
95 fProxy->drawRRect(rrect, paint);
96}
97
reed@android.com8a1c16f2008-12-17 15:59:43 +000098void SkProxyCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
99 fProxy->drawPath(path, paint);
100}
101
102void SkProxyCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y,
103 const SkPaint* paint) {
104 fProxy->drawBitmap(bitmap, x, y, paint);
105}
106
reed@google.com71121732012-09-18 15:14:33 +0000107void SkProxyCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
reed@android.com8a1c16f2008-12-17 15:59:43 +0000108 const SkRect& dst, const SkPaint* paint) {
reed@google.com71121732012-09-18 15:14:33 +0000109 fProxy->drawBitmapRectToRect(bitmap, src, dst, paint);
reed@android.com8a1c16f2008-12-17 15:59:43 +0000110}
111
112void SkProxyCanvas::drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m,
113 const SkPaint* paint) {
114 fProxy->drawBitmapMatrix(bitmap, m, paint);
115}
116
117void SkProxyCanvas::drawSprite(const SkBitmap& bitmap, int x, int y,
118 const SkPaint* paint) {
119 fProxy->drawSprite(bitmap, x, y, paint);
120}
121
122void SkProxyCanvas::drawText(const void* text, size_t byteLength, SkScalar x,
123 SkScalar y, const SkPaint& paint) {
124 fProxy->drawText(text, byteLength, x, y, paint);
125}
126
127void SkProxyCanvas::drawPosText(const void* text, size_t byteLength,
128 const SkPoint pos[], const SkPaint& paint) {
129 fProxy->drawPosText(text, byteLength, pos, paint);
130}
131
132void SkProxyCanvas::drawPosTextH(const void* text, size_t byteLength,
133 const SkScalar xpos[], SkScalar constY,
134 const SkPaint& paint) {
135 fProxy->drawPosTextH(text, byteLength, xpos, constY, paint);
136}
137
138void SkProxyCanvas::drawTextOnPath(const void* text, size_t byteLength,
139 const SkPath& path, const SkMatrix* matrix,
140 const SkPaint& paint) {
141 fProxy->drawTextOnPath(text, byteLength, path, matrix, paint);
142}
143
reed@android.comed0bfb02009-05-13 21:01:21 +0000144void SkProxyCanvas::drawPicture(SkPicture& picture) {
145 fProxy->drawPicture(picture);
146}
147
reed@android.com8a1c16f2008-12-17 15:59:43 +0000148void SkProxyCanvas::drawVertices(VertexMode vmode, int vertexCount,
149 const SkPoint vertices[], const SkPoint texs[],
150 const SkColor colors[], SkXfermode* xmode,
151 const uint16_t indices[], int indexCount,
152 const SkPaint& paint) {
153 fProxy->drawVertices(vmode, vertexCount, vertices, texs, colors,
154 xmode, indices, indexCount, paint);
155}
156
reed@android.comcb608442009-12-04 21:32:27 +0000157void SkProxyCanvas::drawData(const void* data, size_t length) {
158 fProxy->drawData(data, length);
159}
160
robertphillips@google.com0a4805e2013-05-29 13:24:23 +0000161void SkProxyCanvas::beginCommentGroup(const char* description) {
162 fProxy->beginCommentGroup(description);
163}
164
165void SkProxyCanvas::addComment(const char* kywd, const char* value) {
166 fProxy->addComment(kywd, value);
167}
168
169void SkProxyCanvas::endCommentGroup() {
170 fProxy->endCommentGroup();
171}
172
reed@android.com8a1c16f2008-12-17 15:59:43 +0000173SkBounder* SkProxyCanvas::setBounder(SkBounder* bounder) {
174 return fProxy->setBounder(bounder);
175}
176
177SkDrawFilter* SkProxyCanvas::setDrawFilter(SkDrawFilter* filter) {
178 return fProxy->setDrawFilter(filter);
179}